gnu.text
Class Options

java.lang.Object
  extended by gnu.text.Options

public class Options
extends java.lang.Object

Mananges a table of named options, Can inherit from another table of "default" options.


Field Summary
static int BOOLEAN_OPTION
          Bit indicating option value is a boolean.
static int STRING_OPTION
           
static java.lang.String UNKNOWN
           
 
Constructor Summary
Options()
           
Options(Options previous)
           
 
Method Summary
 void add(java.lang.String key, int kind, java.lang.String documentation)
          Create a new option and enters it in this table.
 java.lang.Object get(java.lang.String key, java.lang.Object defaultValue)
          Get the value for the option.
 boolean getBoolean(java.lang.String key)
           
 boolean getBoolean(java.lang.String key, boolean defaultValue)
           
 java.lang.String getDoc(java.lang.String key)
           
 gnu.text.OptionInfo getInfo(java.lang.String key)
           
 java.lang.Object getLocal(java.lang.String key)
          Get current option value.
 java.util.Vector keys()
          Return the list of option keys.
 void popOptionValues(java.util.Vector options)
          Restore a list of options, as set by pushOptionValues
 void pushOptionValues(java.util.Vector options)
          Set a list of options, remember the old value.
 void reset(java.lang.String key, java.lang.Object oldValue)
          Reset the value of a named option.
 void set(java.lang.String key, java.lang.Object value)
          Set the value of a named option.
 void set(java.lang.String key, java.lang.Object value, SourceMessages messages)
          Set the value of a named option.
 java.lang.String set(java.lang.String key, java.lang.String argument)
          Set the value of the key to the argument, appropriate parsed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOLEAN_OPTION

public static final int BOOLEAN_OPTION
Bit indicating option value is a boolean.

See Also:
Constant Field Values

STRING_OPTION

public static final int STRING_OPTION
See Also:
Constant Field Values

UNKNOWN

public static final java.lang.String UNKNOWN
See Also:
Constant Field Values
Constructor Detail

Options

public Options()

Options

public Options(Options previous)
Method Detail

add

public void add(java.lang.String key,
                int kind,
                java.lang.String documentation)
Create a new option and enters it in this table. A duplicate option throws a RuntimeException.

Parameters:
key - the options name (key).
kind - type and other flag bits of the option.
documentation - a String describing what the option does.

set

public void set(java.lang.String key,
                java.lang.Object value)
Set the value of a named option.


set

public void set(java.lang.String key,
                java.lang.Object value,
                SourceMessages messages)
Set the value of a named option.


reset

public void reset(java.lang.String key,
                  java.lang.Object oldValue)
Reset the value of a named option.


set

public java.lang.String set(java.lang.String key,
                            java.lang.String argument)
Set the value of the key to the argument, appropriate parsed. return null on success or a String error message. If the option key is invalid, return UNKNOWN.


getInfo

public gnu.text.OptionInfo getInfo(java.lang.String key)

get

public java.lang.Object get(java.lang.String key,
                            java.lang.Object defaultValue)
Get the value for the option. Throws an except if there is no option by that name, Returns defaultValue if there is such an option, but it hasn't been set.


getLocal

public java.lang.Object getLocal(java.lang.String key)
Get current option value. Only look in local table, in in inherited previous Options. Return null if there is no binding (even when get would throw an except on an unknonw option).


getBoolean

public boolean getBoolean(java.lang.String key)

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean defaultValue)

pushOptionValues

public void pushOptionValues(java.util.Vector options)
Set a list of options, remember the old value.

Parameters:
options - is vector of triples, echo of which is consisting of: a String option key; an entry whose valus is ignores and is used to store the old value; and a new value for the options.

popOptionValues

public void popOptionValues(java.util.Vector options)
Restore a list of options, as set by pushOptionValues


keys

public java.util.Vector keys()
Return the list of option keys.


getDoc

public java.lang.String getDoc(java.lang.String key)