public void mod2imp() throws BookException { // Use short key names for Bibles. if (BookCategory.BIBLE.equals(book.getBookCategory())) { BookName.setFullBookName(false); } Key keys = book.getGlobalKeyList(); StringBuilder buf = new StringBuilder(); for (Key key : keys) { //FIXME(CJB) iteration should be pushed down to benefit from performance improvement String rawText = book.getRawText(key); if (rawText != null && rawText.trim().length() > 0) { buf.delete(0, buf.length()); buf.append("$$$").append(key).append('\n').append(rawText); System.out.println(buf.toString()); } } }
@Override public boolean test(Book book) { return book.getBookCategory().equals(bookCategory) && !book.isLocked(); } });
/** * If the user has chosen to remember the book (by type) then set the * current book for that type. * * @param book the current Book */ public static void setCurrentBook(Book book) { BookCategory type = book.getBookCategory(); if (type.equals(BookCategory.BIBLE) && isCurrentBible()) { currentBible = book; } }
public boolean test(Book book) { return book.getBookCategory().equals(category) && !book.isLocked(); }
public boolean test(Book book) { return !book.getBookCategory().equals(category) && !book.isLocked(); }
@Override public boolean equals(Object obj) { // The real bit ... Book thatBook = ((BookKey)obj).book; return book.getBookCategory().equals(thatBook.getBookCategory()) && book.getAbbreviation().equals(thatBook.getAbbreviation()) && book.getLanguage().equals(thatBook.getLanguage()); }
public static void report(Book b) { if (!b.getBookCategory().equals(BookCategory.BIBLE) && !b.getBookCategory().equals(BookCategory.COMMENTARY)) { System.err.println(b.getInitials() + " is not a Bible or Commentary"); // System.exit(1); } BibleScope scope = new BibleScope(b); BookName.setFullBookName(false); // use short names System.out.println('[' + b.getInitials() + ']'); System.out.println("InScope=" + scope.getInScope().getOsisRef()); System.out.println("OutScope=" + scope.getOutOfScope().getOsisRef()); }
/** * Read all the books that we can get our hands on. * @param args */ public static void main(String[] args) { // TODO(DMS): add the ability to pass a filter specification // Loop through all the Books log.warn("*** Reading all installed Bibles"); BookFilter filter = null; //filter = BookFilters.getCustom("SourceType=ThML"); //filter = BookFilters.getCustom("Description=Ergane Turkish to English Glossary"); //filter = BookFilters.getCustom("ModDrv=zLD"); //filter = BookFilters.getCustom("Initials=BosworthToller"); //filter = BookFilters.getDictionaries(); List<Book> books = getBooks(filter); for (Book book : books) { if (book.isLocked()) { log.warn("****** Skipping: [{}] {} ({})", book.getInitials(), book.getName(), book.getBookCategory()); continue; } log.warn("****** Reading: [{}] {} ({})", book.getInitials(), book.getName(), book.getBookCategory()); Key set = book.getGlobalKeyList(); testReadMultiple(book, set); } }
protected Language getDefaultLanguage() { // get the current language code String langCode = Locale.getDefault().getLanguage(); if (!new Language(langCode).isValidLanguage()) { langCode = Locale.ENGLISH.getLanguage(); } // create the JSword Language for current lang Language localLanguage = new Language(langCode); Log.d(TAG, "Local language is:"+localLanguage); // check a bible exists in current lang otherwise use english boolean foundBibleInLocalLanguage = false; for (Book book : getAllDocuments()) { if (book.getBookCategory().equals(BookCategory.BIBLE) && localLanguage.equals(book.getLanguage())) { foundBibleInLocalLanguage = true; break; } } // if no bibles exist in current lang then fall back to default language (English) so the user will not see an initially empty list if (!foundBibleInLocalLanguage) { Log.d(TAG, "No bibles found in local language so falling back to default lang"); localLanguage = Language.DEFAULT_LANG; } return localLanguage; }
/** * Get text to be spoken without any markup. * * @param book * the book to use * @param key * a reference, appropriate for the book, of one or more entries */ public String getTextToSpeak(Book book, Key key) { try { BookData data = new BookData(book, key); SAXEventProvider osissep = data.getSAXEventProvider(); boolean sayReferences = BookCategory.GENERAL_BOOK.equals(book.getBookCategory()); ContentHandler osisHandler = new OsisToSpeakTextSaxHandler(sayReferences); osissep.provideSAXEvents(osisHandler); return osisHandler.toString(); } catch (Exception e) { Log.e(TAG, "Error getting text from book" , e); return BibleApplication.Companion.getApplication().getString(R.string.error_occurred); } }
public boolean test(Book book) { BookCategory bookCategory = book.getBookCategory(); if (book.isLocked()) { return false; } else { return bookCategory.equals(BookCategory.BIBLE) || bookCategory.equals(BookCategory.COMMENTARY) || bookCategory.equals(BookCategory.DICTIONARY) || bookCategory.equals(BookCategory.GENERAL_BOOK) || bookCategory.equals(BookCategory.MAPS); } } }
/** * Get a reference list for a search result against a book. * * @param bookInitials * @param searchRequest * @return The reference for the matching. * @throws BookException */ public String search(String bookInitials, String searchRequest) throws BookException { Book book = BookInstaller.getInstalledBook(bookInitials); if (isBookIndexed(book) && searchRequest != null) { if (BookCategory.BIBLE.equals(book.getBookCategory())) { BookName.setFullBookName(false); } return book.find(searchRequest).getName(); } return ""; }
BookCategory category = book.getBookCategory(); BookCategory prevCategory = firstBook.getBookCategory(); String prevName = firstBook.getInitials(); showDiffs[i - 1] = comparingBooks && BookCategory.BIBLE.equals(category) && category.equals(prevCategory)
@Test public void testReadCommentaries() throws Exception { for (Book book: books) { if (book.getBookCategory().equals(BookCategory.COMMENTARY) && !book.getInitials().equals("Personal")) { // if (book.getInitials().equals("JFB")) { System.out.println("Book:"+book.getInitials()); OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("John 1:1")); String chapter = convertStreamToString(osisInputStream); int numOpeningDivs = count(chapter, "<div>"); int numClosingDivs = count(chapter, "</div>"); System.out.println(chapter); assertThat("wrong number of divs in "+book, numOpeningDivs, equalTo(numClosingDivs)); } } }
public void testReadLastChapter() throws Exception { for (Book book: books) { if (book.getBookCategory().equals(BookCategory.BIBLE)) { System.out.println("Book:"+book.getInitials()); OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("3 John")); String chapter = convertStreamToString(osisInputStream); int numOpeningDivs = count(chapter, "<div>"); int numClosingDivs = count(chapter, "</div>"); // System.out.println(chapter); assertThat("wrong number of divs in "+book, numOpeningDivs, equalTo(numClosingDivs)); } } }
if (BookCategory.BIBLE.equals(book.getBookCategory())) { key = book.getKey(reference); Passage remainder = (Passage) key; } else if (BookCategory.GENERAL_BOOK.equals(book.getBookCategory())) {
if (BookCategory.BIBLE.equals(book.getBookCategory())) { key = book.getKey(reference); ((Passage) key).trimVerses(maxKeyCount);
private OsisToHtmlSaxHandler getSaxHandler(Book book, Key key, boolean asFragment) { OsisToHtmlParameters osisToHtmlParameters = new OsisToHtmlParameters(); BookCategory bookCategory = book.getBookCategory(); BookMetaData bmd = book.getBookMetaData();