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 SwordGenBook

    java.lang.Object
      org.crosswire.jsword.book.basic.AbstractBook
          org.crosswire.jsword.book.sword.SwordGenBook

All Implemented Interfaces:
  Comparable, Activatable, Book, KeyFactory

    public class SwordGenBook

extends AbstractBook

A Sword version of Dictionary.

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 boolean` | `active` Are we active
`private AbstractBackend` | `backend` To read the data from the disk
`private Key` | `global` The global key list
`private Map` | `map` So we can quickly find a Key given the text for the key
`private SwordBookMetaData` | `sbmd` The Sword configuration file
`private Key` | `set` So we can implement getIndex() easily

Constructor Summary
`protected` | `SwordGenBook(SwordBookMetaData sbmd, AbstractBackend backend)` Start and to as much checking as we can without using memory.

Method Summary
`void` | `activate(Lock lock)` Called to indicate that the Book should initialize itself, and consume whatever system resources it needs to be able to respond to other queries.
`private void` | `checkActive()` Helper method so we can quickly activate ourselves on access
`Key` | `createEmptyKeyList()` Fetch an empty Key to which we can add Keys.
`void` | `deactivate(Lock lock)` Called to indicate that the Book should release whatever system resources it can to make way for other uses.
`BookData` | `getData(Key key)` Retrieval: Add to the given document some mark-up for the specified Verses.
`Key` | `getGlobalKeyList()` Get a complete list of index entries.
`Key` | `getKey(String text)` Someone has typed in a reference to find, but we need a Key to actually look it up.
`String` | `getRawData(Key key)` Returns the raw text that getData(Key key) builds into OSIS.
`Key` | `getValidKey(String name)` Get a Key for the name, if possible.

Methods inherited from class org.crosswire.jsword.book.basic.AbstractBook
`addIndexStatusListener, compareTo, equals, find, find, firePropertyChange, getBook, getBookCategory, getBookMetaData, getDriver, getDriverName, getFullName, getIndexStatus, getInitials, getLanguage, getName, getOsisID, getProperties, getProperty, getUnlockKey, hasFeature, hashCode, isEnciphered, isLeftToRight, isLocked, isQuestionable, isSupported, putProperty, removeIndexStatusListener, setBookMetaData, setIndexStatus, toOSIS, toString, unlock`

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

Field Detail

### global

    private Key global

  The global key list

### active

    private boolean active

  Are we active

### map

    private Map map

  So we can quickly find a Key given the text for the key

### set

    private Key set

  So we can implement getIndex() easily

### backend

    private AbstractBackend backend

  To read the data from the disk

### sbmd

    private SwordBookMetaData sbmd

  The Sword configuration file

Constructor Detail

### SwordGenBook

    protected SwordGenBook(SwordBookMetaData sbmd,
                           AbstractBackend backend)

  Start and to as much checking as we can without using memory. (i.e. actually reading the indexes)

Method Detail

### activate

    public final void activate(Lock lock)

  Description copied from interface: `Activatable`
  Called to indicate that the Book should initialize itself, and consume whatever system resources it needs to be able to respond to other queries.

  Specified by:
    `activate` in interface `Activatable`
  Overrides:
    `activate` in class `AbstractBook`
  Parameters:
    `lock` - An attempt to ensure that only the Activator calls this method

### deactivate

    public final void deactivate(Lock lock)

  Description copied from interface: `Activatable`
  Called to indicate that the Book should release whatever system resources it can to make way for other uses.

  Specified by:
    `deactivate` in interface `Activatable`
  Overrides:
    `deactivate` in class `AbstractBook`
  Parameters:
    `lock` - An attempt to ensure that only the Activator calls this method

### getData

    public BookData getData(Key key)
                     throws BookException

  Description copied from interface: `Book`
  Retrieval: Add to the given document some mark-up for the specified Verses.

  Parameters:
    `key` - The item to locate
  Returns:
    The found Book data
  Throws:
    `BookException` - If anything goes wrong with this method

### getRawData

    public String getRawData(Key key)
                      throws BookException

  Description copied from interface: `Book`
  Returns the raw text that getData(Key key) builds into OSIS.

  Parameters:
    `key` - The item to locate
  Returns:
    The found Book data
  Throws:
    `BookException` - If anything goes wrong with this method

### getGlobalKeyList

    public Key getGlobalKeyList()

  Description copied from interface: `KeyFactory`
  Get a complete list of index entries. Create a Key that encompasses all of the known valid keys for the given context. For a dictionary this will include all of the entries in the dictionary, for a Bible this will probably include all the verses in the Bible, but a commentary may well miss some out.

  Returns:
    A Key that includes all of the known Keys

### getValidKey

    public Key getValidKey(String name)

  Description copied from interface: `KeyFactory`
  Get a Key for the name, if possible. Otherwise return an empty Key.

  Returns:
    a valid key.

### getKey

    public Key getKey(String text)
               throws NoSuchKeyException

  Description copied from interface: `KeyFactory`
  Someone has typed in a reference to find, but we need a Key to actually look it up. So we create a Key from the string if such a translation is possible. The returned Key may be a BranchKey if the string represents more than one Key.

  Parameters:
    `text` - The string to translate into a Key
  Returns:
    The Key corresponding to the input text
  Throws:
    `NoSuchKeyException` - If the name can not be parsed.

### createEmptyKeyList

    public Key createEmptyKeyList()

  Description copied from interface: `KeyFactory`
  Fetch an empty Key to which we can add Keys. Not all implementations of Key are able to hold any type of Key, It isn't reasonable to expect a Key of Bible verses (=Passage) to hold a dictionary Key. So each KeyFactory must be able to create you an empty Key to which you can safely add other Keys it generates.

  Returns:
    An empty Key that can hold other Keys from this factory.

### checkActive

    private void checkActive()

  Helper method so we can quickly activate ourselves on access

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