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()); } } }
/** * Read all the books that we can get our hands on. * * @param args * @throws IOException */ public static void main(String[] args) throws IOException { out = new PrintWriter(new BufferedWriter(new FileWriter("passages.log"))); // Loop through all the Books log.warn("*** Reading all known Books"); BookFilter filter = BookFilters.getCustom("GlobalOptionFilter=ThMLScripref;Category=Biblical Texts"); List<Book> comments = Books.installed().getBooks(filter); for (Book book : comments) { if (!book.isLocked()) { BookMetaData bmd = book.getBookMetaData(); // Skip PlainText as they do not have references marked up if (bmd.getProperty("SourceType") != null) { Key set = book.getGlobalKeyList(); readBook(book, set); } } } out.flush(); out.close(); }
for (Key key : book.getGlobalKeyList()) { String entry = key.getName().toLowerCase(sortLocale); if (entry.compareTo(target) >= 0) {
for (Key key : getCurrentDocument().getGlobalKeyList()) {
/** * While Bible and Commentary are very similar, a Dictionary is read in a * slightly different way. It is also worth looking at the JavaDoc for Book * that has a way of treating Bible, Commentary and Dictionary the same. * * @throws BookException * @see Book */ public void readDictionary() throws BookException { // This just gets a list of all the known dictionaries and picks the // first. In a real world app you will probably have a better way // of doing this. List<Book> dicts = Books.installed().getBooks(BookFilters.getDictionaries()); Book dict = dicts.get(0); // If I want every key in the Dictionary then I do this (or something // like it - in the real world you want to call hasNext() on an iterator // before next() but the point is the same: Key keys = dict.getGlobalKeyList(); Key first = keys.iterator().next(); System.out.println("The first Key in the default dictionary is " + first); BookData data = new BookData(dict, first); System.out.println("And the text against that key is " + OSISUtil.getPlainText(data.getOsisFragment())); }
/** * */ public StrongsAnalysis() { Book bible = Books.installed().getBook("KJV"); if (!bible.hasFeature(FeatureType.STRONGS_NUMBERS)) { bible = null; List<Book> bibles = Books.installed().getBooks(new BookFilters.BookFeatureFilter(FeatureType.STRONGS_NUMBERS)); if (!bibles.isEmpty()) { bible = bibles.get(0); } } if (bible == null) { return; } List<Key> errors = new ArrayList<Key>(); StrongsMapSet sms = new StrongsMapSet(); analyze(sms, bible, errors, bible.getGlobalKeyList()); }
private void computeScope() { if (inScope == null) { Key all = book.getGlobalKeyList(); inScope = book.createEmptyKeyList(); outScope = book.createEmptyKeyList(); for (Key key : all) { if (book.contains(key)) { inScope.addAll(key); } else { outScope.addAll(key); } } } }
StringBuffer buf = new StringBuffer(); Key keys = book.getGlobalKeyList();
/** * 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); } }
writer.setRAMBufferSizeMB(policy.getRAMBufferSize()); generateSearchIndexImpl(job, errors, writer, book.getGlobalKeyList(), 0, policy);