public abstract class Option extends java.lang.Object implements java.lang.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,
java.lang.String name,
java.lang.String shortDescription,
java.lang.String flag,
java.lang.String usage)
Creates an option description
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Option o) |
abstract java.lang.Object |
getDefaultValueObject()
Returns the object for the default value for option.
|
abstract java.lang.String |
getDefaultValueString()
Returns a string representation of the default value.
|
java.lang.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.
|
java.lang.String |
getName()
Returns the name of the option.
|
java.lang.String |
getShortDescription()
Returns a short description of the option
|
abstract java.lang.String |
getStringRepresentation(java.lang.Object value)
Returns a string representation of the option value.
|
int |
getUsage()
Returns the usage of the option.
|
abstract java.lang.Object |
getValueObject(java.lang.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(java.lang.String defaultValue)
Sets the default value for the option.
|
void |
setFlag(java.lang.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(java.lang.String usage)
Sets the usage of the option.
|
java.lang.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, java.lang.String name, java.lang.String shortDescription, java.lang.String flag, java.lang.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 java.lang.Object getValueObject(java.lang.String value) throws MaltChainedException
value
- the string option valueOptionException
MaltChainedException
public abstract java.lang.Object getDefaultValueObject() throws MaltChainedException
OptionException
MaltChainedException
public abstract java.lang.String getDefaultValueString()
public abstract void setDefaultValue(java.lang.String defaultValue) throws MaltChainedException
defaultValue
- the string default valueOptionException
MaltChainedException
public abstract java.lang.String getStringRepresentation(java.lang.Object value)
value
- an option value objectpublic OptionGroup getGroup()
public java.lang.String getName()
public java.lang.String getShortDescription()
public java.lang.String getFlag()
public void setFlag(java.lang.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(java.lang.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 java.lang.Comparable<Option>
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.