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 SwordBook

    java.lang.Object
      org.crosswire.jsword.book.basic.AbstractBook
          org.crosswire.jsword.book.basic.AbstractPassageBook
              org.crosswire.jsword.book.sword.SwordBook

All Implemented Interfaces:
  Comparable<Book>, Activatable, Book

    public class SwordBook

extends AbstractPassageBook

SwordBook is a base class for all verse based Sword type books.

Author:
  Joe Walker
See Also:
  `The GNU Lesser General Public License for details.`

Field Summary
`private Filter` | `filter` The filter to use to convert to OSIS.
`private Key` | `global` A cached representation of the global key list.
`private static org.slf4j.Logger` | `log` The log stream

Constructor Summary
`SwordBook(SwordBookMetaData sbmd, Backend<?> backend)` Construct an SwordBook given the BookMetaData and the AbstractBackend.

Method Summary
`void` | `addOSIS(Key key, org.jdom2.Element div, List<org.jdom2.Content> osisContent)` Add the OSIS elements to the div element.
`void` | `addOSIS(Key key, List<org.jdom2.Content> contentList, List<org.jdom2.Content> osisContent)` Add the OSIS elements to the content list.
`boolean` | `contains(Key key)` Returns `true` if this book contains the specified element.
`protected Filter` | `getFilter()` What filter should be used to filter data in the format produced by this Book?.
`Key` | `getGlobalKeyList()` Get a complete list of index entries.
`protected List<org.jdom2.Content>` | `getOsis(Key key, RawTextToXmlProcessor processor)`
`String` | `getRawText(Key key)` Returns the raw text that getData(Key key) builds into OSIS.
`Key` | `getScope()` Get a complete list of entries.
`boolean` | `isWritable()` A Book is writable if the file system allows the underlying files to be opened for writing and if the driver for the book allows writing.
`void` | `setAliasKey(Key alias, Key source)` Store an alias of one key to another.
`void` | `setRawText(Key key, String rawData)` Store the raw text for the given key.

Methods inherited from class org.crosswire.jsword.book.basic.AbstractPassageBook
`createEmptyKeyList, getBibleBooks, getKey, getOsisIterator, getValidKey, getVersification, setDocument`

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

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

Field Detail

### filter

    private Filter filter

  The filter to use to convert to OSIS.

### global

    private Key global

  A cached representation of the global key list.

### log

    private static final org.slf4j.Logger log

  The log stream

Constructor Detail

### SwordBook

    public SwordBook(SwordBookMetaData sbmd,
                     Backend<?> backend)

  Construct an SwordBook given the BookMetaData and the AbstractBackend.

  Parameters:
    `sbmd` - the metadata that describes the book
    `backend` - the means by which the resource is accessed

Method Detail

### getGlobalKeyList

    public final Key getGlobalKeyList()

  Description copied from interface: `Book`
  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

### getScope

    public Key getScope()

  Description copied from interface: `Book`
  Get a complete list of entries. Create a Key that encompasses all of the existing entries in the book. For most modules this will be the same as `Book.getGlobalKeyList()`, however for a Bible, it will get the references that are actually in the book.

  Specified by:
    `getScope` in interface `Book`
  Overrides:
    `getScope` in class `AbstractBook`
  Returns:
    A Key that includes all of the existing Keys

### contains

    public boolean contains(Key key)

  Description copied from interface: `Book`
  Returns `true` if this book contains the specified element.

  Parameters:
    `key` - element whose presence in this book is to be tested.
  Returns:
    `true` if this book contains the specified element.

### getRawText

    public String getRawText(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

### getOsis

    protected List<org.jdom2.Content> getOsis(Key key,
                                              RawTextToXmlProcessor processor)
                                       throws BookException

  Specified by:
    `getOsis` in class `AbstractBook`
  Throws:
    `BookException`

### addOSIS

    public void addOSIS(Key key,
                        org.jdom2.Element div,
                        List<org.jdom2.Content> osisContent)

  Description copied from class: `AbstractPassageBook`
  Add the OSIS elements to the div element. Note, this assumes that the data is fully marked up.

  Overrides:
    `addOSIS` in class `AbstractPassageBook`
  Parameters:
    `key` - The key being added
    `div` - The div element to which the key's OSIS representation is being added
    `osisContent` - The OSIS representation of the key being added.

### addOSIS

    public void addOSIS(Key key,
                        List<org.jdom2.Content> contentList,
                        List<org.jdom2.Content> osisContent)

  Description copied from class: `AbstractPassageBook`
  Add the OSIS elements to the content list. Note, this assumes that the data is fully marked up.

  Overrides:
    `addOSIS` in class `AbstractPassageBook`
  Parameters:
    `key` - The key being added
    `contentList` - The list to which the key's OSIS representation is being added
    `osisContent` - The OSIS representation of the key being added.

### isWritable

    public boolean isWritable()

  Description copied from interface: `Book`
  A Book is writable if the file system allows the underlying files to be opened for writing and if the driver for the book allows writing. Ultimately, all drivers should allow writing. At this time writing is not supported by drivers, so abstract implementations should return false and let specific implementations return true otherwise.

  Specified by:
    `isWritable` in interface `Book`
  Overrides:
    `isWritable` in class `AbstractPassageBook`
  Returns:
    true if the book is writable

### setRawText

    public void setRawText(Key key,
                           String rawData)
                    throws BookException

  Description copied from interface: `Book`
  Store the raw text for the given key. This will replace/hide any raw text that already is present. Note: it is the responsibility of the calling program to ensure that the raw text matches the character set encoding and markup of the module.

  Parameters:
    `key` - The item to locate
    `rawData` - The text to store
  Throws:
    `BookException` - If anything goes wrong with this method

### setAliasKey

    public void setAliasKey(Key alias,
                            Key source)
                     throws BookException

  Description copied from interface: `Book`
  Store an alias of one key to another. Some Bibles do not have a verse by verse numbering system but rather meld several verses into one. Thus, any verse in the range refers to the same verse. Also it may apply to biblical commentaries that are indexed by Book, Chapter, Verse and that discuss the Bible at a verse range level. For a dictionary, it may be used for synonyms.

  It should be an exception to set an alias when that alias already has raw text. Also, it should be an exception to set an alias to an alias. However, getRawText(Key) must be able to handle alias chains.

  Parameters:
    `alias` - the key that aliases another
    `source` - the key that holds the text
  Throws:
    `BookException` - If anything goes wrong with this method

### getFilter

    protected Filter getFilter()

  Description copied from class: `AbstractPassageBook`
  What filter should be used to filter data in the format produced by this Book?. In some ways this method is more suited to BookMetaData however we do not have a specialization of BookMetaData to fit AbstractPassageBook and it doesn't like any higher in the hierarchy at the moment so I will leave this here.

  Specified by:
    `getFilter` in class `AbstractPassageBook`

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