public enum AccuracyType extends Enum<AccuracyType>
With the last one, you will note that there is a choice. By itself there is not enough information to determine which one it is. There has to be a context in which it is used.
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.
The GNU Lesser General Public License for details.
Enum Constant and Description |
---|
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
|
Modifier and Type | Field and Description |
---|---|
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
|
Modifier and Type | Method and Description |
---|---|
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,
Verse verseBasis,
String[] endParts) |
abstract Verse |
createStartVerse(Versification v11n,
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")
|
protected static String |
getSubIdentifier(String[] parts) |
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")
|
private static boolean |
hasSubIdentifier(String[] parts) |
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 AccuracyType
|
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.
|
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
public static final String VERSE_END_MARK1
public static final String VERSE_END_MARK2
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 nameNullPointerException
- if the argument is nullpublic abstract Verse createStartVerse(Versification v11n, VerseRange verseRangeBasis, String[] parts) throws NoSuchVerseException
v11n
- the versification to which this reference pertainsverseRangeBasis
- the range that stood before the string referenceparts
- a tokenized version of the originalVerse
for the originalNoSuchVerseException
public abstract Verse createEndVerse(Versification v11n, Verse verseBasis, String[] endParts) throws NoSuchVerseException
v11n
- the versification to which this reference pertainsverseBasis
- the verse at the beginning of the rangeendParts
- a tokenized version of the originalVerse
for the originalNoSuchVerseException
public boolean isBook()
public boolean isChapter()
public boolean isVerse()
public static final int getChapter(Versification v11n, BibleBook lbook, String chapter) throws NoSuchVerseException
v11n
- the versification to which this reference pertainslbook
- 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
v11n
- the versification to which this reference pertainslbook
- the integer representation of the booklchapter
- the integer representation of the chapterverse
- the string representation of the verseNoSuchVerseException
public int toInteger()
public static AccuracyType fromText(Versification v11n, String original, String[] parts) throws NoSuchVerseException
v11n
- the versification to which this reference pertainsoriginal
- parts
- is a reference split into partsNoSuchVerseException
public static AccuracyType fromText(Versification v11n, String original, String[] parts, AccuracyType verseAccuracy) throws NoSuchVerseException
v11n
- the versification to which this reference pertainsoriginal
- parts
- verseAccuracy
- NoSuchVerseException
public static AccuracyType fromText(Versification v11n, String original, String[] parts, VerseRange basis) throws NoSuchVerseException
v11n
- the versification to which this reference pertainsoriginal
- parts
- basis
- NoSuchVerseException
public static AccuracyType fromText(Versification v11n, String original, String[] parts, AccuracyType verseAccuracy, VerseRange basis) throws NoSuchVerseException
v11n
- the versification to which this reference pertainsoriginal
- 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 validityNoSuchVerseException
- If the text is invalidprivate static int parseInt(String text) throws NoSuchVerseException
text
- The string to be parsedNoSuchVerseException
- If the reference is illegalprivate static boolean isEndMarker(String text)
text
- The string to be checkedprivate static boolean hasSubIdentifier(String[] parts)
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