/** * Basic constructor * @param args */ public static void main(String[] args) { Book version = null; if (args.length == 0) { usage(); versions(); //System.exit(1); } List<Book> dicts = Books.installed().getBooks(BookFilters.getOnlyBibles()); version = dicts.get(0); Speed speed = new Speed(version); speed.run(); double time = speed.getBenchmark() / 1000.0; System.out.println("CBench mark for '" + version + "': " + time + "s"); }
/** * This is an example of the different ways to select a Book from the * selection available. * * @see org.crosswire.common.config.Config * @see Books */ public void pickBible() { // The Default Bible - JSword does everything it can to make this work Book book = Books.installed().getBook(BIBLE_NAME); // And you can find out more too: System.out.println(book.getLanguage()); // If you want a greater selection of Books: List<Book> books = Books.installed().getBooks(); book = books.get(0); // Or you can narrow the range a bit books = Books.installed().getBooks(BookFilters.getOnlyBibles()); book = books.get(0); // There are implementations of BookFilter for all sorts of things in // the BookFilters class // If you are wanting to get really fancy you can implement your own // BookFilter easily List<Book> test = Books.installed().getBooks(new MyBookFilter("ESV")); book = test.get(0); if (book != null) { System.out.println(book.getInitials()); } // If you want to know about new books as they arrive: Books.installed().addBooksListener(new MyBooksListener()); }
/** * 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); }