/** * Get the default Versification. * * @return the default Versification. * @deprecated Use {@link #getVersification(String)} instead. */ @Deprecated public synchronized Versification getDefaultVersification() { return getVersification(DEFAULT_V11N); }
public Versification getDocumentVersification() { if (documentVersification!=null) { return documentVersification; } else { return Versifications.instance().getVersification(Versifications.DEFAULT_V11N); } } public void setDocumentVersification(Versification documentVersification) {
public ConvertibleVerse(BibleBook book, int chapter, int verseNo) { this(Versifications.instance().getVersification(Versifications.DEFAULT_V11N), book, chapter, verseNo); }
public void restoreState(JSONObject jsonObject) throws JSONException { if (jsonObject!=null) { if (jsonObject.has("versification") && jsonObject.has("bibleBook")) { Versification v11n = Versifications.instance().getVersification(jsonObject.getString("versification")); int bibleBookNo = jsonObject.getInt("bibleBook"); int chapterNo = jsonObject.getInt("chapter"); int verseNo = jsonObject.getInt("verseNo"); mainVerse = new Verse(v11n, BibleBook.values()[bibleBookNo], chapterNo, verseNo, true); } } } }
/** * Get versification specified in properties file e.g. 'Versification=Vulg' * Default to KJV. * If specified Versification is not found then use NRSVA because it includes most books possible */ private Versification getReadingPlanVersification(String planCode) { Versification versification; try { String versificationName = getPlanProperties(planCode).getProperty(VERSIFICATION, DEFAULT_VERSIFICATION); versification = Versifications.instance().getVersification(versificationName); } catch (Exception e) { Log.e(TAG, "Error loading versification from Reading plan:"+planCode); versification = Versifications.instance().getVersification(INCLUSIVE_VERSIFICATION); } return versification; }
/** * Write out the object to the given ObjectOutputStream * * @param in * The stream to read our state from * @throws IOException * if the read fails * @throws ClassNotFoundException * If the read data is incorrect * @serialData Write the ordinal number of this verse */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); String v11nName = in.readUTF(); v11n = Versifications.instance().getVersification(v11nName); Verse decoded = v11n.decodeOrdinal(ordinal); this.book = decoded.book; this.chapter = decoded.chapter; this.verse = decoded.verse; }
/** * Get the versification for the key or the default versification. * * @param key the key that should provide for the Versification * @return the versification for the key */ public static Versification getVersification(Key key) { if (key instanceof VerseKey) { return ((VerseKey) key).getVersification(); } return Versifications.instance().getVersification(Versifications.DEFAULT_V11N); } }
public final Key createEmptyKeyList() { return keyf.createEmptyKeyList(Versifications.instance().getVersification(versification)); }
public Versification getVersification() { try { // Bibles must be a PassageBook return ((AbstractPassageBook)getCurrentDocument()).getVersification(); } catch (Exception e) { Log.e(TAG, "Error getting versification for Book", e); return Versifications.instance().getVersification("KJV"); } }
/** * @param i the current position in the array of books * @return the versification of the book. */ private Versification getVersification(final int i) { return Versifications.instance().getVersification( books[i].getBookMetaData().getProperty(BookMetaData.KEY_VERSIFICATION)); }
public Versification getVersification() { if (this.versificationSystem == null) { this.versificationSystem = Versifications.instance().getVersification(getBookMetaData().getProperty(BookMetaData.KEY_VERSIFICATION)); } return versificationSystem; }
/** * @return v11n of current document */ public Versification getVersification() { AbstractPassageBook doc = getCurrentPassageDocument(); // this should always be true if (doc!=null) { return doc.getVersification(); } else { // but safety first return Versifications.instance().getVersification(SystemKJV.V11N_NAME); } }
public final Key getKey(String text) throws NoSuchKeyException { return PassageKeyFactory.instance().getKey(Versifications.instance().getVersification(versification), text); }
/** * Read a passage from a given stream * * @param in * The stream to read from * @return a newly built Passage * @throws IOException * If there was trouble reading the stream * @throws NoSuchKeyException * if the data was not a valid passage */ public static Passage readPassage(Reader in) throws IOException, NoSuchKeyException { // Get any versification. It does not matter. readDescripton will overwrite it. Versification rs = Versifications.instance().getVersification("KJV"); Passage ref = (Passage) keyf.createEmptyKeyList(rs); ref.readDescription(in); return ref; }
Versification findPreferredCompatibleVersification(ConvertibleVerseRange convertibleVerseRange1, ConvertibleVerseRange convertibleVerseRange2) { for (Versification v11n : versificationsInOrderOfPreference) { if (convertibleVerseRange1.isConvertibleTo(v11n) && convertibleVerseRange2.isConvertibleTo(v11n)) { return v11n; } } log.error("Cannot find compatible versification for "+convertibleVerseRange1+" and "+convertibleVerseRange2+". Returning KJVA."); return Versifications.instance().getVersification("KJVA"); } }
private Verse getVerse(BibleBook book, int chapter, int verse) { Versification v11n = Versifications.instance().getVersification(SystemKJV.V11N_NAME); return new Verse(v11n, book, chapter, verse); } }
@Test public void testGetVerseDescription() { Versification kjv = Versifications.instance().getVersification("KJV"); Verse gen1_0 = new Verse(kjv, BibleBook.GEN, 1, 0); assertThat(CommonUtils.getKeyDescription(gen1_0), equalTo("Genesis 1")); Verse gen1_1 = new Verse(kjv, BibleBook.GEN, 1, 1); assertThat(CommonUtils.getKeyDescription(gen1_1), equalTo("Genesis 1:1")); Verse gen1_10 = new Verse(kjv, BibleBook.GEN, 1, 10); assertThat(CommonUtils.getKeyDescription(gen1_10), equalTo("Genesis 1:10")); }
public void testTrickyWebChapters() throws Exception { { OSISInputStream osisInputStream = new OSISInputStream(webBook, PassageKeyFactory.instance().getKey(Versifications.instance().getVersification("KJV"), "Ps 1")); String chapter = convertStreamToString(osisInputStream); int numOpeningLs = count(chapter, "<l>") + count(chapter, "<l "); int numClosingLs = count(chapter, "</l>"); System.out.println(chapter); assertThat("wrong number of Ls", numOpeningLs, equalTo(numClosingLs)); } { OSISInputStream osisInputStream = new OSISInputStream(webBook, PassageKeyFactory.instance().getKey(Versifications.instance().getVersification("KJV"), "Gen 49")); String chapter = convertStreamToString(osisInputStream); int numOpeningLs = count(chapter, "<l>") + count(chapter, "<l "); int numClosingLs = count(chapter, "</l>"); System.out.println(chapter); assertThat("wrong number of Ls", numOpeningLs, equalTo(numClosingLs)); } }
public String readRawContent(RawBackendState state, Key key) throws IOException { String v11nName = getBookMetaData().getProperty(BookMetaData.KEY_VERSIFICATION); Versification v11n = Versifications.instance().getVersification(v11nName); Verse verse = KeyUtil.getVerse(key); int index = verse.getOrdinal(); Testament testament = v11n.getTestament(index); index = v11n.getTestamentOrdinal(index); RawBackendState initState = null; try { initState = initState(); return getEntry(state, verse.getName(), testament, index); } catch (BookException e) { return ""; } finally { OpenFileStateManager.instance().release(initState); } }
public void setAliasKey(RawFileBackendState state, Key alias, Key source) throws IOException { String v11nName = getBookMetaData().getProperty(BookMetaData.KEY_VERSIFICATION); Versification v11n = Versifications.instance().getVersification(v11nName); Verse aliasVerse = KeyUtil.getVerse(alias); Verse sourceVerse = KeyUtil.getVerse(source); int aliasIndex = aliasVerse.getOrdinal(); Testament testament = v11n.getTestament(aliasIndex); aliasIndex = v11n.getTestamentOrdinal(aliasIndex); RandomAccessFile idxRaf = state.getIdxRaf(testament); int sourceOIndex = sourceVerse.getOrdinal(); sourceOIndex = v11n.getTestamentOrdinal(sourceOIndex); DataIndex dataIndex = getIndex(idxRaf, sourceOIndex); // Only the index is updated to point to the same place as what is // linked. updateIndexFile(idxRaf, aliasIndex, dataIndex.getOffset()); }