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 [dmsmith555 at yahoo dot com]
See Also:
  `for license details.
  The copyright to this program is held by it's authors.`

Field Summary
`private Map` | `longOptions`
`private Map` | `shortOptions`

Constructor Summary
`OptionList()`

Method Summary
`void` | `add(Option option)` Adds an Option to the end of this OptionList.
`List` | `getLongOptions(String key)` Get a list of Options that match the Option's long name.
`List` | `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 shortOptions

### longOptions

    private Map 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` -

### getLongOptions

    public List 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 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-2007
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD