[jsword-svn] r1188 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book jsword/etc/eclipse 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 www.crosswire.org dmsmith at www.crosswire.org
Sat Nov 18 05:59:41 MST 2006


Author: dmsmith
Date: 2006-11-18 05:59:40 -0700 (Sat, 18 Nov 2006)
New Revision: 1188

Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModel.java
   trunk/jsword/etc/eclipse/jsword-app-readeverything.launch
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
   trunk/jsword/src/main/java/org/crosswire/jsword/versification/Msg.properties
   trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java
Log:
Improved passage recognition

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModel.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModel.java	2006-11-15 13:22:00 UTC (rev 1187)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleComboBoxModel.java	2006-11-18 12:59:40 UTC (rev 1188)
@@ -180,17 +180,10 @@
             int chapter = old.getChapter();
             int verse = old.getVerse();
 
-            if (BibleInfo.chaptersInBook(book) < chapter)
-            {
-                chapter = 1;
-            }
+            chapter = Math.min(chapter, BibleInfo.chaptersInBook(book));
+            verse = Math.min(verse, BibleInfo.versesInChapter(book, chapter));
 
-            if (BibleInfo.versesInChapter(book, chapter) < verse)
-            {
-                verse = 1;
-            }
-
-            Verse update = new Verse(book, chapter, verse, true);
+            Verse update = new Verse(book, chapter, verse);
             set.setViewedVerse(update);
         }
         catch (NoSuchVerseException ex)
@@ -212,12 +205,10 @@
             int book = old.getBook();
             int verse = old.getVerse();
 
-            if (BibleInfo.versesInChapter(book, chapter) < verse)
-            {
-                verse = 1;
-            }
+            
+            verse = Math.min(verse, BibleInfo.versesInChapter(book, chapter));
 
-            Verse update = new Verse(book, chapter, verse, true);
+            Verse update = new Verse(book, chapter, verse);
             set.setViewedVerse(update);
         }
         catch (NoSuchVerseException ex)
@@ -231,9 +222,16 @@
      */
     public void setVerse(int verse)
     {
-        Verse old = set.getVerse();
-        Verse update = new Verse(old.getBook(), old.getChapter(), verse, true);
-        set.setViewedVerse(update);
+        try
+        {
+            Verse old = set.getVerse();
+            Verse update = new Verse(old.getBook(), old.getChapter(), verse);
+            set.setViewedVerse(update);
+        }
+        catch (NoSuchVerseException ex)
+        {
+            assert false : ex;
+        }
     }
 
     /* (non-Javadoc)

Modified: trunk/jsword/etc/eclipse/jsword-app-readeverything.launch
===================================================================
--- trunk/jsword/etc/eclipse/jsword-app-readeverything.launch	2006-11-15 13:22:00 UTC (rev 1187)
+++ trunk/jsword/etc/eclipse/jsword-app-readeverything.launch	2006-11-18 12:59:40 UTC (rev 1188)
@@ -1,10 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.crosswire.jsword.book.ReadEverything"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="jsword-limbo"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="bibledesktop"/>
 <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m -ea"/>
 <stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="perspective_default"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/bibledesktop"/>
+</listAttribute>
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
 <stringAttribute key="org.eclipse.debug.ui.target_run_perspective" value="perspective_default"/>
-<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.debug.ui.javaSourceLocator"/>
 </launchConfiguration>

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java	2006-11-15 13:22:00 UTC (rev 1187)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/Verse.java	2006-11-18 12:59:40 UTC (rev 1188)
@@ -755,17 +755,6 @@
         this.verse = ref[VERSE];
     }
 
-    /*
-     * Mutate into this reference and fix the reference if needed.
-     * This must only be called from a ctor to maintain immutability
-     * @param ref An array of the book, chapter and verse to set
-     *
-    private final void setAndPatch(int[] ref)
-    {
-        setAndPatch(ref[BOOK], ref[CHAPTER], ref[VERSE]);
-    }
-    */
-
     /**
      * Verify and set the references.
      * This must only be called from a ctor to maintain immutability

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/versification/Msg.properties
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/versification/Msg.properties	2006-11-15 13:22:00 UTC (rev 1187)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/versification/Msg.properties	2006-11-18 12:59:40 UTC (rev 1188)
@@ -13,5 +13,5 @@
 BibleInfo.Ordinal=Must be 3 parts to the reference.
 BibleInfo.Decode=Ordinal must be between 1 and {0,number,integer} (given {1,number,integer}).
 BibleInfo.Chapter=Chapter should be between 1 and {0,number,integer} for {1} (given {2,number,integer}).
-BibleInfo.Verse=Verse should be between 1 and {0,number,integer} for {1} {2,number,integer} (given {3,number,integer}).ß
+BibleInfo.Verse=Verse should be between 1 and {0,number,integer} for {1} {2,number,integer} (given {3,number,integer}).
 BibleInfo.ErrorCase=Unknown case setting: {0}

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java	2006-11-15 13:22:00 UTC (rev 1187)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/passage/VerseTest.java	2006-11-18 12:59:40 UTC (rev 1188)
@@ -62,6 +62,7 @@
     /* @Override */
     protected void setUp() throws Exception
     {
+        BibleInfo.setFullBookName(false);
         gen11 = new Verse(1, 1, 1);
         gen11a = new Verse(1, 1, 1);
         gen12 = new Verse(1, 1, 2);
@@ -500,7 +501,7 @@
         assertEquals(AccuracyType.fromText("1", AccuracyType.tokenize("1"), vr), AccuracyType.VERSE_ONLY); //$NON-NLS-1$ //$NON-NLS-2$
         try
         {
-            AccuracyType.fromText("complete and utter rubbish", AccuracyType.tokenize("complete and utter rubbish"), vr); //$NON-NLS-1$ //$NON-NLS-2$
+            AccuracyType.fromText("Komplete and utter rubbish", AccuracyType.tokenize("Komplete and utter rubbish"), vr); //$NON-NLS-1$ //$NON-NLS-2$
             fail();
         }
         catch (NoSuchVerseException ex)




More information about the jsword-svn mailing list