public class BookData extends Object implements BookProvider
The GNU Lesser General Public License for details.
Modifier and Type | Class and Description |
---|---|
(package private) class |
BookData.BookVerseContent
A temporary holder for a map that links each verse ID to its set of OSIS elements.
|
Modifier and Type | Field and Description |
---|---|
private Book[] |
books
The books to which the key should be applied.
|
private boolean |
comparingBooks
Whether the Books should be compared.
|
private org.jdom2.Element |
fragment
Just the element
|
private Key |
key
What key was used to create this data
|
private org.jdom2.Element |
osis
The complete OSIS container for the element
|
private UnAccenter |
unaccenter |
Constructor and Description |
---|
BookData(Book[] books,
Key key,
boolean compare)
Create BookData for multiple books.
|
BookData(Book book,
Key key)
Create a BookData.
|
Modifier and Type | Method and Description |
---|---|
private void |
addContentSafely(org.jdom2.Element cell,
List<org.jdom2.Content> xmlContent)
JDOM will throw an exception if we try and add the content to multiple parents.
|
private boolean |
addHeaderAndSetShowDiffsState(org.jdom2.Element row,
boolean[] showDiffs,
int i,
boolean ommittedVerse) |
private void |
addText(boolean doDiffs,
StringBuilder newText,
org.jdom2.Content content)
Adds the text to the diff buffer
|
private void |
addText(boolean doDiffs,
StringBuilder newText,
List<org.jdom2.Content> contents)
Loops around contents and calls addText for a single element
|
private org.jdom2.Element |
appendVersificationNotice(org.jdom2.Element parent,
String notice)
Creates a notice element.
|
Book[] |
getBooks()
Who created this data.
|
Book |
getFirstBook()
Get the first book.
|
Key |
getKey()
The key used to obtain data from one or more books.
|
org.jdom2.Element |
getOsis()
Accessor for the root OSIS element
|
private org.jdom2.Element |
getOsisContent(boolean allowGenTitles) |
org.jdom2.Element |
getOsisFragment()
Accessor for the requested data in OSIS format.
|
org.jdom2.Element |
getOsisFragment(boolean allowGenTitles)
Accessor for the root OSIS element
|
SAXEventProvider |
getSAXEventProvider()
Output the current data as a SAX stream.
|
private Versification |
getVersification(int i) |
boolean |
isComparingBooks() |
private BookData.BookVerseContent |
keyIteratorContentByVerse(Versification v11n,
Iterator<org.jdom2.Content> iter)
We iterate through the content, making sure we key together those bits that belong together.
|
void |
setUnaccenter(UnAccenter unaccenter) |
private Key key
private Book[] books
private boolean comparingBooks
private org.jdom2.Element osis
private org.jdom2.Element fragment
private UnAccenter unaccenter
public BookData(Book book, Key key)
book
- the Book to which the data belongskey
- the Key specifying the datapublic org.jdom2.Element getOsis() throws BookException
BookException
- if there is any problem with this requestpublic org.jdom2.Element getOsisFragment() throws BookException
BookException
- if there is any problem with this requestpublic org.jdom2.Element getOsisFragment(boolean allowGenTitles) throws BookException
allowGenTitles
- whether to generate titlesBookException
- if there is any problem with this requestpublic SAXEventProvider getSAXEventProvider() throws BookException
BookException
- if there is any problem with this requestpublic Book[] getBooks()
getBooks
in interface BookProvider
public Book getFirstBook()
getFirstBook
in interface BookProvider
public Key getKey()
public boolean isComparingBooks()
private org.jdom2.Element getOsisContent(boolean allowGenTitles) throws BookException
BookException
private void addContentSafely(org.jdom2.Element cell, List<org.jdom2.Content> xmlContent)
cell
- the element to be addedxmlContent
- the collector of contentprivate org.jdom2.Element appendVersificationNotice(org.jdom2.Element parent, String notice)
parent
- the parent to which the notice is addednotice
- the notice fragment to be applied to the sub-typeprivate Versification getVersification(int i)
i
- the current position in the array of booksprivate BookData.BookVerseContent keyIteratorContentByVerse(Versification v11n, Iterator<org.jdom2.Content> iter) throws BookException
v11n
- the versification for the contentiter
- the iterator of OSIS contentBookException
- if there is any problem with this requestprivate boolean addHeaderAndSetShowDiffsState(org.jdom2.Element row, boolean[] showDiffs, int i, boolean ommittedVerse)
row
- our current OSIS rowshowDiffs
- the array of states as to whether we are showing diffs for this columni
- our current place in the stateommittedVerse
- true to indicate this column will be ommiting a verseprivate void addText(boolean doDiffs, StringBuilder newText, List<org.jdom2.Content> contents)
doDiffs
- true for calculating differencesnewText
- the newText buffer used to compare one portion of text to anothercontents
- the contents to be addedprivate void addText(boolean doDiffs, StringBuilder newText, org.jdom2.Content content)
doDiffs
- true for calculating differencesnewText
- the newText buffer used to compare one portion of text to anothercontent
- the content element to be addedpublic void setUnaccenter(UnAccenter unaccenter)
unaccenter
- the unaccenter to set