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.book.sword
Class AbstractKeyBackend<T extends OpenFileState>

    java.lang.Object
      org.crosswire.jsword.book.sword.AbstractBackend<T>
          org.crosswire.jsword.book.sword.AbstractKeyBackend<T>

Type Parameters:
  `T` - The type of the OpenFileState that this class extends.

All Implemented Interfaces:
  Serializable, Cloneable, Comparable<Key>, Iterable<Key>, Backend<T>, StatefulFileBackedBackend<T>, Key

Direct Known Subclasses:
  RawLDBackend

    public abstract class AbstractKeyBackend<T extends OpenFileState>

extends AbstractBackend<T>
implements Key

A Backend that can be used as a global key list.

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

Field Summary
`private static long` | `serialVersionUID` Serialization ID

Constructor Summary
`AbstractKeyBackend(SwordBookMetaData sbmd)` Simple 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 false if the receiver is a leaf node and can not have children.
`void` | `clear()` Removes all of the elements from this set (optional operation).
`AbstractKeyBackend<T>` | `clone()` This needs to be declared here so that it is visible as a method on a derived Key.
`int` | `compareTo(Key that)`
`boolean` | `contains(Key key)` Determine whether this Book contains the key in question
`boolean` | `equals(Object obj)` This needs to be declared here so that it is visible as a method on a derived Key.
`int` | `getChildCount()` Returns the number of children that this node has.
`String` | `getName()` A Human readable version of the Key.
`String` | `getName(Key base)` Translate the Key into a human readable string, with the assumption that the specified Key has just been output, so if we are in the same region, we do not need to display the region name, and so on.
`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.
`String` | `getRootName()` A Human readable version of the Key's top level name.
`int` | `hashCode()` This needs to be declared here so that it is visible as a method on a derived Key.
`boolean` | `isEmpty()` Does this Key have 0 members
`Iterator<Key>` | `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.
`void` | `setAliasKey(T state, Key alias, Key source)` Sets alias for a comment on a verse range I.e.
`void` | `setRawText(T state, Key key, String text)` Set the text allotted for the given verse

Methods inherited from class org.crosswire.jsword.book.sword.AbstractBackend
`create, decipher, encipher, getBookMetaData, getGlobalKeyList, getRawText, getRawTextLength, isSupported, isWritable, readIndex, readToOsis, setAliasKey`

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

Methods inherited from interface org.crosswire.jsword.passage.Key
`get, getCardinality, indexOf`

Methods inherited from interface org.crosswire.jsword.book.sword.StatefulFileBackedBackend
`initState, readRawContent`

Field Detail

### serialVersionUID

    private static final long serialVersionUID

  Serialization ID

  See Also:
    Constant Field Values

Constructor Detail

### AbstractKeyBackend

    public AbstractKeyBackend(SwordBookMetaData sbmd)

  Simple ctor

  Parameters:
    `sbmd` - the book's metadata

Method Detail

### canHaveChildren

    public boolean canHaveChildren()

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

  Specified by:
    `canHaveChildren` in interface `Key`
  Returns:
    true if the key can have children

### getChildCount

    public int getChildCount()

  Description copied from interface: `Key`
  Returns the number of children that this node has. Leaf nodes return 0.

  Specified by:
    `getChildCount` in interface `Key`
  Returns:
    the number of children for the node

### isEmpty

    public boolean isEmpty()

  Description copied from interface: `Key`
  Does this Key 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: `Backend`
  Determine whether this Book contains the key in question

  Specified by:
    `contains` in interface `Backend<T extends OpenFileState>`
  Specified by:
    `contains` in interface `Key`
  Specified by:
    `contains` in class `AbstractBackend<T extends OpenFileState>`
  Parameters:
    `key` - The key whose presence is desired.
  Returns:
    true if the Book contains the key

### iterator

    public Iterator<Key> iterator()

  Specified by:
    `iterator` in interface `Iterable<Key>`

### 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.

### 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`

### setAliasKey

    public void setAliasKey(T state,
                            Key alias,
                            Key source)
                     throws IOException

  Description copied from interface: `StatefulFileBackedBackend`
  Sets alias for a comment on a verse range I.e. setRawText() was for verse range Gen.1.1-3 then setAliasKey should be called for Gen.1.1.2 and Gen.1.1.3

  Specified by:
    `setAliasKey` in interface `StatefulFileBackedBackend<T extends OpenFileState>`
  Parameters:
    `state` - the open file state
    `alias` - Alias Key
    `source` - Source Key
  Throws:
    `IOException` - Exception when anything goes wrong on writing the alias

### setRawText

    public void setRawText(T state,
                           Key key,
                           String text)
                    throws BookException,
                           IOException

  Description copied from interface: `StatefulFileBackedBackend`
  Set the text allotted for the given verse

  Specified by:
    `setRawText` in interface `StatefulFileBackedBackend<T extends OpenFileState>`
  Parameters:
    `state` - TODO
    `key` - The key to set text to
    `text` - The text to be set for key
  Throws:
    `BookException` - If the data can not be set.
    `IOException` - If the module data path could not be created.

### 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.

### clone

    public AbstractKeyBackend<T> 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

### 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, for example "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

### getName

    public String getName(Key base)

  Description copied from interface: `Key`
  Translate the Key into a human readable string, with the assumption that the specified Key has just been output, so if we are in the same region, we do not need to display the region name, and so on.

  Specified by:
    `getName` in interface `Key`
  Parameters:
    `base` - The key to use to cut down unnecessary output.
  Returns:
    The string representation

### 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

### 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

### getRootName

    public String getRootName()

  Description copied from interface: `Key`
  A Human readable version of the Key's top level name. For Biblical passages this uses short books names. For a dictionary it might return A-Z.

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

### 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.

### equals

    public boolean equals(Object obj)

  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:
    `equals` in interface `Key`
  Overrides:
    `equals` in class `Object`
  Returns:
    true if equal

### hashCode

    public int hashCode()

  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:
    `hashCode` in interface `Key`
  Overrides:
    `hashCode` in class `Object`
  Returns:
    the hashcode

### compareTo

    public int compareTo(Key that)

  Specified by:
    `compareTo` in interface `Comparable<Key>`

### 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`

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