|
|
|||||||||||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||||||||||
java.lang.Objectde.lmu.ifi.dbs.elki.utilities.optionhandling.Option<T>
de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameter<T,C>
T - the type of a possible value (i.e., the type of the option)C - the type of a possible parameter constraintpublic abstract class Parameter<T,C>
Abstract class for specifying a parameter.
A parameter is defined as an option having a specific value.
| Field Summary | |
|---|---|
protected List<ParameterConstraint<C>> |
constraints
Holds parameter constraints for this parameter. |
protected T |
defaultValue
The default value of the parameter (may be null). |
private boolean |
defaultValueTaken
Specifies if the default value of this parameter was taken as parameter value. |
protected boolean |
optionalParameter
Specifies if this parameter is an optional parameter. |
| Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Option |
|---|
optionid, shortDescription, value |
| Constructor Summary | |
|---|---|
Parameter(OptionID optionID)
Constructs a parameter with the given optionID. |
|
Parameter(OptionID optionID,
List<ParameterConstraint<C>> constraints)
Constructs a parameter with the given optionID, and constraints. |
|
Parameter(OptionID optionID,
List<ParameterConstraint<C>> constraints,
boolean optional,
T defaultValue)
Constructs a parameter with the given optionID, constraints, and optional flag. |
|
Parameter(OptionID optionID,
ParameterConstraint<C> constraint)
Constructs a parameter with the given optionID, and constraint. |
|
Parameter(OptionID optionID,
ParameterConstraint<C> constraint,
boolean optional,
T defaultValue)
Constructs a parameter with the given optionID, constraint, and optional flag. |
|
| Method Summary | |
|---|---|
protected void |
addConstraint(ParameterConstraint<C> constraint)
Adds a parameter constraint to the list of parameter constraints. |
protected void |
addConstraintList(List<ParameterConstraint<C>> constraints)
Adds a list of parameter constraints to the current list of parameter constraints. |
T |
getDefaultValue()
Returns the default value of the parameter. |
String |
getFullDescription()
Returns the extended description of the option which includes the option's type, the short description and the default value (if specified). |
T |
getValue()
Returns the value of the option. |
String |
getValuesDescription()
Return a string explaining valid values. |
boolean |
hasDefaultValue()
Checks if this parameter has a default value. |
boolean |
hasValuesDescription()
Whether this class has a list of default values. |
boolean |
isOptional()
Checks if this parameter is an optional parameter. |
boolean |
isSet()
Returns true if the value of the option is set, false otherwise. |
void |
reset()
Resets the value of the parameter to null. |
void |
setDefaultValue(T defaultValue)
Sets the default value of this parameter. |
void |
setDefaultValueToValue()
Sets the default value of this parameter as the actual value of this parameter. |
void |
setOptional(boolean opt)
Specifies if this parameter is an optional parameter. |
boolean |
tookDefaultValue()
Checks if the default value of this parameter was taken as the actual parameter value. |
| Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Option |
|---|
getName, getOptionID, getShortDescription, getSyntax, isValid, setShortDescription, setValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected T defaultValue
private boolean defaultValueTaken
protected boolean optionalParameter
protected final List<ParameterConstraint<C>> constraints
| Constructor Detail |
|---|
public Parameter(OptionID optionID,
List<ParameterConstraint<C>> constraints)
optionID - the unique id of this parameterconstraints - the constraints of this parameter, may be empty if there
are no constraints
public Parameter(OptionID optionID,
ParameterConstraint<C> constraint)
optionID - the unique id of this parameterconstraint - the constraint of this parameter
public Parameter(OptionID optionID,
List<ParameterConstraint<C>> constraints,
boolean optional,
T defaultValue)
optionID - the unique id of this parameterconstraints - the constraints of this parameter, may be empty if there
are no constraintsoptional - specifies if this parameter is an optional parameterdefaultValue - the default value of this parameter (may be null)
public Parameter(OptionID optionID,
ParameterConstraint<C> constraint,
boolean optional,
T defaultValue)
optionID - the unique id of this parameterconstraint - the constraint of this parameteroptional - specifies if this parameter is an optional parameterdefaultValue - the default value of this parameter (may be null)public Parameter(OptionID optionID)
optionID - the unique id of the option| Method Detail |
|---|
protected void addConstraint(ParameterConstraint<C> constraint)
constraint - the parameter constraint to be addedprotected void addConstraintList(List<ParameterConstraint<C>> constraints)
constraints - list of parameter constraints to be addedpublic void setDefaultValue(T defaultValue)
defaultValue - default value of this parameterpublic boolean hasDefaultValue()
public void setDefaultValueToValue()
public void setOptional(boolean opt)
opt - true if this parameter is optional,false otherwisepublic boolean isOptional()
public boolean tookDefaultValue()
public boolean isSet()
Option
isSet in class Option<T>
public T getValue()
throws UnusedParameterException
Option
getValue in class Option<T>UnusedParameterException - is not thrown actually in this class
but subclasses may require allowance to throw this Exceptionpublic T getDefaultValue()
public boolean hasValuesDescription()
public String getValuesDescription()
public void reset()
public final String getFullDescription()
Option
getFullDescription in class Option<T>
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||