public Boolean isModuleLoaded(Module module) { if (module == null || !moduleSet.containsKey(module.getID())) { android.util.Log.i( TAG, String.format( "Books can't be loaded for an unknown module %1$s", module == null ? "" : module.getID())); return false; } return true; }
public LinkedHashMap<String, String> searchInBook( Module module, String bookID, String regQuery, BufferedReader bReader) { LinkedHashMap<String, String> searchRes = new LinkedHashMap<String, String>(); String str; int chapterNumber = module.ChapterZero ? -1 : 0; int verseNumber = 0; try { while ((str = bReader.readLine()) != null) { str = str.replaceAll("\\s(\\d)+", ""); if (str.toLowerCase().contains(module.ChapterSign)) { chapterNumber++; verseNumber = 0; } if (str.toLowerCase().contains(module.VerseSign)) verseNumber++; if (str.toLowerCase().matches(regQuery)) { OSISLink osisLink = new OSISLink( OSISLink.MOD_DATASOURCE_FS, module.getDataSourceID(), module.ShortName, bookID, chapterNumber, verseNumber); String content = StringProc.stripTags(str, module.HtmlFilter, true).replaceAll("^\\d+\\s+", ""); searchRes.put(osisLink.getPath(), content); } } } catch (IOException e) { Log.e( TAG, String.format("searchInBook(%1$s, %2$s, %3$s)", module.getID(), bookID, regQuery), e); e.printStackTrace(); } return searchRes; }