|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.versification.BibleInfo
public final class BibleInfo
BibleInfo is a static class that deals with Book number conversions and similar. We start counting at 1 for books, chapters and verses (so Genesis=1, Revelation=66). However internally books start counting at 0 and go up to 65.
I've considered merging BibleInfo and PassageUtil since they are both supporting static only classes. However they are both non-trivial, so together they would be large, and there is a good dividing line between the 2.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
private static BibleNames |
bibleNames
Localized BibleNames |
static int |
BOOK
Used for methods with int[3] parameters, for the book |
private static CaseType |
bookCase
How the book names are reported. |
private static int |
BOOKS_IN_BIBLE
Constant for the number of books in the Bible |
(package private) static short[] |
BOOKS_IN_SECTION
The number of books in each section |
static int |
CHAPTER
Used for methods with int[3] parameters, for the chapter |
private static int |
CHAPTERS_IN_BIBLE
Constant for the number of chapters in the Bible |
(package private) static short[] |
CHAPTERS_IN_BOOK
Constant for the number of chapters in each book |
private static BibleNames |
englishBibleNames
English BibleNames, or null when using the program's default locale |
private static boolean |
fullBookName
Whether long or short, full or abbreviated names are used. |
(package private) static BibleInfo |
instance
A singleton used to do initialization. |
(package private) static short[] |
ORDINAL_AT_START_OF_BOOK
Constant for the ordinal number of the first verse in each book |
(package private) static short[][] |
ORDINAL_AT_START_OF_CHAPTER
Constant for the ordinal number of the first verse in each chapter. |
private static SectionNames |
sectionNames
Localized Bible SectionNames |
static int |
VERSE
Used for methods with int[3] parameters, for the verse |
(package private) static short |
VERSES_IN_BIBLE
Constant for the number of verses in the Bible |
(package private) static short[] |
VERSES_IN_BOOK
Constant for the number of verses in each book |
(package private) static short[][] |
VERSES_IN_CHAPTER
Constant for the number of verses in each chapter |
Constructor Summary | |
---|---|
private |
BibleInfo()
Ensure that we can not be instantiated |
Method Summary | |
---|---|
static int |
booksInBible()
Count the books in the Bible. |
static int |
booksInSection(int section)
How many books are there in each of the above sections |
static int |
chaptersInBible()
Count the chapters in the Bible. |
static int |
chaptersInBook(int book)
Count the chapters in this book. |
private static boolean |
containsLetter(String text)
This is simply a convenience function to wrap Character.isLetter() |
static int[] |
decodeOrdinal(int ordinal)
Where does this verse come in the Bible. |
static String |
getBookName(int book)
Get the preferred name of a book. |
static int |
getBookNumber(String find)
Get number of a book from its name. |
static int |
getCase()
This is only used by config |
static CaseType |
getDefaultCase()
How do we report the names of the books?. |
static String |
getLongBookName(int book)
Get the full name of a book (e.g. |
static String |
getOSISName(int book)
Get the OSIS name for a book. |
static String |
getSectionName(int section)
Get the full name of a book (e.g. |
static String |
getShortBookName(int book)
Get the short name of a book (e.g. |
private static void |
initialize()
Load up the resources for Bible book and section names. |
static boolean |
isBookName(String find)
Is the given string a valid book name. |
static boolean |
isFullBookName()
This is only used by config |
static int[] |
patch(int[] ref)
Fix up these verses so that they are as valid a possible. |
static void |
setCase(CaseType newBookCase)
How do we report the names of the books?. |
static void |
setCase(int bookCase)
This is only used by config. |
static void |
setFullBookName(boolean fullName)
Set whether the name should be full or abbreviated, long or short. |
static void |
validate(int[] ref)
Does the following represent a real verse? |
static void |
validate(int book,
int chapter,
int verse)
Does the following represent a real verse?. |
static int |
verseCount(int[] ref1,
int[] ref2)
How many verses between ref1 and ref2 (inclusive). |
static int |
verseCount(int book1,
int chapter1,
int verse1,
int book2,
int chapter2,
int verse2)
How many verses between ref1 and ref2 (inclusive). |
static int |
verseOrdinal(int[] ref)
Where does this verse come in the Bible. |
static int |
verseOrdinal(int book,
int chapter,
int verse)
Where does this verse come in the Bible. |
static int |
versesInBible()
Count the verses in the Bible. |
static int |
versesInBook(int book)
Count the verses in a book. |
static int |
versesInChapter(int book,
int chapter)
Count the verses in a chapter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static BibleNames bibleNames
private static BibleNames englishBibleNames
private static SectionNames sectionNames
private static CaseType bookCase
private static boolean fullBookName
public static final int BOOK
public static final int CHAPTER
public static final int VERSE
private static final int BOOKS_IN_BIBLE
private static final int CHAPTERS_IN_BIBLE
static final short[] CHAPTERS_IN_BOOK
static final short VERSES_IN_BIBLE
static final short[] VERSES_IN_BOOK
static final short[][] VERSES_IN_CHAPTER
static final short[] ORDINAL_AT_START_OF_BOOK
static final short[][] ORDINAL_AT_START_OF_CHAPTER
static final short[] BOOKS_IN_SECTION
static final BibleInfo instance
Constructor Detail |
---|
private BibleInfo()
Method Detail |
---|
public static void setCase(int bookCase)
bookCase
- The new case to use for reporting book names
IllegalArgumentException
- If the case is not between 0 and 2getCase()
public static int getCase()
setCase(CaseType)
public static void setCase(CaseType newBookCase)
newBookCase
- The new case to use for reporting book names
IllegalArgumentException
- If the case is not between 0 and 2getCase()
public static boolean isFullBookName()
setFullBookName(boolean)
public static void setFullBookName(boolean fullName)
fullName
- The new case to use for reporting book namesisFullBookName()
public static CaseType getDefaultCase()
setCase(int)
public static String getBookName(int book) throws NoSuchVerseException
book
- The book number (1-66)
NoSuchVerseException
- If the book number is not validpublic static String getLongBookName(int book) throws NoSuchVerseException
book
- The book number (1-66)
NoSuchVerseException
- If the book number is not validpublic static String getShortBookName(int book) throws NoSuchVerseException
book
- The book number (1-66)
NoSuchVerseException
- If the book number is not validpublic static String getOSISName(int book) throws NoSuchVerseException
book
- The book number (1-66)
NoSuchVerseException
- If the book number is not validpublic static int getBookNumber(String find)
find
- The string to identify
public static boolean isBookName(String find)
find
- The string to identify
public static int booksInBible()
public static int chaptersInBible()
public static int versesInBible()
public static int chaptersInBook(int book) throws NoSuchVerseException
book
- The book part of the reference.
NoSuchVerseException
- If the book number is not validpublic static int versesInChapter(int book, int chapter) throws NoSuchVerseException
book
- The book part of the reference.chapter
- The current chapter
NoSuchVerseException
- If the book or chapter number is not validpublic static int versesInBook(int book) throws NoSuchVerseException
book
- The book part of the reference.
NoSuchVerseException
- If the book number is not validpublic static int verseOrdinal(int book, int chapter, int verse) throws NoSuchVerseException
book
- The book part of the reference.chapter
- The current chapterverse
- The current verse
NoSuchVerseException
- If the reference is illegalpublic static int verseOrdinal(int[] ref) throws NoSuchVerseException
ref
- An array of 3 ints, book, chapter, verse
NoSuchVerseException
- If the reference is illegalpublic static int[] decodeOrdinal(int ordinal) throws NoSuchVerseException
ordinal
- The ordinal number of the verse
NoSuchVerseException
- If the reference is illegalpublic static void validate(int book, int chapter, int verse) throws NoSuchVerseException
book
- The book part of the reference.chapter
- The chapter part of the reference.verse
- The verse part of the reference.
NoSuchVerseException
- If the reference is illegalpublic static void validate(int[] ref) throws NoSuchVerseException
ref
- An array of 3 ints, book, chapter, verse
NoSuchVerseException
- If the reference is illegalpublic static int[] patch(int[] ref)
There is another patch system that allows us to use large numbers to mean "the end of" so "Gen 1:32".otherPatch() gives "Gen 1:31". This could be useful to allow the user to enter things like "Gen 1:99" meaning the end of the chapter. Or "Isa 99:1" to mean the last chapter in Isaiah verse 1 or even "Rev 99:99" to mean the last verse in the Bible.
However I have not implemented this because I've used a different convention: "Gen 1:$" (OLB compatible) or "Gen 1:ff" (common comentary usage) to mean the end of the chapter - So the functionality is there anyway.
I think that getting into the habit of typing "Gen 1:99" is bad. It could be the source of surprises "Psa 119:99" is not what you'd might expect, and neither is "Psa 99:1" is you wanted the last chapter in Psalms - expecting us to type "Psa 999:1" seems like we're getting silly.
However dispite this maybe we should provide the functionality anyway.
ref
- An array of 3 ints, book, chapter, verse. This array will be changed.
public static int verseCount(int book1, int chapter1, int verse1, int book2, int chapter2, int verse2) throws NoSuchVerseException
book1
- The book part of the first reference.chapter1
- The chapter part of the first reference.verse1
- The verse part of the first reference.book2
- The book part of the second reference.chapter2
- The chapter part of the second reference.verse2
- The verse part of the second reference.
NoSuchVerseException
- If either reference is illegalpublic static int verseCount(int[] ref1, int[] ref2) throws NoSuchVerseException
ref1
- An array of 3 ints, book, chapter, verse for the first reference.ref2
- An array of 3 ints, book, chapter, verse for the second reference.
NoSuchVerseException
- If either reference is illegalpublic static int booksInSection(int section)
section
- The section
SectionNames.getSection(int)
public static String getSectionName(int section) throws NoSuchVerseException
section
- The book number (1-66)
NoSuchVerseException
- If the book number is not validprivate static boolean containsLetter(String text)
text
- The string to be parsed
private static void initialize()
|
Copyright ยจ 2003-2006 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |