|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.crosswire.jsword.passage.PassageKeyFactory
public class PassageKeyFactory
An implementation of KeyFactory that works for most Bibles that contain all the verses in the Bible.
|
Distribution Licence: JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors. |
Licence| Field Summary | |
|---|---|
private static int |
defaultType
The default type |
private static KeyFactory |
keyf
How we create Passages |
static int |
MIX
Optimize the Passage for a mix |
static int |
SIZE
Optimize the Passage for size |
static int |
SPEED
Optimize the Passage for speed |
static int |
TALLY
Optimize the Passage for tally operations |
private static Passage |
whole
The cached whole Bible passage |
static int |
WRITE_SPEED
Optimize the Passage for speed |
| 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 Passage |
createPassage()
Create an empty Passage using the default type. |
protected Passage |
createPassage(int type)
Create an empty Passage using a specified type. |
protected Passage |
createPassage(int type,
String name)
Create an empty Passage using a specified type. |
protected Passage |
createPassage(String name)
Create an empty Passage using the default type. |
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. |
static KeyFactory |
instance()
|
static Passage |
readPassage(Reader in)
Read a passage from a given stream |
static void |
setDefaultPassage(int defaultType)
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 |
|---|
public static final int SPEED
public static final int WRITE_SPEED
public static final int SIZE
public static final int MIX
public static final int TALLY
private static KeyFactory keyf
private static Passage whole
private static int defaultType
| Constructor Detail |
|---|
private PassageKeyFactory()
| Method Detail |
|---|
public static KeyFactory instance()
public Key createEmptyKeyList()
KeyFactory
createEmptyKeyList in interface KeyFactory
public Key getKey(String name)
throws NoSuchKeyException
KeyFactory
getKey in interface KeyFactoryname - The string to translate into a Key
NoSuchKeyException - If the name can not be parsed.public Key getGlobalKeyList()
KeyFactory
getGlobalKeyList in interface KeyFactoryprotected Passage createPassage()
protected Passage createPassage(String name)
throws NoSuchVerseException
name - The Passage description.
NoSuchVerseException - if the name is invalidprotected Passage createPassage(int type)
type - The type of Passage to create.
setDefaultPassage(int)
protected Passage createPassage(int type,
String name)
throws NoSuchVerseException
type - The type of Passage to create.name - The Passage description.
NoSuchVerseException - if the name is invalidsetDefaultPassage(int)public static void setDefaultPassage(int defaultType)
defaultType - 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 invalid
public 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
|
Copyright ? 2003-2004 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||