|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pavlov.main.Quiz
public class Quiz
Contains state information for a quiz in progress.
Field Summary | |
---|---|
protected Vector<AnswerListener> |
answerListeners
Components, mostly pluglets, that respond to users answers. |
protected ChapterReference |
chapRef
The chapter to choose questions from. |
Constructor Summary | |
---|---|
Quiz(AbstractPavlovApplication absPav,
User aUser,
ChapterReference ref)
Creates a new Quiz instance. |
Method Summary | |
---|---|
void |
addAnswerListener(AnswerListener g)
Register an AnswerListener with this quiz. |
void |
addQuestionChangedListener(QuestionChangedListener lis)
Adds an object to be notified when the question has changed. |
void |
answerEvent(AnswerEvent e)
The user has answered a question. |
ChapterData |
getChapterData()
Return the current ChapterData. |
ChapterReference |
getChapterReference()
Describe getChapterReference method here. |
protected Question |
getNextQuestion()
Gets a valud question using the user's current question selection strategy. |
User |
getUser()
Returns the active user. |
String |
getUserName()
Describe getUserName method here. |
Question |
newQuestion()
Ask the user a new question. |
protected void |
notifyAnswerListeners(boolean correct)
Let the registered answerlisteners know that the user has answered a question. |
protected void |
notifyQuestionChangedListeners()
Let registerd answer listeners know that the question has changed. |
protected void |
rightAnswer()
Tell quizData and chapterData that the user answered a question correctly. |
void |
save()
Saves the user's statistical data. |
void |
setStrategy(AbstractStrategy s)
Choose the question selection strategy. |
void |
strategyChanged(AbstractStrategy which)
Implements the StrategyListener interface. |
protected void |
wrongAnswer()
Tell quizData and chapterData that the user answered a question incorrectly. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ChapterReference chapRef
protected Vector<AnswerListener> answerListeners
Constructor Detail |
---|
public Quiz(AbstractPavlovApplication absPav, User aUser, ChapterReference ref)
Quiz
instance. The AbstractPavlovApplication
may safely be null.
absPav
- an AbstractPavlovApplication
valueaUser
- an User
valueref
- a ChapterReference
valueMethod Detail |
---|
public ChapterReference getChapterReference()
getChapterReference
method here.
ChapterReference
valuepublic String getUserName()
getUserName
method here.
String
valuepublic User getUser()
String
valuepublic void addQuestionChangedListener(QuestionChangedListener lis)
lis
- a QuestionChangedListener
valuepublic Question newQuestion()
Question
valueprotected void notifyQuestionChangedListeners()
public void save() throws FileNotFoundException, IOException
FileNotFoundException
- if an error occurs
IOException
- if an error occursprotected void rightAnswer()
protected void wrongAnswer()
protected void notifyAnswerListeners(boolean correct)
correct
- a boolean
valuepublic ChapterData getChapterData()
ChapterData
valueprotected Question getNextQuestion()
Question
valuepublic void answerEvent(AnswerEvent e)
answerEvent
in interface AnswerListener
e
- an AnswerEvent
valuepublic void setStrategy(AbstractStrategy s)
s
- an AbstractStrategy
valuepublic void strategyChanged(AbstractStrategy which)
strategyChanged
in interface StrategyListener
which
- an AbstractStrategy
valuepublic void addAnswerListener(AnswerListener g)
addAnswerListener
in interface AnswerEventProducer
g
- an AnswerListener
value
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |