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

## org.crosswire.common.options
Class OptionList

    java.lang.Object
      org.crosswire.common.options.OptionList

    public class OptionList

extends Object

An OptionList contains an ordered set of Options. The primary ability of an OptionList is to find the matches for an Option.

Author:
  DM Smith
See Also:
  `The GNU Lesser General Public License for details.`

Field Summary
`private Map<String,Option>` | `longOptions`
`private Map<String,Option>` | `shortOptions`

Constructor Summary
`OptionList()`

Method Summary
`void` | `add(Option option)` Adds an Option to the end of this OptionList.
`List<Option>` | `getLongOptions(String key)` Get a list of Options that match the Option's long name.
`List<Option>` | `getOptions(String key)` Get a list of Options that match the Option's short or long name.
`Option` | `getShortOption(char key)` Get the Option that matches the key on the Option's short name.

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

Field Detail

### shortOptions

    private Map<String,Option> shortOptions

### longOptions

    private Map<String,Option> longOptions

Constructor Detail

### OptionList

    public OptionList()

Method Detail

### add

    public void add(Option option)

  Adds an Option to the end of this OptionList. It is an error with "undefined" behavior for an Option's short or long name to already be known.

  Parameters:
    `option` - the option to append

### getLongOptions

    public List<Option> getLongOptions(String key)

  Get a list of Options that match the Option's long name. Return all Options where the key is a prefix of its long name. If there is an exact match then it is at the head of the list. It is up to the program to decide how to handle ambiguity.

  Parameters:
    `key` - the input to match
  Returns:
    a list of all matches, or an empty list

### getShortOption

    public Option getShortOption(char key)

  Get the Option that matches the key on the Option's short name.

  Parameters:
    `key` - the input to match
  Returns:
    the matching Option, null otherwise.

### getOptions

    public List<Option> getOptions(String key)

  Get a list of Options that match the Option's short or long name. Obviously, if the key is longer than a single character it won't match a short name. Return all Options where the key is a prefix of its long name. If there is an exact match then it is at the head of the list. It is up to the program to decide how to handle ambiguity.

  Parameters:
    `key` - the input to match
  Returns:
    a list of all matches, or an empty list

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2015
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD