net.sf.freecol.common.model
Class RandomRange

java.lang.Object
  extended by net.sf.freecol.common.model.RandomRange

public class RandomRange
extends java.lang.Object


Field Summary
private  int factor
          Factor to multiply the value with.
private static java.util.logging.Logger logger
           
private  int maximum
          Maximum value.
private  int minimum
          Minimum value.
private  int probability
          Probability that the result is not zero.
private  java.util.List<Scope> scopes
          A list of Scopes limiting the applicability of this Feature.
 
Constructor Summary
RandomRange()
           
RandomRange(int probability, int minimum, int maximum, int factor)
          Creates a new RandomRange instance.
RandomRange(javax.xml.stream.XMLStreamReader in)
          Creates a new RandomRange instance.
 
Method Summary
 RandomRange clone()
           
 int getAmount(int random)
          Describe getAmount method here.
 int getAmount(java.lang.String prefix, java.util.Random random, boolean continuous)
          Gets the amount of plunder.
 int getFactor()
          Get the Factor value.
 int getMaximum()
          Get the Maximum value.
 int getMinimum()
          Get the Minimum value.
 int getProbability()
          Get the Probability value.
 int getRandomLimit()
          Describe getRandomLimit method here.
 int getRange()
          Describe getRange method here.
 java.util.List<Scope> getScopes()
          Return the scopes of this RandomRange.
 void readFromXML(javax.xml.stream.XMLStreamReader in)
           
 void setFactor(int newFactor)
          Set the Factor value.
 void setMaximum(int newMaximum)
          Set the Maximum value.
 void setMinimum(int newMinimum)
          Set the Minimum value.
 void setProbability(int newProbability)
          Set the Probability value.
 void toXML(javax.xml.stream.XMLStreamWriter out, java.lang.String tag)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static java.util.logging.Logger logger

probability

private int probability
Probability that the result is not zero.


minimum

private int minimum
Minimum value.


maximum

private int maximum
Maximum value.


factor

private int factor
Factor to multiply the value with.


scopes

private java.util.List<Scope> scopes
A list of Scopes limiting the applicability of this Feature.

Constructor Detail

RandomRange

public RandomRange()

RandomRange

public RandomRange(int probability,
                   int minimum,
                   int maximum,
                   int factor)
Creates a new RandomRange instance.

Parameters:
probability - an int value
minimum - an int value
maximum - an int value
factor - an int value

RandomRange

public RandomRange(javax.xml.stream.XMLStreamReader in)
            throws javax.xml.stream.XMLStreamException
Creates a new RandomRange instance.

Parameters:
in - a XMLStreamReader value
Throws:
javax.xml.stream.XMLStreamException
Method Detail

getProbability

public final int getProbability()
Get the Probability value.

Returns:
an int value

setProbability

public final void setProbability(int newProbability)
Set the Probability value.

Parameters:
newProbability - The new Probability value.

getMinimum

public final int getMinimum()
Get the Minimum value.

Returns:
an int value

setMinimum

public final void setMinimum(int newMinimum)
Set the Minimum value.

Parameters:
newMinimum - The new Minimum value.

getMaximum

public final int getMaximum()
Get the Maximum value.

Returns:
an int value

setMaximum

public final void setMaximum(int newMaximum)
Set the Maximum value.

Parameters:
newMaximum - The new Maximum value.

getFactor

public final int getFactor()
Get the Factor value.

Returns:
an int value

setFactor

public final void setFactor(int newFactor)
Set the Factor value.

Parameters:
newFactor - The new Factor value.

getRange

public int getRange()
Describe getRange method here.

Returns:
an int value

getRandomLimit

public int getRandomLimit()
Describe getRandomLimit method here.

Returns:
an int value

getAmount

public int getAmount(int random)
Describe getAmount method here.

Parameters:
random - an int value
Returns:
an int value

getAmount

public int getAmount(java.lang.String prefix,
                     java.util.Random random,
                     boolean continuous)
Gets the amount of plunder.

Parameters:
prefix - A logger prefix.
random - A pseudo-random number source.
continuous - Choose a continuous or discrete result.
Returns:
A random amount of plunder as defined by this RandomRange.

getScopes

public java.util.List<Scope> getScopes()
Return the scopes of this RandomRange.

Returns:
the scopes of this RandomRange

clone

public RandomRange clone()
Overrides:
clone in class java.lang.Object

readFromXML

public void readFromXML(javax.xml.stream.XMLStreamReader in)
                 throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

toXML

public void toXML(javax.xml.stream.XMLStreamWriter out,
                  java.lang.String tag)
           throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException