org.crosswire.jsword.book.basic
Class DefaultBookMetaData

java.lang.Object
  extended by org.crosswire.jsword.book.basic.AbstractBookMetaData
      extended by org.crosswire.jsword.book.basic.DefaultBookMetaData
All Implemented Interfaces:
Comparable, BookMetaData

public class DefaultBookMetaData
extends AbstractBookMetaData

DefaultBookMetaData is an implementation of the of the BookMetaData interface. A less complete implementation design for imheritance is available in AbstractBookMetaData where the complexity is in the setup rather than the inheritance. DefaultBookMetaData is probably the preferred implementation.

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: DefaultBookMetaData.java,v 1.18 2005/03/20 02:34:45 dmsmith Exp $
Author:
Joe Walker [joe at eireneh dot com]
See Also:
Licence

Field Summary
private  String initials
           
private  String name
           
private  BookType type
           
 
Fields inherited from class org.crosswire.jsword.book.basic.AbstractBookMetaData
DEFAULT_LANG_CODE
 
Fields inherited from interface org.crosswire.jsword.book.BookMetaData
KEY_BOOK, KEY_DRIVER, KEY_INDEXSTATUS, KEY_INITIALS, KEY_LANGUAGE, KEY_NAME, KEY_TYPE
 
Constructor Summary
DefaultBookMetaData(BookDriver driver, Book book, Properties prop)
          Ctor with a properties from which to get values.
DefaultBookMetaData(BookDriver driver, String name, BookType type)
          Ctor with some default values.
 
Method Summary
private  void addRow(org.jdom.Element table, String key, String value)
           
 String getInitials()
          The initials of this book - how people familiar with this book will know it, for example "NIV", "KJV".
 String getName()
          The name of the book, for example "King James Version" or "Bible in Basic English" or "Greek".
 BookType getType()
          What type of content is this, a Bible or a reference work like a Dictionary or Commentary
 boolean isLeftToRight()
          Return the orientation of the language of the Book.
 void setInitials(String initials)
          See note on setName() for side effect on setInitials().
 void setLanguage(String language)
           
 void setName(String name)
          Setting the name also sets some default initials, so if you wish to set some specific initials then it should be done after setting the name.
 void setType(BookType type)
           
 void setType(String typestr)
           
 org.jdom.Document toOSIS()
          Get an OSIS representation of information concerning this Book.
 
Methods inherited from class org.crosswire.jsword.book.basic.AbstractBookMetaData
addPropertyChangeListener, compareTo, equals, firePropertyChange, getDriver, getDriverName, getFullName, getIndexStatus, getLanguage, getLanguage, getOsisID, getProperties, getProperty, hasFeature, hashCode, putProperty, removePropertyChangeListener, setDriver, setIndexStatus, setProperties, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

type

private BookType type

name

private String name

initials

private String initials
Constructor Detail

DefaultBookMetaData

public DefaultBookMetaData(BookDriver driver,
                           Book book,
                           Properties prop)
Ctor with a properties from which to get values. A call to setBook() is still required after this ctor is called


DefaultBookMetaData

public DefaultBookMetaData(BookDriver driver,
                           String name,
                           BookType type)
Ctor with some default values. A call to setBook() is still required after this ctor is called

Method Detail

getType

public BookType getType()
Description copied from interface: BookMetaData
What type of content is this, a Bible or a reference work like a Dictionary or Commentary

Returns:
The type of book

getName

public String getName()
Description copied from interface: BookMetaData
The name of the book, for example "King James Version" or "Bible in Basic English" or "Greek". In general it should be possible to deduce the initials from the name by removing all the non-capital letters. Although this is only a generalization. This method should not return null or a blank string.

Returns:
The name of this book

getInitials

public String getInitials()
Description copied from interface: BookMetaData
The initials of this book - how people familiar with this book will know it, for example "NIV", "KJV".

Returns:
The book's initials

isLeftToRight

public boolean isLeftToRight()
Description copied from interface: BookMetaData
Return the orientation of the language of the Book. If a book contains more than one language, it refers to the dominate language of the book. This will be used to present Arabic and Hebrew in their propper orientation.

Returns:
true if the orientation for the dominate language is LeftToRight.

setLanguage

public void setLanguage(String language)
Parameters:
language - The language to set.

setInitials

public void setInitials(String initials)
See note on setName() for side effect on setInitials(). If a value of null is used then the initials are defaulted using the name

Parameters:
initials - The initials to set.
See Also:
setName(String)

setName

public void setName(String name)
Setting the name also sets some default initials, so if you wish to set some specific initials then it should be done after setting the name.

Parameters:
name - The name to set.
See Also:
setInitials(String)

setType

public void setType(BookType type)
Parameters:
type - The type to set.

setType

public void setType(String typestr)
Parameters:
typestr - The string version of the type to set.

toOSIS

public org.jdom.Document toOSIS()
Description copied from interface: BookMetaData
Get an OSIS representation of information concerning this Book.

Specified by:
toOSIS in interface BookMetaData
Overrides:
toOSIS in class AbstractBookMetaData

addRow

private void addRow(org.jdom.Element table,
                    String key,
                    String value)

Copyright ? 2003-2004