|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.versification.Versification
public class Versification
A named Versification defines the order of BibleBooks by Testament, the number of chapters in each BibleBook, the number of verses in each chapter.
for license details.
The copyright to this program is held by it's authors.
,
Serialized FormField Summary | |
---|---|
private BibleBookList |
bookList
The ordered list of books in this versification. |
private int[][] |
chapterStarts
Constant for the ordinal number of the first verse in each chapter. |
private static BibleNames |
englishBibleNames
English BibleNames, or null when using the program's default locale |
private int[][] |
lastVerse
Constant for the max verse number in each chapter |
private Map<Locale,BibleNames> |
localizedBibleNames
we cache the Localized Bible Names because there is quite a bit of processing going on for each individual Locale |
private String |
name
The OSIS name of the reference system. |
private int |
ntMaxOrdinal
The last ordinal number of the New Testament and the maximum ordinal number of this Reference System |
private int |
otMaxOrdinal
The last ordinal number of the Old Testament |
private static long |
serialVersionUID
Serialization ID |
Constructor Summary | |
---|---|
Versification()
|
|
Versification(String name,
BibleBook[] booksOT,
BibleBook[] booksNT,
int[][] lastVerseOT,
int[][] lastVerseNT)
Construct a Versification. |
Method Summary | |
---|---|
Verse |
add(Verse verse,
int n)
Get the verse that is a few verses on from the one we've got. |
boolean |
containsBook(BibleBook book)
Does this Versification contain the BibleBook. |
private static boolean |
containsLetter(String text)
This is simply a convenience function to wrap Character.isLetter() |
Verse |
decodeOrdinal(int ordinal)
Where does this verse come in the Bible. |
int |
distance(Verse start,
Verse end)
How many verses are there in between the 2 Verses. |
static void |
dump(PrintStream out,
String name,
BibleBookList bookList,
int[][] array)
|
VerseRange |
getAllVerses()
Get a VerseRange encompassing this Versification. |
private BibleNames |
getBibleNamesForLocale(Locale locale)
Gets the bible names for a specific locale. |
BibleBook |
getBook(int ordinal)
Get the BibleBook by its position in this Versification. |
BibleBook |
getBook(String find)
Get a book from its name. |
int |
getBookCount()
Get the number of books in this Versification. |
int |
getBookCount(Verse start,
Verse end)
The number of books between two verses includes the books of the two verses and everything in between. |
Iterator<BibleBook> |
getBookIterator()
Get the BibleBooks in this Versification. |
BookName |
getBookName(BibleBook book)
Get the BookName. |
int |
getChapterCount(Verse start,
Verse end)
The number of chapters between two verses includes the chapters of the two verses and everything in between. |
int |
getCount(Testament testament)
Give the count of verses in the testament or the whole Bible. |
BibleBook |
getFirstBook()
Return the first book in the list. |
BibleBook |
getLastBook()
Return the first book in the list. |
int |
getLastChapter(BibleBook book)
Get the last valid chapter number for a book. |
int |
getLastVerse(BibleBook book,
int chapter)
Get the last valid verse number for a chapter. |
private BibleNames |
getLocalizedBibleNames()
Gets the localized bible names, based on the LocaleProviderManager |
String |
getLongName(BibleBook book)
Get the full name of a book (e.g. |
String |
getName()
Get the OSIS name for this Versification. |
BibleBook |
getNextBook(BibleBook book)
Given a BibleBook, get the next BibleBook in this Versification. |
int |
getOrdinal(Testament testament,
int testamentOrdinal)
Determine the ordinal value for this versification given the ordinal value in a testament. |
int |
getOrdinal(Verse verse)
Where does this verse come in the Bible. |
String |
getPreferredName(BibleBook book)
Get the preferred name of a book. |
BibleBook |
getPreviousBook(BibleBook book)
Given a BibleBook, get the previous BibleBook in this Versification. |
String |
getShortName(BibleBook book)
Get the short name of a book (e.g. |
Testament |
getTestament(int ordinal)
Get the testament of a given verse |
int |
getTestamentOrdinal(int ordinal)
Where does this verse come in the Bible. |
private void |
initBookLookup()
Load up the resources for Bible book and section names. |
boolean |
isAdjacentBook(Verse first,
Verse second)
Two verses are in adjacent books if one book follows the other in this versification. |
boolean |
isAdjacentChapter(Verse first,
Verse second)
Two verse are adjacent if one immediately follows the other, even across book boundaries. |
boolean |
isAdjacentVerse(Verse first,
Verse second)
Is this verse adjacent to another verse |
boolean |
isBook(String find)
Is the given string a valid book name. |
boolean |
isBookIntro(Verse verse)
A book introduction is an introduction that has a chapter of 0. |
boolean |
isChapterIntro(Verse verse)
A chapter introduction is an introduction that has a chapter other than 0 |
boolean |
isEndOfBook(Verse verse)
The end of the book is indicated by the chapter number matching the last chapter in the book and the verse number matching the last verse in the chapter. |
boolean |
isEndOfChapter(Verse verse)
The end of the chapter is indicated by the verse number matching the last in the chapter. |
boolean |
isIntro(Verse verse)
An introduction is a Verse that has a verse number of 0. |
boolean |
isSameBook(Verse first,
Verse second)
Two verses are in the same book when they have the same book. |
boolean |
isSameChapter(Verse first,
Verse second)
Two verses are in the same chapter if both the book and chapter agree. |
boolean |
isStartOfBook(Verse verse)
The start of a book is indicated by a chapter number of 0 or 1 and a verse number of 0 or 1. |
boolean |
isStartOfChapter(Verse verse)
The start of a chapter is indicated by a verse number of 0 or 1 |
Verse |
max(Verse first,
Verse second)
Determine the later of the two verses. |
int |
maximumOrdinal()
The maximum number of verses in the Bible, including module, testament, book and chapter introductions. |
Verse |
min(Verse first,
Verse second)
Determine the earlier of the two verses. |
Verse |
next(Verse verse)
Get the verse that is a few verses on from the one we've got. |
static void |
optimize(PrintStream out,
BibleBookList bookList,
int[][] lastVerse)
|
Verse |
patch(BibleBook book,
int chapter,
int verse)
Fix up these verses so that they are as valid a possible. |
Verse |
subtract(Verse verse,
int n)
Get the verse n down from here this Verse. |
void |
validate(BibleBook book,
int chapter,
int verse)
Does the following represent a real verse?. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private String name
private BibleBookList bookList
private int otMaxOrdinal
private int ntMaxOrdinal
private int[][] lastVerse
private int[][] chapterStarts
private transient Map<Locale,BibleNames> localizedBibleNames
private static BibleNames englishBibleNames
private static final long serialVersionUID
Constructor Detail |
---|
public Versification()
public Versification(String name, BibleBook[] booksOT, BibleBook[] booksNT, int[][] lastVerseOT, int[][] lastVerseNT)
name
- The name of this reference systembooksOT
- An ordered list of books in this reference system. The list
should not include INTRO_BIBLE, or INTRO_OT.booksNT
- An ordered list of books in this reference system. The list
should not include INTRO_NT.lastVerseOT
- For each book in booksOT, this has an array with one entry for
each chapter whose value is the highest numbered verse in that
chapter. Do not include chapter 0.lastVerseNT
- For each book in booksNT, this has an array with one entry for
each chapter whose value is the highest numbered verse in that
chapter. Do not include chapter 0.Method Detail |
---|
public String getName()
public boolean containsBook(BibleBook book)
book
-
public BibleBook getBook(int ordinal)
ordinal
-
public int getBookCount()
public BibleBook getFirstBook()
public BibleBook getLastBook()
public BibleBook getNextBook(BibleBook book)
book
- A BibleBook in the Versification
public BibleBook getPreviousBook(BibleBook book)
book
- A BibleBook in the Versification
public Iterator<BibleBook> getBookIterator()
public BookName getBookName(BibleBook book)
book
- the desired book
public String getPreferredName(BibleBook book)
book
- the desired book
public String getLongName(BibleBook book)
public String getShortName(BibleBook book)
public BibleBook getBook(String find)
find
- The string to identify
public boolean isBook(String find)
find
- The string to identify
public int getLastChapter(BibleBook book)
book
- The book part of the reference.
public int getLastVerse(BibleBook book, int chapter)
book
- The book part of the reference.chapter
- The current chapter
public VerseRange getAllVerses()
public boolean isIntro(Verse verse)
verse
- the verse to test
public boolean isBookIntro(Verse verse)
verse
- the verse to test
public boolean isChapterIntro(Verse verse)
verse
- the verse to test
public boolean isStartOfChapter(Verse verse)
verse
- the verse to test
public boolean isEndOfChapter(Verse verse)
verse
- the verse to test
public boolean isStartOfBook(Verse verse)
verse
- the verse to test
public boolean isEndOfBook(Verse verse)
verse
- the verse to test
public boolean isSameChapter(Verse first, Verse second)
first
- The verse to compare tosecond
- The verse to compare to
public boolean isAdjacentChapter(Verse first, Verse second)
first
- The verse to compare tosecond
- The verse to compare to
public boolean isSameBook(Verse first, Verse second)
first
- The verse to compare tosecond
- The verse to compare to
public boolean isAdjacentBook(Verse first, Verse second)
first
- The verse to compare tosecond
- The verse to compare to
public boolean isAdjacentVerse(Verse first, Verse second)
first
- The first verse in the comparisonsecond
- The second verse in the comparison
public int distance(Verse start, Verse end)
distance(gen11, gen12) == 1
start
- The first Verse in the rangeend
- The last Verse in the range
public Verse min(Verse first, Verse second)
first
- the first verse to comparesecond
- the second verse to compare
public Verse max(Verse first, Verse second)
first
- the first verse to comparesecond
- the second verse to compare
public Verse subtract(Verse verse, int n)
verse
- The verse to use as a startn
- The number to count down by
public Verse next(Verse verse)
verse
- The verse to use as a startn
- the number of verses later than the one we're one
public Verse add(Verse verse, int n)
verse
- The verse to use as a startn
- the number of verses later than the one we're one
public int getChapterCount(Verse start, Verse end)
start
- The first Verse in the rangeend
- The last Verse in the range
public int getBookCount(Verse start, Verse end)
start
- The first Verse in the rangeend
- The last Verse in the range
public int maximumOrdinal()
public int getOrdinal(Verse verse)
verse
- The verse to convert
public int getTestamentOrdinal(int ordinal)
ordinal
- The ordinal number of the verse to convert
public int getOrdinal(Testament testament, int testamentOrdinal)
testament
- the testament in which the ordinal value pertainstestamentOrdinal
- the ordinal value within the testament
public Testament getTestament(int ordinal)
public int getCount(Testament testament)
testament
- The testament to count. If null, then all testaments.
public Verse decodeOrdinal(int ordinal)
ordinal
- The ordinal number of the verse
public void validate(BibleBook 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 Verse patch(BibleBook book, int chapter, int verse)
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 commentary 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 despite this maybe we should provide the functionality anyway.
book
- the book to obtainchapter
- the supposed chapterverse
- the supposed verse
public static void dump(PrintStream out, String name, BibleBookList bookList, int[][] array)
public static void optimize(PrintStream out, BibleBookList bookList, int[][] lastVerse)
private BibleNames getLocalizedBibleNames()
LocaleProviderManager
private BibleNames getBibleNamesForLocale(Locale locale)
locale
- the locale
private void initBookLookup()
private static boolean containsLetter(String text)
text
- The string to be parsed
|
Copyright ? 2003-2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |