net.sourceforge.pavlov.event
Class AnswerEvent

java.lang.Object
  extended by net.sourceforge.pavlov.event.AnswerEvent

public final class AnswerEvent
extends Object

An event generated when a user answers a question in a quiz. Contains, directly and indirectly, almost all available information about the user, the current book and chapter, and the current quiz.


Constructor Summary
AnswerEvent(boolean wasCorrect)
          Creates a new AnswerEvent instance.
AnswerEvent(boolean correct, User user, QuestionData question, QuizData quiz, BookData book, ChapterData chapter, boolean newQuiz)
          Creates a new AnswerEvent instance.
 
Method Summary
 BookData getBookData()
          Returns the BookData for the Book containing the answered question.
 ChapterData getChapterData()
          Returns the ChapterData for the chapter containing the answered question.
 ChapterStatistics getChapterStatistics()
          Returns the ChapterStatistics for the chapter containing the answered question.
 int getNumberOfAnswers()
          How many questions answered in the current quiz.
 int getNumberOfCorrectAnswers()
          How many correct answers in the current quiz.
 int getNumberOfIncorrectAnswers()
          How many incorrect answers in the current quiz.
 double getPercentageOfCorrectAnswers()
          Percentage of correct answers in the current quiz.
 QuestionData getQuestionData()
          Returns the QuestionData for the answered question.
 QuizData getQuizData()
          Returns the QuizData for the current quiz.
 User getUser()
          Returns the User who answered the question.
 boolean isCorrect()
          Whether the answer was correct.
 boolean isNewQuiz()
          Returns true if this is the first answer in a quiz.
 void setCorrect(boolean newCorrect)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnswerEvent

public AnswerEvent(boolean wasCorrect)
Creates a new AnswerEvent instance.

Parameters:
wasCorrect - whether the answer was correct

AnswerEvent

public AnswerEvent(boolean correct,
                   User user,
                   QuestionData question,
                   QuizData quiz,
                   BookData book,
                   ChapterData chapter,
                   boolean newQuiz)
Creates a new AnswerEvent instance.

Parameters:
wasCorrect - whether the answer was correct
theUser - an User value
theQues - a QuestionData value
theQuiz - a QuizData value
theBook - a BookData value
theChapter - a ChapterData value
newQuiz - a boolean value
Method Detail

isCorrect

public boolean isCorrect()
Whether the answer was correct.

Returns:
a boolean value

setCorrect

public void setCorrect(boolean newCorrect)

getNumberOfAnswers

public int getNumberOfAnswers()
How many questions answered in the current quiz.

Returns:
an int value

getNumberOfCorrectAnswers

public int getNumberOfCorrectAnswers()
How many correct answers in the current quiz.

Returns:
an int value

getNumberOfIncorrectAnswers

public int getNumberOfIncorrectAnswers()
How many incorrect answers in the current quiz.

Returns:
an int value

getPercentageOfCorrectAnswers

public double getPercentageOfCorrectAnswers()
Percentage of correct answers in the current quiz.

Returns:
a double value

getQuizData

public QuizData getQuizData()
Returns the QuizData for the current quiz.

Returns:
a QuizData value

getChapterStatistics

public ChapterStatistics getChapterStatistics()
Returns the ChapterStatistics for the chapter containing the answered question.

Returns:
a ChapterStatistics value

getQuestionData

public QuestionData getQuestionData()
Returns the QuestionData for the answered question.

Returns:
a QuestionData value

getUser

public User getUser()
Returns the User who answered the question.

Returns:
an User value

getChapterData

public ChapterData getChapterData()
Returns the ChapterData for the chapter containing the answered question.

Returns:
a ChapterData value

getBookData

public BookData getBookData()
Returns the BookData for the Book containing the answered question.

Returns:
a BookData value

isNewQuiz

public boolean isNewQuiz()
Returns true if this is the first answer in a quiz.

Returns:
a boolean value