public class ReadingsBook extends AbstractBook implements PreferredKey
The GNU Lesser General Public License for details.
Modifier and Type | Field and Description |
---|---|
private Key |
global
The global key list
|
private Map<Key,String> |
hash
The store of keys and data
|
private static org.slf4j.Logger |
log
The log stream
|
Constructor and Description |
---|
ReadingsBook(ReadingsBookDriver driver,
String setname,
BookCategory type)
Constructor for ReadingsBook.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Key key)
Returns true if this book contains the specified element.
|
Key |
createEmptyKeyList()
Fetch an empty Key to which we can add Keys.
|
Key |
getGlobalKeyList()
Get a complete list of index entries.
|
Key |
getKey(String name)
Someone has typed in a reference to find, but we need a Key to actually
look it up.
|
List<org.jdom2.Content> |
getOsis(Key key,
RawTextToXmlProcessor processor)
Returns an empty list
|
Iterator<org.jdom2.Content> |
getOsisIterator(Key key,
boolean allowEmpty,
boolean allowGenTitles)
Return an iterator that returns each key's OSIS in turn.
|
Key |
getPreferred()
What Key would this object like us to use?
|
String |
getRawText(Key key)
Returns an empty string
(non-Javadoc)
|
Key |
getValidKey(String name)
Get a Key for the name, if possible.
|
boolean |
hasFeature(FeatureType feature)
Return whether the feature is supported by the book.
|
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.
|
activate, addIndexStatusListener, compareTo, deactivate, equals, find, find, firePropertyChange, getAbbreviation, getBackend, getBook, getBookCategory, getBookMetaData, getDriver, getDriverName, getIndexStatus, getInitials, getLanguage, getName, getOsisID, getProperty, getPropertyKeys, getScope, getUnlockKey, hashCode, isEnciphered, isLeftToRight, isLocked, isQuestionable, isSupported, match, putProperty, putProperty, removeIndexStatusListener, setBookMetaData, setIndexStatus, toOSIS, toString, unlock
private Key global
private static final org.slf4j.Logger log
public ReadingsBook(ReadingsBookDriver driver, String setname, BookCategory type)
driver
- the driver for this booksetname
- the name of this booktype
- the type of bookpublic Key getPreferred()
PreferredKey
getPreferred
in interface PreferredKey
public Iterator<org.jdom2.Content> getOsisIterator(Key key, boolean allowEmpty, boolean allowGenTitles) throws BookException
Book
getOsisIterator
in interface Book
key
- the Items to locateallowEmpty
- indicates whether empty keys should be present.allowGenTitles
- indicates whether to generate titlesBookException
- If anything goes wrong with this methodpublic boolean contains(Key key)
Book
public String getRawText(Key key) throws BookException
getRawText
in interface Book
key
- The item to locateBookException
- If anything goes wrong with this methodBook.getRawText(org.crosswire.jsword.passage.Key)
public List<org.jdom2.Content> getOsis(Key key, RawTextToXmlProcessor processor) throws BookException
getOsis
in class AbstractBook
BookException
public boolean isWritable()
Book
isWritable
in interface Book
public void setRawText(Key key, String rawData) throws BookException
Book
setRawText
in interface Book
key
- The item to locaterawData
- The text to storeBookException
- If anything goes wrong with this methodpublic void setAliasKey(Key alias, Key source) throws BookException
Book
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.
setAliasKey
in interface Book
alias
- the key that aliases anothersource
- the key that holds the textBookException
- If anything goes wrong with this methodpublic Key getValidKey(String name)
Book
getValidKey
in interface Book
name
- The string to translate into a Keypublic Key getKey(String name) throws NoSuchKeyException
Book
getKey
in interface Book
name
- The string to translate into a KeyNoSuchKeyException
- If the name can not be parsed.public Key getGlobalKeyList()
Book
getGlobalKeyList
in interface Book
public Key createEmptyKeyList()
Book
createEmptyKeyList
in interface Book
public boolean hasFeature(FeatureType feature)
Book
hasFeature
in interface Book
hasFeature
in class AbstractBook
feature
- the type of the Feature to check