|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.passage.PassageKeyFactory
public final class PassageKeyFactory
An implementation of KeyFactory that works for most Bibles that contain all the verses in the Bible.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
private static PassageType |
defaultType
The default type |
private static KeyFactory |
keyf
How we create Passages |
private static Passage |
whole
The cached whole Bible passage |
Constructor Summary | |
---|---|
private |
PassageKeyFactory()
This class implements a Singleton pattern. |
Method Summary | |
---|---|
protected static int |
binarySize(int max)
Write to buffer (starting at index) the given number using a set of bytes as required by the max possible value for the number |
Key |
createEmptyKeyList()
Fetch an empty Key to which we can add Keys. |
protected static int |
fromBinary(byte[] buffer,
int[] index,
int max)
Read and return an int from the buffer (starting at index[0]) using a set of bytes as required by the max possible value for the number, and incrementing index[0] by that number of bytes. |
static Passage |
fromBinaryRepresentation(byte[] buffer)
Write out the object to the given ObjectOutputStream |
static int |
getDefaultPassage()
Get the default reference type. |
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. |
static Passage |
getReadOnlyPassage(Passage ref,
boolean ignore)
Get a new Passage based on another Passage that synchronizes all access to its members. |
static Passage |
getSynchronizedPassage(Passage ref)
Get a new Passage based on another Passage that synchronizes all access to its members. |
Key |
getValidKey(String name)
Get a Key for the name, if possible. |
static KeyFactory |
instance()
|
private String |
mungOsisRef(String name)
Replace spaces with semi-colons, because the parser expects them. |
private String |
normalize(String name)
The internals of a Passage require that references are separated with a reference delimiter. |
static Passage |
readPassage(Reader in)
Read a passage from a given stream |
static void |
setDefaultPassage(int newDefaultType)
Set the default reference type. |
protected static int |
toBinary(byte[] buffer,
int index,
int number,
int max)
Write to buffer (starting at index) the given number using a set of bytes as required by the max possible value for the number |
static byte[] |
toBinaryRepresentation(Passage ref)
Convert us to a binary representation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static KeyFactory keyf
private static Passage whole
private static PassageType defaultType
Constructor Detail |
---|
private PassageKeyFactory()
Method Detail |
---|
public static KeyFactory instance()
public Key createEmptyKeyList()
KeyFactory
createEmptyKeyList
in interface KeyFactory
public Key getValidKey(String name)
KeyFactory
getValidKey
in interface KeyFactory
public Key getKey(String name) throws NoSuchKeyException
KeyFactory
getKey
in interface KeyFactory
name
- The string to translate into a Key
NoSuchKeyException
- If the name can not be parsed.public Key getGlobalKeyList()
KeyFactory
getGlobalKeyList
in interface KeyFactory
public static void setDefaultPassage(int newDefaultType)
newDefaultType
- The new default type.public static int getDefaultPassage()
setDefaultPassage(int)
public static Passage getSynchronizedPassage(Passage ref)
ref
- The passage to synchronize
public static Passage getReadOnlyPassage(Passage ref, boolean ignore)
ref
- The passage to synchronizeignore
- Do we throw up if someone tries to change us
public static byte[] toBinaryRepresentation(Passage ref)
ref
- The Passage to convert
public static Passage fromBinaryRepresentation(byte[] buffer) throws NoSuchVerseException
buffer
- The stream to read our state from
NoSuchVerseException
- If the buffer is invalidpublic static Passage readPassage(Reader in) throws IOException, NoSuchVerseException
in
- The stream to read from
IOException
- If there was troule reading the stream
NoSuchVerseException
- if the data was not a valid passageprotected static int binarySize(int max)
max
- The number to write
protected static int toBinary(byte[] buffer, int index, int number, int max)
buffer
- Where to write toindex
- The offset to start atnumber
- The number to writemax
- The max size
protected static int fromBinary(byte[] buffer, int[] index, int max)
buffer
- The buffer to read fromindex
- The offset to start atmax
- The max nuber of bytes to read
private String mungOsisRef(String name)
name
-
private String normalize(String name)
name
-
|
Copyright ยจ 2003-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |