org.crosswire.jsword.book
Class Defaults

java.lang.Object
  extended by org.crosswire.jsword.book.Defaults

public final class Defaults
extends Object

Handles the current default Books.

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

Nested Class Summary
(package private) static class Defaults.DefaultsBookListener
          To keep us up to date with changes in the available Books
 
Field Summary
private static String BIBLE_KEY
           
private static DefaultBook bibleDeft
          The default Bible
private static String COMMENTARY_KEY
           
private static DefaultBook commentaryDeft
          The default Commentary
private static Book currentBible
          The current bible being tracked.
private static String DAILY_DEVOTIONALS_KEY
           
private static DefaultBook dailyDevotionalDeft
          The default DailyDevotional
private static String DICTIONARY_KEY
           
private static DefaultBook dictionaryDeft
          The default Dictionary
private static String GREEKDEF_KEY
           
private static DefaultBook greekDefinitionsDeft
          The default Greek Definitions Dictionary.
private static String GREEKPARSE_KEY
           
private static DefaultBook greekParseDeft
          The default Greek Parse Dictionary.
private static String HEBREWDEF_KEY
           
private static DefaultBook hebrewDefinitionsDeft
          The default Hebrew Definitions Dictionary.
private static String HEBREWPARSE_KEY
           
private static DefaultBook hebrewParseDeft
          The default Hebrew Parse Dictionary.
private static boolean trackBible
          Indicates whether the last book of each type is used next time.
 
Constructor Summary
private Defaults()
          Prevent construction.
 
Method Summary
protected static void checkAllPreferable()
          Go through all of the current books checking to see if we need to replace the current defaults with one of these.
protected static void checkPreferable(Book book)
          Determine whether this Book become the default.
static Book getBible()
           
static String getBibleByName()
           
private static Map<Book,String> getBookMap(BookFilter filter)
          Convert a filter into an array of names of Books that pass the filter.
static Book getCommentary()
           
static String getCommentaryByName()
           
static Book getCurrentBible()
          Get the current Bible, if set, else the default Bible.
static Book getDailyDevotional()
           
static String getDailyDevotionalByName()
           
protected static DefaultBook getDefaultBible()
           
protected static DefaultBook getDefaultCommentary()
           
protected static DefaultBook getDefaultDailyDevotional()
           
protected static DefaultBook getDefaultDictionary()
           
protected static DefaultBook getDefaultGreekDefinitions()
           
protected static DefaultBook getDefaultGreekParse()
           
protected static DefaultBook getDefaultHebrewDefinitions()
           
protected static DefaultBook getDefaultHebrewParse()
           
static Book getDictionary()
           
static String getDictionaryByName()
           
static Book getGreekDefinitions()
           
static String getGreekDefinitionsByName()
           
static Book getGreekParse()
           
static String getGreekParseByName()
          Set the default Greek morphology dictionary by name.
static Book getHebrewDefinitions()
           
static String getHebrewDefinitionsByName()
           
static Book getHebrewParse()
           
static String getHebrewParseByName()
           
static boolean isCurrentBible()
          Determine whether the getBible should return the current Bible or the user's chosen default.
static void refreshBooks()
          Create book lists for every type of book.
static void setBible(Book book)
          Set the default Bible.
static void setBibleByName(String name)
          Set the default Bible by name.
static void setCommentary(Book book)
          Set the default commentary.
static void setCommentaryByName(String name)
          Set the default commentary by name.
static void setCurrentBible(boolean current)
          Establish whether the getBible should return the current Bible or the user's chosen default.
static void setCurrentBook(Book book)
          If the user has chosen to remember the book (by type) then set the current book for that type.
static void setDailyDevotional(Book book)
          Set the default daily devotional.
static void setDailyDevotionalByName(String name)
          Set the default daily devotional by name.
static void setDictionary(Book book)
          Set the default dictionary.
static void setDictionaryByName(String name)
          Set the default dictionary by name.
static void setGreekDefinitions(Book book)
          Set the default Greek Strong's Numbers dictionary.
static void setGreekDefinitionsByName(String name)
          Set the default Greek Strong's Numbers dictionary by name.
static void setGreekParse(Book book)
          Set the default Greek morphology dictionary.
static void setGreekParseByName(String name)
           
static void setHebrewDefinitions(Book book)
          Set the default Hebrew Strong's Numbers dictionary.
static void setHebrewDefinitionsByName(String name)
          Set the default Hebrew Strong's Numbers dictionary by name.
static void setHebrewParse(Book book)
          Set the default Hebrew morphology dictionary by name.
static void setHebrewParseByName(String name)
          Set the default Hebrew morphology dictionary by name.
protected static void unsetBible()
          Unset the default Bible.
protected static void unsetCommentary()
          Unset the default commentary.
protected static void unsetDailyDevotional()
          Unset the default daily devotional.
protected static void unsetDictionary()
          Unset the default dictionary.
protected static void unsetGreekDefinitions()
          Unset the default Greek Strong's Numbers dictionary.
protected static void unsetGreekParse()
          Unset the default Greek morphology dictionary.
protected static void unsetHebrewDefinitions()
          Unset the default Hebrew Strong's Numbers dictionary.
protected static void unsetHebrewParse()
          Unset the default Hebrew morphology dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIBLE_KEY

private static final String BIBLE_KEY
See Also:
Constant Field Values

COMMENTARY_KEY

private static final String COMMENTARY_KEY
See Also:
Constant Field Values

DICTIONARY_KEY

private static final String DICTIONARY_KEY
See Also:
Constant Field Values

DAILY_DEVOTIONALS_KEY

private static final String DAILY_DEVOTIONALS_KEY
See Also:
Constant Field Values

GREEKDEF_KEY

private static final String GREEKDEF_KEY
See Also:
Constant Field Values

HEBREWDEF_KEY

private static final String HEBREWDEF_KEY
See Also:
Constant Field Values

GREEKPARSE_KEY

private static final String GREEKPARSE_KEY
See Also:
Constant Field Values

HEBREWPARSE_KEY

private static final String HEBREWPARSE_KEY
See Also:
Constant Field Values

trackBible

private static boolean trackBible
Indicates whether the last book of each type is used next time.


currentBible

private static Book currentBible
The current bible being tracked.


bibleDeft

private static DefaultBook bibleDeft
The default Bible


commentaryDeft

private static DefaultBook commentaryDeft
The default Commentary


dailyDevotionalDeft

private static DefaultBook dailyDevotionalDeft
The default DailyDevotional


dictionaryDeft

private static DefaultBook dictionaryDeft
The default Dictionary


greekParseDeft

private static DefaultBook greekParseDeft
The default Greek Parse Dictionary.


hebrewParseDeft

private static DefaultBook hebrewParseDeft
The default Hebrew Parse Dictionary.


greekDefinitionsDeft

private static DefaultBook greekDefinitionsDeft
The default Greek Definitions Dictionary.


hebrewDefinitionsDeft

private static DefaultBook hebrewDefinitionsDeft
The default Hebrew Definitions Dictionary.

Constructor Detail

Defaults

private Defaults()
Prevent construction.

Method Detail

isCurrentBible

public static boolean isCurrentBible()
Determine whether the getBible should return the current Bible or the user's chosen default.

Returns:
true if the bible tracks the user's selection

setCurrentBible

public static void setCurrentBible(boolean current)
Establish whether the getBible should return the current Bible or the user's chosen default.

Parameters:
current - whether getBible tracks the current Bible

setCurrentBook

public static void setCurrentBook(Book book)
If the user has chosen to remember the book (by type) then set the current book for that type.

Parameters:
book - the current Book

getCurrentBible

public static Book getCurrentBible()
Get the current Bible, if set, else the default Bible.

Returns:
the current Bible

setBible

public static void setBible(Book book)
Set the default Bible.

Parameters:
book - the default Bible

unsetBible

protected static void unsetBible()
Unset the default Bible.


getBible

public static Book getBible()
Returns:
the default Bible

getBibleByName

public static String getBibleByName()
Returns:
the name of the default Bible

setBibleByName

public static void setBibleByName(String name)
Set the default Bible by name.

Parameters:
name - the name of the default Bible

setCommentary

public static void setCommentary(Book book)
Set the default commentary.

Parameters:
book - the default commentary

unsetCommentary

protected static void unsetCommentary()
Unset the default commentary.


getCommentary

public static Book getCommentary()
Returns:
the default commentary

getCommentaryByName

public static String getCommentaryByName()
Returns:
the name of the default commentary

setCommentaryByName

public static void setCommentaryByName(String name)
Set the default commentary by name.

Parameters:
name - the default commentary's name

setDictionary

public static void setDictionary(Book book)
Set the default dictionary.

Parameters:
book - the default dictionary

unsetDictionary

protected static void unsetDictionary()
Unset the default dictionary.


getDictionary

public static Book getDictionary()
Returns:
the default dictionary

getDictionaryByName

public static String getDictionaryByName()
Returns:
the name of the default dictionary

setDictionaryByName

public static void setDictionaryByName(String name)
Set the default dictionary by name.

Parameters:
name - the name of the default dictionary

setDailyDevotional

public static void setDailyDevotional(Book book)
Set the default daily devotional.

Parameters:
book - the default daily devotional

unsetDailyDevotional

protected static void unsetDailyDevotional()
Unset the default daily devotional.


getDailyDevotional

public static Book getDailyDevotional()
Returns:
the default daily devotional

getDailyDevotionalByName

public static String getDailyDevotionalByName()
Returns:
the name of the default daily devotional

setDailyDevotionalByName

public static void setDailyDevotionalByName(String name)
Set the default daily devotional by name.

Parameters:
name - the name of the default daily devotional

setGreekDefinitions

public static void setGreekDefinitions(Book book)
Set the default Greek Strong's Numbers dictionary.

Parameters:
book - the default Greek Strong's Numbers dictionary.

unsetGreekDefinitions

protected static void unsetGreekDefinitions()
Unset the default Greek Strong's Numbers dictionary.


getGreekDefinitions

public static Book getGreekDefinitions()
Returns:
the default Greek Strong's Numbers dictionary

getGreekDefinitionsByName

public static String getGreekDefinitionsByName()
Returns:
the name of the default Greek Strong's Numbers dictionary

setGreekDefinitionsByName

public static void setGreekDefinitionsByName(String name)
Set the default Greek Strong's Numbers dictionary by name.

Parameters:
name - the name of the default Greek Strong's Numbers dictionary

setHebrewDefinitions

public static void setHebrewDefinitions(Book book)
Set the default Hebrew Strong's Numbers dictionary.

Parameters:
book - the default Hebrew Strong's Numbers dictionary.

unsetHebrewDefinitions

protected static void unsetHebrewDefinitions()
Unset the default Hebrew Strong's Numbers dictionary.


getHebrewDefinitions

public static Book getHebrewDefinitions()
Returns:
the default Hebrew Strong's Numbers dictionary

getHebrewDefinitionsByName

public static String getHebrewDefinitionsByName()
Returns:
the name of the default Hebrew Strong's Numbers dictionary

setHebrewDefinitionsByName

public static void setHebrewDefinitionsByName(String name)
Set the default Hebrew Strong's Numbers dictionary by name.

Parameters:
name - the name of the default Hebrew Strong's Numbers dictionary

setGreekParse

public static void setGreekParse(Book book)
Set the default Greek morphology dictionary.

Parameters:
book - the default Greek morphology dictionary.

unsetGreekParse

protected static void unsetGreekParse()
Unset the default Greek morphology dictionary.


getGreekParse

public static Book getGreekParse()
Returns:
the default Greek morphology dictionary

getGreekParseByName

public static String getGreekParseByName()
Set the default Greek morphology dictionary by name.

Returns:
the name of the default Greek morphology dictionary

setGreekParseByName

public static void setGreekParseByName(String name)
Parameters:
name - the name of the default Greek morphology dictionary

setHebrewParse

public static void setHebrewParse(Book book)
Set the default Hebrew morphology dictionary by name.

Parameters:
book - the default Hebrew morphology dictionary by name.

unsetHebrewParse

protected static void unsetHebrewParse()
Unset the default Hebrew morphology dictionary.


getHebrewParse

public static Book getHebrewParse()
Returns:
the default Hebrew morphology dictionary

getHebrewParseByName

public static String getHebrewParseByName()
Returns:
the name of the default Hebrew morphology dictionary

setHebrewParseByName

public static void setHebrewParseByName(String name)
Set the default Hebrew morphology dictionary by name.

Parameters:
name - the default Hebrew morphology dictionary by name.

getDefaultBible

protected static DefaultBook getDefaultBible()
Returns:
the default Bible

getDefaultCommentary

protected static DefaultBook getDefaultCommentary()
Returns:
the default commentary

getDefaultDictionary

protected static DefaultBook getDefaultDictionary()
Returns:
the default dictionary

getDefaultDailyDevotional

protected static DefaultBook getDefaultDailyDevotional()
Returns:
the default daily devotional

getDefaultGreekDefinitions

protected static DefaultBook getDefaultGreekDefinitions()
Returns:
the default Greek Strong's Numbers dictionary

getDefaultHebrewDefinitions

protected static DefaultBook getDefaultHebrewDefinitions()
Returns:
the default Hebrew Strong's Numbers dictionary

getDefaultGreekParse

protected static DefaultBook getDefaultGreekParse()
Returns:
the default Greek morphology dictionary

getDefaultHebrewParse

protected static DefaultBook getDefaultHebrewParse()
Returns:
the default Hebrew morphology dictionary

refreshBooks

public static void refreshBooks()
Create book lists for every type of book.


checkAllPreferable

protected static void checkAllPreferable()
Go through all of the current books checking to see if we need to replace the current defaults with one of these.


checkPreferable

protected static void checkPreferable(Book book)
Determine whether this Book become the default. It should, only if there is not one.

Parameters:
book - the book to check

getBookMap

private static Map<Book,String> getBookMap(BookFilter filter)
Convert a filter into an array of names of Books that pass the filter.

Parameters:
filter - the filter to locate matching books
Returns:
matching books

Copyright ยจ 2003-2015