[jsword-devel] Module introductions

DM Smith dmsmith at crosswire.org
Tue Jan 3 12:40:00 MST 2012

I have just checked in a first pass at adding support for module 
introductions for Bibles and commentaries.

I still have 50 failures in the JUnit tests to go through. So consider 
the nightly build to be unstable until further notice. However, even 
once stable, please do not use it in a front-end (AndBible, Al Kitab, 
...) without thorough testing.

Here is the design:
SWORD has always allowed for introductions, but JSword did not support them.

There is one introduction for the module as a whole, one for the OT, one 
for the NT, one for each book of the Bible and one for each chapter in 
each Bible book.

In SWORD, they are accessed as:
Module introduction: Testament 0, Book 0, Chapter 0, Verse 0.
OT introduction: Testament 1, Book 0, Chapter 0, Verse 0.
NT introduction: Testament 2, Book 0, Chapter 0, Verse 0.
Book introduction: Testament t, Book b, Chapter 0, Verse 0.
Chapter introduction: Testament b, Book b, Chapter c, Verse 0.

Since JSword's Verse object does not have a notion of testament, it 
would be difficult to add it at this time. Instead, I've added 
BibleBook.INTRO_BIBLE, BibleBook.INTRO_OT and BibleBook.INTRO_NT.

BibleInfo.getOrdinal(Verse v) used to get 1 for Gen 1.1, 2 for Gen 1:1 
and so forth for each verse in the KJV. Now it is as follows:
0 - INTRO_BIBLE 0:0 - The Book introduction
1 - INTRO_OT 0:0 - The OT Testament introduction
2 - GEN 0:0 - The introduction to the book of Genesis
3 - GEN 1:0 - The introduction to Genesis chapter 1
4 - GEN 1:1
35 - GEN 1:31
36 - GEN 2:0 - The introduction to Genesis chapter 2
37 - GEN 2:1
n - last verse in the OT
n + 1 - INTRO_NT, 0, 0 - The New Testament introduction
n + 2 - MATT 0:0 - The introduction to Matt
n + 3 - MATT 1:0 - The introduction to Matt 1
n + 4 - MATT 1:1
BibleInfo.getTestamentOrdinal(Verse v) is new. It gives the same value 
for OT verses, but starts at 1 for the NT Intro.

There are some practical implications of this:
Introductions are included in bit sets.
The number of verses in a chapter now really gives the maximum verse 
number in a chapter.
Likewise, the number of chapters in a book really gives the maximum 
chapter number in a book.
BibleInfo.getTestamentOrdinal(Verse v) maps directly to the SWORD 
indexes of the module, eliminating a conversion.
The number of BibleBooks from BibleBook.GEN to BibleBook.REV is now 67.

For those that have dug into the arrays in BibleInfo, you'll see some 
The VERSES_IN_CHAPTER array used to be indexed by chapter - 1. Now it 
includes chapter 0 and is indexed by chapter. And it includes the intros 
for Bible, OT and NT as separate entries. This array will be renamed as 
it gives the maximum verse number for each chapter, not the number of 
The ORDINAL_AT_START_OF_CHAPTER now includes all intros in the array. 
This was derived from VERSES_IN_CHAPTER as a necessary optimization.

A bunch of the methods in BibleInfo have been deprecated and no longer 
have any other replacements. These are marked as "Do not use".

Let me know if you experience any problems using this code. Or if you 
have any questions, suggestions, ....

In His Service,

More information about the jsword-devel mailing list