diff --git a/pom.xml b/pom.xml index ea98c7adc..2d79e3ff3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.crosswire jsword jar - 1.6.5-SNAPSHOT + 1.6.4-SNAPSHOT jsword http://maven.apache.org diff --git a/src/main/java/org/crosswire/jsword/versification/Versification.java b/src/main/java/org/crosswire/jsword/versification/Versification.java index 31addc173..9af2a8eee 100644 --- a/src/main/java/org/crosswire/jsword/versification/Versification.java +++ b/src/main/java/org/crosswire/jsword/versification/Versification.java @@ -66,8 +66,10 @@ public Versification() { * chapter. Do not include chapter 0. */ public Versification(String name, BibleBook[] booksOT, BibleBook[] booksNT, int[][] lastVerseOT, int[][] lastVerseNT) { - this.name = name; - + initializeVersification(name, booksOT, booksNT, lastVerseOT, lastVerseNT); + } + public void initializeVersification(String name, BibleBook[] booksOT, BibleBook[] booksNT, int[][] lastVerseOT, int[][] lastVerseNT) { + this.name = name; // Copy the books into an aggregated BibleBook array // including INTRO_BIBLE and INTRO_OT/INTRO_NT for non-null book lists int bookCount = 1; // Always include the INTRO_BIBLE diff --git a/src/main/java/org/crosswire/jsword/versification/custom/CustomVersification.java b/src/main/java/org/crosswire/jsword/versification/custom/CustomVersification.java index 75fa88c24..613152751 100644 --- a/src/main/java/org/crosswire/jsword/versification/custom/CustomVersification.java +++ b/src/main/java/org/crosswire/jsword/versification/custom/CustomVersification.java @@ -39,33 +39,36 @@ public void loadFromJSON(final File jsonFile) throws NoSuchKeyException, BookExc //convert json string to V11nTmp object V11nTmp v11n = objectMapper.readValue(jsonData, V11nTmp.class); - SystemCustomVersification.V11N_NAME = v11n.v11nName; + SystemCustomVersification scv = new SystemCustomVersification(); + + scv.V11N_NAME = v11n.v11nName; int vmIndex = 0; - SystemCustomVersification.BOOKS_OT = new BibleBook[v11n.otbooks.length - 1]; - SystemCustomVersification.LAST_VERSE_OT = new int[v11n.otbooks.length - 1][]; + scv.BOOKS_OT = new BibleBook[v11n.otbooks.length - 1]; + scv.LAST_VERSE_OT = new int[v11n.otbooks.length - 1][]; for(int i = 0; i < v11n.otbooks.length - 1; i++){ - SystemCustomVersification.BOOKS_OT[i] = BibleBook.fromOSIS(v11n.otbooks[i].osis); - SystemCustomVersification.LAST_VERSE_OT[i] = new int[v11n.otbooks[i].chapmax]; - System.arraycopy( v11n.vm, vmIndex, SystemCustomVersification.LAST_VERSE_OT[i], 0, v11n.otbooks[i].chapmax); + scv.BOOKS_OT[i] = BibleBook.fromOSIS(v11n.otbooks[i].osis); + scv.LAST_VERSE_OT[i] = new int[v11n.otbooks[i].chapmax]; + System.arraycopy( v11n.vm, vmIndex, scv.LAST_VERSE_OT[i], 0, v11n.otbooks[i].chapmax); vmIndex += v11n.otbooks[i].chapmax; } - SystemCustomVersification.BOOKS_NT = new BibleBook[v11n.ntbooks.length - 1]; - SystemCustomVersification.LAST_VERSE_NT = new int[v11n.ntbooks.length - 1][]; + scv.BOOKS_NT = new BibleBook[v11n.ntbooks.length - 1]; + scv.LAST_VERSE_NT = new int[v11n.ntbooks.length - 1][]; for(int i = 0; i < v11n.ntbooks.length - 1; i++){ - SystemCustomVersification.BOOKS_NT[i] = BibleBook.fromOSIS(v11n.ntbooks[i].osis); - SystemCustomVersification.LAST_VERSE_NT[i] = new int[v11n.ntbooks[i].chapmax]; - System.arraycopy( v11n.vm, vmIndex, SystemCustomVersification.LAST_VERSE_NT[i], 0, v11n.ntbooks[i].chapmax); + scv.BOOKS_NT[i] = BibleBook.fromOSIS(v11n.ntbooks[i].osis); + scv.LAST_VERSE_NT[i] = new int[v11n.ntbooks[i].chapmax]; + System.arraycopy( v11n.vm, vmIndex, scv.LAST_VERSE_NT[i], 0, v11n.ntbooks[i].chapmax); vmIndex += v11n.ntbooks[i].chapmax; } - if(!Versifications.instance().isDefined(SystemCustomVersification.V11N_NAME)) { - Versifications.instance().register(new SystemCustomVersification()); + if(!Versifications.instance().isDefined(scv.V11N_NAME)) { + scv.uodateSuper(); + Versifications.instance().register(scv); try { URI[] dirs = CWProject.instance().getProjectResourceDirs(); final File parent = new File(dirs[0]); - File mapFile = new File(parent, SystemCustomVersification.V11N_NAME + ".properties"); + File mapFile = new File(parent, scv.V11N_NAME + ".properties"); if (mapFile.exists()) mapFile.delete(); if(v11n.jsword_mappings.length > 0) { mapFile.createNewFile(); diff --git a/src/main/java/org/crosswire/jsword/versification/custom/SystemCustomVersification.java b/src/main/java/org/crosswire/jsword/versification/custom/SystemCustomVersification.java index e312ab842..d50897997 100644 --- a/src/main/java/org/crosswire/jsword/versification/custom/SystemCustomVersification.java +++ b/src/main/java/org/crosswire/jsword/versification/custom/SystemCustomVersification.java @@ -6,21 +6,25 @@ public class SystemCustomVersification extends Versification { /* protected */ SystemCustomVersification() { - super(V11N_NAME, BOOKS_OT, BOOKS_NT, LAST_VERSE_OT, LAST_VERSE_NT); + //super(V11N_NAME, BOOKS_OT, BOOKS_NT, LAST_VERSE_OT, LAST_VERSE_NT); } - public static String V11N_NAME = ""; - static BibleBook[] BOOKS_OT = { + public void uodateSuper() { + super.initializeVersification(this.V11N_NAME, BOOKS_OT, BOOKS_NT, LAST_VERSE_OT, LAST_VERSE_NT); + } + + public String V11N_NAME = ""; + BibleBook[] BOOKS_OT = { }; - static BibleBook[] BOOKS_NT = { + BibleBook[] BOOKS_NT = { }; - static int[][] LAST_VERSE_OT = { + int[][] LAST_VERSE_OT = { }; - static int[][] LAST_VERSE_NT = { + int[][] LAST_VERSE_NT = { }; - private static final long serialVersionUID = -1483944788413812511L; + //private static final long serialVersionUID = -1483944788413812511L; }