public class Flag extends AbstractParameter<Flag,java.lang.Boolean>
A flag object is optional parameter which can be set (value "true") or not (value "false").
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NOT_SET
Constant indicating that the flag is not set.
|
static java.lang.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 |
|---|---|
java.lang.String |
getSyntax()
A flag has no syntax, since it doesn't take extra options
|
java.lang.String |
getValueAsString()
Get the value as string.
|
boolean |
isFalse()
Shorthand for
isDefined() && getValue() == false |
boolean |
isTrue()
Shorthand for
isDefined() && getValue() == true |
protected java.lang.Boolean |
parseValue(java.lang.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(java.lang.Boolean obj)
Validate a value after parsing (e.g. do constraint checks!)
|
addConstraint, describeValues, getConstraints, getDefaultValue, getDefaultValueAsString, getOptionID, getShortDescription, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValue, setValueInternal, tookDefaultValue, tryDefaultValuepublic static final java.lang.String SET
public static final java.lang.String NOT_SET
public Flag(OptionID optionID)
If the flag is not set its value is "false".
optionID - the unique id of the optionprotected java.lang.Boolean parseValue(java.lang.Object obj)
throws ParameterException
AbstractParameterparseValue in class AbstractParameter<Flag,java.lang.Boolean>obj - Object to parse (may be a string representation!)ParameterException - when the object cannot be parsed.public java.lang.String getSyntax()
getSyntax in interface Parameter<java.lang.Boolean>getSyntax in class AbstractParameter<Flag,java.lang.Boolean>public java.lang.String getValueAsString()
ParameternullgetValueAsString in interface Parameter<java.lang.Boolean>getValueAsString in class AbstractParameter<Flag,java.lang.Boolean>protected boolean validate(java.lang.Boolean obj)
throws ParameterException
AbstractParametervalidate in class AbstractParameter<Flag,java.lang.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 © 2019 ELKI Development Team. License information.