public final class BookName extends Object
The GNU Lesser General Public License for details.
Modifier and Type | Field and Description |
---|---|
private String[] |
alternateNames |
private BibleBook |
book |
private static CaseType |
bookCase
How the book names are reported.
|
private static boolean |
fullBookName
Whether long or short, full or abbreviated names are used.
|
private Locale |
locale
The locale for the Book Name
|
private String |
longName |
private String |
normalizedLongName |
private String |
normalizedShortName |
private static Pattern |
normPattern
remove spaces and some punctuation in Book Name (make sure , is allowed)
|
private String |
shortName |
Constructor and Description |
---|
BookName(Locale locale,
BibleBook book,
String longName,
String shortName,
String alternateNames)
Create a BookName for a Book of the Bible in a given language.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
BibleBook |
getBook()
Get the BibleBook to which this set of names is tied.
|
static int |
getCase()
This is only used by config
|
static CaseType |
getDefaultCase()
How do we report the names of the books?.
|
String |
getLongName()
Get the full name of a book (e.g.
|
String |
getNormalizedLongName() |
String |
getNormalizedShortName() |
String |
getPreferredName()
Get the preferred name of a book.
|
String |
getShortName()
Get the short name of a book (e.g.
|
int |
hashCode() |
static boolean |
isFullBookName()
This is only used by config
|
boolean |
match(String normalizedName)
Match the normalized name as closely as possible.
|
static String |
normalize(String str,
Locale locale)
Normalize by stripping punctuation and whitespace and lowercasing.
|
static void |
setCase(CaseType newBookCase)
How do we report the names of the books?.
|
static void |
setCase(int bookCase)
This is only used by config.
|
static void |
setFullBookName(boolean fullName)
Set whether the name should be full or abbreviated, long or short.
|
String |
toString() |
private static Pattern normPattern
private BibleBook book
private String longName
private String normalizedLongName
private String shortName
private String normalizedShortName
private String[] alternateNames
private Locale locale
private static CaseType bookCase
private static boolean fullBookName
public BookName(Locale locale, BibleBook book, String longName, String shortName, String alternateNames)
locale
- the language of this BookNamebook
- the Book's canonical numberlongName
- the Book's long nameshortName
- the Book's short name, if anyalternateNames
- optional comma separated list of alternates for the Bookpublic BibleBook getBook()
public String getPreferredName()
public String getLongName()
public String getShortName()
public String getNormalizedLongName()
public String getNormalizedShortName()
public boolean match(String normalizedName)
normalizedName
- the already normalized name to match against.public static String normalize(String str, Locale locale)
str
- the string to normalizelocale
- the locale that should be used for normalizationpublic static void setCase(int bookCase)
bookCase
- The new case to use for reporting book namesIllegalArgumentException
- If the case is not between 0 and 2getCase()
public static void setCase(CaseType newBookCase)
newBookCase
- The new case to use for reporting book namesIllegalArgumentException
- If the case is not between 0 and 2getCase()
public static int getCase()
setCase(CaseType)
public static boolean isFullBookName()
setFullBookName(boolean)
public static void setFullBookName(boolean fullName)
fullName
- The new case to use for reporting book namesisFullBookName()
public static CaseType getDefaultCase()
setCase(int)