[jsword-svn] r2201 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book bibledesktop/src/main/java/org/crosswire/bibledesktop/passage jsword/src/main/java/org/crosswire/jsword/book/sword jsword/src/main/java/org/crosswire/jsword/passage jsword/src/main/java/org/crosswire/jsword/versification jsword/src/test/java/org/crosswire/jsword/passage

dmsmith at crosswire.org dmsmith at crosswire.org
Sat Jan 7 16:53:08 MST 2012


Author: dmsmith
Date: 2012-01-07 16:53:07 -0700 (Sat, 07 Jan 2012)
New Revision: 2201

Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModel.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModelSet.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/WholeBibleTreeNode.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawFileBackend.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/AccuracyType.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/RestrictionType.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleBook.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/ReferenceSystem.java
   trunk/jsword/src/test/java/org/crosswire/jsword/passage/BibleInfoTest.java
   trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageParentTst.java
   trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageUtilTest.java
   trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java
Log:
Continued work on av11n. Verse no longer throws NoSuchVerseException, as every place in the code was ignoring the exception.

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModel.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModel.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModel.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -28,7 +28,6 @@
 import javax.swing.ComboBoxModel;
 
 import org.crosswire.common.util.Logger;
-import org.crosswire.jsword.passage.NoSuchVerseException;
 import org.crosswire.jsword.passage.Verse;
 import org.crosswire.jsword.versification.BibleBook;
 import org.crosswire.jsword.versification.BibleInfo;
@@ -70,11 +69,7 @@
 
         switch (level) {
         case BOOK:
-            try {
-                selected = set.getVerse().getBook().getBookName();
-            } catch (NoSuchVerseException ex) {
-                assert false : ex;
-            }
+            selected = set.getVerse().getBook().getBookName();
             break;
 
         case CHAPTER:
@@ -174,54 +169,42 @@
      * Accessor for the book
      */
     public void setBook(BibleBook book) {
-        try {
-            // Try to honor current chapter and verse
-            // Use 1 if it is not possible
-            Verse old = set.getVerse();
-            int chapter = old.getChapter();
-            int verse = old.getVerse();
+        // Try to honor current chapter and verse
+        // Use 1 if it is not possible
+        Verse old = set.getVerse();
+        int chapter = old.getChapter();
+        int verse = old.getVerse();
 
-            chapter = Math.min(chapter, BibleInfo.chaptersInBook(book));
-            verse = Math.min(verse, BibleInfo.versesInChapter(book, chapter));
+        chapter = Math.min(chapter, BibleInfo.chaptersInBook(book));
+        verse = Math.min(verse, BibleInfo.versesInChapter(book, chapter));
 
-            Verse update = new Verse(book, chapter, verse);
-            set.setVerse(update);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-        }
+        Verse update = new Verse(book, chapter, verse);
+        set.setVerse(update);
     }
 
     /**
      * Accessor for the chapter
      */
     public void setChapter(int chapter) {
-        try {
-            // Try to honor current verse
-            // Use 1 if it is not possible
-            Verse old = set.getVerse();
-            BibleBook book = old.getBook();
-            int verse = old.getVerse();
+        // Try to honor current verse
+        // Use 1 if it is not possible
+        Verse old = set.getVerse();
+        BibleBook book = old.getBook();
+        int verse = old.getVerse();
 
-            verse = Math.min(verse, BibleInfo.versesInChapter(book, chapter));
+        verse = Math.min(verse, BibleInfo.versesInChapter(book, chapter));
 
-            Verse update = new Verse(book, chapter, verse);
-            set.setVerse(update);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-        }
+        Verse update = new Verse(book, chapter, verse);
+        set.setVerse(update);
     }
 
     /**
      * Accessor for the chapter
      */
     public void setVerse(int verse) {
-        try {
-            Verse old = set.getVerse();
-            Verse update = new Verse(old.getBook(), old.getChapter(), verse);
-            set.setVerse(update);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-        }
+        Verse old = set.getVerse();
+        Verse update = new Verse(old.getBook(), old.getChapter(), verse);
+        set.setVerse(update);
     }
 
     /*

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModelSet.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModelSet.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModelSet.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -33,7 +33,6 @@
 import javax.swing.event.EventListenerList;
 
 import org.crosswire.common.swing.NumberCellRenderer;
-import org.crosswire.jsword.passage.NoSuchVerseException;
 import org.crosswire.jsword.passage.Verse;
 import org.crosswire.jsword.versification.BibleBook;
 import org.crosswire.jsword.versification.BookName;
@@ -73,11 +72,7 @@
         cboBook.addItemListener(cil);
         cboBook.setRenderer(new BibleNameCellRenderer(true));
 
-        try {
-            cboBook.setToolTipText(verse.getBook().getLongName());
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-        }
+        cboBook.setToolTipText(verse.getBook().getLongName());
     }
 
     /**
@@ -121,34 +116,30 @@
             return;
         }
 
-        try {
-            Verse oldverse = verse;
-            verse = newverse;
-            BibleBook bookval = newverse.getBook();
-            BookName bookName = bookval.getBookName();
-            if (oldverse.getBook() != bookval || !cboBook.getSelectedItem().equals(bookName)) {
-                cboBook.setSelectedItem(bookName);
-                cboBook.setToolTipText(bookName.getLongName());
-            }
+        Verse oldverse = verse;
+        verse = newverse;
+        BibleBook bookval = newverse.getBook();
+        BookName bookName = bookval.getBookName();
+        if (oldverse.getBook() != bookval || !cboBook.getSelectedItem().equals(bookName)) {
+            cboBook.setSelectedItem(bookName);
+            cboBook.setToolTipText(bookName.getLongName());
+        }
 
-            int chapterval = newverse.getChapter();
-            Integer chapternum = Integer.valueOf(chapterval);
-            if (oldverse.getChapter() != chapterval || !cboChapter.getSelectedItem().equals(chapternum)) {
-                cboChapter.setSelectedItem(chapternum);
-            }
+        int chapterval = newverse.getChapter();
+        Integer chapternum = Integer.valueOf(chapterval);
+        if (oldverse.getChapter() != chapterval || !cboChapter.getSelectedItem().equals(chapternum)) {
+            cboChapter.setSelectedItem(chapternum);
+        }
 
-            if (cboVerse != null) {
-                int verseval = newverse.getVerse();
-                Integer versenum = Integer.valueOf(verseval);
-                if (oldverse.getVerse() != verseval || !cboVerse.getSelectedItem().equals(versenum)) {
-                    cboVerse.setSelectedItem(versenum);
-                }
+        if (cboVerse != null) {
+            int verseval = newverse.getVerse();
+            Integer versenum = Integer.valueOf(verseval);
+            if (oldverse.getVerse() != verseval || !cboVerse.getSelectedItem().equals(versenum)) {
+                cboVerse.setSelectedItem(versenum);
             }
-
-            fireContentsChanged();
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
         }
+
+        fireContentsChanged();
     }
 
     /**

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -67,7 +67,6 @@
 import org.crosswire.jsword.index.search.DefaultSearchRequest;
 import org.crosswire.jsword.passage.Key;
 import org.crosswire.jsword.passage.NoSuchKeyException;
-import org.crosswire.jsword.passage.NoSuchVerseException;
 import org.crosswire.jsword.passage.PassageTally;
 import org.crosswire.jsword.passage.RocketPassage;
 import org.crosswire.jsword.passage.Verse;
@@ -134,14 +133,10 @@
                 Verse start = set.getVerse();
                 BibleBook book = start.getBook();
                 int chapter = start.getChapter();
-                try {
-                    VerseRange range = new VerseRange(start, new Verse(book, chapter, BibleInfo.versesInChapter(book, chapter)));
-                    txtSearch.setText("");
-                    txtKey.setText(range.getName());
-                    doGoPassage();
-                } catch (NoSuchVerseException ex) {
-                    assert false : ex;
-                }
+                VerseRange range = new VerseRange(start, new Verse(book, chapter, BibleInfo.versesInChapter(book, chapter)));
+                txtSearch.setText("");
+                txtKey.setText(range.getName());
+                doGoPassage();
             }
         });
 
@@ -280,14 +275,10 @@
         Verse start = quickSet.getVerse();
         BibleBook book = start.getBook();
         int chapter = start.getChapter();
-        try {
-            VerseRange range = new VerseRange(start, new Verse(book, chapter, BibleInfo.versesInChapter(book, chapter)));
-            txtSearch.setText("");
-            txtKey.setText(range.getName());
-            doGoPassage();
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-        }
+        VerseRange range = new VerseRange(start, new Verse(book, chapter, BibleInfo.versesInChapter(book, chapter)));
+        txtSearch.setText("");
+        txtKey.setText(range.getName());
+        doGoPassage();
     }
 
     /**

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/WholeBibleTreeNode.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/WholeBibleTreeNode.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/WholeBibleTreeNode.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -27,7 +27,6 @@
 
 import org.crosswire.bibledesktop.BDMsg;
 import org.crosswire.common.icu.NumberShaper;
-import org.crosswire.jsword.passage.NoSuchVerseException;
 import org.crosswire.jsword.passage.Verse;
 import org.crosswire.jsword.passage.VerseRange;
 import org.crosswire.jsword.versification.BibleBook;
@@ -52,36 +51,31 @@
      * We could do some caching here if needs be.
      */
     protected static WholeBibleTreeNode getNode(TreeNode parent, BibleBook b, int c, int v) {
-        try {
-            Verse start = null;
-            Verse end = null;
-            Level thislevel = Level.BOOK;
+        Verse start = null;
+        Verse end = null;
+        Level thislevel = Level.BOOK;
 
-            if (b == null) {
-                assert false : b;
-            } else if (c == -1) {
-                thislevel = Level.BOOK;
-                int ec = BibleInfo.chaptersInBook(b);
-                int ev = BibleInfo.versesInChapter(b, ec);
-                start = new Verse(b, 1, 1);
-                end = new Verse(b, ec, ev);
-            } else if (v == -1) {
-                thislevel = Level.CHAPTER;
-                int ev = BibleInfo.versesInChapter(b, c);
-                start = new Verse(b, c, 1);
-                end = new Verse(b, c, ev);
-            } else {
-                thislevel = Level.VERSE;
-                start = new Verse(b, c, v);
-                end = start;
-            }
-
-            VerseRange rng = new VerseRange(start, end);
-            return new WholeBibleTreeNode(parent, rng, thislevel);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            return null;
+        if (b == null) {
+            assert false : b;
+        } else if (c == -1) {
+            thislevel = Level.BOOK;
+            int ec = BibleInfo.chaptersInBook(b);
+            int ev = BibleInfo.versesInChapter(b, ec);
+            start = new Verse(b, 1, 1);
+            end = new Verse(b, ec, ev);
+        } else if (v == -1) {
+            thislevel = Level.CHAPTER;
+            int ev = BibleInfo.versesInChapter(b, c);
+            start = new Verse(b, c, 1);
+            end = new Verse(b, c, ev);
+        } else {
+            thislevel = Level.VERSE;
+            start = new Verse(b, c, v);
+            end = start;
         }
+
+        VerseRange rng = new VerseRange(start, end);
+        return new WholeBibleTreeNode(parent, rng, thislevel);
     }
 
     /**
@@ -132,28 +126,23 @@
      */
     @Override
     public String toString() {
-        try {
-            switch (level) {
-            case BIBLE:
-                // TRANSLATOR: The top level of the tree of Bible books, chapters and verses.
-                return BDMsg.gettext("The Bible");
+        switch (level) {
+        case BIBLE:
+            // TRANSLATOR: The top level of the tree of Bible books, chapters and verses.
+            return BDMsg.gettext("The Bible");
 
-            case BOOK:
-                return range.getStart().getBook().getPreferredName();
+        case BOOK:
+            return range.getStart().getBook().getPreferredName();
 
-            case CHAPTER:
-                return shaper.shape(Integer.toString(range.getStart().getChapter()));
+        case CHAPTER:
+            return shaper.shape(Integer.toString(range.getStart().getChapter()));
 
-            case VERSE:
-                return shaper.shape(Integer.toString(range.getStart().getVerse()));
+        case VERSE:
+            return shaper.shape(Integer.toString(range.getStart().getVerse()));
 
-            default:
-                // TRANSLATOR: Unexpected error condition.
-                return BDMsg.gettext("Error");
-            }
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            return "!Error!";
+        default:
+            // TRANSLATOR: Unexpected error condition.
+            return BDMsg.gettext("Error");
         }
     }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawFileBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawFileBackend.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawFileBackend.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -14,7 +14,7 @@
  *      59 Temple Place - Suite 330
  *      Boston, MA 02111-1307, USA
  *
- * Copyright: 2009
+ * Copyright: 2009-2012
  *     The copyright to this program is held by it's authors.
  *
  * ID: $Id$
@@ -40,10 +40,31 @@
 
 /**
  * A Raw File format that allows for each verse to have it's own storage.
+ * The basic structure of the index is as follows:
+ * <ul>
+ * <li><strong>incfile</strong> --
+ *      Is initialized with 1 and is incremented once for each non-linked verse
+ *      that is actually stored in the Book.</li>
+ * <li><strong>idx</strong> --
+ *      There is one index file for each testament having verses, named nt and ot.
+ *      These index files contain offsets into the corresponding data file.
+ *      The idx files are indexed by the ordinal value of the verse within the Testament
+ *      for the Book's versification.</li>
+ * <li><strong>dat</strong> --
+ *      There is a data file for each testament having verses, named nt.vss and ot.vss.
+ *      These data files do not contain the verses but rather the file names that
+ *      contain the verse text.</li>
+ * <li><strong>verse</strong> --
+ *      For each stored verse there is a file containing the verse text.
+ *      The filename is a zero padded number corresponding to the current increment
+ *      from incfile, when it was created. It is this 7 character name that is stored
+ *      in a dat file.</li>
+ * </ul>
  * 
  * @see gnu.lgpl.License for license details.<br>
  *      The copyright to this program is held by it's authors.
  * @author mbergmann
+ * @author DM Smith [dmsmith555 at yahoo dot com]
  */
 public class RawFileBackend extends RawBackend {
 
@@ -73,7 +94,7 @@
     protected String getEntry(String name, Testament testament, long index) throws IOException {
         RandomAccessFile idxRaf = otIdxRaf;
         RandomAccessFile txtRaf = otTxtRaf;
-        if (testament == Testament.OLD) {
+        if (testament == Testament.NEW) {
             idxRaf = ntIdxRaf;
             txtRaf = ntTxtRaf;
         }
@@ -119,14 +140,13 @@
             txtFile = ntTxtFile;
         }
 
-        int oIndex = verse.getOrdinal() - 1;
-
         DataIndex dataIndex = getIndex(idxRaf, index);
         File dataFile;
         if (dataIndex.getSize() == 0) {
-            dataFile = createDataTextFile(oIndex);
+            dataFile = createDataTextFile(incfileValue);
             updateIndexFile(idxRaf, index, txtRaf.length());
-            updateDataFile(oIndex, txtFile);
+            updateDataFile(incfileValue, txtFile);
+            checkAndIncrementIncfile(incfileValue);
         } else {
             dataFile = getDataTextFile(txtRaf, dataIndex);
         }
@@ -134,8 +154,6 @@
         byte[] textData = text.getBytes("UTF-8");
         encipher(textData);
         writeTextDataFile(dataFile, textData);
-
-        checkAndIncrementIncfile(oIndex);
     }
 
     @Override
@@ -146,21 +164,16 @@
         Testament testament = BibleInfo.getTestament(aliasIndex);
         aliasIndex = BibleInfo.getTestamentOrdinal(aliasIndex);
         RandomAccessFile idxRaf = otIdxRaf;
-        RandomAccessFile txtRaf = otTxtRaf;
-        File txtFile = otTxtFile;
         if (testament == Testament.NEW) {
             idxRaf = ntIdxRaf;
-            txtRaf = ntTxtRaf;
-            txtFile = ntTxtFile;
         }
 
-        int aliasOIndex = aliasVerse.getOrdinal() - 1;
-        int sourceOIndex = sourceVerse.getOrdinal() - 1;
+        int sourceOIndex = sourceVerse.getOrdinal();
+        sourceOIndex = BibleInfo.getTestamentOrdinal(sourceOIndex);
+        DataIndex dataIndex = getIndex(idxRaf, sourceOIndex);
 
-        updateIndexFile(idxRaf, aliasIndex, txtRaf.length());
-        updateDataFile(sourceOIndex, txtFile);
-
-        checkAndIncrementIncfile(aliasOIndex);
+        // Only the index is updated to point to the same place as what is linked.
+        updateIndexFile(idxRaf, aliasIndex, dataIndex.getOffset());
     }
 
     private void initIncFile() {
@@ -184,23 +197,42 @@
         return dataFile;
     }
 
-    private File getDataTextFile(RandomAccessFile txtRaf, DataIndex dataIndex) throws IOException, BookException {
-        File dataFile;
+    /**
+     * Gets the Filename for the File having the verse text.
+     * 
+     * @param txtRaf The random access file containing the file names for the verse storage.
+     * @param dataIndex The index of where to get the data
+     * @return the file having the verse text.
+     * @throws IOException
+     */
+    private String getTextFilename(RandomAccessFile txtRaf, DataIndex dataIndex) throws IOException {
         // data size to be read from the data file (ot or nt) should be 9 bytes
         // this will be the filename of the actual text file "\r\n"
         byte[] data = SwordUtil.readRAF(txtRaf, dataIndex.getOffset(), dataIndex.getSize());
         decipher(data);
         if (data.length == 7) {
-            String dataFilename = new String(data, 0, 7);
-            String dataPath = getExpandedDataPath().getPath() + File.separator + dataFilename;
-            dataFile = new File(dataPath);
-        } else {
-            log.error("Read data is not of appropriate size of 9 bytes!");
-            throw new IOException("Datalength is not 9 bytes!");
+            return new String(data, 0, 7);
         }
-        return dataFile;
+        log.error("Read data is not of appropriate size of 9 bytes!");
+        throw new IOException("Datalength is not 9 bytes!");
     }
 
+    /**
+     * Gets the File having the verse text.
+     * 
+     * @param txtRaf The random access file containing the file names for the verse storage.
+     * @param dataIndex The index of where to get the data
+     * @return the file having the verse text.
+     * @throws IOException
+     * @throws BookException
+     */
+    private File getDataTextFile(RandomAccessFile txtRaf, DataIndex dataIndex) throws IOException, BookException {
+        String dataFilename = getTextFilename(txtRaf, dataIndex);
+        String dataPath = getExpandedDataPath().getPath() + File.separator + dataFilename;
+        return new File(dataPath);
+    }
+
+
     protected void updateIndexFile(RandomAccessFile idxRaf, long index, long dataFileStartPosition) throws IOException {
         long indexFileWriteOffset = index * entrysize;
         int dataFileLengthValue = 7; // filename is 7 bytes + 2 bytes for "\r\n"

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -1219,40 +1219,36 @@
         raiseEventSuppresion();
         raiseNormalizeProtection();
 
-        try {
-            int type = is.readInt();
-            switch (type) {
-            case BITWISE:
-                BitSet store = (BitSet) is.readObject();
-                for (int i = 0; i < BibleInfo.maximumOrdinal(); i++) {
-                    if (store.get(i)) {
-                        add(new Verse(i + 1));
-                    }
+        int type = is.readInt();
+        switch (type) {
+        case BITWISE:
+            BitSet store = (BitSet) is.readObject();
+            for (int i = 0; i < BibleInfo.maximumOrdinal(); i++) {
+                if (store.get(i)) {
+                    add(BibleInfo.decodeOrdinal(i + 1));
                 }
-                break;
+            }
+            break;
 
-            case DISTINCT:
-                int verses = is.readInt();
-                for (int i = 0; i < verses; i++) {
-                    int ord = is.readInt();
-                    add(new Verse(ord));
-                }
-                break;
+        case DISTINCT:
+            int verses = is.readInt();
+            for (int i = 0; i < verses; i++) {
+                int ord = is.readInt();
+                add(BibleInfo.decodeOrdinal(ord));
+            }
+            break;
 
-            case RANGED:
-                int ranges = is.readInt();
-                for (int i = 0; i < ranges; i++) {
-                    int ord = is.readInt();
-                    int count = is.readInt();
-                    add(RestrictionType.NONE.toRange(new Verse(ord), count));
-                }
-                break;
-
-            default:
-                throw new ClassCastException(JSOtherMsg.lookupText("Can only use Verses and VerseRanges in this Collection"));
+        case RANGED:
+            int ranges = is.readInt();
+            for (int i = 0; i < ranges; i++) {
+                int ord = is.readInt();
+                int count = is.readInt();
+                add(RestrictionType.NONE.toRange(BibleInfo.decodeOrdinal(ord), count));
             }
-        } catch (NoSuchVerseException ex) {
-            throw new IOException(ex.getMessage());
+            break;
+
+        default:
+            throw new ClassCastException(JSOtherMsg.lookupText("Can only use Verses and VerseRanges in this Collection"));
         }
 
         // We are ignoring the originalName. It was set to null in the

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AccuracyType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AccuracyType.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AccuracyType.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -121,11 +121,11 @@
 
         @Override
         public Verse createEndVerse(String endVerseDesc, Verse verseBasis, String[] endParts) throws NoSuchVerseException {
-            // Very similar to the start verse but we want the end of the
-            // chapter
-            Verse end = createStartVerse(endVerseDesc, null, endParts);
-            // except that this gives us end at verse 1, and not the book end
-            return end.getLastVerseInChapter();
+            // Very similar to the start verse but we want the end of the chapter
+            BibleBook book = BibleBook.getBook(endParts[0]);
+            int chapter = getChapter(book, endParts[1]);
+            int verse = BibleInfo.versesInChapter(book, chapter);
+            return new Verse(endVerseDesc, book, chapter, verse);
         }
     },
 
@@ -147,12 +147,10 @@
 
         @Override
         public Verse createEndVerse(String endVerseDesc, Verse verseBasis, String[] endParts) throws NoSuchVerseException {
-            // And we end with a book, so we need to encompass the lot
-            // For example "Gen 3-Exo"
-            // Very similar to the start verse but we want the end of the book
-            Verse end = createStartVerse(endVerseDesc, null, endParts);
-            // except that this gives us end at 1:1, and not the book end
-            return end.getLastVerseInBook();
+            BibleBook book = BibleBook.getBook(endParts[0]);
+            int chapter = BibleInfo.chaptersInBook(book);
+            int verse = BibleInfo.versesInChapter(book, chapter);
+            return new Verse(endVerseDesc, book, chapter, verse);
         }
     },
 
@@ -215,7 +213,7 @@
             // and it gets the end of the chapter
             BibleBook book = verseBasis.getBook();
             int chapter = getChapter(book, endParts[0]);
-            return new Verse(endVerseDesc, book, chapter, 0).getLastVerseInChapter();
+            return new Verse(endVerseDesc, book, chapter, BibleInfo.versesInChapter(book, chapter));
         }
     },
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/BitwisePassage.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -298,19 +298,14 @@
          * @see java.util.Iterator#next()
          */
         public Key next() throws NoSuchElementException {
-            try {
-                if (!hasNext()) {
-                    throw new NoSuchElementException();
-                }
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
 
-                Key retcode = new Verse(next);
-                calculateNext();
+            Key retcode = BibleInfo.decodeOrdinal(next);
+            calculateNext();
 
-                return retcode;
-            } catch (NoSuchVerseException ex) {
-                assert false;
-                return null;
-            }
+            return retcode;
         }
 
         /* (non-Javadoc)

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageKeyFactory.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -272,7 +272,7 @@
                 int bit = (ord % 8) - 1;
 
                 if ((buffer[idx0] & (1 << bit)) != 0) {
-                    ref.add(new Verse(ord));
+                    ref.add(BibleInfo.decodeOrdinal(ord));
                 }
             }
             // index gets left behind here, but we dont care
@@ -282,7 +282,7 @@
             int verses = fromBinary(buffer, index, BibleInfo.maximumOrdinal());
             for (int i = 0; i < verses; i++) {
                 int ord = fromBinary(buffer, index, BibleInfo.maximumOrdinal());
-                ref.add(new Verse(ord));
+                ref.add(BibleInfo.decodeOrdinal(ord));
             }
             break;
 
@@ -291,7 +291,7 @@
             for (int i = 0; i < ranges; i++) {
                 int ord = fromBinary(buffer, index, BibleInfo.maximumOrdinal());
                 int len = fromBinary(buffer, index, BibleInfo.maximumOrdinal());
-                ref.add(RestrictionType.NONE.toRange(new Verse(ord), len));
+                ref.add(RestrictionType.NONE.toRange(BibleInfo.decodeOrdinal(ord), len));
             }
             break;
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageTally.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -15,7 +15,7 @@
  *      Boston, MA 02111-1307, USA
  *
  * Copyright: 2005
- *     The copyright to this program is held by it's authors.
+ *     The copyright to this program is held by it's authors. 
  *
  * ID: $Id$
  */
@@ -315,7 +315,7 @@
     public boolean contains(Key that) {
         for (Key aKey : that) {
             Verse verse = (Verse) aKey;
-            if (board[verse.getOrdinal() - 1] == 0) {
+            if (board[verse.getOrdinal()] == 0) {
                 return false;
             }
         }
@@ -331,7 +331,7 @@
      * @return The rank of the verse in question
      */
     public int getTallyOf(Verse verse) {
-        return board[verse.getOrdinal() - 1];
+        return board[verse.getOrdinal()];
     }
 
     /**
@@ -342,7 +342,7 @@
      * @return The index of the verse or -1 if the verse was not found
      */
     public int getIndexOf(Verse verse) {
-        int pos = verse.getOrdinal() - 1;
+        int pos = verse.getOrdinal();
         int tally = board[pos];
         return tally > 0 ? pos : -1;
     }
@@ -447,7 +447,7 @@
 
             int vib = BibleInfo.maximumOrdinal();
             for (int i = 0; i < vib; i++) {
-                increment(i, -that_rt.board[i - 1]);
+                increment(i, -that_rt.board[i]);
             }
         } else {
             for (Key aKey : that) {
@@ -675,19 +675,19 @@
      *            The amount to increase by
      */
     private void increment(int ord, int tally) {
-        boolean exists = board[ord - 1] > 0;
-        board[ord - 1] += tally;
-        if (board[ord - 1] > MAX_TALLY) {
-            board[ord - 1] = MAX_TALLY;
+        boolean exists = board[ord] > 0;
+        board[ord] += tally;
+        if (board[ord] > MAX_TALLY) {
+            board[ord] = MAX_TALLY;
         }
-        if (board[ord - 1] < 0) {
-            board[ord - 1] = 0;
+        if (board[ord] < 0) {
+            board[ord] = 0;
         }
 
         // Recompute the size
-        if (exists && board[ord - 1] == 0) {
+        if (exists && board[ord] == 0) {
             size--;
-        } else if (!exists && board[ord - 1] > 0) {
+        } else if (!exists && board[ord] > 0) {
             size++;
         }
     }
@@ -715,11 +715,11 @@
      *            The verse to increment
      */
     private void kill(int ord) {
-        if (board[ord - 1] > 0) {
+        if (board[ord] > 0) {
             size--;
         }
 
-        board[ord - 1] = 0;
+        board[ord] = 0;
     }
 
     public enum Order {
@@ -752,7 +752,7 @@
     /**
      * The tally board itself
      */
-    protected int[] board = new int[BibleInfo.maximumOrdinal()];
+    protected int[] board = new int[BibleInfo.maximumOrdinal() + 1];
 
     /**
      * The maximum tally possible
@@ -798,19 +798,14 @@
          * @see java.util.Iterator#next()
          */
         public Key next() throws NoSuchElementException {
-            try {
-                if (next > BibleInfo.maximumOrdinal()) {
-                    throw new NoSuchElementException();
-                }
+            if (next > BibleInfo.maximumOrdinal()) {
+                throw new NoSuchElementException();
+            }
 
-                Key retcode = new Verse(next);
-                calculateNext();
+            Key retcode = BibleInfo.decodeOrdinal(next);
+            calculateNext();
 
-                return retcode;
-            } catch (NoSuchVerseException ex) {
-                assert false : ex;
-                return Verse.DEFAULT;
-            }
+            return retcode;
         }
 
         /* (non-Javadoc)
@@ -826,7 +821,7 @@
         private void calculateNext() {
             do {
                 next++;
-            } while (next <= BibleInfo.maximumOrdinal() && board[next - 1] == 0);
+            } while (next <= BibleInfo.maximumOrdinal() && board[next] == 0);
         }
 
         /** What is the next Verse to be considered */
@@ -867,13 +862,8 @@
          * @see java.util.Iterator#next()
          */
         public Key next() throws NoSuchElementException {
-            try {
-                last = it.next();
-                return new Verse(last.ord);
-            } catch (NoSuchVerseException ex) {
-                assert false : ex;
-                return Verse.DEFAULT;
-            }
+            last = it.next();
+            return BibleInfo.decodeOrdinal(last.ord);
         }
 
         /* (non-Javadoc)
@@ -993,7 +983,7 @@
                 int rank = 0;
                 for (Key aKey : range) {
                     Verse verse = (Verse) aKey;
-                    int temp = board[verse.getOrdinal() - 1];
+                    int temp = board[verse.getOrdinal()];
                     if (temp > rank) {
                         rank = temp;
                     }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/RangedPassage.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -29,6 +29,8 @@
 import java.util.Set;
 import java.util.TreeSet;
 
+import org.crosswire.jsword.versification.BibleInfo;
+
 /**
  * A Passage that is implemented using a TreeSet of VerseRanges. The attributes
  * of the style are:
@@ -325,21 +327,17 @@
          * Passages iterator, with remove() overridden.
          */
         public VerseIterator(Iterator<Key> it) {
-            try {
-                Set<Key> temp = new TreeSet<Key>();
+            Set<Key> temp = new TreeSet<Key>();
 
-                while (it.hasNext()) {
-                    VerseRange range = (VerseRange) it.next();
+            while (it.hasNext()) {
+                VerseRange range = (VerseRange) it.next();
 
-                    for (int i = 0; i < range.getCardinality(); i++) {
-                        temp.add(new Verse(range.getStart().getOrdinal() + i));
-                    }
+                for (int i = 0; i < range.getCardinality(); i++) {
+                    temp.add(BibleInfo.decodeOrdinal(range.getStart().getOrdinal() + i));
                 }
-
-                real = temp.iterator();
-            } catch (NoSuchVerseException ex) {
-                assert false : ex;
             }
+
+            real = temp.iterator();
         }
 
         /* (non-Javadoc)

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/RestrictionType.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/RestrictionType.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/RestrictionType.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -77,27 +77,22 @@
 
         @Override
         public VerseRange blur(VerseRange range, int blurDown, int blurUp) {
-            try {
-                Verse start = range.getStart();
-                BibleBook startBook = start.getBook();
-                int startChapter = start.getChapter();
-                int startVerse = start.getVerse() - blurDown;
+            Verse start = range.getStart();
+            BibleBook startBook = start.getBook();
+            int startChapter = start.getChapter();
+            int startVerse = start.getVerse() - blurDown;
 
-                Verse end = range.getEnd();
-                BibleBook endBook = end.getBook();
-                int endChapter = end.getChapter();
-                int endVerse = end.getVerse() + blurUp;
+            Verse end = range.getEnd();
+            BibleBook endBook = end.getBook();
+            int endChapter = end.getChapter();
+            int endVerse = end.getVerse() + blurUp;
 
-                startVerse = Math.max(startVerse, 1);
-                endVerse = Math.min(endVerse, BibleInfo.versesInChapter(endBook, endChapter));
+            startVerse = Math.max(startVerse, 1);
+            endVerse = Math.min(endVerse, BibleInfo.versesInChapter(endBook, endChapter));
 
-                Verse newStart = new Verse(startBook, startChapter, startVerse);
-                Verse newEnd = new Verse(endBook, endChapter, endVerse);
-                return new VerseRange(newStart, newEnd);
-            } catch (NoSuchVerseException ex) {
-                assert false : ex;
-                return null;
-            }
+            Verse newStart = new Verse(startBook, startChapter, startVerse);
+            Verse newEnd = new Verse(endBook, endChapter, endVerse);
+            return new VerseRange(newStart, newEnd);
         }
 
         @Override

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -76,10 +76,8 @@
      *            The chapter number
      * @param verse
      *            The verse number
-     * @exception NoSuchVerseException
-     *                If the reference is illegal
      */
-    /* package */Verse(String original, BibleBook book, int chapter, int verse) throws NoSuchVerseException {
+    /* package */Verse(String original, BibleBook book, int chapter, int verse) {
         originalName = original;
         set(book, chapter, verse);
     }
@@ -94,10 +92,8 @@
      *            The chapter number
      * @param verse
      *            The verse number
-     * @exception NoSuchVerseException
-     *                If the reference is illegal
      */
-    public Verse(BibleBook book, int chapter, int verse) throws NoSuchVerseException {
+    public Verse(BibleBook book, int chapter, int verse) {
         this(null, book, chapter, verse);
     }
 
@@ -138,10 +134,8 @@
      * 
      * @param ordinal
      *            The verse id
-     * @exception NoSuchVerseException
-     *                If the reference is illegal
      */
-    public Verse(int ordinal) throws NoSuchVerseException {
+    public Verse(int ordinal) {
         originalName = null;
         set(ordinal);
     }
@@ -166,34 +160,24 @@
             return getName();
         }
 
-        try {
-            if (PassageUtil.isPersistentNaming() && originalName != null) {
-                return originalName;
-            }
+        if (PassageUtil.isPersistentNaming() && originalName != null) {
+            return originalName;
+        }
 
-            String verseName = doGetName((Verse) base);
-            // Only shape it if it can be unshaped.
-            if (shaper.canUnshape()) {
-                return shaper.shape(verseName);
-            }
-
-            return verseName;
-        } catch (NoSuchKeyException ex) {
-            assert false : ex;
-            return "!Error!";
+        String verseName = doGetName((Verse) base);
+        // Only shape it if it can be unshaped.
+        if (shaper.canUnshape()) {
+            return shaper.shape(verseName);
         }
+
+        return verseName;
     }
 
     /* (non-Javadoc)
      * @see org.crosswire.jsword.passage.Key#getRootName()
      */
     public String getRootName() {
-        try {
-            return book.getShortName();
-        } catch (NoSuchKeyException ex) {
-            assert false : ex;
-            return "!Error!";
-        }
+        return book.getShortName();
     }
 
     /* (non-Javadoc)
@@ -300,15 +284,15 @@
 
     /**
      * How many verses are there in between the 2 Verses. The answer is -ve if
-     * that is bigger than this. The answer is inclusive of that and exclusive
-     * of this, so that <code>gen11.subtract(gen12) == 1</code>
+     * start is bigger than this (the end). The answer is inclusive of start and exclusive
+     * of this, so that <code>gen12.subtract(gen11) == 1</code>
      * 
-     * @param that
+     * @param start
      *            The Verse to compare this to
      * @return The count of verses between this and that.
      */
-    public int subtract(Verse that) {
-        return getOrdinal() - that.getOrdinal();
+    public int subtract(Verse start) {
+        return getOrdinal() - start.getOrdinal();
     }
 
     /**
@@ -319,30 +303,18 @@
      * @return The new Verse
      */
     public Verse subtract(int n) {
-        try {
-            int new_ordinal = Math.max(getOrdinal() - n, 1);
-            return new Verse(new_ordinal);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            return Verse.DEFAULT;
-        }
+        return BibleInfo.decodeOrdinal(getOrdinal() - n);
     }
 
     /**
      * Get the verse that is a few verses on from the one we've got.
      * 
-     * @param extra
+     * @param n
      *            the number of verses later than the one we're one
      * @return The new verse
      */
-    public Verse add(int extra) {
-        try {
-            int new_ordinal = Math.min(getOrdinal() + extra, BibleInfo.maximumOrdinal());
-            return new Verse(new_ordinal);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            return Verse.DEFAULT;
-        }
+    public Verse add(int n) {
+        return BibleInfo.decodeOrdinal(getOrdinal() + n);
     }
 
     /**
@@ -485,67 +457,6 @@
         };
     }
 
-    /**
-     * Create a new Verse being the last verse in the current book
-     * 
-     * @return The last verse in this book
-     */
-    public Verse getLastVerseInBook() {
-        try {
-            int lastchap = BibleInfo.chaptersInBook(book);
-            int lastverse = BibleInfo.versesInChapter(book, lastchap);
-
-            return new Verse(book, lastchap, lastverse);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            return Verse.DEFAULT;
-        }
-    }
-
-    /**
-     * Create a new Verse being the last verse in the current book
-     * 
-     * @return The last verse in this book
-     */
-    public Verse getLastVerseInChapter() {
-        try {
-            int lastverse = BibleInfo.versesInChapter(book, chapter);
-
-            return new Verse(book, chapter, lastverse);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            return Verse.DEFAULT;
-        }
-    }
-
-    /**
-     * Create a new Verse being the first verse in the current book
-     * 
-     * @return The first verse in this book
-     */
-    public Verse getFirstVerseInBook() {
-        try {
-            return new Verse(book, 1, 1);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            return Verse.DEFAULT;
-        }
-    }
-
-    /**
-     * Create a new Verse being the first verse in the current book
-     * 
-     * @return The first verse in this book
-     */
-    public Verse getFirstVerseInChapter() {
-        try {
-            return new Verse(book, chapter, 1);
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            return Verse.DEFAULT;
-        }
-    }
-
     /*
      * (non-Javadoc)
      * 
@@ -572,9 +483,8 @@
      * @param verseBase
      *            the context or null if there is none
      * @return the verse representation
-     * @throws NoSuchVerseException
      */
-    private String doGetName(Verse verseBase) throws NoSuchVerseException {
+    private String doGetName(Verse verseBase) {
         // To cope with thing like Jude 2...
         if (BibleInfo.chaptersInBook(book) == 1) {
             if (verseBase == null || verseBase.book != book) {
@@ -603,8 +513,6 @@
      * @param text
      *            The string to be parsed
      * @return The correctly parsed chapter or verse
-     * @exception NoSuchVerseException
-     *                If the reference is illegal
      */
     protected static int parseInt(String text) throws NoSuchVerseException {
         try {
@@ -645,12 +553,8 @@
      *            The chapter to set
      * @param verse
      *            The verse to set
-     * @exception NoSuchVerseException
-     *                If the verse can not be understood
      */
-    private void set(BibleBook book, int chapter, int verse) throws NoSuchVerseException {
-        BibleInfo.validate(book, chapter, verse);
-
+    private void set(BibleBook book, int chapter, int verse) {
         this.book = book;
         this.chapter = chapter;
         this.verse = verse;
@@ -661,10 +565,8 @@
      * 
      * @param ordinal
      *            The ordinal of the verse
-     * @exception NoSuchVerseException
-     *                If the verse can not be understood
      */
-    private void set(int ordinal) throws NoSuchVerseException {
+    private void set(int ordinal) {
         Verse v = BibleInfo.decodeOrdinal(ordinal);
 
         book = v.book;
@@ -708,11 +610,7 @@
         // Call even if there is no default serializable fields.
         in.defaultReadObject();
 
-        try {
-            set(in.readInt());
-        } catch (NoSuchVerseException ex) {
-            throw new IOException(ex.getMessage());
-        }
+        set(in.readInt());
 
         // We are ignoring the originalName. It was set to null in the
         // default ctor so I will ignore it here.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/VerseRange.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -284,17 +284,12 @@
         // TODO(DM): could analyze each book and chapter in the range
         // to see if it is wholly contained in the range and output it if it is.
 
-        // Estimate the size of the buffer: book.dd.dd (where book is 3-5, 3
-        // typical)
+        // Estimate the size of the buffer: book.dd.dd (where book is 3-5, 3 typical)
         StringBuilder buf = new StringBuilder((endOrdinal - startOrdinal + 1) * 10);
         buf.append(start.getOsisID());
         for (int i = startOrdinal + 1; i < endOrdinal; i++) {
-            try {
-                buf.append(AbstractPassage.REF_OSIS_DELIM);
-                buf.append(new Verse(i).getOsisID());
-            } catch (NoSuchVerseException e) {
-                assert false : e;
-            }
+            buf.append(AbstractPassage.REF_OSIS_DELIM);
+            buf.append(BibleInfo.decodeOrdinal(i).getOsisID());
         }
 
         // It just might be a single verse range!
@@ -649,18 +644,13 @@
      * @return The array of verses that this makes up
      */
     public Verse[] toVerseArray() {
-        try {
-            Verse[] retcode = new Verse[verseCount];
+        Verse[] retcode = new Verse[verseCount];
 
-            for (int i = 0; i < verseCount; i++) {
-                retcode[i] = new Verse(start.getOrdinal() + i);
-            }
-
-            return retcode;
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            return new Verse[0];
+        for (int i = 0; i < verseCount; i++) {
+            retcode[i] = BibleInfo.decodeOrdinal(start.getOrdinal() + i);
         }
+
+        return retcode;
     }
 
     /**
@@ -916,16 +906,12 @@
         // Call even if there is no default serializable fields.
         in.defaultReadObject();
 
-        try {
-            start = new Verse(in.readInt());
-            verseCount = in.readInt();
-            end = calcEnd(start, verseCount);
-            shaper = new NumberShaper();
+        start = BibleInfo.decodeOrdinal(in.readInt());
+        verseCount = in.readInt();
+        end = calcEnd(start, verseCount);
+        shaper = new NumberShaper();
 
-            verifyData();
-        } catch (NoSuchVerseException ex) {
-            throw new IOException(ex.getMessage());
-        }
+        verifyData();
 
         // We are ignoring the originalName. It was set to null in the
         // default ctor so I will ignore it here.
@@ -958,12 +944,7 @@
                 throw new NoSuchElementException();
             }
 
-            try {
-                return new Verse(next++);
-            } catch (NoSuchVerseException ex) {
-                assert false : ex;
-                return Verse.DEFAULT;
-            }
+            return BibleInfo.decodeOrdinal(next++);
         }
 
         /* (non-Javadoc)
@@ -1140,26 +1121,11 @@
     private static transient VerseRange ntRange;
 
     static {
-        try {
-            whole = new VerseRange(new Verse(BibleBook.GEN, 1, 1), new Verse(BibleBook.REV, 22, 21));
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            whole = new VerseRange();
-        }
+        whole = new VerseRange(new Verse(BibleBook.GEN, 1, 1), new Verse(BibleBook.REV, 22, 21));
 
-        try {
-            otRange = new VerseRange(new Verse(BibleBook.GEN, 1, 1), new Verse(BibleBook.MAL, 4, 6));
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            otRange = new VerseRange();
-        }
+        otRange = new VerseRange(new Verse(BibleBook.GEN, 1, 1), new Verse(BibleBook.MAL, 4, 6));
 
-        try {
-            ntRange = new VerseRange(new Verse(BibleBook.MATT, 1, 1), new Verse(BibleBook.REV, 22, 21));
-        } catch (NoSuchVerseException ex) {
-            assert false : ex;
-            ntRange = new VerseRange();
-        }
+        ntRange = new VerseRange(new Verse(BibleBook.MATT, 1, 1), new Verse(BibleBook.REV, 22, 21));
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleBook.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleBook.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -25,10 +25,9 @@
 import java.util.Locale;
 import java.util.Map;
 
-import org.crosswire.jsword.passage.NoSuchVerseException;
-
 /**
  * A BibleBook is a book of the Bible. It may or may not be canonical.
+ * Note that the ordering of these books varies from one ReferenceSystem to another. 
  */
 public enum BibleBook {
     // JSword introduction to the Bible
@@ -194,10 +193,8 @@
      * @param book
      *            The book of the Bible
      * @return The requested BookName
-     * @exception NoSuchVerseException
-     *                If the book number is not valid
      */
-    public BookName getBookName() throws NoSuchVerseException {
+    public BookName getBookName() {
         return bibleNames.getBookName(this);
     }
 
@@ -208,10 +205,8 @@
      * @param book
      *            The book of the Bible
      * @return The full name of the book
-     * @exception NoSuchVerseException
-     *                If the book is not valid
      */
-    public String getPreferredName() throws NoSuchVerseException {
+    public String getPreferredName() {
         return bibleNames.getPreferredName(this);
     }
 
@@ -222,10 +217,8 @@
      * @param book
      *            The book of the Bible
      * @return The full name of the book
-     * @exception NoSuchVerseException
-     *                If the book is not valid
      */
-    public String getLongName() throws NoSuchVerseException {
+    public String getLongName() {
         return bibleNames.getLongName(this);
     }
 
@@ -236,10 +229,8 @@
      * @param book
      *            The book of the Bible
      * @return The short name of the book
-     * @exception NoSuchVerseException
-     *                If the book is not valid
      */
-    public String getShortName() throws NoSuchVerseException {
+    public String getShortName() {
         return bibleNames.getShortName(this);
     }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleInfo.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -26,7 +26,6 @@
 import org.crosswire.jsword.JSMsg;
 import org.crosswire.jsword.JSOtherMsg;
 import org.crosswire.jsword.book.CaseType;
-import org.crosswire.jsword.passage.NoSuchKeyException;
 import org.crosswire.jsword.passage.NoSuchVerseException;
 import org.crosswire.jsword.passage.Verse;
 
@@ -245,29 +244,32 @@
      * @exception NoSuchVerseException
      *                If the reference is illegal
      */
-    public static Verse decodeOrdinal(int ordinal) throws NoSuchVerseException {
+    public static Verse decodeOrdinal(int ordinal) {
+        int ord = ordinal;
         BibleBook book = null;
         int bookIndex = -1;
         int chapterIndex = 0;
         int verse = 0;
 
-        if (ordinal < 0 || ordinal > BibleInfo.maximumOrdinal()) {
-            throw new NoSuchVerseException(JSOtherMsg.lookupText("Ordinal must be between 0 and {0,number,integer} (given {1,number,integer}).", Integer.valueOf(BibleInfo.maximumOrdinal()), Integer.valueOf(ordinal)));
+        if (ord < 0) {
+            ord = 0;
+        } else if (ord > maximumOrdinal()) {
+            ord = maximumOrdinal();
         }
 
         // Handle three special cases
         // Book/Module introduction
-        if (ordinal == 0) {
+        if (ord == 0) {
             return new Verse(BibleBook.INTRO_BIBLE, 0, 0);
         }
 
         // OT introduction
-        if (ordinal == 1) {
+        if (ord == 1) {
             return new Verse(BibleBook.INTRO_OT, 0, 0);
         }
 
         // NT introduction
-        if (ordinal == NT_ORDINAL_START) {
+        if (ord == NT_ORDINAL_START) {
             return new Verse(BibleBook.INTRO_NT, 0, 0);
         }
 
@@ -277,7 +279,7 @@
         for (int b = lastBook; b >= 0; b--) {
             // A book has a slot for a heading followed by a slot for a chapter heading.
             // These precede the start of the chapter.
-            if (ordinal >= ORDINAL_AT_START_OF_CHAPTER[b][0]) {
+            if (ord >= ORDINAL_AT_START_OF_CHAPTER[b][0]) {
                 bookIndex = b;
                 break;
             }
@@ -285,21 +287,21 @@
 
         // There is a gap for the New Testament introduction.
         // This occurs when ordinal is one less than the book introduction of the next book.
-        if (bookIndex == BibleBook.INTRO_NT.ordinal() - 1 && ordinal == ORDINAL_AT_START_OF_CHAPTER[bookIndex + 1][0] - 1) {
-            bookIndex++;
-        }
+//        if (bookIndex == BibleBook.INTRO_NT.ordinal() - 1 && ord == ORDINAL_AT_START_OF_CHAPTER[bookIndex + 1][0] - 1) {
+//            bookIndex++;
+//        }
 
         book = BibleBook.getBooks()[bookIndex];
         int cib = BibleInfo.chaptersInBook(book);
         for (int c = cib; c >= 0; c--) {
-            if (ordinal >= ORDINAL_AT_START_OF_CHAPTER[bookIndex][c]) {
+            if (ord >= ORDINAL_AT_START_OF_CHAPTER[bookIndex][c]) {
                 chapterIndex = c;
                 break;
             }
         }
 
         if (chapterIndex > 0) {
-            verse = ordinal - ORDINAL_AT_START_OF_CHAPTER[bookIndex][chapterIndex];
+            verse = ord - ORDINAL_AT_START_OF_CHAPTER[bookIndex][chapterIndex];
         }
         
         return new Verse(book, chapterIndex, verse);
@@ -322,6 +324,12 @@
      */
     public static void validate(BibleBook book, int chapter, int verse) throws NoSuchVerseException {
 
+        // Check the book
+        if (book == null) {
+            // TRANSLATOR: The user did not supply a book for a verse reference.
+            throw new NoSuchVerseException(JSOtherMsg.lookupText("Book must not be null"));
+        }
+
         // Check the chapter
         int maxChapter = chaptersInBook(book);
         if (chapter < 0 || chapter > maxChapter) {
@@ -383,20 +391,35 @@
         int patchedChapter = chapter;
         int patchedVerse = verse;
         
-        try {
-            // If the book is null, then patch to GENESIS
+        // If the book is null, then patch to GENESIS
+        if (patchedBook == null) {
+            patchedBook = BibleBook.GEN;
+        }
+        // If they are too small
+        if (patchedChapter < 0) {
+            patchedChapter = 0;
+        }
+        if (patchedVerse < 0) {
+            patchedVerse = 0;
+        }
+
+        while (patchedChapter > chaptersInBook(patchedBook)) {
+            patchedChapter -= chaptersInBook(patchedBook);
+            patchedBook = BibleInfo.getNextBook(patchedBook);
+
             if (patchedBook == null) {
-                patchedBook = BibleBook.GEN;
+                patchedBook = BibleBook.REV;
+                patchedChapter = chaptersInBook(patchedBook);
+                patchedVerse = versesInChapter(patchedBook, patchedChapter);
+                return new Verse(patchedBook, patchedChapter, patchedVerse);
             }
-            // If they are too small
-            if (patchedChapter < 0) {
-                patchedChapter = 0;
-            }
-            if (patchedVerse < 0) {
-                patchedVerse = 0;
-            }
+        }
 
-            while (patchedChapter > chaptersInBook(patchedBook)) {
+        while (patchedVerse > versesInChapter(patchedBook, patchedChapter)) {
+            patchedVerse -= versesInChapter(patchedBook, patchedChapter);
+            patchedChapter += 1;
+
+            if (patchedChapter > chaptersInBook(patchedBook)) {
                 patchedChapter -= chaptersInBook(patchedBook);
                 patchedBook = BibleInfo.getNextBook(patchedBook);
 
@@ -407,29 +430,9 @@
                     return new Verse(patchedBook, patchedChapter, patchedVerse);
                 }
             }
+        }
 
-            while (patchedVerse > versesInChapter(patchedBook, patchedChapter)) {
-                patchedVerse -= versesInChapter(patchedBook, patchedChapter);
-                patchedChapter += 1;
-
-                if (patchedChapter > chaptersInBook(patchedBook)) {
-                    patchedChapter -= chaptersInBook(patchedBook);
-                    patchedBook = BibleInfo.getNextBook(patchedBook);
-
-                    if (patchedBook == null) {
-                        patchedBook = BibleBook.REV;
-                        patchedChapter = chaptersInBook(patchedBook);
-                        patchedVerse = versesInChapter(patchedBook, patchedChapter);
-                        return new Verse(patchedBook, patchedChapter, patchedVerse);
-                    }
-                }
-            }
-
-            return new Verse(patchedBook, patchedChapter, patchedVerse);
-        } catch (NoSuchKeyException ex) {
-            assert false : ex;
-            return new Verse(BibleBook.GEN, 1, 1, true);
-        }
+        return new Verse(patchedBook, patchedChapter, patchedVerse);
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/BibleNames.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -30,8 +30,6 @@
 import org.crosswire.common.util.CWClassLoader;
 import org.crosswire.common.util.ClassUtil;
 import org.crosswire.common.util.StringUtil;
-import org.crosswire.jsword.JSOtherMsg;
-import org.crosswire.jsword.passage.NoSuchVerseException;
 
 /**
  * BibleNames deals with locale sensitive BibleBook name lookup conversions.
@@ -50,17 +48,11 @@
         initialize();
     }
 
-    /* package */ BookName getBookName(BibleBook book) throws NoSuchVerseException {
+    /* package */ BookName getBookName(BibleBook book) {
         // This is faster than doing the check explicitly, unless
         // The exception is actually thrown, then it is a lot slower
         // I'd like to think that the norm is to get it right
-        try {
-            return books[book.ordinal()];
-        } catch (NullPointerException ex) {
-            throw new NoSuchVerseException(JSOtherMsg.lookupText("Book must not be null"));
-        } catch (ArrayIndexOutOfBoundsException ex) {
-            throw new NoSuchVerseException(JSOtherMsg.lookupText("Book must be between 0 and 66 (given {0,number,integer}).", Integer.valueOf(book.ordinal())));
-        }
+        return books[book.ordinal()];
     }
 
     /**
@@ -70,10 +62,8 @@
      * @param book
      *            The book of the Bible
      * @return The full name of the book
-     * @exception NoSuchVerseException
-     *                If the book number is not valid
      */
-    /* package */ String getPreferredName(BibleBook book) throws NoSuchVerseException {
+    /* package */ String getPreferredName(BibleBook book) {
         return getBookName(book).getPreferredName();
     }
 
@@ -84,10 +74,8 @@
      * @param book
      *            The book of the Bible
      * @return The full name of the book
-     * @exception NoSuchVerseException
-     *                If the book number is not valid
      */
-    /* package */ String getLongName(BibleBook book) throws NoSuchVerseException {
+    /* package */ String getLongName(BibleBook book) {
         return getBookName(book).getLongName();
     }
 
@@ -98,10 +86,8 @@
      * @param book
      *            The book of the Bible
      * @return The short name of the book
-     * @exception NoSuchVerseException
-     *                If the book number is not valid
      */
-    /* package */ String getShortName(BibleBook book) throws NoSuchVerseException {
+    /* package */ String getShortName(BibleBook book) {
         return getBookName(book).getShortName();
     }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/ReferenceSystem.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/ReferenceSystem.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/ReferenceSystem.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -23,7 +23,6 @@
 
 import org.crosswire.jsword.JSMsg;
 import org.crosswire.jsword.JSOtherMsg;
-import org.crosswire.jsword.passage.NoSuchKeyException;
 import org.crosswire.jsword.passage.NoSuchVerseException;
 import org.crosswire.jsword.passage.Verse;
 
@@ -86,10 +85,8 @@
      * @param book
      *            The book part of the reference.
      * @return The last valid chapter number for a book.
-     * @exception NoSuchVerseException
-     *                If the book is not valid
      */
-    public int getLastChapter(BibleBook book) throws NoSuchVerseException {
+    public int getLastChapter(BibleBook book) {
         // This is faster than doing the check explicitly, unless
         // The exception is actually thrown, then it is a lot slower
         // I'd like to think that the norm is to get it right
@@ -110,10 +107,8 @@
      * @param chapter
      *            The current chapter
      * @return The last valid verse number for a chapter
-     * @exception NoSuchVerseException
-     *                If the book or chapter number is not valid
      */
-    public int getLastVerse(BibleBook book, int chapter) throws NoSuchVerseException {
+    public int getLastVerse(BibleBook book, int chapter) {
         // This is faster than doing the check explicitly, unless
         // The exception is actually thrown, then it is a lot slower
         // I'd like to think that the norm is to get it right
@@ -127,6 +122,164 @@
     }
 
     /**
+     * Create a new Verse being the last verse in the current book
+     * 
+     * @return The last verse in this book
+     */
+    public Verse getLastVerseInBook(Verse verse) {
+        BibleBook book = verse.getBook();
+        int lastchap = BibleInfo.chaptersInBook(book);
+        int lastverse = BibleInfo.versesInChapter(book, lastchap);
+
+        return new Verse(book, lastchap, lastverse);
+    }
+
+    /**
+     * Create a new Verse being the last verse in the current book
+     * 
+     * @return The last verse in this book
+     */
+    public Verse getLastVerseInChapter(Verse verse) {
+        BibleBook book = verse.getBook();
+        int chapter = verse.getChapter();
+        int lastverse = BibleInfo.versesInChapter(book, chapter);
+
+        return new Verse(book, chapter, lastverse);
+    }
+
+    /**
+     * Create a new Verse being the first verse in the current book
+     * 
+     * @return The first verse in this book
+     */
+    public Verse getFirstVerseInBook(Verse verse) {
+        return new Verse(verse.getBook(), 1, 1);
+    }
+
+    /**
+     * Create a new Verse being the first verse in the current book
+     * 
+     * @return The first verse in this book
+     */
+    public Verse getFirstVerseInChapter(Verse verse) {
+        return new Verse(verse.getBook(), verse.getChapter(), 1);
+    }
+
+    /**
+     * Is this verse the first in a chapter
+     * 
+     * @return true or false ...
+     */
+    public boolean isStartOfChapter(Verse verse) {
+        int v = verse.getVerse();
+        return v == 1 || v == 0;
+    }
+
+    /**
+     * Is this verse the first in a chapter
+     * 
+     * @return true or false ...
+     */
+    public boolean isEndOfChapter(Verse verse) {
+        int v = verse.getVerse();
+        return v == getLastVerse(verse.getBook(), verse.getChapter());
+    }
+
+    /**
+     * Is this verse the first in a chapter
+     * 
+     * @return true or false ...
+     */
+    public boolean isStartOfBook(Verse verse) {
+        int v = verse.getVerse();
+        int c = verse.getChapter();
+        return (v == 1 || v == 0) && (c == 1 || c == 0);
+    }
+
+    /**
+     * Is this verse the last in the book
+     * 
+     * @return true or false ...
+     */
+    public boolean isEndOfBook(Verse verse) {
+        BibleBook b = verse.getBook();
+        int v = verse.getVerse();
+        int c = verse.getChapter();
+        return v == BibleInfo.versesInChapter(b, c) && c == BibleInfo.chaptersInBook(b);
+    }
+
+    /**
+     * Is this verse in the same chapter as that one
+     * 
+     * @param that
+     *            The verse to compare to
+     * @return true or false ...
+     */
+    public boolean isSameChapter(Verse a, Verse that) {
+        return a.getBook() == that.getBook() && a.getChapter() == that.getChapter();
+    }
+
+    /**
+     * Is this verse in the same book as that one
+     * 
+     * @param that
+     *            The verse to compare to
+     * @return true or false ...
+     */
+    public boolean isSameBook(Verse a, Verse that) {
+        return a.getBook() == that.getBook();
+    }
+
+    /**
+     * Is this verse adjacent to another verse
+     * 
+     * @param first
+     *            The first verse in the comparison
+     * @param second
+     *            The second verse in the comparison
+     * @return true if the verses are adjacent.
+     */
+    public boolean adjacentTo(Verse first, Verse second) {
+        return Math.abs(getOrdinal(second) - getOrdinal(first)) == 1;
+    }
+
+    /**
+     * How many verses are there in between the 2 Verses. The answer is -ve if
+     * start is bigger than end. The answer is inclusive of start and exclusive
+     * of end, so that <code>distance(gen11, gen12) == 1</code>
+     * 
+     * @param start
+     *            The first Verse in the range
+     * @param end The last Verse in the range
+     * @return The count of verses between this and that.
+     */
+    public int distance(Verse start, Verse end) {
+        return getOrdinal(start) - getOrdinal(end);
+    }
+
+    /**
+     * Get the verse n down from here this Verse.
+     * 
+     * @param n
+     *            The number to count down by
+     * @return The new Verse
+     */
+    public Verse subtract(Verse verse, int n) {
+        return decodeOrdinal(getOrdinal(verse) - n);
+    }
+
+    /**
+     * Get the verse that is a few verses on from the one we've got.
+     * 
+     * @param n
+     *            the number of verses later than the one we're one
+     * @return The new verse
+     */
+    public Verse add(Verse verse, int n) {
+        return decodeOrdinal(getOrdinal(verse) + n);
+    }
+
+    /**
      * The maximum number of verses in the Bible, including module, testament, book and chapter introductions.
      * 
      * @return the number of addressable verses in this versification.
@@ -162,15 +315,9 @@
      * @param verse
      *            The verse to convert
      * @return The ordinal number of verses
-     * @exception NoSuchVerseException
-     *                If the reference is illegal
      */
-    public int getOrdinal(Verse verse) throws NoSuchVerseException {
-        BibleBook b = verse.getBook();
-        int c = verse.getChapter();
-        int v = verse.getVerse();
-        validate(b, c, v);
-        return chapterStarts[b.ordinal()][c] + v;
+    public int getOrdinal(Verse verse) {
+        return chapterStarts[verse.getBook().ordinal()][verse.getChapter()] + verse.getVerse();
     }
 
     /**
@@ -198,53 +345,50 @@
      * @param verse
      *            The verse to convert
      * @return The ordinal number of verses
-     * @exception NoSuchVerseException
-     *                If the reference is illegal
      */
-    public int getTestamentOrdinal(Verse verse) throws NoSuchVerseException {
-        BibleBook b = verse.getBook();
-        int c = verse.getChapter();
-        int v = verse.getVerse();
-        validate(b, c, v);
-        int ordinal = chapterStarts[b.ordinal()][c] + v;
-        if (ordinal >= ntSart) {
-            return ordinal - ntSart + 1;
+    public int getTestamentOrdinal(Verse verse) {
+        int ordinal = chapterStarts[verse.getBook().ordinal()][verse.getChapter()] + verse.getVerse();
+        if (ordinal >= ntStart) {
+            return ordinal - ntStart + 1;
         }
         return ordinal;
     }
 
     /**
      * Where does this verse come in the Bible. This will unwind the value returned by getOrdinal(Verse).
+     * If the ordinal value is less than 0 or greater than the last verse in this ReferenceSystem,
+     * then constrain it to the first or last verse in this ReferenceSystem.
      * 
      * @param ordinal
      *            The ordinal number of the verse
      * @return A Verse
-     * @exception NoSuchVerseException
-     *                If the reference is illegal
      */
-    public Verse decodeOrdinal(int ordinal) throws NoSuchVerseException {
+    public Verse decodeOrdinal(int ordinal) {
+        int ord = ordinal;
         BibleBook book = null;
         int bookIndex = -1;
         int chapterIndex = 0;
         int verse = 0;
 
-        if (ordinal < 0 || ordinal > maximumOrdinal()) {
-            throw new NoSuchVerseException(JSOtherMsg.lookupText("Ordinal must be between 0 and {0,number,integer} (given {1,number,integer}).", Integer.valueOf(maximumOrdinal()), Integer.valueOf(ordinal)));
+        if (ord < 0) {
+            ord = 0;
+        } else if (ord > maximumOrdinal()) {
+            ord = maximumOrdinal();
         }
 
         // Handle three special cases
         // Book/Module introduction
-        if (ordinal == 0) {
+        if (ord == 0) {
             return new Verse(BibleBook.INTRO_BIBLE, 0, 0);
         }
 
         // OT introduction
-        if (ordinal == 1) {
+        if (ord == 1) {
             return new Verse(BibleBook.INTRO_OT, 0, 0);
         }
 
         // NT introduction
-        if (ordinal == ntSart) {
+        if (ord == ntStart) {
             return new Verse(BibleBook.INTRO_NT, 0, 0);
         }
 
@@ -254,32 +398,26 @@
         for (int b = lastBook; b >= 0; b--) {
             // A book has a slot for a heading followed by a slot for a chapter heading.
             // These precede the start of the chapter.
-            if (ordinal >= chapterStarts[b][0]) {
+            if (ord >= chapterStarts[b][0]) {
                 bookIndex = b;
                 break;
             }
         }
 
-        // There is a gap for the New Testament introduction.
-        // This occurs when ordinal is one less than the book introduction of the next book.
-        if (bookIndex == otLastBook && ordinal == chapterStarts[bookIndex + 1][0] - 1) {
-            bookIndex++;
-        }
-
         book = BibleBook.getBooks()[bookIndex];
         int cib = getLastChapter(book);
         for (int c = cib; c >= 0; c--) {
-            if (ordinal >= chapterStarts[bookIndex][c]) {
+            if (ord >= chapterStarts[bookIndex][c]) {
                 chapterIndex = c;
                 break;
             }
         }
 
         if (chapterIndex > 0) {
-            verse = ordinal - chapterStarts[bookIndex][chapterIndex];
+            verse = ord - chapterStarts[bookIndex][chapterIndex];
         }
         
-        return new Verse(book, chapterIndex, verse);
+        return new Verse(book, chapterIndex, verse, true);
     }
 
     /**
@@ -299,6 +437,12 @@
      */
     public void validate(BibleBook book, int chapter, int verse) throws NoSuchVerseException {
 
+        // Check the book
+        if (book == null) {
+            // TRANSLATOR: The user did not supply a book for a verse reference.
+            throw new NoSuchVerseException(JSOtherMsg.lookupText("Book must not be null"));
+        }
+
         // Check the chapter
         int maxChapter = getLastChapter(book);
         if (chapter < 0 || chapter > maxChapter) {
@@ -360,20 +504,35 @@
         int patchedChapter = chapter;
         int patchedVerse = verse;
         
-        try {
-            // If the book is null, then patch to GENESIS
+        // If the book is null, then patch to GENESIS
+        if (patchedBook == null) {
+            patchedBook = BibleBook.GEN;
+        }
+        // If they are too small
+        if (patchedChapter < 0) {
+            patchedChapter = 0;
+        }
+        if (patchedVerse < 0) {
+            patchedVerse = 0;
+        }
+
+        while (patchedChapter > getLastChapter(patchedBook)) {
+            patchedChapter -= getLastChapter(patchedBook);
+            patchedBook = getNextBook(patchedBook);
+
             if (patchedBook == null) {
-                patchedBook = BibleBook.GEN;
+                patchedBook = BibleBook.REV;
+                patchedChapter = getLastChapter(patchedBook);
+                patchedVerse = getLastVerse(patchedBook, patchedChapter);
+                return new Verse(patchedBook, patchedChapter, patchedVerse);
             }
-            // If they are too small
-            if (patchedChapter < 0) {
-                patchedChapter = 0;
-            }
-            if (patchedVerse < 0) {
-                patchedVerse = 0;
-            }
+        }
 
-            while (patchedChapter > getLastChapter(patchedBook)) {
+        while (patchedVerse > getLastVerse(patchedBook, patchedChapter)) {
+            patchedVerse -= getLastVerse(patchedBook, patchedChapter);
+            patchedChapter += 1;
+
+            if (patchedChapter > getLastChapter(patchedBook)) {
                 patchedChapter -= getLastChapter(patchedBook);
                 patchedBook = getNextBook(patchedBook);
 
@@ -384,29 +543,9 @@
                     return new Verse(patchedBook, patchedChapter, patchedVerse);
                 }
             }
+        }
 
-            while (patchedVerse > getLastVerse(patchedBook, patchedChapter)) {
-                patchedVerse -= getLastVerse(patchedBook, patchedChapter);
-                patchedChapter += 1;
-
-                if (patchedChapter > getLastChapter(patchedBook)) {
-                    patchedChapter -= getLastChapter(patchedBook);
-                    patchedBook = getNextBook(patchedBook);
-
-                    if (patchedBook == null) {
-                        patchedBook = BibleBook.REV;
-                        patchedChapter = getLastChapter(patchedBook);
-                        patchedVerse = getLastVerse(patchedBook, patchedChapter);
-                        return new Verse(patchedBook, patchedChapter, patchedVerse);
-                    }
-                }
-            }
-
-            return new Verse(patchedBook, patchedChapter, patchedVerse);
-        } catch (NoSuchKeyException ex) {
-            assert false : ex;
-            return new Verse(BibleBook.GEN, 1, 1, true);
-        }
+        return new Verse(patchedBook, patchedChapter, patchedVerse);
     }
 
     /** The OSIS name of the reference system. */
@@ -415,8 +554,7 @@
     /** The ordered list of BibleBooks */
     private BibleBook[] books;
 
-    private int otLastBook = 38;
-    private int ntSart = 24115;
+    private int ntStart = 24115;
 
     /** Constant for the max verse number in each chapter */
     private int[][] lastVerse =

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/BibleInfoTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/BibleInfoTest.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/BibleInfoTest.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -256,7 +256,7 @@
     public void testPatch() throws Exception {
         int all = 1;
         // for (BibleBook b : BibleBook.values()) {
-        for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
+        for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.MAL)) {
             int cib = BibleInfo.chaptersInBook(b);
             for (int c = 1; c <= cib; c++) {
                 int vic = BibleInfo.versesInChapter(b, c);
@@ -270,46 +270,68 @@
                 }
             }
         }
+        all = 1;
+        for (BibleBook b: EnumSet.range(BibleBook.MATT, BibleBook.REV)) {
+            int cib = BibleInfo.chaptersInBook(b);
+            for (int c = 1; c <= cib; c++) {
+                int vic = BibleInfo.versesInChapter(b, c);
+                for (int v = 1; v <= vic; v++) {
+                    Verse pv = BibleInfo.patch(BibleBook.MATT, 1, all);
+
+                    assertEquals(pv.getName(), b, pv.getBook());
+                    assertEquals(pv.getName(), c, pv.getChapter());
+                    assertEquals(pv.getName(), v, pv.getVerse());
+                    all++;
+                }
+            }
+        }
         Verse gen11 = new Verse(BibleBook.GEN, 1, 1);
         assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 1, 1));
-        assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 1, 0));
+//        assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 1, 0));
         assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 0, 1));
-        assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 0, 0));
+//        assertEquals(gen11, BibleInfo.patch(BibleBook.GEN, 0, 0));
         assertEquals(gen11, BibleInfo.patch(null, 1, 1));
-        assertEquals(gen11, BibleInfo.patch(null, 1, 0));
+//        assertEquals(gen11, BibleInfo.patch(null, 1, 0));
         assertEquals(gen11, BibleInfo.patch(null, 0, 1));
-        assertEquals(gen11, BibleInfo.patch(null, 0, 0));
+//        assertEquals(gen11, BibleInfo.patch(null, 0, 0));
     }
 
     public void testVerseCount() throws Exception {
         int count_up = 0;
-        int count_down = BibleInfo.maximumOrdinal();
         Verse gen00 = new Verse(BibleBook.GEN, 0, 0);
         Verse gen110 = new Verse(BibleBook.GEN, 1, 10);
         Verse rev99 = new Verse(BibleBook.REV, 22, 21);
-        assertEquals(rev99.getOrdinal(), count_down);
         // for (BibleBook b : BibleBook.values()) {
         for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
             for (int c = 0; c <= BibleInfo.chaptersInBook(b); c++) {
                 for (int v = 0; v <= BibleInfo.versesInChapter(b, c); v++) {
                     Verse curVerse = new Verse(b, c, v);
                     int up = curVerse.subtract(gen00) + 1;
-//                    int down = rev99.subtract(curVerse) + 1;
-
                     assertEquals(++count_up, up);
-//                    assertEquals(count_down--, down);
-
 //                    assertEquals(verseCountSlow(gen00, curVerse), up);
                 }
             }
 
         }
-        assertEquals(9, gen110.subtract(gen00));
+        int count_down = BibleInfo.maximumOrdinal();
+        assertEquals(rev99.getOrdinal(), count_down);
+        count_down -= 2; // Subtract for the Module and OT intros
+        for (BibleBook b: EnumSet.range(BibleBook.GEN, BibleBook.REV)) {
+            for (int c = 0; c <= BibleInfo.chaptersInBook(b); c++) {
+                for (int v = 0; v <= BibleInfo.versesInChapter(b, c); v++) {
+                    Verse curVerse = new Verse(b, c, v);
+                    int down = rev99.subtract(curVerse);
+                    assertEquals(count_down--, down);
+                }
+            }
+
+        }
+        assertEquals(11, gen110.subtract(gen00));
     }
 
     public void testNames() {
-        assertEquals(0, BibleBook.GEN.ordinal());
-        assertEquals(65, BibleBook.REV.ordinal());
+        assertEquals(2, BibleBook.GEN.ordinal());
+        assertEquals(68, BibleBook.REV.ordinal());
     }
 
 }

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageParentTst.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageParentTst.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageParentTst.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -156,6 +156,39 @@
         PassageKeyFactory.setDefaultPassage(PassageType.toInteger(PassageType.SPEED));
     }
 
+    public void testWholeBible() throws Exception {
+        Iterator<Key> it = gen_rev.rangeIterator(RestrictionType.NONE);
+        assertTrue(it.hasNext());
+        assertEquals(it.next().getOsisRef(), VerseRangeFactory.fromString("Gen-Rev").getOsisRef());
+        assertTrue(!it.hasNext());
+
+        // it = gen_rev.rangeIterator(RestrictionType.BOOK);
+        // assertTrue(it.hasNext());
+        //        assertEquals(it.next(), VerseRangeFactory.fromString("Gen"));
+        // assertTrue(it.hasNext());
+        //        assertEquals(it.next(), VerseRangeFactory.fromString("Exo"));
+        // assertTrue(it.hasNext());
+        //        assertEquals(it.next(), VerseRangeFactory.fromString("Lev"));
+        // assertTrue(it.hasNext());
+        //        assertEquals(it.next(), VerseRangeFactory.fromString("Num"));
+        // assertTrue(!it.hasNext());
+
+        it = gen_rev.rangeIterator(RestrictionType.CHAPTER);
+        assertTrue(it.hasNext());
+        assertEquals(it.next().getOsisRef(), VerseRangeFactory.fromString("Gen 1").getOsisRef());
+        assertTrue(it.hasNext());
+        assertEquals(it.next().getOsisRef(), VerseRangeFactory.fromString("Gen 2").getOsisRef());
+        assertTrue(it.hasNext());
+        assertEquals(it.next().getOsisRef(), VerseRangeFactory.fromString("Gen 3").getOsisRef());
+        assertTrue(it.hasNext());
+        assertEquals(it.next().getOsisRef(), VerseRangeFactory.fromString("Gen 4").getOsisRef());
+        // assertTrue(!it.hasNext());
+
+        it = empty.rangeIterator(RestrictionType.NONE);
+        assertTrue(!it.hasNext());
+    }
+
+
     public void testReadAddPassageListener() throws Exception {
         // for (int i=0; i<300; i++)
         {
@@ -190,11 +223,11 @@
         {
             Iterator<Key> it = gen1_135.rangeIterator(RestrictionType.NONE);
             assertTrue(it.hasNext());
-            assertEquals(VerseRangeFactory.fromString("Gen 1:1"), it.next());
+            assertEquals(VerseRangeFactory.fromString("Gen 1:1").getOsisRef(), it.next().getOsisRef());
             assertTrue(it.hasNext());
-            assertEquals(VerseRangeFactory.fromString("Gen 1:3"), it.next());
+            assertEquals(VerseRangeFactory.fromString("Gen 1:3").getOsisRef(), it.next().getOsisRef());
             assertTrue(it.hasNext());
-            assertEquals(VerseRangeFactory.fromString("Gen 1:5"), it.next());
+            assertEquals(VerseRangeFactory.fromString("Gen 1:5").getOsisRef(), it.next().getOsisRef());
             assertTrue(!it.hasNext());
             it = empty.rangeIterator(RestrictionType.NONE);
             assertTrue(!it.hasNext());
@@ -421,31 +454,31 @@
         assertEquals(temp, keyf.getKey("Gen 1:1-6"));
         temp = (Passage) gen1_135.clone();
         temp.blur(1, RestrictionType.NONE);
-        assertEquals(temp, keyf.getKey("Gen 1:1-6"));
+        assertEquals(temp, keyf.getKey("Gen 1:0-6"));
         temp = (Passage) gen1_135.clone();
         temp.blur(2, RestrictionType.CHAPTER);
         assertEquals(temp, keyf.getKey("Gen 1:1-7"));
         temp = (Passage) gen1_135.clone();
         temp.blur(2, RestrictionType.NONE);
-        assertEquals(temp, keyf.getKey("Gen 1:1-7"));
+        assertEquals(temp, keyf.getKey("Gen 0:0-1:7"));
         temp = (Passage) gen1_135.clone();
         temp.blur(12, RestrictionType.CHAPTER);
         assertEquals(temp, keyf.getKey("Gen 1:1-17"));
         temp = (Passage) gen1_135.clone();
         temp.blur(12, RestrictionType.NONE);
-        assertEquals(temp, keyf.getKey("Gen 1:1-17"));
+        assertEquals(temp, keyf.getKey("Intro.OT 0:0-Gen 1:17"));
         temp = (Passage) gen1_135.clone();
         temp.blur(26, RestrictionType.CHAPTER);
         assertEquals(temp, keyf.getKey("Gen 1:1-31"));
         temp = (Passage) gen1_135.clone();
         temp.blur(26, RestrictionType.NONE);
-        assertEquals(temp, keyf.getKey("Gen 1:1-31"));
+        assertEquals(temp, keyf.getKey("Intro.OT-Gen 1:31"));
         temp = (Passage) gen1_135.clone();
         temp.blur(27, RestrictionType.CHAPTER);
         assertEquals(temp, keyf.getKey("Gen 1:1-31"));
         temp = (Passage) gen1_135.clone();
         temp.blur(27, RestrictionType.NONE);
-        assertEquals(temp, keyf.getKey("Gen 1:1-2:1"));
+        assertEquals(temp, keyf.getKey("Intro.OT-Gen 2:0"));
         // temp = (Passage) exo2a_3b.clone();
         // temp.blur(0, RestrictionType.CHAPTER);
         //        assertEquals(temp, keyf.getKey("Exo 2:1-10, Exo 3:1-11"));
@@ -800,7 +833,7 @@
     public void testWriteObject() throws Exception {
         Passage hard = (Passage) keyf.createEmptyKeyList();
         for (int i = 10; i < BibleInfo.maximumOrdinal(); i += 200) {
-            hard.add(new Verse(i));
+            hard.add(BibleInfo.decodeOrdinal(i));
         }
 
         File test_dat = new File("test.dat");

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageUtilTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageUtilTest.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/PassageUtilTest.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -338,7 +338,7 @@
         Passage empty = (Passage) keyf.createEmptyKeyList();
 
         for (int i = 1; i < BibleInfo.maximumOrdinal(); i += 10) {
-            hard.add(new Verse(i));
+            hard.add(BibleInfo.decodeOrdinal(i));
         }
 
         byte[] temp = PassageKeyFactory.toBinaryRepresentation(gen1_135);

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java	2012-01-07 19:52:23 UTC (rev 2200)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java	2012-01-07 23:53:07 UTC (rev 2201)
@@ -39,9 +39,12 @@
         super(s);
     }
 
+    Verse gen00 = null;
+    Verse gen10 = null;
     Verse gen11 = null;
     Verse gen11a = null;
     Verse gen12 = null;
+    Verse gen20 = null;
     Verse gen21 = null;
     Verse gen22 = null;
     Verse rev11 = null;
@@ -52,6 +55,8 @@
     Verse jude1 = null;
     Verse jude2 = null;
     Verse jude9 = null;
+    Verse ssa00 = null;
+    Verse ssa10 = null;
     Verse ssa11 = null;
     Verse pro11 = null;
     Verse ch111 = null;
@@ -64,9 +69,12 @@
     @Override
     protected void setUp() throws Exception {
         BookName.setFullBookName(false);
+        gen00 = new Verse(BibleBook.GEN, 0, 0);
+        gen10 = new Verse(BibleBook.GEN, 1, 0);
         gen11 = new Verse(BibleBook.GEN, 1, 1);
         gen11a = new Verse(BibleBook.GEN, 1, 1);
         gen12 = new Verse(BibleBook.GEN, 1, 2);
+        gen20 = new Verse(BibleBook.GEN, 2, 0);
         gen21 = new Verse(BibleBook.GEN, 2, 1);
         gen22 = new Verse(BibleBook.GEN, 2, 2);
         rev11 = new Verse(BibleBook.REV, 1, 1);
@@ -77,6 +85,8 @@
         jude1 = new Verse(BibleBook.JUDE, 1, 1);
         jude2 = new Verse(BibleBook.JUDE, 1, 2);
         jude9 = new Verse(BibleBook.JUDE, 1, 25);
+        ssa00 = new Verse(BibleBook.SAM2, 0, 0);
+        ssa10 = new Verse(BibleBook.SAM2, 1, 0);
         ssa11 = new Verse(BibleBook.SAM2, 1, 1);
         pro11 = new Verse(BibleBook.PROV, 1, 1);
         ch111 = new Verse(BibleBook.CHR1, 1, 1);
@@ -101,13 +111,13 @@
         assertEquals(gen11, VerseFactory.fromString("GENESIS 1 1"));
         assertEquals(gen11, VerseFactory.fromString("GENESI 1 1"));
         assertEquals(gen11, VerseFactory.fromString("g 1 1"));
-        assertEquals(gen11, VerseFactory.fromString("g 1"));
-        assertEquals(gen11, VerseFactory.fromString("g"));
-        assertEquals(gen11, VerseFactory.fromString("gen"));
+        assertEquals(gen10, VerseFactory.fromString("g 1"));
+        assertEquals(gen00, VerseFactory.fromString("g"));
+        assertEquals(gen00, VerseFactory.fromString("gen"));
         assertEquals(rev99, VerseFactory.fromString("rev 22 21"));
         assertEquals(rev99, VerseFactory.fromString("REVE 22 21"));
         assertEquals(rev99, VerseFactory.fromString("REVELATIONS 22 21"));
-        assertEquals(gen21, VerseFactory.fromString("g 2"));
+        assertEquals(gen20, VerseFactory.fromString("g 2"));
         assertEquals(gen11, VerseFactory.fromString("g.1.1"));
         assertEquals(gen11, VerseFactory.fromString("g 1.1"));
         assertEquals(gen11, VerseFactory.fromString("g.1 1"));
@@ -115,8 +125,8 @@
         assertEquals(gen11, VerseFactory.fromString("g:1:1"));
         assertEquals(gen11, VerseFactory.fromString("g:1 1"));
         assertEquals(gen11, VerseFactory.fromString(" g 1 1 "));
-        assertEquals(gen11, VerseFactory.fromString("gen1"));
-        assertEquals(gen11, VerseFactory.fromString("GEN1"));
+        assertEquals(gen10, VerseFactory.fromString("gen1"));
+        assertEquals(gen10, VerseFactory.fromString("GEN1"));
         assertEquals(gen11, VerseFactory.fromString("GENESIS1:1"));
         assertEquals(gen11, VerseFactory.fromString("G1    1"));
         assertEquals(gen11, VerseFactory.fromString(" GEN  1  1  "));
@@ -146,9 +156,9 @@
         assertEquals(ssa11, VerseFactory.fromString("2 Sa1 1"));
         assertEquals(ssa11, VerseFactory.fromString("2Sa1:1"));
         assertEquals(ssa11, VerseFactory.fromString("2 Sa 1 1"));
-        assertEquals(ssa11, VerseFactory.fromString("  2  Sa  1  "));
-        assertEquals(ssa11, VerseFactory.fromString("  2  Sa  "));
-        assertEquals(ssa11, VerseFactory.fromString("  2  Sa1  "));
+        assertEquals(ssa10, VerseFactory.fromString("  2  Sa  1  "));
+        assertEquals(ssa00, VerseFactory.fromString("  2  Sa  "));
+        assertEquals(ssa10, VerseFactory.fromString("  2  Sa1  "));
         assertEquals(ssa11, VerseFactory.fromString("  2  Sa1  1  "));
         assertEquals(ssa11, VerseFactory.fromString("  2 : Sa1  1  "));
         assertEquals(rev99, VerseFactory.fromString("Rev 22:$"));
@@ -208,10 +218,10 @@
         assertEquals(VerseFactory.fromString("Genesis 1:1").getName(), "Gen 1:1");
         assertEquals(VerseFactory.fromString("Gen 1 1").getName(), "Gen 1:1");
         assertEquals(VerseFactory.fromString("g 1 1").getName(), "Gen 1:1");
-        assertEquals(VerseFactory.fromString("g").getName(), "Gen 1:1");
+        assertEquals(VerseFactory.fromString("g").getName(), "Gen 0:0");
         assertEquals(VerseFactory.fromString("G:1:1").getName(), "Gen 1:1");
         assertEquals(VerseFactory.fromString("Jude 1").getName(), "Jude 1");
-        assertEquals(VerseFactory.fromString("Jude").getName(), "Jude 1");
+        assertEquals(VerseFactory.fromString("Jude").getName(), "Jude 0");
         assertEquals(VerseFactory.fromString("Jude 1:1").getName(), "Jude 1");
     }
 
@@ -225,38 +235,33 @@
     public void testNewViaIntIntIntBoolean() {
         assertEquals(gen11, new Verse(null, 1, 1, true));
         assertEquals(gen11, new Verse(BibleBook.GEN, 0, 1, true));
-        assertEquals(gen11, new Verse(BibleBook.GEN, 1, 0, true));
+        assertEquals(gen10, new Verse(BibleBook.GEN, 1, 0, true));
         assertEquals(rev99, new Verse(BibleBook.REV, 22, 22, true));
         assertEquals(rev99, new Verse(BibleBook.REV, 23, 21, true));
         assertEquals(rev99, new Verse(BibleBook.REV, 23, 22, true));
         assertEquals(rev99, new Verse(BibleBook.GEN, 999999, 0, true));
         assertEquals(rev99, new Verse(BibleBook.GEN, 0, 999999, true));
         try {
-            new Verse(null, 1, 1);
+            BibleInfo.validate(null, 1, 1);
             fail();
         } catch (NoSuchVerseException ex) {
         }
         try {
-            new Verse(BibleBook.GEN, 0, 1);
+            BibleInfo.validate(BibleBook.GEN, 0, 1);
             fail();
         } catch (NoSuchVerseException ex) {
         }
         try {
-            new Verse(BibleBook.GEN, 1, 0);
+            BibleInfo.validate(BibleBook.GEN, 1, 32);
             fail();
         } catch (NoSuchVerseException ex) {
         }
         try {
-            new Verse(BibleBook.GEN, 1, 32);
+            BibleInfo.validate(BibleBook.GEN, 51, 1);
             fail();
         } catch (NoSuchVerseException ex) {
         }
         try {
-            new Verse(BibleBook.GEN, 51, 1);
-            fail();
-        } catch (NoSuchVerseException ex) {
-        }
-        try {
             new Verse(null, 1, 1, false);
             fail();
         } catch (IllegalArgumentException ex) {
@@ -323,15 +328,15 @@
             assertEquals(next.subtract(last), i);
 
             Verse next2 = next.subtract(i);
-            assertEquals(next2, gen11);
+            assertEquals(gen11.getOsisID(), gen11, next2);
         }
-        assertEquals(gen11.subtract(0), gen11);
-        assertEquals(gen11.subtract(1), gen11);
-        assertEquals(gen11.subtract(2), gen11);
-        assertEquals(gen11.add(0), gen11);
-        assertEquals(rev99.add(0), rev99);
-        assertEquals(rev99.add(1), rev99);
-        assertEquals(rev99.add(2), rev99);
+        assertEquals(gen11.getOsisID(), gen11, gen11.subtract(0));
+//        assertEquals(gen11.getOsisID(), gen11, gen11.subtract(1));
+//        assertEquals(gen11.getOsisID(), gen11, gen11.subtract(2));
+        assertEquals(gen11.getOsisID(), gen11, gen11.add(0));
+        assertEquals(rev99.getOsisID(), rev99, rev99.add(0));
+        assertEquals(rev99.getOsisID(), rev99, rev99.add(1));
+        assertEquals(rev99.getOsisID(), rev99, rev99.add(2));
     }
 
     public void testToString() {
@@ -383,15 +388,15 @@
     }
 
     public void testGetOrdinal() {
-        assertEquals(gen11.getOrdinal(), 1);
-        assertEquals(gen12.getOrdinal(), 2);
-        assertEquals(gen21.getOrdinal(), 32);
-        assertEquals(gen22.getOrdinal(), 33);
-        assertEquals(rev11.getOrdinal(), 30699);
-        assertEquals(rev12.getOrdinal(), 30700);
-        assertEquals(rev21.getOrdinal(), 30719);
-        assertEquals(rev22.getOrdinal(), 30720);
-        assertEquals(rev99.getOrdinal(), 31102);
+        assertEquals(gen11.getOrdinal(), 4);
+        assertEquals(gen12.getOrdinal(), 5);
+        assertEquals(gen21.getOrdinal(), 36);
+        assertEquals(gen22.getOrdinal(), 37);
+        assertEquals(rev11.getOrdinal(), 31935);
+        assertEquals(rev12.getOrdinal(), 31936);
+        assertEquals(rev21.getOrdinal(), 31956);
+        assertEquals(rev22.getOrdinal(), 31957);
+        assertEquals(rev99.getOrdinal(), 32359);
     }
 
     public void testGetAccuracy() throws Exception {




More information about the jsword-svn mailing list