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, useDefaultValue
public 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
AbstractParameter
parseValue
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()
Parameter
null
getValueAsString
in interface Parameter<Boolean>
getValueAsString
in class AbstractParameter<Flag,Boolean>
protected boolean validate(Boolean obj) throws ParameterException
AbstractParameter
validate
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() == true
public boolean isFalse()
isDefined() && getValue() == false
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.