MaltParser 1.4.1

org.maltparser.core.options.option
Class Option

java.lang.Object
  extended by org.maltparser.core.options.option.Option
All Implemented Interfaces:
Comparable<Option>
Direct Known Subclasses:
BoolOption, ClassOption, EnumOption, IntegerOption, StringEnumOption, StringOption, UnaryOption

public abstract class Option
extends Object
implements Comparable<Option>

Abstract class that contains description of an option that are the same over all option types.

Since:
1.0
Author:
Johan Hall

Field Summary
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 Summary
Option(OptionGroup group, String name, String shortDescription, String flag, String usage)
          Creates an option description
 
Method Summary
 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 setGroup(OptionGroup group)
          Sets the reference to the option group
 void setName(String name)
          Sets the name of the option.
 void setShortDescription(String shortDescription)
          Sets a short description of the option
 void setUsage(int usage)
          Sets the usage of the option.
 void setUsage(String usage)
          Sets the usage of the option.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

TRAIN

public static final int TRAIN
The option is only relevant during learning

See Also:
Constant Field Values

PROCESS

public static final int PROCESS
The option is only relevant during processing (parsing)

See Also:
Constant Field Values

BOTH

public static final int BOTH
The option is relevant both during learning and processing (parsing)

See Also:
Constant Field Values

SAVE

public static final int SAVE
The option is saved during learning and cannot be overloaded during processing (parsing)

See Also:
Constant Field Values
Constructor Detail

Option

public Option(OptionGroup group,
              String name,
              String shortDescription,
              String flag,
              String usage)
       throws MaltChainedException
Creates an option description

Parameters:
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.
Throws:
OptionException
MaltChainedException
Method Detail

getValueObject

public abstract Object getValueObject(String value)
                               throws MaltChainedException
Returns the corresponding object for the option value (specified as a string value).

Parameters:
value - the string option value
Returns:
the corresponding object for the option value (specified as a string value).
Throws:
OptionException
MaltChainedException

getDefaultValueObject

public abstract Object getDefaultValueObject()
                                      throws MaltChainedException
Returns the object for the default value for option.

Returns:
the object for the default value for option.
Throws:
OptionException
MaltChainedException

getDefaultValueString

public abstract String getDefaultValueString()
Returns a string representation of the default value.

Returns:
a string representation of the default value

setDefaultValue

public abstract void setDefaultValue(String defaultValue)
                              throws MaltChainedException
Sets the default value for the option.

Parameters:
defaultValue - the string default value
Throws:
OptionException
MaltChainedException

getStringRepresentation

public abstract String getStringRepresentation(Object value)
Returns a string representation of the option value.

Parameters:
value - an option value object
Returns:
a string representation of the option value, if the option value could not be found null is returned.

getGroup

public OptionGroup getGroup()
Returns a reference to a option group.

Returns:
a reference to a option group.

setGroup

public void setGroup(OptionGroup group)
Sets the reference to the option group

Parameters:
group - a reference to a option group

getName

public String getName()
Returns the name of the option.

Returns:
the name of the option.

setName

public void setName(String name)
             throws MaltChainedException
Sets the name of the option.

Parameters:
name - the name of the option.
Throws:
OptionException
MaltChainedException

getShortDescription

public String getShortDescription()
Returns a short description of the option

Returns:
a short description of the option

setShortDescription

public void setShortDescription(String shortDescription)
Sets a short description of the option

Parameters:
shortDescription - a short description of the option

getFlag

public String getFlag()
Returns a character that is used as a flag for the command line input

Returns:
a character that is used as a flag for the command line input

setFlag

public void setFlag(String flag)
             throws MaltChainedException
Sets a character that is used as a flag for the command line input

Parameters:
flag - a character that is used as a flag for the command line input
Throws:
OptionException
MaltChainedException

getUsage

public int getUsage()
Returns the usage of the option.

Returns:
the usage of the option.

setUsage

public void setUsage(String usage)
              throws MaltChainedException
Sets the usage of the option.

Parameters:
usage - the usage of the option.
Throws:
OptionException
MaltChainedException

setUsage

public void setUsage(int usage)
              throws MaltChainedException
Sets the usage of the option.

Parameters:
usage - the usage of the option.
Throws:
OptionException
MaltChainedException

isAmbiguous

public boolean isAmbiguous()
Returns true if the option name is ambiguous over all option groups, otherwise false.

Returns:
true if the option name is ambiguous over all option groups, otherwise false.

setAmbiguous

public void setAmbiguous(boolean ambiguous)
Sets true if the option name is ambiguous over all option groups, otherwise false.

Parameters:
ambiguous - true if the option name is ambiguous over all option groups, otherwise false.

compareTo

public int compareTo(Option o)
Specified by:
compareTo in interface Comparable<Option>

toString

public String toString()
Overrides:
toString in class Object

MaltParser 1.4.1

Copyright 2007-2010 Johan Hall, Jens Nilsson and Joakim Nivre.