org.crosswire.jsword.versification
Class OSISNames

java.lang.Object
  extended by org.crosswire.jsword.versification.OSISNames

public final class OSISNames
extends Object

BibleNames is a static class that deals with Book name lookup conversions. We start counting at 1 for books (so Genesis=1, Revelation=66). However internally books start counting at 0 and go up to 65.

Author:
Joe Walker [joe at eireneh dot com], DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details. The copyright to this program is held by it's authors.

Field Summary
(package private) static OSISNames instance
          A singleton used to do initialization.
private static String OSIS_KEY
           
private static Locale OSIS_LOCALE
          The Locale of OSIS Names
private static String[] osisBooks
          Standard OSIS names for the book of the Bible, in mixed case
private static Map osisMap
          Standard OSIS names for the book of the Bible, in lowercase, generated at runtime
 
Constructor Summary
private OSISNames()
          Ensure that we can not be instantiated
 
Method Summary
static String getName(int book)
          Get the OSIS name for a book.
static int getNumber(String find)
          Get number of a book from its name.
private static String getString(ResourceBundle resources, String key)
           
private static void initialize()
          Load up the resources for Bible book and section names, and cache the upper and lower versions of them.
static boolean isBookName(String find)
          Is the given string a valid book name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OSIS_LOCALE

private static final Locale OSIS_LOCALE
The Locale of OSIS Names


instance

static final OSISNames instance
A singleton used to do initialization. Could be used to change static methods to non-static


OSIS_KEY

private static final String OSIS_KEY
See Also:
Constant Field Values

osisBooks

private static String[] osisBooks
Standard OSIS names for the book of the Bible, in mixed case


osisMap

private static Map osisMap
Standard OSIS names for the book of the Bible, in lowercase, generated at runtime

Constructor Detail

OSISNames

private OSISNames()
Ensure that we can not be instantiated

Method Detail

getName

public static String getName(int book)
                      throws NoSuchVerseException
Get the OSIS name for a book.

Parameters:
book - The book number (1-66)
Returns:
the OSIS defined short name for a book
Throws:
NoSuchVerseException - If the book number is not valid

getNumber

public static int getNumber(String find)
Get number of a book from its name.

Parameters:
find - The string to identify
Returns:
The book number (1 to 66) On error -1

isBookName

public static boolean isBookName(String find)
Is the given string a valid book name. If this method returns true then getBookNumber() will return a number and not throw an exception.

Parameters:
find - The string to identify
Returns:
The book number (1 to 66)

initialize

private static void initialize()
Load up the resources for Bible book and section names, and cache the upper and lower versions of them.


getString

private static String getString(ResourceBundle resources,
                                String key)

Copyright ยจ 2003-2007