net.sourceforge.pavlov.user
Class ChapterStatistics

java.lang.Object
  extended by net.sourceforge.pavlov.user.ChapterStatistics
All Implemented Interfaces:
Serializable

public class ChapterStatistics
extends Object
implements Serializable

Statistics which describle all quizzes a user has taken in a given chapter.

See Also:
Serialized Form

Field Summary
 double frequency
          Percentage of questions that have been answered.
 int nAnswered
          Number of questions in the chapter that have been answered.
 int nOnceRights
          Number of questions answered correctly at least once.
 int nOnlyWrongs
          Number of questions answered only wrong.
 int nQuestions
          Number of questions in the chapter.
 double onlyWrongsVersusNumberOfQuestions
          Percentage of questions answered at least once, but with no correct answers divided by number of questions in the chapter.
 double rightsVersusNumberOfAnswers
          Percentage of right answers.
 double rightsVersusNumberOfQuestions
          Percentage of questions answered right at least once divided by number of questions in chapter.
 int totAnswers
          Total number of answers.
 int totRights
          Total number of right answers.
 
Constructor Summary
ChapterStatistics()
          Creates a new ChapterStatistics instance.
ChapterStatistics(int nQs, int totAs, int nAns, int c, int d, int e)
          Creates a new ChapterStatistics instance.
 
Method Summary
 void addQuestionData(QuestionData qd)
          Add a question to the ChapterStatistics.
 void addRight(QuestionData q)
          Call when the question has been answered correctly.
 void addWrong(QuestionData q)
          Call when the question has been answered incorrectly.
 ChapterStatistics deepCopy()
          Uses a nifty trick from "Design Patterns in Java" to make a completely independent copy of this chapter.
 int getNumberNeverAnswered()
          Number of questions in the chapter that the user has never answered.
 double getPercentageOfRightAnswers()
          Number of right answers as percentage of number of total answers.
 double getPercentageOfWrongAnswers()
          Number of wrong answers as percentage of number of total answers.
 double getPercentNeverAnswered()
          Percentage of questions in the chapter that the user has never answered.
 double getPercentOfQuestionsAnsweredAtLeastOnce()
          Percentage of questions in the chapter that have been answered at least once.
 double getPercentOfQuestionsAnsweredRightAtLeastOnce()
          Percentage of questions that have been answered correctly at least once.
 double getPercentOfQuestionsOnlyAnsweredWrong()
          Percentage of questions that have been answered at least once, but never correctly.
 int getTotalNumberOfWrongAnswers()
          Number of wrong answers over all quizzes for this user on this chapter.
 void recalc()
          Recalculares derived statistics from basic statistics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nQuestions

public int nQuestions
Number of questions in the chapter.


nAnswered

public int nAnswered
Number of questions in the chapter that have been answered.


nOnceRights

public int nOnceRights
Number of questions answered correctly at least once.


nOnlyWrongs

public int nOnlyWrongs
Number of questions answered only wrong.


totAnswers

public int totAnswers
Total number of answers.


totRights

public int totRights
Total number of right answers.


rightsVersusNumberOfQuestions

public double rightsVersusNumberOfQuestions
Percentage of questions answered right at least once divided by number of questions in chapter.


onlyWrongsVersusNumberOfQuestions

public double onlyWrongsVersusNumberOfQuestions
Percentage of questions answered at least once, but with no correct answers divided by number of questions in the chapter.


rightsVersusNumberOfAnswers

public double rightsVersusNumberOfAnswers
Percentage of right answers.


frequency

public double frequency
Percentage of questions that have been answered.

Constructor Detail

ChapterStatistics

public ChapterStatistics()
Creates a new ChapterStatistics instance.


ChapterStatistics

public ChapterStatistics(int nQs,
                         int totAs,
                         int nAns,
                         int c,
                         int d,
                         int e)
Creates a new ChapterStatistics instance.

Parameters:
nQs - Number of questions.
totAs - Total number of answers.
nAns - Number of questions answered at least once.
c - Number of questions answered correctly at least once.
d - Total number of correct answers.
e - Number of questions answered only incorrectly.
Method Detail

getPercentageOfRightAnswers

public double getPercentageOfRightAnswers()
Number of right answers as percentage of number of total answers.

Returns:
a double value

getPercentageOfWrongAnswers

public double getPercentageOfWrongAnswers()
Number of wrong answers as percentage of number of total answers.

Returns:
a double value

getPercentOfQuestionsAnsweredAtLeastOnce

public double getPercentOfQuestionsAnsweredAtLeastOnce()
Percentage of questions in the chapter that have been answered at least once.

Returns:
a double value

getTotalNumberOfWrongAnswers

public int getTotalNumberOfWrongAnswers()
Number of wrong answers over all quizzes for this user on this chapter.

Returns:
an int value

getPercentOfQuestionsAnsweredRightAtLeastOnce

public double getPercentOfQuestionsAnsweredRightAtLeastOnce()
Percentage of questions that have been answered correctly at least once.

Returns:
a double value

getPercentOfQuestionsOnlyAnsweredWrong

public double getPercentOfQuestionsOnlyAnsweredWrong()
Percentage of questions that have been answered at least once, but never correctly.

Returns:
a double value

getNumberNeverAnswered

public int getNumberNeverAnswered()
Number of questions in the chapter that the user has never answered.

Returns:
an int value

getPercentNeverAnswered

public double getPercentNeverAnswered()
Percentage of questions in the chapter that the user has never answered.

Returns:
a double value

recalc

public void recalc()
Recalculares derived statistics from basic statistics.


deepCopy

public ChapterStatistics deepCopy()
Uses a nifty trick from "Design Patterns in Java" to make a completely independent copy of this chapter. Useful in chapter editors.

Returns:
a ChapterStatistics value

addRight

public void addRight(QuestionData q)
Call when the question has been answered correctly.

Parameters:
q - a QuestionData value

addWrong

public void addWrong(QuestionData q)
Call when the question has been answered incorrectly.

Parameters:
q - a QuestionData value

addQuestionData

public void addQuestionData(QuestionData qd)
Add a question to the ChapterStatistics. Only add a question once!

Parameters:
qd - a QuestionData value