public class RandomParameter extends AbstractParameter<RandomParameter,RandomFactory>
Modifier and Type | Field and Description |
---|---|
(package private) Long |
seed
Seed value, if used
|
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription
Constructor and Description |
---|
RandomParameter(OptionID optionID)
Constructor without default.
|
RandomParameter(OptionID optionID,
long seed)
Constructor with default seed value.
|
RandomParameter(OptionID optionID,
RandomFactory defaultValue)
Constructor with default value.
|
Modifier and Type | Method and Description |
---|---|
String |
getDefaultValueAsString()
Get the default value as string.
|
Object |
getGivenValue()
Get the last given value.
|
String |
getSyntax()
Returns a string representation of the parameter's type (e.g. an
IntParameter
should return <int> ). |
String |
getValueAsString()
Get the value as string.
|
protected RandomFactory |
parseValue(Object obj)
Parse a given value into the destination type.
|
void |
setValue(Object obj)
Sets the value of the option.
|
addConstraint, getDefaultValue, getFullDescription, getName, getOptionID, getShortDescription, getValue, getValuesDescription, hasDefaultValue, hasValuesDescription, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValue, validate
Long seed
public RandomParameter(OptionID optionID)
optionID
- Option IDpublic RandomParameter(OptionID optionID, RandomFactory defaultValue)
null
,
which means a new random will be generated.optionID
- Option IDdefaultValue
- Default value. If null
, a new random object
will be created.public RandomParameter(OptionID optionID, long seed)
optionID
- Option IDseed
- Default seed.public String getSyntax()
Parameter
IntParameter
should return <int>
).getSyntax
in interface Parameter<RandomFactory>
getSyntax
in class AbstractParameter<RandomParameter,RandomFactory>
public void setValue(Object obj) throws ParameterException
Parameter
setValue
in interface Parameter<RandomFactory>
setValue
in class AbstractParameter<RandomParameter,RandomFactory>
obj
- the option's value to be setParameterException
- if the given value is not a valid value for this
option.protected RandomFactory parseValue(Object obj) throws ParameterException
AbstractParameter
parseValue
in class AbstractParameter<RandomParameter,RandomFactory>
obj
- Object to parse (may be a string representation!)ParameterException
- when the object cannot be parsed.public Object getGivenValue()
Parameter
null
getGivenValue
in interface Parameter<RandomFactory>
getGivenValue
in class AbstractParameter<RandomParameter,RandomFactory>
public String getValueAsString()
Parameter
null
getValueAsString
in interface Parameter<RandomFactory>
getValueAsString
in class AbstractParameter<RandomParameter,RandomFactory>
public String getDefaultValueAsString()
Parameter
getDefaultValueAsString
in interface Parameter<RandomFactory>
getDefaultValueAsString
in class AbstractParameter<RandomParameter,RandomFactory>