/** * Get a list of installed books by BookFilter. * * @param filter * The book filter * @return the list of matching books * @see BookFilter * @see Books */ public static List<Book> getInstalledBooks(BookFilter filter) { return Books.installed().getBooks(filter); }
/** * Get a particular installed book by initials. * * @param bookInitials * The book name to search for * @return The found book. Null otherwise. */ public Book getBook(String bookInitials) { return Books.installed().getBook(bookInitials); }
/** * Get a list of all installed books. * * @return the list of installed books */ public static List<Book> getInstalledBooks() { return Books.installed().getBooks(); }
/** * Get a particular installed book by initials. * * @param bookInitials * The book name to search for * @return The found book. Null otherwise. */ public static Book getInstalledBook(String bookInitials) { return Books.installed().getBook(bookInitials); }
public List<Language> sortLanguages(Collection<Language> languages) { List<Language> languageList = new ArrayList<>(); if (languages!=null) { languageList.addAll(languages); // sort languages alphabetically Collections.sort(languageList, new RelevantLanguageSorter(Books.installed().getBooks())); } return languageList; }
/** * List the available versions */ private static void versions() { System.out.println(" Available versions:"); List<Book> lbmds = Books.installed().getBooks(); for (Book book : lbmds) { System.out.println(" " + book.getName()); } } }
public Book getDefaultStrongsHebrewDictionary() { // default to StrongsRealHebrew or StrongsHebrew String[] preferredBooks = {"StrongsRealHebrew", "StrongsHebrew"}; for (String prefBook : preferredBooks) { Book strongs = Books.installed().getBook(prefBook); if (strongs!=null) { return strongs; } } return Defaults.getHebrewDefinitions(); }
/** * Go through all of the current books checking to see if we need to replace * the current defaults with one of these. */ protected static void checkAllPreferable() { for (Book book : Books.installed().getBooks()) { checkPreferable(book); } }
/** prefer the Real alternatives to the default versions because they contain the native Greek Hebrew words */ public Book getDefaultStrongsGreekDictionary() { // default to StrongsRealGreek or StrongsGreek String[] preferredBooks = {"StrongsRealGreek", "StrongsGreek"}; for (String prefBook : preferredBooks) { Book strongs = Books.installed().getBook(prefBook); if (strongs!=null) { return strongs; } } return Defaults.getGreekDefinitions(); }
/** * Convert a filter into an array of names of Books that pass the filter. * * @param filter the filter to locate matching books * @return matching books */ private static Map<Book, String> getBookMap(BookFilter filter) { Map<Book, String> books = new TreeMap<Book, String>(BookComparators.getDefault()); for (Book book : Books.installed().getBooks(filter)) { books.put(book, book.getName()); } return books; }
/** return all supported documents - bibles and commentaries for now */ public List<Book> getDocuments() { log.debug("Getting books"); // currently only bibles and commentaries are supported List<Book> allDocuments = Books.installed().getBooks(SUPPORTED_DOCUMENT_TYPES); log.debug("Got books, Num="+allDocuments.size()); return allDocuments; }
public @Nullable Book getSpeakBook() { if (playbackSettings != null && playbackSettings.getBookId() != null) { return Books.installed().getBook(playbackSettings.getBookId()); } else { return null; } }
public List<Book> getBibles() { log.debug("Getting bibles"); List<Book> documents = Books.installed().getBooks(BookFilters.getBibles()); log.debug("Got bibles, Num="+documents.size()); return documents; }
public List<Book> getBooks(final BookCategory bookCategory) { log.debug("Getting books of type "+bookCategory.getName()); List<Book> documents = Books.installed().getBooks(new BookFilter() { @Override public boolean test(Book book) { return book.getBookCategory().equals(bookCategory) && !book.isLocked(); } }); log.debug("Got books, Num="+documents.size()); return documents; }
@After public void tearDown() { // ensure it is in the list after removal by some tests Books.installed().addBook(esv); }
@Before public void setup() { DocumentBibleBooksFactory mockDocumentBibleBooksFactory = mock(DocumentBibleBooksFactory.class); bibleTraverser = new BibleTraverser(mockDocumentBibleBooksFactory); testBook = (AbstractPassageBook) Books.installed().getBook("ESV2011"); }
@Before public void setup() { documentBibleBooksFactory = new DocumentBibleBooksFactory(); esv = (AbstractPassageBook) Books.installed().getBook("ESV2011"); }
@Test public void testContains() { AbstractPassageBook esv = (AbstractPassageBook)Books.installed().getBook("ESV2011"); DocumentBibleBooks esvBibleBooks = new DocumentBibleBooks(esv); assertThat(true, is(esvBibleBooks.contains(BibleBook.GEN))); assertThat(true, is(esvBibleBooks.contains(BibleBook.OBAD))); assertThat(false, is(esvBibleBooks.contains(BibleBook.PR_AZAR))); } }
@Test public void initialise_shouldInstallBookChangeListenersToResetCache() throws Exception { documentBibleBooksFactory.initialise(); assertThat(documentBibleBooksFactory.size(), equalTo(0)); documentBibleBooksFactory.getBooksFor(esv); assertThat(documentBibleBooksFactory.size(), equalTo(1)); Books.installed().removeBook(esv); assertThat(documentBibleBooksFactory.size(), equalTo(0)); }