|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pavlov.library.Question
public class Question
The text of a question, its correct answer, incorrect answers, and associated information.
Constructor Summary | |
---|---|
Question()
Creates a new Question instance. |
|
Question(String _id)
Creates a new Question instance. |
Method Summary | |
---|---|
void |
addHint(String x)
Adds a hint for the question. |
void |
addWrongAnswer(String x)
Adds an incorrect answer for the question. |
int |
compareTo(Object obj)
|
Question |
deepCopy()
Uses a nifty trick from "Design Patterns in Java" to create a completely independent copy of this question. |
boolean |
equals(Object obj)
Returns true if the given object is a Question and its fields are equal to mine. |
protected void |
finalize()
|
Vector<String> |
getAnswersShuffled()
Gets the vector of incorrect answers. |
String |
getHint()
Returns a random hint. |
String |
getID()
Returns this question's ID. |
String |
getImageFile()
Gets the name of the image file to be shown for this question. |
URL |
getImageURL()
Gets the URL of the image file to be shown for this question. |
String |
getRightAnswer()
Returns this question's correct answer. |
String |
getRightAnswerEncoded()
Returns this question's correct answer URLEncoded. |
String |
getSoundFile()
Returns the name of the sound file to play when this question is presented to the user. |
String |
getText()
Returns this question's text. |
String |
getWrongAnswer()
Returns a random incorrect answer. |
String |
getWrongAnswer(int i)
Returns the numbered incorrect answer, or null if it doesn't exist. |
Vector<String> |
getWrongAnswers()
Gets the vector of incorrect answers. |
boolean |
hasImage()
Returns true if there is an image to display for this question. |
static Question |
makeBlankQuestion()
Creates a blank question suitable for editing. |
void |
setHints(Vector<String> v)
Sets the hints for this question. |
void |
setId(String x)
Sets the question's ID. |
void |
setImageFile(String x)
Sets the image to be displayed for this question. |
void |
setRightAnswer(String x)
Set's the question's correct answer. |
void |
setSoundFile(String x)
Sets the sound to play for this question. |
void |
setText(String x)
Sets the text of the question. |
void |
setWrongAnswer(String ans,
int i)
Sets wrongAnswer number i to ans. |
void |
setWrongAnswers(Vector<String> v)
Sets all the incorrect answers for this question. |
String |
toHTML(Writer writer,
Random v)
Dumps this queston as HTML to the given writer. |
void |
toXML(Writer writer)
Dumps this question as an XML entity to the given writer. |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Question()
Question
instance.
public Question(String _id)
Question
instance.
_id
- a String
valueMethod Detail |
---|
public int compareTo(Object obj)
compareTo
in interface Comparable
public void setId(String x)
x
- a String
valuepublic void setText(String x)
x
- a String
valuepublic void setRightAnswer(String x)
x
- a String
valuepublic void addWrongAnswer(String x)
x
- a String
valuepublic void addHint(String x)
x
- a String
valuepublic void setSoundFile(String x)
x
- a String
valuepublic void setImageFile(String x)
x
- a String
valuepublic String getImageFile()
String
valuepublic URL getImageURL()
String
valuepublic boolean hasImage()
boolean
valuepublic void setHints(Vector<String> v)
v
- a Vector
valuepublic void setWrongAnswers(Vector<String> v)
v
- a Vector
valuepublic void setWrongAnswer(String ans, int i)
ans
- a String
valuei
- an int
valuepublic Vector<String> getWrongAnswers()
Vector
valuepublic Vector<String> getAnswersShuffled()
Vector
valuepublic String getID()
String
valuepublic String getText()
String
valuepublic String getRightAnswer()
String
valuepublic String getRightAnswerEncoded()
String
valuepublic String getWrongAnswer()
String
valuepublic String getWrongAnswer(int i)
i
- an int
value
String
valuepublic String getHint()
String
valuepublic String getSoundFile()
String
valuepublic void toXML(Writer writer) throws IOException
writer
- a java.io.Writer
value
IOException
- if an error occurspublic String toHTML(Writer writer, Random v) throws IOException
writer
- a java.io.Writer
valuev
- a Random
value
String
value
IOException
- if an error occurspublic static Question makeBlankQuestion()
Question
valuepublic boolean equals(Object obj)
equals
in class Object
obj
- an Object
value
boolean
valuepublic Question deepCopy()
Question
valueprotected void finalize() throws Throwable
finalize
in class Object
Throwable
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |