|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter<Boolean,Boolean> de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag
public class Flag
Option class specifying a flag object.
A flag object is optional parameter which can be set (value "true") or not (value "false").
Field Summary | |
---|---|
static String |
NOT_SET
Constant indicating that the flag is not set. |
static String |
SET
Constant indicating that the flag is set. |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter |
---|
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription |
Constructor Summary | |
---|---|
Flag(OptionID optionID)
Constructs a flag object with the given optionID. |
Method Summary | |
---|---|
String |
getSyntax()
A flag has no syntax, since it doesn't take extra options |
String |
getValueAsString()
Get the value as string. |
boolean |
isFalse()
Shorthand for isDefined() && getValue() == false |
boolean |
isTrue()
Shorthand for isDefined() && getValue() == true |
protected Boolean |
parseValue(Object obj)
Parse a given value into the destination type. |
void |
setValue(boolean val)
Convenience function using a native boolean, that doesn't require error handling. |
protected boolean |
validate(Boolean obj)
Validate a value after parsing (e.g. do constrain checks!) |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter |
---|
addConstraint, getDefaultValue, getDefaultValueAsString, getFullDescription, getGivenValue, getName, getOptionID, getShortDescription, getValue, getValuesDescription, hasDefaultValue, hasValuesDescription, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValue, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SET
public static final String NOT_SET
Constructor Detail |
---|
public Flag(OptionID optionID)
optionID
- the unique id of the optionMethod Detail |
---|
protected Boolean parseValue(Object obj) throws ParameterException
Parameter
parseValue
in class Parameter<Boolean,Boolean>
obj
- Object to parse (may be a string representation!)
ParameterException
- when the object cannot be parsed.public String getSyntax()
getSyntax
in class Parameter<Boolean,Boolean>
public String getValueAsString()
null
getValueAsString
in class Parameter<Boolean,Boolean>
protected boolean validate(Boolean obj) throws ParameterException
validate
in class Parameter<Boolean,Boolean>
obj
- Object to validate
ParameterException
- when the object is not valid.public void setValue(boolean val)
val
- boolean valuepublic boolean isTrue()
isDefined() && getValue() == true
public boolean isFalse()
isDefined() && getValue() == false
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |