net.sourceforge.pavlov.library
Interface AbstractChapter

All Superinterfaces:
Comparable
All Known Implementing Classes:
Chapter

public interface AbstractChapter
extends Comparable

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


Method Summary
 String getAuthor()
          Returns who wrote or maintains this chapter.
 String getCover()
          Returns the filename for a descriptive image.
 String getDescription()
          Returns descriptive text about the nature of the questions.
 int getNumberOfQuestions()
          Number of questions this chapter contains.
 Question getQuestion(String id)
          Gets the question with the specified ID or null if it doesn't exist.
 Collection<Question> getQuestionsCollection()
          Returns all questions as a Collection
 Collection<Question> getQuestionsReadOnly()
          Returns the chapter's questions as a read-only collection.
 String getTitle()
          Returns the title of this chapter.
 String toString()
          Returns the chapter's title
 void toXML(Writer writer)
          Dumps the chapter in XML format to the given writer.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getAuthor

String getAuthor()
Returns who wrote or maintains this chapter.

Returns:
a String value

getCover

String getCover()
Returns the filename for a descriptive image.

Returns:
a String value

getDescription

String getDescription()
Returns descriptive text about the nature of the questions.

Returns:
a String value

getNumberOfQuestions

int getNumberOfQuestions()
Number of questions this chapter contains.

Returns:
an int value

getQuestion

Question getQuestion(String id)
Gets the question with the specified ID or null if it doesn't exist.

Parameters:
id - a String value
Returns:
a Question value

getTitle

String getTitle()
Returns the title of this chapter.

Returns:
a String value

getQuestionsCollection

Collection<Question> getQuestionsCollection()
Returns all questions as a Collection

Returns:
a Collection value

getQuestionsReadOnly

Collection<Question> getQuestionsReadOnly()
Returns the chapter's questions as a read-only collection.

Returns:
a Collection value

toString

String toString()
Returns the chapter's title

Overrides:
toString in class Object
Returns:
a String value

toXML

void toXML(Writer writer)
           throws IOException
Dumps the chapter in XML format to the given writer. Dumps all questions too.

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