/** * Does this Versification contain the BibleBook. * * @param book * @return true if it is present. */ public boolean contains(BibleBook book) { return book != null && bookMap[book.ordinal()] != -1; }
/** * Where does the BibleBook come in the order of books of the Bible. * The first book is 0, the next is 1 and so forth. * If the BibleBook is not in this Reference System, * then the return value of this routine is -1. * * @param book * @return the ordinal value of the book or -1 if not present */ public int getOrdinal(BibleBook book) { return bookMap[book.ordinal()]; }
/** * Given a BibleBook, get the previous BibleBook in this Versification. If it is the first book, return null. * @param book A BibleBook in the Versification * @return the previous BibleBook or null. */ public BibleBook getPreviousBook(BibleBook book) { int ordinal = book.ordinal(); int position = bookMap[ordinal]; if (position > 0) { return books[position - 1]; } return null; }
/** * Given a BibleBook, get the next BibleBook in this Versification. If it is the last book, return null. * @param book A BibleBook in the Versification * @return the previous BibleBook or null. */ public BibleBook getNextBook(BibleBook book) { int ordinal = book.ordinal(); int position = bookMap[ordinal]; if (position != -1 && position + 1 < books.length) { return books[position + 1]; } return null; }
public int getCurrentBibleBookNo() { return verseVersificationSelected.getBook().ordinal(); }
public JSONObject getStateJson() throws JSONException { JSONObject object = new JSONObject(); object.put("versification", mainVerse.getVersification().getName()); object.put("bibleBook", mainVerse.getBook().ordinal()); object.put("chapter", mainVerse.getChapter()); object.put("verseNo", mainVerse.getVerse()); return object; }
@Test public void testGetCurrentBibleBookNo() throws Exception { currentBibleVerse.setVerseSelected(kjvV11n, kjvPs10v1); assertThat(currentBibleVerse.getCurrentBibleBookNo(), equalTo(BibleBook.PS.ordinal())); }