org.crosswire.jsword.book.sword
Enum BookType

java.lang.Object
  extended by java.lang.Enum<BookType>
      extended by org.crosswire.jsword.book.sword.BookType
All Implemented Interfaces:
Serializable, Comparable<BookType>

public enum BookType
extends Enum<BookType>

Data about book types.

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

Enum Constant Summary
HREF_COM
          Uncompresses HREF Commentaries
RAW_COM
          Uncompressed Commentaries
RAW_COM4
           
RAW_FILES
          Uncompressed Commentaries
RAW_GEN_BOOK
          Generic Books
RAW_LD
          2-Byte Index Uncompressed Dictionaries
RAW_LD4
          4-Byte Index Uncompressed Dictionaries
RAW_TEXT
          Uncompressed Bibles
Z_COM
          Compressed Commentaries
Z_LD
          Compressed Dictionaries
Z_TEXT
          Compressed Bibles
 
Field Summary
private  BookCategory category
          What category is this book
private  KeyType keyType
          What category is this book
private  String name
          The name of the BookType
 
Method Summary
 Book createBook(SwordBookMetaData sbmd)
          Create a Book appropriate for the BookMetaData
static BookType fromString(String name)
          Lookup method to convert from a String
protected abstract  Backend getBackend(SwordBookMetaData sbmd)
          Create a the appropriate backend for this type of book
protected abstract  Book getBook(SwordBookMetaData sbmd, Backend backend)
          Create a Book with the given backend
 BookCategory getBookCategory()
          The category of this book
static BookType getBookType(String name)
          Find a BookType from a name.
 KeyType getKeyType()
          Get the way this type of Book organizes it's keys.
 boolean isSupported(SwordBookMetaData sbmd)
          Given a SwordBookMetaData determine whether this BookType will work for it.
 String toString()
           
static BookType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static BookType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

RAW_TEXT

public static final BookType RAW_TEXT
Uncompressed Bibles


Z_TEXT

public static final BookType Z_TEXT
Compressed Bibles


RAW_COM

public static final BookType RAW_COM
Uncompressed Commentaries


RAW_COM4

public static final BookType RAW_COM4

Z_COM

public static final BookType Z_COM
Compressed Commentaries


HREF_COM

public static final BookType HREF_COM
Uncompresses HREF Commentaries


RAW_FILES

public static final BookType RAW_FILES
Uncompressed Commentaries


RAW_LD

public static final BookType RAW_LD
2-Byte Index Uncompressed Dictionaries


RAW_LD4

public static final BookType RAW_LD4
4-Byte Index Uncompressed Dictionaries


Z_LD

public static final BookType Z_LD
Compressed Dictionaries


RAW_GEN_BOOK

public static final BookType RAW_GEN_BOOK
Generic Books

Field Detail

name

private String name
The name of the BookType


category

private BookCategory category
What category is this book


keyType

private KeyType keyType
What category is this book

Method Detail

values

public static BookType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (BookType c : BookType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static BookType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getBookType

public static BookType getBookType(String name)
Find a BookType from a name.

Parameters:
name - The name of the BookType to look up
Returns:
The found BookType or null if the name is not found

getBookCategory

public BookCategory getBookCategory()
The category of this book

Returns:
the category of this book

getKeyType

public KeyType getKeyType()
Get the way this type of Book organizes it's keys.

Returns:
the organization of keys for this book

isSupported

public boolean isSupported(SwordBookMetaData sbmd)
Given a SwordBookMetaData determine whether this BookType will work for it.

Parameters:
sbmd - the BookMetaData that this BookType works upon
Returns:
true if this is a usable BookType

createBook

public Book createBook(SwordBookMetaData sbmd)
                throws BookException
Create a Book appropriate for the BookMetaData

Parameters:
sbmd - the book metadata
Returns:
a book for that metadata
Throws:
BookException

getBook

protected abstract Book getBook(SwordBookMetaData sbmd,
                                Backend backend)
Create a Book with the given backend


getBackend

protected abstract Backend getBackend(SwordBookMetaData sbmd)
                               throws BookException
Create a the appropriate backend for this type of book

Throws:
BookException

fromString

public static BookType fromString(String name)
Lookup method to convert from a String

Parameters:
name - the string representation of a book type
Returns:
the matching book type

toString

public String toString()
Overrides:
toString in class Enum<BookType>

Copyright ยจ 2003-2015