net.sourceforge.pavlov.user
Class QuestionData

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

public final class QuestionData
extends Object

Encapsulates correct and incorrect responses to a given question.


Constructor Summary
QuestionData()
          Creates a QuestionData with id "NOID"
QuestionData(String id)
          Creates a QuestionData with the given id
 
Method Summary
 void addRight(Date when)
          Adds a correct response for this question
 void addWrong(Date when)
          Adds an incorrect response for this question
protected  void finalize()
           
 String getID()
          Return's this question's unique identifier
 Date getLastAsked()
          When last asked.
 int getNumAsked()
          Number of times asked.
 double getPercentage()
          Percentage of correct answers, or -1 if no answers.
 int getRight()
          Number of correct responses.
 int getTotal()
          Number of total responses.
 int getWrong()
          Number of incorrect responses.
 boolean hasBeenAsked()
          True if this question has been asked.
 double percentage()
          Deprecated. use getPercentage() instead.
 void setID(String id)
          Sets this question's unique identifier
 void toXML(Writer writer)
          Dumps this question in XML to the given writer.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuestionData

public QuestionData()
Creates a QuestionData with id "NOID"


QuestionData

public QuestionData(String id)
Creates a QuestionData with the given id

Parameters:
id - a String value
Method Detail

getID

public String getID()
Return's this question's unique identifier

Returns:
a String value

setID

public void setID(String id)
Sets this question's unique identifier

Parameters:
_id - a String value

addRight

public void addRight(Date when)
Adds a correct response for this question

Parameters:
when - a Date value

addWrong

public void addWrong(Date when)
Adds an incorrect response for this question

Parameters:
when - a Date value

getLastAsked

public Date getLastAsked()
When last asked.

Returns:
a Date value

percentage

@Deprecated
public double percentage()
Deprecated. use getPercentage() instead.

double from 0 to 100.0 of correct response percentage


getNumAsked

public int getNumAsked()
Number of times asked.

Returns:
an int value

hasBeenAsked

public boolean hasBeenAsked()
True if this question has been asked.

Returns:
a boolean value

getPercentage

public double getPercentage()
Percentage of correct answers, or -1 if no answers.

Returns:
a double value

getRight

public int getRight()
Number of correct responses.

Returns:
an int value

getWrong

public int getWrong()
Number of incorrect responses.

Returns:
an int value

getTotal

public int getTotal()
Number of total responses.

Returns:
an int value

toXML

public void toXML(Writer writer)
           throws IOException
Dumps this question in XML to the given writer.

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

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable