org.crosswire.jsword.book.sword
Class ModuleType

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

public abstract class ModuleType
extends Object
implements Serializable

Data about module types.

Distribution Licence:
JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
The copyright to this program is held by it's authors.

Version:
$Id: ModuleType.java,v 1.16 2005/03/19 01:56:47 dmsmith Exp $
Author:
Joe Walker [joe at eireneh dot com], DM Smith [dmsmith555 at yahoo dot com]
See Also:
Licence, Serialized Form

Field Summary
static ModuleType HREF_COM
          Uncompresses HREF Commentaries
private  String name
          The name of the ModuleType
private static int nextObj
           
private  int obj
           
static ModuleType RAW_COM
          Uncompressed Commentaries
static ModuleType RAW_FILES
          Uncompressed Commentaries
static ModuleType RAW_GEN_BOOK
          Generic Books
static ModuleType RAW_LD
          2-Byte Index Uncompressed Dictionaries
static ModuleType RAW_LD4
          4-Byte Index Uncompressed Dictionaries
static ModuleType RAW_TEXT
          Uncompressed Bibles
private  BookType type
          What booktype is this module
private static ModuleType[] VALUES
           
static ModuleType Z_COM
          Compressed Commentaries
static ModuleType Z_LD
          Compressed Dictionaries
static ModuleType Z_TEXT
          Compressed Bibles
 
Constructor Summary
ModuleType(String name, BookType 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 ModuleType fromString(String name)
          Lookup method to convert from a String
protected abstract  Backend getBackend(SwordBookMetaData sbmd, File rootPath)
          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
 BookType getBookType()
          The book type of this module
protected static Backend getCompressedBackend(SwordBookMetaData sbmd, File rootPath)
           
static ModuleType getModuleType(String name)
          Find a ModuleType from a name.
 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 ModuleType 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 ModuleType RAW_TEXT
Uncompressed Bibles


Z_TEXT

public static final ModuleType Z_TEXT
Compressed Bibles


RAW_COM

public static final ModuleType RAW_COM
Uncompressed Commentaries


Z_COM

public static final ModuleType Z_COM
Compressed Commentaries


HREF_COM

public static final ModuleType HREF_COM
Uncompresses HREF Commentaries


RAW_FILES

public static final ModuleType RAW_FILES
Uncompressed Commentaries


RAW_LD

public static final ModuleType RAW_LD
2-Byte Index Uncompressed Dictionaries


RAW_LD4

public static final ModuleType RAW_LD4
4-Byte Index Uncompressed Dictionaries


Z_LD

public static final ModuleType Z_LD
Compressed Dictionaries


RAW_GEN_BOOK

public static final ModuleType RAW_GEN_BOOK
Generic Books


name

private String name
The name of the ModuleType


type

private BookType type
What booktype is this module


nextObj

private static int nextObj

obj

private final int obj

VALUES

private static final ModuleType[] VALUES
Constructor Detail

ModuleType

public ModuleType(String name,
                  BookType type)
Simple ctor

Method Detail

getModuleType

public static ModuleType getModuleType(String name)
Find a ModuleType from a name.

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

getBookType

public BookType getBookType()
The book type of this module


isSupported

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

Parameters:
sbmd - the BookMetaData that this ModuleType works upon
Returns:
true if this is a useable ModuleType

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,
                                Backend backend)
Create a Book with the given backend


getBackend

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

Throws:
BookException

getCompressedBackend

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

isCompressedBackendSupported

protected static boolean isCompressedBackendSupported(SwordBookMetaData sbmd)

fromString

public static ModuleType 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-2004