[jsword-devel] AccuracyType for single chapter books

Brian Fernandes infernalproteus at gmail.com
Fri Dec 28 07:38:21 MST 2007


In my application, I create a key based on the book and chapter selected 
by a user and pass it on to the JSWord API to get the corresponding 
text. So if you select Genesis and chapter 1, I get the key using 
Book#getKey("Genesis.1"); The corresponding text is the first chapter of 
Genesis. OK.
If I do the same for a single chapter book though, like Jude, the text I 
get back is just the first verse of that chapter and not the first 
chapter as I expected. (The key I used is "Jude.1").

I stepped into the code and this seems to be because the AccuracyType 
for "Genesis.1" is BOOK_CHAPTER, while the type for "Jude.1" is  
BOOK_VERSE. These results are perfect according to the javadoc for that 
method. But these results also cause 
VerseRangeFactory#fromString(String) to return a range covering just 
that one verse instead of the entire chapter, consequently, I get a 
single verse back instead of the chapter.

My expectation is: Jude.1 and Genesis.1 should both be BOOK_CHAPTER 
type, but I see that there is code which explicitly returns BOOK_VERSE 
for the former because it has only one chapter. I'm sure there is a 
reason for this, but I cannot figure this out. Is my expectation 
invalid? If so, how should I construct my key so that I get back the 
entire chapter instead of just that one verse? I'm using code nearly 
identical to APIExamples#readStyledText.

Best regards,
Brian.

P.S. This is the AccuracyType method I was talking about:
public static AccuracyType fromText(String original, String[] parts, 
AccuracyType verseAccuracy, VerseRange basis)




More information about the jsword-devel mailing list