net.sourceforge.pavlov.library
Interface AbstractBook

All Superinterfaces:
Comparable
All Known Implementing Classes:
Book

public interface AbstractBook
extends Comparable

An interface to be implemented by classes that can act as Pavlov books. As of Pavlov 1.0, the only implementation is Book, which reads a book from an XML file. However, there's no reason that an implementation couldn't be written to generate its chapters and questions programmatically, i.e., an arithmetic book with chapters "Addition" and "Subtraction" who generate questions algorithmically from the question ID.


Method Summary
 String getAuthor()
          Returns name of the author/maintainer of this book.
 Chapter getChapter(String cpName)
          Returns the named chapter, or null if it doesn't exist
 Collection<AbstractChapter> getChaptersReadOnly()
          Returns the book's chapters as a read-only collection.
 String getCover()
          Returns filename of a descriptive image of this book.
 String getDescription()
          Returns textual description of this book's contents.
 String getName()
          Returns descriptive name of this book.
 int getNumberOfQuestions()
          Sums the number of questions of all my chapters and returns the total.
 String getTitle()
          Deprecated. use getName() instead.
 Collection<AbstractChapter> getValues()
          Deprecated.  
 void populateTree(DefaultMutableTreeNode bk)
          Displays chapters as a tree.
 void save(File directory)
           
 String toString()
          Returns the book's name
 void toXML(Writer writer)
          Dumps the Book in XML format to the given writer.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getAuthor

String getAuthor()
Returns name of the author/maintainer of this book.

Returns:
a String value

getChapter

Chapter getChapter(String cpName)
Returns the named chapter, or null if it doesn't exist

Parameters:
cpName - a String value
Returns:
a Chapter value

getCover

String getCover()
Returns filename of a descriptive image of this book.

Returns:
a String value

getDescription

String getDescription()
Returns textual description of this book's contents.

Returns:
a String value

getName

String getName()
Returns descriptive name of this book.

Returns:
a String value

getNumberOfQuestions

int getNumberOfQuestions()
Sums the number of questions of all my chapters and returns the total.

Returns:
an int value

getTitle

@Deprecated
String getTitle()
Deprecated. use getName() instead.

Describe getTitle method here.

Returns:
a String value

getValues

@Deprecated
Collection<AbstractChapter> getValues()
Deprecated. 

Returns the book's chapters as a collection.

Returns:
a Collection value

getChaptersReadOnly

Collection<AbstractChapter> getChaptersReadOnly()
Returns the book's chapters as a read-only collection.

Returns:
a Collection value

populateTree

void populateTree(DefaultMutableTreeNode bk)
Displays chapters as a tree.

Parameters:
bk - a DefaultMutableTreeNode value

toString

String toString()
Returns the book's name

Overrides:
toString in class Object
Returns:
a String value

toXML

void toXML(Writer writer)
           throws IOException
Dumps the Book in XML format to the given writer. Loops throught chapters, questions.

Parameters:
writer - a Writer value
Throws:
IOException - if an error occurs

save

void save(File directory)
          throws IOException
Throws:
IOException