net.sourceforge.pavlov.user
Class BookData

java.lang.Object
  extended by net.sourceforge.pavlov.user.BookData

public final class BookData
extends Object

Encapsulates a users responses to all questions in a book.

See Also:
Book, ChapterData, QuestionData

Constructor Summary
BookData()
          Creates a new BookData entitled "Untitled".
BookData(String title)
          Creates a new BookData with the given title
 
Method Summary
 void addChapter(ChapterData chap)
          Adds the given ChapterData to this book, keyed on ChapterData.getTitle().
 ChapterData getChapter(String chapterName)
          Returns the named ChapterData, or null if it doesn't exist.
 QuestionData getQuestionData(String chapterName, String questionID)
          Returns the named ChapterData, or null if it doesn't exist.
 String getTitle()
          Returns the Book's title.
 void setLast(String date)
          Deprecated.  
 void setTitle(String title)
          Sets the Book's title.
 void toXML(Writer writer)
          Dumps the BookData in XML format to the given writer.
 void validate(AbstractBook book)
          Describe validate method here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BookData

public BookData(String title)
Creates a new BookData with the given title

Parameters:
title - a String value

BookData

public BookData()
Creates a new BookData entitled "Untitled".

Method Detail

getTitle

public String getTitle()
Returns the Book's title.

Returns:
a String value

setTitle

public void setTitle(String title)
Sets the Book's title.

Parameters:
title - a String value

getChapter

public ChapterData getChapter(String chapterName)
Returns the named ChapterData, or null if it doesn't exist.

Parameters:
chapterName - a String value
Returns:
a ChapterData value

getQuestionData

public QuestionData getQuestionData(String chapterName,
                                    String questionID)
Returns the named ChapterData, or null if it doesn't exist.

Parameters:
chapterName - a String value
questionID - a String value
Returns:
a QuestionData value

addChapter

public void addChapter(ChapterData chap)
Adds the given ChapterData to this book, keyed on ChapterData.getTitle().

Parameters:
c - a ChapterData value

setLast

@Deprecated
public void setLast(String date)
Deprecated. 

Sets the time of the last response to a question in this book.

Parameters:
t - a String value

validate

public void validate(AbstractBook book)
Describe validate method here.

Parameters:
book - an AbstractBook value

toXML

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

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