org.crosswire.jsword.book.sword
Class BookType

java.lang.Object
  extended by org.crosswire.jsword.book.sword.BookType
All Implemented Interfaces:
Serializable

public abstract class BookType
extends Object
implements Serializable

Data about book types.

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., Serialized Form

Field Summary
static BookType HREF_COM
          Uncompresses HREF Commentaries
private  String name
          The name of the BookType
private static int nextObj
           
private  int obj
           
static BookType RAW_COM
          Uncompressed Commentaries
static BookType RAW_FILES
          Uncompressed Commentaries
static BookType RAW_GEN_BOOK
          Generic Books
static BookType RAW_LD
          2-Byte Index Uncompressed Dictionaries
static BookType RAW_LD4
          4-Byte Index Uncompressed Dictionaries
static BookType RAW_TEXT
          Uncompressed Bibles
private  BookCategory type
          What category is this book
private static BookType[] VALUES
           
static BookType Z_COM
          Compressed Commentaries
static BookType Z_LD
          Compressed Dictionaries
static BookType Z_TEXT
          Compressed Bibles
 
Constructor Summary
BookType(String name, BookCategory type)
          Simple ctor
 
Method Summary
 Book createBook(SwordBookMetaData sbmd, File progdir)
          Create a Book appropriate for the BookMetaData
 boolean equals(Object o)
          Prevent subclasses from overriding canonical identity based Object methods
static BookType fromString(String name)
          Lookup method to convert from a String
protected abstract  AbstractBackend getBackend(SwordBookMetaData sbmd, File rootPath)
          Create a the appropriate backend for this type of book
protected abstract  Book getBook(SwordBookMetaData sbmd, AbstractBackend 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.
protected static AbstractBackend getCompressedBackend(SwordBookMetaData sbmd, File rootPath)
           
 int hashCode()
          Prevent subclasses from overriding canonical identity based Object methods
protected  boolean isBackendSupported(SwordBookMetaData sbmd)
          By default the backend is supported if the BookMetaData is not null.
protected static boolean isCompressedBackendSupported(SwordBookMetaData sbmd)
           
 boolean isSupported(SwordBookMetaData sbmd)
          Given a SwordBookMetaData determine whether this BookType will work for it.
(package private)  Object readResolve()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field 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


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


name

private String name
The name of the BookType


type

private BookCategory type
What category is this book


nextObj

private static int nextObj

obj

private final int obj

VALUES

private static final BookType[] VALUES
Constructor Detail

BookType

public BookType(String name,
                BookCategory type)
Simple ctor

Method Detail

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


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 useable BookType

isBackendSupported

protected boolean isBackendSupported(SwordBookMetaData sbmd)
By default the backend is supported if the BookMetaData is not null.

Returns:
true if this is a useable BackEnd

createBook

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

Throws:
BookException

getBook

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


getBackend

protected abstract AbstractBackend getBackend(SwordBookMetaData sbmd,
                                              File rootPath)
                                       throws BookException
Create a the appropriate backend for this type of book

Throws:
BookException

getCompressedBackend

protected static AbstractBackend getCompressedBackend(SwordBookMetaData sbmd,
                                                      File rootPath)
                                               throws BookException
Throws:
BookException

isCompressedBackendSupported

protected static boolean isCompressedBackendSupported(SwordBookMetaData sbmd)

fromString

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


equals

public final boolean equals(Object o)
Prevent subclasses from overriding canonical identity based Object methods

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public final int hashCode()
Prevent subclasses from overriding canonical identity based Object methods

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object

readResolve

Object readResolve()

Copyright ยจ 2003-2006