public class RandomParameter extends AbstractParameter<RandomParameter,RandomFactory>
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
GLOBAL_RANDOM_STR |
(package private) java.lang.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 |
---|---|
java.lang.String |
getDefaultValueAsString()
Get the default value as string.
|
java.lang.String |
getSyntax()
Returns a string representation of the parameter's type (e.g. an
IntParameter
should return <int> ). |
java.lang.String |
getValueAsString()
Get the value as string.
|
protected RandomFactory |
parseValue(java.lang.Object obj)
Parse a given value into the destination type.
|
void |
setValue(java.lang.Object obj)
Sets the value of the option.
|
addConstraint, describeValues, getConstraints, getDefaultValue, getOptionID, getShortDescription, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValueInternal, tookDefaultValue, tryDefaultValue, validate
private static final java.lang.String GLOBAL_RANDOM_STR
java.lang.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 java.lang.String getSyntax()
Parameter
IntParameter
should return <int>
).getSyntax
in interface Parameter<RandomFactory>
getSyntax
in class AbstractParameter<RandomParameter,RandomFactory>
public void setValue(java.lang.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(java.lang.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 java.lang.String getValueAsString()
Parameter
null
getValueAsString
in interface Parameter<RandomFactory>
getValueAsString
in class AbstractParameter<RandomParameter,RandomFactory>
public java.lang.String getDefaultValueAsString()
Parameter
getDefaultValueAsString
in interface Parameter<RandomFactory>
getDefaultValueAsString
in class AbstractParameter<RandomParameter,RandomFactory>
Copyright © 2019 ELKI Development Team. License information.