|
||||||||||
| 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 PassageKeyFactory |
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(Versification v11n)
|
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. |
(package private) static Passage |
fromBinaryRepresentation(byte[] buffer)
Write out the object to the given ObjectOutputStream |
static int |
getDefaultPassage()
Get the default reference type. |
Key |
getGlobalKeyList(Versification v11n)
|
Key |
getKey(Versification v11n,
String name)
|
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(Versification v11n,
String name)
|
static PassageKeyFactory |
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 |
(package private) 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 PassageType defaultType
private static PassageKeyFactory keyf
private static Passage whole
| Constructor Detail |
|---|
private PassageKeyFactory()
| Method Detail |
|---|
public static PassageKeyFactory instance()
public Key createEmptyKeyList(Versification v11n)
public Key getValidKey(Versification v11n,
String name)
public Key getKey(Versification v11n,
String name)
throws NoSuchKeyException
NoSuchKeyExceptionpublic Key getGlobalKeyList(Versification v11n)
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
static byte[] toBinaryRepresentation(Passage ref)
ref - The Passage to convert
static Passage fromBinaryRepresentation(byte[] buffer)
throws NoSuchVerseException
buffer - The stream to read our state from
NoSuchVerseException - If the buffer is invalid
public static Passage readPassage(Reader in)
throws IOException,
NoSuchVerseException
in - The stream to read from
IOException - If there was trouble 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 number of bytes to read
private String mungOsisRef(String name)
name -
private String normalize(String name)
name -
|
Copyright ? 2003-2011 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||