public class SwordGenBook extends AbstractBook
The GNU Lesser General Public License for details.
Modifier and Type | Field and Description |
---|---|
private boolean |
active
Are we active
|
protected SourceFilter |
filter
The filter to use to convert to OSIS.
|
private Key |
global
The global key list
|
private Map<String,Key> |
map
So we can quickly find a Key given the text for the key
|
private Key |
set
So we can implement getIndex() easily
|
Modifier | Constructor and Description |
---|---|
protected |
SwordGenBook(SwordBookMetaData sbmd,
Backend backend)
Construct an SwordGenBook given the BookMetaData and the AbstractBackend.
|
Modifier and Type | Method and Description |
---|---|
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
|
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.
|
void |
deactivate(Lock lock)
Called to indicate that the Book should release whatever system resources
it can to make way for other uses.
|
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.
|
List<org.jdom2.Content> |
getOsis(Key key,
RawTextToXmlProcessor processor) |
Iterator<org.jdom2.Content> |
getOsisIterator(Key key,
boolean allowEmpty,
boolean allowGenTitle)
Return an iterator that returns each key's OSIS in turn.
|
String |
getRawText(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.
|
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.
|
addIndexStatusListener, compareTo, equals, find, find, firePropertyChange, getAbbreviation, getBackend, getBook, getBookCategory, getBookMetaData, getDriver, getDriverName, getIndexStatus, getInitials, getLanguage, getName, getOsisID, getProperty, getPropertyKeys, getScope, getUnlockKey, hasFeature, hashCode, isEnciphered, isLeftToRight, isLocked, isQuestionable, isSupported, match, putProperty, putProperty, removeIndexStatusListener, setBookMetaData, setIndexStatus, toOSIS, toString, unlock
private Key global
private boolean active
private Key set
protected SourceFilter filter
protected SwordGenBook(SwordBookMetaData sbmd, Backend backend)
sbmd
- the metadata that describes the bookbackend
- the means by which the resource is accessedpublic final void activate(Lock lock)
Activatable
activate
in interface Activatable
activate
in class AbstractBook
lock
- An attempt to ensure that only the Activator calls this methodpublic final void deactivate(Lock lock)
Activatable
deactivate
in interface Activatable
deactivate
in class AbstractBook
lock
- An attempt to ensure that only the Activator calls this methodpublic Iterator<org.jdom2.Content> getOsisIterator(Key key, boolean allowEmpty, boolean allowGenTitle) throws BookException
Book
key
- the Items to locateallowEmpty
- indicates whether empty keys should be present.allowGenTitle
- indicates whether to generate titlesBookException
- If anything goes wrong with this methodpublic String getRawText(Key key) throws BookException
Book
key
- The item to locateBookException
- If anything goes wrong with this methodpublic boolean contains(Key key)
Book
key
- element whose presence in this book is to be tested.public List<org.jdom2.Content> getOsis(Key key, RawTextToXmlProcessor processor) throws BookException
getOsis
in class AbstractBook
BookException
public boolean isWritable()
Book
public void setRawText(Key key, String rawData) throws BookException
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.
alias
- the key that aliases anothersource
- the key that holds the textBookException
- If anything goes wrong with this methodpublic Key getGlobalKeyList()
Book
public Key getValidKey(String name)
Book
name
- The string to translate into a Keypublic Key getKey(String text) throws NoSuchKeyException
Book
text
- The string to translate into a KeyNoSuchKeyException
- If the name can not be parsed.public Key createEmptyKeyList()
Book
private void checkActive()