public abstract class Option extends Object implements Comparable<Option>
Modifier and Type | Field and Description |
---|---|
static int |
BOTH
The option is relevant both during learning and processing (parsing)
|
static int |
NONE |
static int |
PROCESS
The option is only relevant during processing (parsing)
|
static int |
SAVE
The option is saved during learning and cannot be overloaded during processing (parsing)
|
static int |
TRAIN
The option is only relevant during learning
|
Constructor and Description |
---|
Option(OptionGroup group,
String name,
String shortDescription,
String flag,
String usage)
Creates an option description
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Option o) |
abstract Object |
getDefaultValueObject()
Returns the object for the default value for option.
|
abstract String |
getDefaultValueString()
Returns a string representation of the default value.
|
String |
getFlag()
Returns a character that is used as a flag for the command line input
|
OptionGroup |
getGroup()
Returns a reference to a option group.
|
String |
getName()
Returns the name of the option.
|
String |
getShortDescription()
Returns a short description of the option
|
abstract String |
getStringRepresentation(Object value)
Returns a string representation of the option value.
|
int |
getUsage()
Returns the usage of the option.
|
abstract Object |
getValueObject(String value)
Returns the corresponding object for the option value (specified as a string value).
|
boolean |
isAmbiguous()
Returns true if the option name is ambiguous over all option groups, otherwise false.
|
void |
setAmbiguous(boolean ambiguous)
Sets true if the option name is ambiguous over all option groups, otherwise false.
|
abstract void |
setDefaultValue(String defaultValue)
Sets the default value for the option.
|
void |
setFlag(String flag)
Sets a character that is used as a flag for the command line input
|
void |
setUsage(int usage)
Sets the usage of the option.
|
void |
setUsage(String usage)
Sets the usage of the option.
|
String |
toString() |
public static final int NONE
public static final int TRAIN
public static final int PROCESS
public static final int BOTH
public static final int SAVE
public Option(OptionGroup group, String name, String shortDescription, String flag, String usage) throws MaltChainedException
group
- a reference to the option group.name
- the name of the option.shortDescription
- a short description of the option.flag
- a flag that can be used in the command line.usage
- a string that explains the usage of the option.OptionException
MaltChainedException
public abstract Object getValueObject(String value) throws MaltChainedException
value
- the string option valueOptionException
MaltChainedException
public abstract Object getDefaultValueObject() throws MaltChainedException
OptionException
MaltChainedException
public abstract String getDefaultValueString()
public abstract void setDefaultValue(String defaultValue) throws MaltChainedException
defaultValue
- the string default valueOptionException
MaltChainedException
public abstract String getStringRepresentation(Object value)
value
- an option value objectpublic OptionGroup getGroup()
public String getShortDescription()
public String getFlag()
public void setFlag(String flag) throws MaltChainedException
flag
- a character that is used as a flag for the command line inputOptionException
MaltChainedException
public int getUsage()
public void setUsage(String usage) throws MaltChainedException
usage
- the usage of the option.OptionException
MaltChainedException
public void setUsage(int usage) throws MaltChainedException
usage
- the usage of the option.OptionException
MaltChainedException
public boolean isAmbiguous()
public void setAmbiguous(boolean ambiguous)
ambiguous
- true if the option name is ambiguous over all option groups, otherwise false.public int compareTo(Option o)
compareTo
in interface Comparable<Option>
Copyright 2007-2014 Johan Hall, Jens Nilsson and Joakim Nivre.