use of org.crosswire.jsword.versification.BibleBook in project BibleMultiConverter by schierlm.
the class SWORDVersification method doImport.
@Override
public void doImport(VersificationSet versifications, String... importArgs) throws Exception {
org.crosswire.jsword.versification.Versification v11n_kjv = Versifications.instance().getVersification(SystemKJV.V11N_NAME);
Map<BookID, BibleBook> reverseBookMapping = new EnumMap<>(BookID.class);
for (Map.Entry<BibleBook, BookID> entry : BookMapping.MAPPING.entrySet()) {
reverseBookMapping.put(entry.getValue(), entry.getKey());
}
for (String versificationName : SWORDVersificationDetector.ALL_V11N_NAMES) {
System.out.println("--- " + versificationName + " ---");
org.crosswire.jsword.versification.Versification v11n = Versifications.instance().getVersification(versificationName);
LinkedHashMap<BookID, int[]> verseCounts = new LinkedHashMap<>();
for (Iterator<BibleBook> it = v11n.getBookIterator(); it.hasNext(); ) {
BibleBook bb = (BibleBook) it.next();
int[] chapters = new int[v11n.getLastChapter(bb)];
if (chapters.length == 0)
continue;
verseCounts.put(BookMapping.MAPPING.get(bb), chapters);
for (int j = 1; j <= v11n.getLastChapter(bb); j++) {
chapters[j - 1] = v11n.getLastVerse(bb, j);
}
}
versifications.getVersifications().add(Versification.fromVerseCounts("SWORD_" + versificationName, null, null, verseCounts));
if (!versificationName.equals(SystemKJV.V11N_NAME) && !missingMappings.contains(versificationName)) {
buildMapping(versifications, SystemKJV.V11N_NAME, v11n_kjv, versificationName, v11n, reverseBookMapping);
buildMapping(versifications, versificationName, v11n, SystemKJV.V11N_NAME, v11n_kjv, reverseBookMapping);
}
}
}
use of org.crosswire.jsword.versification.BibleBook in project BibleMultiConverter by schierlm.
the class SWORDVersificationDetector method loadSchemes.
@Override
protected VersificationScheme[] loadSchemes() throws IOException {
// parse header
VersificationScheme[] result = new VersificationScheme[ALL_V11N_NAMES.length];
for (int i = 0; i < result.length; i++) {
EnumMap<BookID, BitSet[]> coveredBooks = new EnumMap<BookID, BitSet[]>(BookID.class);
Versification v11n = Versifications.instance().getVersification(ALL_V11N_NAMES[i]);
for (Iterator<BibleBook> it = v11n.getBookIterator(); it.hasNext(); ) {
BibleBook bb = (BibleBook) it.next();
BitSet[] chapters = new BitSet[v11n.getLastChapter(bb)];
coveredBooks.put(BookMapping.MAPPING.get(bb), chapters);
for (int j = 1; j <= v11n.getLastChapter(bb); j++) {
chapters[j - 1] = new BitSet();
chapters[j - 1].set(1, v11n.getLastVerse(bb, j) + 1);
}
}
result[i] = new VersificationScheme(ALL_V11N_NAMES[i], coveredBooks);
}
return result;
}
Aggregations