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.jsword.passage
Class DefaultLeafKeyList

    java.lang.Object
      org.crosswire.jsword.passage.DefaultLeafKeyList

All Implemented Interfaces:
  Cloneable, Comparable, Key

Direct Known Subclasses:
  RawLDBackend.IndexKey, ReadingsKey

    public class DefaultLeafKeyList

extends Object
implements Key

A simple default implementation of the Key interface.

Author:
  Joe Walker [joe at eireneh dot com]
See Also:
  `for license details. The copyright to this program is held by it's authors.`

Field Summary
`private String` | `name` The human readable string that this key represents
`private String` | `osisName` The OSIS version of this Key
`private Key` | `parent` The parent of this key

Constructor Summary
`DefaultLeafKeyList(String name, String osisName)` Default ctor
`DefaultLeafKeyList(String name, String osisName, Key parent)` Default ctor

Method Summary
`void` | `addAll(Key key)` Adds the specified element to this set if it is not already present.
`void` | `blur(int by, RestrictionType restrict)` Widen the range of the verses/keys in this list.
`boolean` | `canHaveChildren()` Returns true if the receiver is a leaf node and can not have children.
`void` | `clear()` Removes all of the elements from this set (optional operation).
`Object` | `clone()` This needs to be declared here so that it is visible as a method on a derived Key.
`int` | `compareTo(Object obj)`
`boolean` | `contains(Key key)` Returns `true` if this set contains the specified element.
`boolean` | `equals(Object obj)`
`Key` | `get(int index)` Gets a key from a specific point in this list.
`int` | `getChildCount()` Returns the number of elements in this set (its cardinality).
`String` | `getName()` A Human readable version of the Key.
`String` | `getOsisID()` The OSIS defined id specification for this Key.
`String` | `getOsisRef()` The OSIS defined reference specification for this Key.
`Key` | `getParent()` All keys have parents unless they are the root of a Key.
`int` | `hashCode()`
`int` | `indexOf(Key that)` Reverse a Key into the position the key holds in the list
`boolean` | `isEmpty()` Does this Passage have 0 members
`Iterator` | `iterator()`
`void` | `removeAll(Key key)` Removes the specified elements from this set if it is present.
`void` | `retainAll(Key key)` Removes all but the specified element from this set.
`String` | `toString()`

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

Field Detail

### parent

    private Key parent

  The parent of this key

### name

    private String name

  The human readable string that this key represents

### osisName

    private String osisName

  The OSIS version of this Key

Constructor Detail

### DefaultLeafKeyList

    public DefaultLeafKeyList(String name,
                              String osisName)

  Default ctor

### DefaultLeafKeyList

    public DefaultLeafKeyList(String name,
                              String osisName,
                              Key parent)

  Default ctor

Method Detail

### canHaveChildren

    public boolean canHaveChildren()

  Description copied from interface: `Key`
  Returns true if the receiver is a leaf node and can not have children. Any attempt to add()/remove() wlll throw

  Specified by:
    `canHaveChildren` in interface `Key`

### getName

    public String getName()

  Description copied from interface: `Key`
  A Human readable version of the Key. For Biblical passages this uses short books names, and the shortest sensible rendering eg "Mat 3:1-4" and "Mar 1:1, 3, 5" and "3Jo, Jude"

  Specified by:
    `getName` in interface `Key`
  Returns:
    a String containing a description of the Key

### getOsisRef

    public String getOsisRef()

  Description copied from interface: `Key`
  The OSIS defined reference specification for this Key. When the key is a single element, it is an OSIS book name with '.' separating the parts. When the key is multiple elements, it uses a range notation. Note, this will create a comma separated list of ranges, which is improper OSIS.

  Specified by:
    `getOsisRef` in interface `Key`
  Returns:
    a String containing the OSIS description of the verses

### getOsisID

    public String getOsisID()

  Description copied from interface: `Key`
  The OSIS defined id specification for this Key. When the key is a single element, it is an OSIS book name with '.' separating the parts. When the key is multiple elements, it uses a space to separate each.

  Specified by:
    `getOsisID` in interface `Key`
  Returns:
    a String containing the OSIS description of the verses

### getParent

    public Key getParent()

  Description copied from interface: `Key`
  All keys have parents unless they are the root of a Key.

  Specified by:
    `getParent` in interface `Key`
  Returns:
    The parent of this tree, or null if this Key is the root.

### getChildCount

    public int getChildCount()

  Description copied from interface: `Key`
  Returns the number of elements in this set (its cardinality). If this set contains more than `Integer.MAX_VALUE` elements, returns `Integer.MAX_VALUE`.

  Specified by:
    `getChildCount` in interface `Key`
  Returns:
    the number of elements in this set (its cardinality).

### isEmpty

    public boolean isEmpty()

  Description copied from interface: `Key`
  Does this Passage have 0 members

  Specified by:
    `isEmpty` in interface `Key`
  Returns:
    `true` if this set contains no elements.

### contains

    public boolean contains(Key key)

  Description copied from interface: `Key`
  Returns `true` if this set contains the specified element.

  Specified by:
    `contains` in interface `Key`
  Parameters:
    `key` - element whose presence in this set is to be tested.
  Returns:
    `true` if this set contains the specified element.

### iterator

    public Iterator iterator()

  Specified by:
    `iterator` in interface `Key`
  Returns:
    an iterator over the elements in this set.

### addAll

    public void addAll(Key key)

  Description copied from interface: `Key`
  Adds the specified element to this set if it is not already present.

  Specified by:
    `addAll` in interface `Key`
  Parameters:
    `key` - element to be added to this set.

### removeAll

    public void removeAll(Key key)

  Description copied from interface: `Key`
  Removes the specified elements from this set if it is present.

  Specified by:
    `removeAll` in interface `Key`
  Parameters:
    `key` - object to be removed from this set, if present.

### retainAll

    public void retainAll(Key key)

  Description copied from interface: `Key`
  Removes all but the specified element from this set.

  Specified by:
    `retainAll` in interface `Key`
  Parameters:
    `key` - object to be left in this set.

### clear

    public void clear()

  Description copied from interface: `Key`
  Removes all of the elements from this set (optional operation). This set will be empty after this call returns (unless it throws an exception).

  Specified by:
    `clear` in interface `Key`

### get

    public Key get(int index)

  Description copied from interface: `Key`
  Gets a key from a specific point in this list.

  Specified by:
    `get` in interface `Key`
  Parameters:
    `index` - The index of the Key to retrieve
  Returns:
    The specified key

### indexOf

    public int indexOf(Key that)

  Description copied from interface: `Key`
  Reverse a Key into the position the key holds in the list

  Specified by:
    `indexOf` in interface `Key`
  Parameters:
    `that` - The Key to find
  Returns:
    The index of the key or -1 if the key is not in the list

### blur

    public void blur(int by,
                     RestrictionType restrict)

  Description copied from interface: `Key`
  Widen the range of the verses/keys in this list. This is primarily for "find x within n verses of y" type applications.

  Specified by:
    `blur` in interface `Key`
  Parameters:
    `by` - The number of verses/keys to widen by
    `restrict` - How should we restrict the blurring?
  See Also:
    `Passage`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### compareTo

    public int compareTo(Object obj)

  Specified by:
    `compareTo` in interface `Comparable`

### clone

    public Object clone()

  Description copied from interface: `Key`
  This needs to be declared here so that it is visible as a method on a derived Key.

  Specified by:
    `clone` in interface `Key`
  Overrides:
    `clone` in class `Object`
  Returns:
    A complete copy of ourselves

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