
public class Flag extends AbstractParameter<Flag,Boolean>
| Modifier and Type | Field and Description |
|---|---|
static String |
NOT_SET
Constant indicating that the flag is not set.
|
static String |
SET
Constant indicating that the flag is set.
|
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription| Constructor and Description |
|---|
Flag(OptionID optionID)
Constructs a flag object with the given optionID.
|
| Modifier and Type | Method and Description |
|---|---|
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!)
|
addConstraint, getDefaultValue, getDefaultValueAsString, getFullDescription, getGivenValue, getName, getOptionID, getShortDescription, getValue, getValuesDescription, hasDefaultValue, hasValuesDescription, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValue, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValuepublic static final String SET
public static final String NOT_SET
public Flag(OptionID optionID)
optionID - the unique id of the optionprotected Boolean parseValue(Object obj) throws ParameterException
AbstractParameterparseValue in class AbstractParameter<Flag,Boolean>obj - Object to parse (may be a string representation!)ParameterException - when the object cannot be parsed.public String getSyntax()
public String getValueAsString()
ParameternullgetValueAsString in interface Parameter<Boolean>getValueAsString in class AbstractParameter<Flag,Boolean>protected boolean validate(Boolean obj) throws ParameterException
AbstractParametervalidate in class AbstractParameter<Flag,Boolean>obj - Object to validateParameterException - when the object is not valid.public void setValue(boolean val)
val - boolean valuepublic boolean isTrue()
isDefined() && getValue() == truepublic boolean isFalse()
isDefined() && getValue() == falseCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.