/** * 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())); }
/** * Create book lists for every type of book. */ public static void refreshBooks() { // Create the array of Bibles Map<Book, String> bnames = getBookMap(BookFilters.getOnlyBibles()); ChoiceFactory.getDataMap().put(BIBLE_KEY, bnames); // Create the array of Commentaries Map<Book, String> cnames = getBookMap(BookFilters.getCommentaries()); ChoiceFactory.getDataMap().put(COMMENTARY_KEY, cnames); // Create the array of Dictionaries Map<Book, String> dnames = getBookMap(BookFilters.getDictionaries()); ChoiceFactory.getDataMap().put(DICTIONARY_KEY, dnames); // Create the array of DailyDevotionals Map<Book, String> rnames = getBookMap(BookFilters.getDailyDevotionals()); ChoiceFactory.getDataMap().put(DAILY_DEVOTIONALS_KEY, rnames); // Create the array of Dictionaries Map<Book, String> greekDef = getBookMap(BookFilters.getGreekDefinitions()); ChoiceFactory.getDataMap().put(GREEKDEF_KEY, greekDef); // Create the array of Dictionaries Map<Book, String> hebrewDef = getBookMap(BookFilters.getHebrewDefinitions()); ChoiceFactory.getDataMap().put(HEBREWDEF_KEY, hebrewDef); // Create the array of Dictionaries Map<Book, String> greekParse = getBookMap(BookFilters.getGreekParse()); ChoiceFactory.getDataMap().put(GREEKPARSE_KEY, greekParse); // Create the array of Dictionaries Map<Book, String> hebrewParse = getBookMap(BookFilters.getHebrewParse()); ChoiceFactory.getDataMap().put(HEBREWPARSE_KEY, hebrewParse); }