org.crosswire.jsword.versification
Class BibleNames

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

public final class BibleNames
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
static byte ACTS
           
private static String ALT_KEY
           
private  String[][] altBooks
          Alternative shortened names for the book of the Bible, expected to be normalized
private  Map altBooksMap
          Alternative shortened names for the book of the Bible, normalized, generated at runtime
static byte AMOS
           
static byte CHRONICLES1
           
static byte CHRONICLES2
           
static byte COLOSSIANS
           
static byte CORINTHIANS1
           
static byte CORINTHIANS2
           
static byte DANIEL
           
static byte DEUTERONOMY
           
static byte ECCLESIASTES
           
static byte EPHESIANS
           
static byte ESTHER
           
static byte EXODUS
           
static byte EZEKIEL
           
static byte EZRA
           
private static String FULL_KEY
           
private  String[] fullBooks
          The full names of the book of the Bible, in mixed case
private  Map fullBooksMap
          The full names of the book of the Bible, normalized, generated at runtime
private  String[] fullBooksSearch
          The full names of the book of the Bible, normalized, generated at runtime
static byte GALATIANS
           
static byte GENESIS
          Handy book finder
static byte HABAKKUK
           
static byte HAGGAI
           
static byte HEBREWS
           
static byte HOSEA
           
static byte ISAIAH
           
static byte JAMES
           
static byte JEREMIAH
           
static byte JOB
           
static byte JOEL
           
static byte JOHN
           
static byte JOHN1
           
static byte JOHN2
           
static byte JOHN3
           
static byte JONAH
           
static byte JOSHUA
           
static byte JUDE
           
static byte JUDGES
           
static byte KINGS1
           
static byte KINGS2
           
static byte LAMENTATIONS
           
static byte LEVITICUS
           
private  Locale locale
          The locale for the Bible Names
static byte LUKE
           
static byte MALACHI
           
static byte MARK
           
static byte MATTHEW
           
static byte MICAH
           
static byte NAHUM
           
static byte NEHEMIAH
           
private static Pattern normPattern
          remove spaces and punctuation in Bible Names
static byte NUMBERS
           
static byte OBADIAH
           
static byte PETER1
           
static byte PETER2
           
static byte PHILEMON
           
static byte PHILIPPIANS
           
static byte PROVERBS
           
static byte PSALMS
           
static byte REVELATION
           
static byte ROMANS
           
static byte RUTH
           
static byte SAMUEL1
           
static byte SAMUEL2
           
private static String SHORT_KEY
           
private  String[] shortBooks
          Standard shortened names for the book of the Bible, in mixed case
private  Map shortBooksMap
          Standard shortened names for the book of the Bible, normalized, generated at runtime.
private  String[] shortBooksSearch
          Standard shortened names for the book of the Bible, normalized, generated at runtime.
static byte SONGOFSOLOMON
           
static byte THESSALONIANS1
           
static byte THESSALONIANS2
           
static byte TIMOTHY1
           
static byte TIMOTHY2
           
static byte TITUS
           
static byte ZECHARIAH
           
static byte ZEPHANIAH
           
 
Constructor Summary
BibleNames(Locale locale)
          Ensure that we can not be instantiated
 
Method Summary
 String getBookName(int book)
          Get the preferred name of a book.
 int getBookNumber(String find)
          Get number of a book from its name.
 String getLongBookName(int book)
          Get the full name of a book (e.g.
 String getShortBookName(int book)
          Get the short name of a book (e.g.
private  String getString(ResourceBundle resources, String key)
           
private  void initialize()
          Load up the resources for Bible book and section names, and cache the upper and lower versions of them.
 boolean isBookName(String find)
          Is the given string a valid book name.
private  String normalize(String str)
          Normalize by stripping punctuation and whitespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FULL_KEY

private static final String FULL_KEY
See Also:
Constant Field Values

SHORT_KEY

private static final String SHORT_KEY
See Also:
Constant Field Values

ALT_KEY

private static final String ALT_KEY
See Also:
Constant Field Values

GENESIS

public static final byte GENESIS
Handy book finder

See Also:
Constant Field Values

EXODUS

public static final byte EXODUS
See Also:
Constant Field Values

LEVITICUS

public static final byte LEVITICUS
See Also:
Constant Field Values

NUMBERS

public static final byte NUMBERS
See Also:
Constant Field Values

DEUTERONOMY

public static final byte DEUTERONOMY
See Also:
Constant Field Values

JOSHUA

public static final byte JOSHUA
See Also:
Constant Field Values

JUDGES

public static final byte JUDGES
See Also:
Constant Field Values

RUTH

public static final byte RUTH
See Also:
Constant Field Values

SAMUEL1

public static final byte SAMUEL1
See Also:
Constant Field Values

SAMUEL2

public static final byte SAMUEL2
See Also:
Constant Field Values

KINGS1

public static final byte KINGS1
See Also:
Constant Field Values

KINGS2

public static final byte KINGS2
See Also:
Constant Field Values

CHRONICLES1

public static final byte CHRONICLES1
See Also:
Constant Field Values

CHRONICLES2

public static final byte CHRONICLES2
See Also:
Constant Field Values

EZRA

public static final byte EZRA
See Also:
Constant Field Values

NEHEMIAH

public static final byte NEHEMIAH
See Also:
Constant Field Values

ESTHER

public static final byte ESTHER
See Also:
Constant Field Values

JOB

public static final byte JOB
See Also:
Constant Field Values

PSALMS

public static final byte PSALMS
See Also:
Constant Field Values

PROVERBS

public static final byte PROVERBS
See Also:
Constant Field Values

ECCLESIASTES

public static final byte ECCLESIASTES
See Also:
Constant Field Values

SONGOFSOLOMON

public static final byte SONGOFSOLOMON
See Also:
Constant Field Values

ISAIAH

public static final byte ISAIAH
See Also:
Constant Field Values

JEREMIAH

public static final byte JEREMIAH
See Also:
Constant Field Values

LAMENTATIONS

public static final byte LAMENTATIONS
See Also:
Constant Field Values

EZEKIEL

public static final byte EZEKIEL
See Also:
Constant Field Values

DANIEL

public static final byte DANIEL
See Also:
Constant Field Values

HOSEA

public static final byte HOSEA
See Also:
Constant Field Values

JOEL

public static final byte JOEL
See Also:
Constant Field Values

AMOS

public static final byte AMOS
See Also:
Constant Field Values

OBADIAH

public static final byte OBADIAH
See Also:
Constant Field Values

JONAH

public static final byte JONAH
See Also:
Constant Field Values

MICAH

public static final byte MICAH
See Also:
Constant Field Values

NAHUM

public static final byte NAHUM
See Also:
Constant Field Values

HABAKKUK

public static final byte HABAKKUK
See Also:
Constant Field Values

ZEPHANIAH

public static final byte ZEPHANIAH
See Also:
Constant Field Values

HAGGAI

public static final byte HAGGAI
See Also:
Constant Field Values

ZECHARIAH

public static final byte ZECHARIAH
See Also:
Constant Field Values

MALACHI

public static final byte MALACHI
See Also:
Constant Field Values

MATTHEW

public static final byte MATTHEW
See Also:
Constant Field Values

MARK

public static final byte MARK
See Also:
Constant Field Values

LUKE

public static final byte LUKE
See Also:
Constant Field Values

JOHN

public static final byte JOHN
See Also:
Constant Field Values

ACTS

public static final byte ACTS
See Also:
Constant Field Values

ROMANS

public static final byte ROMANS
See Also:
Constant Field Values

CORINTHIANS1

public static final byte CORINTHIANS1
See Also:
Constant Field Values

CORINTHIANS2

public static final byte CORINTHIANS2
See Also:
Constant Field Values

GALATIANS

public static final byte GALATIANS
See Also:
Constant Field Values

EPHESIANS

public static final byte EPHESIANS
See Also:
Constant Field Values

PHILIPPIANS

public static final byte PHILIPPIANS
See Also:
Constant Field Values

COLOSSIANS

public static final byte COLOSSIANS
See Also:
Constant Field Values

THESSALONIANS1

public static final byte THESSALONIANS1
See Also:
Constant Field Values

THESSALONIANS2

public static final byte THESSALONIANS2
See Also:
Constant Field Values

TIMOTHY1

public static final byte TIMOTHY1
See Also:
Constant Field Values

TIMOTHY2

public static final byte TIMOTHY2
See Also:
Constant Field Values

TITUS

public static final byte TITUS
See Also:
Constant Field Values

PHILEMON

public static final byte PHILEMON
See Also:
Constant Field Values

HEBREWS

public static final byte HEBREWS
See Also:
Constant Field Values

JAMES

public static final byte JAMES
See Also:
Constant Field Values

PETER1

public static final byte PETER1
See Also:
Constant Field Values

PETER2

public static final byte PETER2
See Also:
Constant Field Values

JOHN1

public static final byte JOHN1
See Also:
Constant Field Values

JOHN2

public static final byte JOHN2
See Also:
Constant Field Values

JOHN3

public static final byte JOHN3
See Also:
Constant Field Values

JUDE

public static final byte JUDE
See Also:
Constant Field Values

REVELATION

public static final byte REVELATION
See Also:
Constant Field Values

normPattern

private static Pattern normPattern
remove spaces and punctuation in Bible Names


locale

private Locale locale
The locale for the Bible Names


fullBooks

private String[] fullBooks
The full names of the book of the Bible, in mixed case


fullBooksSearch

private String[] fullBooksSearch
The full names of the book of the Bible, normalized, generated at runtime


fullBooksMap

private Map fullBooksMap
The full names of the book of the Bible, normalized, generated at runtime


shortBooks

private String[] shortBooks
Standard shortened names for the book of the Bible, in mixed case


shortBooksSearch

private String[] shortBooksSearch
Standard shortened names for the book of the Bible, normalized, generated at runtime.


shortBooksMap

private Map shortBooksMap
Standard shortened names for the book of the Bible, normalized, generated at runtime.


altBooks

private String[][] altBooks
Alternative shortened names for the book of the Bible, expected to be normalized


altBooksMap

private Map altBooksMap
Alternative shortened names for the book of the Bible, normalized, generated at runtime

Constructor Detail

BibleNames

public BibleNames(Locale locale)
Ensure that we can not be instantiated

Method Detail

getBookName

public String getBookName(int book)
                   throws NoSuchVerseException
Get the preferred name of a book. Altered by the case setting (see setBookCase() and isLongBookName())

Parameters:
book - The book number (1-66)
Returns:
The full name of the book
Throws:
NoSuchVerseException - If the book number is not valid

getLongBookName

public String getLongBookName(int book)
                       throws NoSuchVerseException
Get the full name of a book (e.g. "Genesis"). Altered by the case setting (see setBookCase())

Parameters:
book - The book number (1-66)
Returns:
The full name of the book
Throws:
NoSuchVerseException - If the book number is not valid

getShortBookName

public String getShortBookName(int book)
                        throws NoSuchVerseException
Get the short name of a book (e.g. "Gen"). Altered by the case setting (see setBookCase())

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

getBookNumber

public int getBookNumber(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 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)

normalize

private String normalize(String str)
Normalize by stripping punctuation and whitespace.

Parameters:
str - the string to normalize
Returns:
the normalized string

initialize

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


getString

private String getString(ResourceBundle resources,
                         String key)

Copyright ยจ 2003-2006