|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<AccuracyType>
org.crosswire.jsword.passage.AccuracyType
public enum 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 preceding range is an entire chapter or book then 10 would understood as CHAPTER_ONLY or BOOK_ONLY (respectively)
If the number has no preceding 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.
Enum Constant Summary | |
---|---|
BOOK_CHAPTER
The passage was specified to a book and chapter (no verse). |
|
BOOK_ONLY
The passage was specified to a book only (no chapter or verse). |
|
BOOK_VERSE
The verse was specified as book, chapter and verse. |
|
CHAPTER_ONLY
There was only a chapter number |
|
CHAPTER_VERSE
The passage was specified to a chapter and verse (no book). |
|
VERSE_ONLY
There was only a verse number |
Field Summary | |
---|---|
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 |
Method Summary | |
---|---|
private static NoSuchVerseException |
buildVersePartsException(String original,
String[] parts)
|
private static void |
checkValidChapterOrVerse(String text)
Is this text valid in a chapter/verse context |
abstract Verse |
createEndVerse(Versification v11n,
String endVerseDesc,
Verse verseBasis,
String[] endParts)
|
abstract Verse |
createStartVerse(Versification v11n,
String original,
VerseRange verseRangeBasis,
String[] parts)
|
static AccuracyType |
fromText(Versification v11n,
String original,
String[] parts)
Determine how closely the string defines a verse. |
static AccuracyType |
fromText(Versification v11n,
String original,
String[] parts,
AccuracyType verseAccuracy)
|
static AccuracyType |
fromText(Versification v11n,
String original,
String[] parts,
AccuracyType verseAccuracy,
VerseRange basis)
Does this string exactly define a Verse. |
static AccuracyType |
fromText(Versification v11n,
String original,
String[] parts,
VerseRange basis)
|
static int |
getChapter(Versification v11n,
BibleBook lbook,
String chapter)
Interprets the chapter value, which is either a number or "ff" or "$" (meaning "what follows") |
static int |
getVerse(Versification v11n,
BibleBook lbook,
int lchapter,
String verse)
Interprets the verse value, which is either a number or "ff" or "$" (meaning "what follows") |
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. |
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. |
static AccuracyType |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static AccuracyType[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant 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
Field Detail |
---|
public static final String VERSE_ALLOWED_DELIMS
public static final String VERSE_END_MARK1
public static final String VERSE_END_MARK2
Method Detail |
---|
public static AccuracyType[] values()
for (AccuracyType c : AccuracyType.values()) System.out.println(c);
public static AccuracyType valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic abstract Verse createStartVerse(Versification v11n, 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(Versification v11n, 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(Versification v11n, BibleBook lbook, String chapter) throws NoSuchVerseException
lbook
- the bookchapter
- a string representation of the chapter. May be "ff" or "$" for
"what follows".
NoSuchVerseException
public static final int getVerse(Versification v11n, BibleBook 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(Versification v11n, String original, String[] parts) throws NoSuchVerseException
original
- parts
- is a reference split into parts
NoSuchVerseException
public static AccuracyType fromText(Versification v11n, String original, String[] parts, AccuracyType verseAccuracy) throws NoSuchVerseException
original
- parts
- verseAccuracy
-
NoSuchVerseException
public static AccuracyType fromText(Versification v11n, String original, String[] parts, VerseRange basis) throws NoSuchVerseException
original
- parts
- basis
-
NoSuchVerseException
public static AccuracyType fromText(Versification v11n, String original, String[] parts, AccuracyType verseAccuracy, VerseRange basis) throws NoSuchVerseException
parts
- verseAccuracy
- basis
-
NoSuchVerseException
private static NoSuchVerseException buildVersePartsException(String original, String[] parts)
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) throws NoSuchVerseException
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.
NoSuchVerseException
|
Copyright ? 2003-2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |