[jsword-svn] jsword/java/jsword/org/crosswire/jsword/passage s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sat Jun 11 19:39:30 MST 2005


Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/passage
In directory www.crosswire.org:/tmp/cvs-serv32246/java/jsword/org/crosswire/jsword/passage

Modified Files:
	BibleInfo.java Verse.java VerseRange.java 
Log Message:
Made full book names a configurable default and used it.
Fixed the name of Readings.

Index: Verse.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/passage/Verse.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** Verse.java	17 May 2005 00:43:15 -0000	1.39
--- Verse.java	12 Jun 2005 02:39:28 -0000	1.40
***************
*** 169,177 ****
              if (BibleInfo.chaptersInBook(book) == 1)
              {
!                 return BibleInfo.getShortBookName(book)
                      + Verse.VERSE_PREF_DELIM1
                      + verse;
              }
!             return BibleInfo.getShortBookName(book)
                  + Verse.VERSE_PREF_DELIM1
                  + chapter
--- 169,177 ----
              if (BibleInfo.chaptersInBook(book) == 1)
              {
!                 return BibleInfo.getBookName(book)
                      + Verse.VERSE_PREF_DELIM1
                      + verse;
              }
!             return BibleInfo.getBookName(book)
                  + Verse.VERSE_PREF_DELIM1
                  + chapter
***************
*** 210,214 ****
                  if (base.book != book)
                  {
!                     return BibleInfo.getShortBookName(book)
                          + Verse.VERSE_PREF_DELIM1
                          + verse;
--- 210,214 ----
                  if (base.book != book)
                  {
!                     return BibleInfo.getBookName(book)
                          + Verse.VERSE_PREF_DELIM1
                          + verse;
***************
*** 220,224 ****
              if (base.book != book)
              {
!                 return BibleInfo.getShortBookName(book)
                      + Verse.VERSE_PREF_DELIM1
                      + chapter
--- 220,224 ----
              if (base.book != book)
              {
!                 return BibleInfo.getBookName(book)
                      + Verse.VERSE_PREF_DELIM1
                      + chapter

Index: BibleInfo.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/passage/BibleInfo.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** BibleInfo.java	17 May 2005 00:43:15 -0000	1.33
--- BibleInfo.java	12 Jun 2005 02:39:28 -0000	1.34
***************
*** 176,187 ****
      public static void setCase(CaseType newBookCase)
      {
-         if (newBookCase.equals(CaseType.MIXED))
-         {
-             throw new IllegalArgumentException();
-         }
          BibleInfo.bookCase = newBookCase;
      }
  
      /**
       * How do we report the names of the books?.
       * @return The current case setting
--- 176,203 ----
      public static void setCase(CaseType newBookCase)
      {
          BibleInfo.bookCase = newBookCase;
      }
  
      /**
+      * This is only used by config
+      * @return Whether the name is long or short. Default is Full (true).
+      * @see BibleInfo#setFullBookName(boolean)
+      */
+     public static boolean isFullBookName()
+     {
+         return BibleInfo.fullBookName;
+     }
+ 
+     /**
+      * Set whether the name should be full or abbreviated, long or short.
+      * @param fullName The new case to use for reporting book names
+      * @see #isFullBookName()
+      */
+     public static void setFullBookName(boolean fullName)
+     {
+         BibleInfo.fullBookName = fullName;
+     }
+ 
+     /**
       * How do we report the names of the books?.
       * @return The current case setting
***************
*** 195,198 ****
--- 211,230 ----
  
      /**
+      * Get the preferred name of a book.
+      * Altered by the case setting (see setBookCase() and isLongBookName())
+      * @param book The book number (1-66)
+      * @return The full name of the book
+      * @exception NoSuchVerseException If the book number is not valid
+      */
+     public static String getBookName(int book) throws NoSuchVerseException
+     {
+         if (isFullBookName())
+         {
+             return getLongBookName(book);
+         }
+         return getShortBookName(book);
+     }
+ 
+     /**
       * Get the full name of a book (e.g. "Genesis").
       * Altered by the case setting (see setBookCase())
***************
*** 538,542 ****
              {
                  new Integer(chaptersInBook(book)),
!                 getShortBookName(book - 1), new Integer(chapter),
              };
              throw new NoSuchVerseException(Msg.BOOKS_CHAPTER, params);
--- 570,574 ----
              {
                  new Integer(chaptersInBook(book)),
!                 getBookName(book - 1), new Integer(chapter),
              };
              throw new NoSuchVerseException(Msg.BOOKS_CHAPTER, params);
***************
*** 549,553 ****
              {
                  new Integer(versesInChapter(book, chapter)),
!                 getShortBookName(book - 1),
                  new Integer(chapter),
                  new Integer(verse),
--- 581,585 ----
              {
                  new Integer(versesInChapter(book, chapter)),
!                 getBookName(book - 1),
                  new Integer(chapter),
                  new Integer(verse),
***************
*** 898,906 ****
  
      /**
!      * How the book names are reported
       */
      private static CaseType bookCase = CaseType.SENTENCE;
  
      /**
       * Handy section finder. There is a bit of moderately bad programming
       * here because org.crosswire.jsword.control.map.sw*ng.GroupVerseColor
--- 930,943 ----
  
      /**
!      * How the book names are reported.
       */
      private static CaseType bookCase = CaseType.SENTENCE;
  
      /**
+      * Whether long or short, full or abbreviated names are used.
+      */
+     private static boolean fullBookName = true;
+ 
+     /**
       * Handy section finder. There is a bit of moderately bad programming
       * here because org.crosswire.jsword.control.map.sw*ng.GroupVerseColor

Index: VerseRange.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/passage/VerseRange.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** VerseRange.java	5 Jun 2005 03:46:50 -0000	1.43
--- VerseRange.java	12 Jun 2005 02:39:28 -0000	1.44
***************
*** 166,172 ****
                      // base since we start at the start of a book, and should have been
                      // recently normalized()
!                     return BibleInfo.getShortBookName(start_book)
                           + VerseRange.RANGE_PREF_DELIM
!                          + BibleInfo.getShortBookName(end_book);
                  }
  
--- 166,172 ----
                      // base since we start at the start of a book, and should have been
                      // recently normalized()
!                     return BibleInfo.getBookName(start_book)
                           + VerseRange.RANGE_PREF_DELIM
!                          + BibleInfo.getBookName(end_book);
                  }
  
***************
*** 175,181 ****
                  {
                      // Just report book and chapter names
!                     return BibleInfo.getShortBookName(start_book)
                           + Verse.VERSE_PREF_DELIM1 + start_chapter
!                          + VerseRange.RANGE_PREF_DELIM + BibleInfo.getShortBookName(end_book)
                           + Verse.VERSE_PREF_DELIM1 + end_chapter;
                  }
--- 175,181 ----
                  {
                      // Just report book and chapter names
!                     return BibleInfo.getBookName(start_book)
                           + Verse.VERSE_PREF_DELIM1 + start_chapter
!                          + VerseRange.RANGE_PREF_DELIM + BibleInfo.getBookName(end_book)
                           + Verse.VERSE_PREF_DELIM1 + end_chapter;
                  }
***************
*** 190,194 ****
                  // base since we start at the start of a book, and should have been
                  // recently normalized()
!                 return BibleInfo.getShortBookName(start_book);
              }
  
--- 190,194 ----
                  // base since we start at the start of a book, and should have been
                  // recently normalized()
!                 return BibleInfo.getBookName(start_book);
              }
  
***************
*** 200,204 ****
                  {
                      // Just report the name of the book and the chapters
!                     return BibleInfo.getShortBookName(start_book)
                           + Verse.VERSE_PREF_DELIM1 + start_chapter
                           + VerseRange.RANGE_PREF_DELIM + end_chapter;
--- 200,204 ----
                  {
                      // Just report the name of the book and the chapters
!                     return BibleInfo.getBookName(start_book)
                           + Verse.VERSE_PREF_DELIM1 + start_chapter
                           + VerseRange.RANGE_PREF_DELIM + end_chapter;
***************
*** 214,218 ****
              {
                  // Just report the name of the book and the chapter
!                 return BibleInfo.getShortBookName(start_book)
                       + Verse.VERSE_PREF_DELIM1 + start_chapter;
              }
--- 214,218 ----
              {
                  // Just report the name of the book and the chapter
!                 return BibleInfo.getBookName(start_book)
                       + Verse.VERSE_PREF_DELIM1 + start_chapter;
              }



More information about the jsword-svn mailing list