|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.passage.AccuracyType
public abstract class AccuracyType
Types of Accuracy for verse references. For example:
It may be found in a verse range like: Gen 1:2 - 10. In this case the context of 10 is Gen 1:2, which is BOOK_VERSE. So in this case, 10 is VERSE_ONLY.
If it is at the beginning of a range like 10 - 22:3, it has to have more context. If the context is a prior entry like Gen 2:5, 10 - 22:3, then its context is Gen 2:5, which is BOOK_VERSE and 10 is VERSE_ONLY.
However if it is Gen 2, 10 - 22:3 then the context is Gen 2, BOOK_CHAPTER so 10 is understood as BOOK_CHAPTER.
As a special case, if the preceeding range is an entire chapter or book then 10 would understood as CHAPTER_ONLY or BOOK_ONLY (respectively)
If the number has no preceeding context, then it is understood as being BOOK_ONLY.
In all of these examples, the start verse was being interpreted. In the case of a verse that is the end of a range, it is interpreted in the context of the range's start.
for license details.
The copyright to this program is held by it's authors.
,
Serialized FormField Summary | |
---|---|
static AccuracyType |
BOOK_CHAPTER
The passage was specified to a book and chapter (no verse). |
static AccuracyType |
BOOK_ONLY
The passage was specified to a book only (no chapter or verse). |
static AccuracyType |
BOOK_VERSE
The verse was specified as book, chapter and verse. |
static AccuracyType |
CHAPTER_ONLY
There was only a chapter number |
static AccuracyType |
CHAPTER_VERSE
The passage was specified to a chapter and verse (no book). |
private String |
name
The name of the object |
private static int |
nextObj
|
private int |
obj
|
private static AccuracyType[] |
VALUES
|
static String |
VERSE_ALLOWED_DELIMS
What characters can we use to separate parts to a verse |
static String |
VERSE_END_MARK1
Characters that are used to indicate end of verse/chapter, part 1 |
static String |
VERSE_END_MARK2
Characters that are used to indicate end of verse/chapter, part 2 |
static AccuracyType |
VERSE_ONLY
There was only a verse number |
Constructor Summary | |
---|---|
AccuracyType(String name)
Simple ctor |
Method Summary | |
---|---|
private static void |
checkValidChapterOrVerse(String text)
Is this text valid in a chapter/verse context |
abstract Verse |
createEndVerse(String endVerseDesc,
Verse verseBasis,
String[] endParts)
|
abstract Verse |
createStartVerse(String original,
VerseRange verseRangeBasis,
String[] parts)
|
boolean |
equals(Object o)
Prevent subclasses from overriding canonical identity based Object methods |
static AccuracyType |
fromInteger(int i)
Lookup method to convert from an integer |
static AccuracyType |
fromString(String name)
Lookup method to convert from a String |
static AccuracyType |
fromText(String original,
String[] parts)
Determine how closely the string defines a verse. |
static AccuracyType |
fromText(String original,
String[] parts,
AccuracyType verseAccuracy)
|
static AccuracyType |
fromText(String original,
String[] parts,
AccuracyType verseAccuracy,
VerseRange basis)
Does this string exactly define a Verse. |
static AccuracyType |
fromText(String original,
String[] parts,
VerseRange basis)
|
static int |
getChapter(int lbook,
String chapter)
Interprets the chapter value, which is either a number or "ff" or "$" (meaning "what follows") |
static int |
getVerse(int lbook,
int lchapter,
String verse)
Interprets the verse value, which is either a number or "ff" or "$" (meaning "what follows") |
int |
hashCode()
Prevent subclasses from overriding canonical identity based Object methods |
boolean |
isBook()
|
boolean |
isChapter()
|
private static boolean |
isEndMarker(String text)
Is this string a legal marker for 'to the end of the chapter' |
boolean |
isVerse()
|
private static int |
parseInt(String text)
This is simply a convenience function to wrap Integer.parseInt() and give us a reasonable exception on failure. |
(package private) Object |
readResolve()
|
int |
toInteger()
Get an integer representation for this RestrictionType |
static String[] |
tokenize(String input)
Take a string representation of a verse and parse it into an Array of Strings where each part is likely to be a verse part. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final AccuracyType BOOK_VERSE
public static final AccuracyType BOOK_CHAPTER
public static final AccuracyType BOOK_ONLY
public static final AccuracyType CHAPTER_VERSE
public static final AccuracyType CHAPTER_ONLY
public static final AccuracyType VERSE_ONLY
public static final String VERSE_ALLOWED_DELIMS
private String name
private static int nextObj
private final int obj
private static final AccuracyType[] VALUES
public static final String VERSE_END_MARK1
public static final String VERSE_END_MARK2
Constructor Detail |
---|
public AccuracyType(String name)
Method Detail |
---|
public abstract Verse createStartVerse(String original, VerseRange verseRangeBasis, String[] parts) throws NoSuchVerseException
original
- the original verse reference as a stringverseRangeBasis
- the range that stood before the string referenceparts
- a tokenized version of the original
Verse
for the original
NoSuchVerseException
public abstract Verse createEndVerse(String endVerseDesc, Verse verseBasis, String[] endParts) throws NoSuchVerseException
endVerseDesc
- the original verse reference as a stringverseBasis
- the verse at the beginning of the rangeendParts
- a tokenized version of the original
Verse
for the original
NoSuchVerseException
public boolean isBook()
public boolean isChapter()
public boolean isVerse()
public static final int getChapter(int lbook, String chapter) throws NoSuchVerseException
lbook
- the integer representation of the bookchapter
- a string representation of the chapter. May be "ff" or "$" for "what follows".
NoSuchVerseException
public static final int getVerse(int lbook, int lchapter, String verse) throws NoSuchVerseException
lbook
- the integer representation of the booklchapter
- the integer representation of the chapterverse
- the string representation of the verse
NoSuchVerseException
public int toInteger()
public static AccuracyType fromText(String original, String[] parts) throws NoSuchVerseException
original
- parts
- is a reference split into parts
NoSuchVerseException
public static AccuracyType fromText(String original, String[] parts, AccuracyType verseAccuracy) throws NoSuchVerseException
original
- parts
- verseAccuracy
-
NoSuchVerseException
public static AccuracyType fromText(String original, String[] parts, VerseRange basis) throws NoSuchVerseException
original
- parts
- basis
-
NoSuchVerseException
public static AccuracyType fromText(String original, String[] parts, AccuracyType verseAccuracy, VerseRange basis) throws NoSuchVerseException
parts
- verseAccuracy
- basis
-
NoSuchVerseException
private static void checkValidChapterOrVerse(String text) throws NoSuchVerseException
text
- The string to test for validity
NoSuchVerseException
- If the text is invalidprivate static int parseInt(String text) throws NoSuchVerseException
text
- The string to be parsed
NoSuchVerseException
- If the reference is illegalprivate static boolean isEndMarker(String text)
text
- The string to be checked
public static String[] tokenize(String input)
Parts can be separated by pretty much anything. No distinction is made between them. While chapter and verse need to be separated, a separator is assumed between digits and non-digits. Adjacent words, (i.e. sequences of non-digits) are understood to be a book reference. If a number runs up against a book name, it is considered to be either part of the book name (i.e. it is before it) or a chapter number (i.e. it stands after it.)
Note: ff and $ are considered to be digits.
Note: it is not necessary for this to be a BCV (book, chapter, verse), it may just be BC, B, C, V or CV. No distinction is needed here for a number that stands alone.
input
- The string to parse.
public static AccuracyType fromString(String name)
name
- the name of the AccuracyType
public static AccuracyType fromInteger(int i)
i
- the i-th AccuracyType
public final boolean equals(Object o)
Object.equals(java.lang.Object)
public final int hashCode()
Object.hashCode()
public String toString()
Object readResolve()
|
Copyright ? 2003-2006 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |