org.crosswire.jsword.versification
Class BibleNames

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

public final class BibleNames
extends Object

BibleNames deals with locale sensitive BibleBook name lookup conversions.

Author:
Joe Walker, DM Smith
See Also:
The GNU Lesser General Public License for details.

Nested Class Summary
private  class BibleNames.NameList
          NameList is the internal, internationalize list of names for a locale.
 
Field Summary
private static BibleNames.NameList englishBibleNames
          English BibleNames, or null when using the program's default locale
private static BibleNames instance
           
private  Map<Locale,BibleNames.NameList> localizedBibleNames
          we cache the Localized Bible Names because there is quite a bit of processing going on for each individual Locale
 
Constructor Summary
private BibleNames()
          This class is a singleton, enforced by a private constructor.
 
Method Summary
private static boolean containsLetter(String text)
          This is simply a convenience function to wrap Character.isLetter()
private  BibleNames.NameList getBibleNamesForLocale(Locale locale)
          Gets the bible names for a specific locale.
 BibleBook getBook(String find)
          Get a book from its name.
 BookName getBookName(BibleBook book)
          Get the BookName.
private  BibleNames.NameList getLocalizedBibleNames()
          Gets the localized bible names, based on the LocaleProviderManager
 String getLongName(BibleBook book)
          Get the full name of a book (e.g.
 String getPreferredName(BibleBook book)
          Get the preferred name of a book.
 String getShortName(BibleBook book)
          Get the short name of a book (e.g.
static BibleNames instance()
          Get the singleton instance of BibleNames.
 boolean isBook(String find)
          Is the given string a valid book name.
(package private)  void load(Locale locale)
          Load name information for BibleNames for a given locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localizedBibleNames

private transient Map<Locale,BibleNames.NameList> localizedBibleNames
we cache the Localized Bible Names because there is quite a bit of processing going on for each individual Locale


englishBibleNames

private static BibleNames.NameList englishBibleNames
English BibleNames, or null when using the program's default locale


instance

private static final BibleNames instance
Constructor Detail

BibleNames

private BibleNames()
This class is a singleton, enforced by a private constructor.

Method Detail

instance

public static BibleNames instance()
Get the singleton instance of BibleNames.

Returns:
the singleton

getBookName

public BookName getBookName(BibleBook book)
Get the BookName.

Parameters:
book - the desired book
Returns:
The requested BookName or null if not in this versification

getPreferredName

public String getPreferredName(BibleBook book)
Get the preferred name of a book. Altered by the case setting (see setBookCase() and isFullBookName())

Parameters:
book - the desired book
Returns:
The full name of the book or blank if not in this versification

getLongName

public String getLongName(BibleBook book)
Get the full name of a book (e.g. "Genesis"). Altered by the case setting (see setBookCase())

Parameters:
book - the book
Returns:
The full name of the book or blank if not in this versification

getShortName

public String getShortName(BibleBook book)
Get the short name of a book (e.g. "Gen"). Altered by the case setting (see setBookCase())

Parameters:
book - the book
Returns:
The short name of the book or blank if not in this versification

getBook

public BibleBook getBook(String find)
Get a book from its name.

Parameters:
find - The string to identify
Returns:
The BibleBook, On error null

isBook

public boolean isBook(String find)
Is the given string a valid book name. If this method returns true then getBook() will return a BibleBook and not null.

Parameters:
find - The string to identify
Returns:
true when the book name is recognized

load

void load(Locale locale)
Load name information for BibleNames for a given locale. This routine is for testing the underlying NameList.

Parameters:
locale -

getLocalizedBibleNames

private BibleNames.NameList getLocalizedBibleNames()
Gets the localized bible names, based on the LocaleProviderManager

Returns:
the localized bible names

getBibleNamesForLocale

private BibleNames.NameList getBibleNamesForLocale(Locale locale)
Gets the bible names for a specific locale.

Parameters:
locale - the locale
Returns:
the bible names for locale

containsLetter

private static boolean containsLetter(String text)
This is simply a convenience function to wrap Character.isLetter()

Parameters:
text - The string to be parsed
Returns:
true if the string contains letters

Copyright ยจ 2003-2015