Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| MaltParser 1.6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.maltparser.core.options
Class OptionManager

    java.lang.Object
      org.maltparser.core.options.OptionManager

    public class OptionManager

extends Object

Option Manager is the management class for all option handling. All queries and manipulations of an option or an option value should go through this class.

Since:
  1.0
Author:
  Johan Hall

Field Summary
`static int` | `DEFAULTVALUE`

Method Summary
`void` | `generateMaps()` Creates several option maps for fast access to individual options.
`int` | `getNumberOfOptionValues(int containerIndex)` Returns the number of option values for a particular option container.
`Set<Integer>` | `getOptionContainerIndices()` Returns a sorted set of container names.
`Object` | `getOptionDefaultValue(String optiongroup, String optionname)`
`OptionDescriptions` | `getOptionDescriptions()` Returns the option description
`Object` | `getOptionValue(int containerIndex, String optiongroup, String optionname)` Returns the option value for an option that is specified by the option group name and option name.
`Object` | `getOptionValueNoDefault(int containerIndex, String optiongroup, String optionname)`
`String` | `getOptionValueString(int containerIndex, String optiongroup, String optionname)` Returns a string representation of the option value for an option that is specified by the option group name and the option name.
`String` | `getOptionValueStringNoDefault(int containerIndex, String optiongroup, String optionname)`
`static OptionManager` | `instance()` Returns a reference to the single instance.
`void` | `loadOptionDescriptionFile()` Loads the option description file `/appdata/options.xml`
`void` | `loadOptionDescriptionFile(URL url)` Loads the option description file
`void` | `loadOptions(int containerIndex, InputStreamReader isr)` Loads the saved options (options that are marked with `usage=Option.SAVE`).
`void` | `loadOptions(int containerIndex, String fileName)` Loads the saved options (options that are marked with `usage=save`).
`void` | `overloadOptionValue(int containerIndex, String optiongroup, String optionname, String value)` Overloads the option value specified by the container index, the option group name, the option name.
`boolean` | `parseCommandLine(String[] args, int containerIndex)` Parses the command line arguments.
`boolean` | `parseCommandLine(String argString, int containerIndex)`
`void` | `parseOptionInstanceXMLfile(String fileName)` Parses the option file for option values.
`void` | `saveOptions(int containerIndex, OutputStreamWriter osw)` Saves all options that are marked as usage=Option.SAVE for a particular option container.
`void` | `saveOptions(int containerIndex, String fileName)` Saves all options that are marked as usage=Option.SAVE for a particular option container.
`void` | `saveOptions(OutputStreamWriter osw)` Saves all options that are marked as `usage=Option.SAVE`
`void` | `saveOptions(String fileName)` Saves all options that are marked as `usage=Option.SAVE`
`String` | `toString()`
`String` | `toStringPrettyValues(int containerIndex, Set<String> excludeGroups)` Returns a string representation of all option value, except the options in a option group specified by the excludeGroup argument.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULTVALUE

    public static final int DEFAULTVALUE

See Also:
  Constant Field Values

Method Detail

### instance

    public static OptionManager instance()

  Returns a reference to the single instance.

### loadOptionDescriptionFile

    public void loadOptionDescriptionFile()
                                   throws MaltChainedException

  Loads the option description file `/appdata/options.xml`

  Throws:
    `MaltChainedException`

### loadOptionDescriptionFile

    public void loadOptionDescriptionFile(URL url)
                                   throws MaltChainedException

  Loads the option description file

  Parameters:
    `url` - URL of the option description file
  Throws:
    `MaltChainedException`

### getOptionDescriptions

    public OptionDescriptions getOptionDescriptions()

  Returns the option description

  Returns:
    the option description

### getOptionValue

    public Object getOptionValue(int containerIndex,
                                 String optiongroup,
                                 String optionname)
                          throws MaltChainedException

  Returns the option value for an option that is specified by the option group name and option name. The container name points out the specific option container.

  Parameters:
    `containerIndex` - The index of the option container (0..n and -1 is default values).
    `optiongroup` - The name of the option group.
    `optionname` - The name of the option.
  Returns:
    an object that contains the value of the option, null if the option value could not be found.
  Throws:
    `OptionException`
    `MaltChainedException`

### getOptionDefaultValue

    public Object getOptionDefaultValue(String optiongroup,
                                        String optionname)
                                 throws MaltChainedException

  Throws:
    `MaltChainedException`

### getOptionValueNoDefault

    public Object getOptionValueNoDefault(int containerIndex,
                                          String optiongroup,
                                          String optionname)
                                   throws MaltChainedException

  Throws:
    `MaltChainedException`

### getOptionValueString

    public String getOptionValueString(int containerIndex,
                                       String optiongroup,
                                       String optionname)
                                throws MaltChainedException

  Returns a string representation of the option value for an option that is specified by the option group name and the option name. The container name points out the specific option container.

  Parameters:
    `containerIndex` - The index of the option container (0..n and -1 is default values).
    `optiongroup` - The name of the option group.
    `optionname` - The name of the option.
  Returns:
    a string representation of the option value
  Throws:
    `MaltChainedException`

### getOptionValueStringNoDefault

    public String getOptionValueStringNoDefault(int containerIndex,
                                                String optiongroup,
                                                String optionname)
                                         throws MaltChainedException

  Throws:
    `MaltChainedException`

### overloadOptionValue

    public void overloadOptionValue(int containerIndex,
                                    String optiongroup,
                                    String optionname,
                                    String value)
                             throws MaltChainedException

  Overloads the option value specified by the container index, the option group name, the option name. This method is used to override option that have specific dependencies.

  Parameters:
    `containerIndex` - the index of the option container (0..n and -1 is default values).
    `optiongroup` - the name of the option group.
    `optionname` - the name of the option.
    `value` - the option value that should replace the current option value.
  Throws:
    `MaltChainedException`

### getNumberOfOptionValues

    public int getNumberOfOptionValues(int containerIndex)

  Returns the number of option values for a particular option container.

  Parameters:
    `containerIndex` - The index of the option container (0..n).
  Returns:
    the number of option values for a particular option container.

### getOptionContainerIndices

    public Set<Integer> getOptionContainerIndices()

  Returns a sorted set of container names.

  Returns:
    a sorted set of container names.

### loadOptions

    public void loadOptions(int containerIndex,
                            String fileName)
                     throws MaltChainedException

  Loads the saved options (options that are marked with `usage=save`).

  Parameters:
    `fileName` - The path to the file where to load the saved options.
  Throws:
    `MaltChainedException`

### loadOptions

    public void loadOptions(int containerIndex,
                            InputStreamReader isr)
                     throws MaltChainedException

  Loads the saved options (options that are marked with `usage=Option.SAVE`).

  Parameters:
    `isr` - the input stream reader of the saved options file.
  Throws:
    `MaltChainedException`

### saveOptions

    public void saveOptions(String fileName)
                     throws MaltChainedException

  Saves all options that are marked as `usage=Option.SAVE`

  Parameters:
    `fileName` - The path to the file where the saveOption should by saved.
  Throws:
    `MaltChainedException`

### saveOptions

    public void saveOptions(OutputStreamWriter osw)
                     throws MaltChainedException

  Saves all options that are marked as `usage=Option.SAVE`

  Parameters:
    `osw` - the output stream writer of the saved option file
  Throws:
    `MaltChainedException`

### saveOptions

    public void saveOptions(int containerIndex,
                            String fileName)
                     throws MaltChainedException

  Saves all options that are marked as usage=Option.SAVE for a particular option container.

  Parameters:
    `containerIndex` - The index of the option container (0..n).
    `fileName` - The path to the file where the saveOption should by saved.
  Throws:
    `MaltChainedException`

### saveOptions

    public void saveOptions(int containerIndex,
                            OutputStreamWriter osw)
                     throws MaltChainedException

  Saves all options that are marked as usage=Option.SAVE for a particular option container.

  Parameters:
    `containerIndex` - The index of the option container (0..n).
    `osw` - the output stream writer of the saved option file
  Throws:
    `MaltChainedException`

### generateMaps

    public void generateMaps()
                      throws MaltChainedException

  Creates several option maps for fast access to individual options.

  Throws:
    `OptionException`
    `MaltChainedException`

### parseCommandLine

    public boolean parseCommandLine(String argString,
                                    int containerIndex)
                             throws MaltChainedException

  Throws:
    `MaltChainedException`

### parseCommandLine

    public boolean parseCommandLine(String[] args,
                                    int containerIndex)
                             throws MaltChainedException

  Parses the command line arguments.

  Parameters:
    `args` - An array of arguments that are supplied when starting the application.
  Throws:
    `OptionException`
    `MaltChainedException`

### parseOptionInstanceXMLfile

    public void parseOptionInstanceXMLfile(String fileName)
                                    throws MaltChainedException

  Parses the option file for option values.

  Parameters:
    `fileName` - The option file name (must be a xml file).
  Throws:
    `OptionException`
    `MaltChainedException`

### toStringPrettyValues

    public String toStringPrettyValues(int containerIndex,
                                       Set<String> excludeGroups)
                                throws MaltChainedException

  Returns a string representation of all option value, except the options in a option group specified by the excludeGroup argument.

  Parameters:
    `containerIndex` - The index of the option container (0..n and -1 is default values).
    `excludeGroups` - a set of option group names that should by excluded in the string representation
  Returns:
    a string representation of all option value
  Throws:
    `MaltChainedException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| MaltParser 1.6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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