|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectexe.questionCollection
exe.XMLquestionCollection
public class XMLquestionCollection
This class stores a collection of XML questions to be
displayed along with GAIGS snapshots. It inherits the functionality of the
original questionCollection class but is used to store
questions in the new GAIGS XML format.
An XMLquestionCollection object contains a reference to the
PrintWriter output stream to which it is to write
question information and maintains a Vector of the
questions that have been added to the collection. Using an
XMLquestionCollection in a script-producing program provides a
simple mechanism for managing questions and properly inserting
them into the showfile.
In order to use the XML question support provided by
XMLquestionCollection, a script-producing program must import
the package exe. Note that an
XMLquestionCollection only allows the insertion of
questions of the types XMLfibQuestion,
XMLmcQuestion, XMLmsQuestion, and
XMLtfQuestion. Therefore, this class is intended for use with
programs that produce scripts in the new GAIGS XML format.
| Constructor Summary | |
|---|---|
XMLquestionCollection(java.io.PrintWriter out)
Constructs a new XMLquestionCollection by specifying the
PrintWriter output stream to which this collection should
write its information. |
|
XMLquestionCollection(java.io.PrintWriter out,
int numq)
Constructs a new XMLquestionCollection by specifying the
PrintWriter output stream to which this collection should
write its information and the maximum number of questions
that can be added to this collection. |
|
XMLquestionCollection(java.io.PrintWriter out,
int numq,
int nump)
Deprecated. Replaced by #XMLquestionCollection(PrintWriter, int)).
Due to changes in how XMLquestionCollection
handles probabilistic questioning, tne nump
parameter is no longer necessary and is simply ignored. |
|
| Method Summary | |
|---|---|
boolean |
addQuestion(question q)
Adds a question to this XMLquestionCollection. |
boolean |
addQuestion(question q,
boolean always)
Adds a question to this XMLquestionCollection
and gives the user the option to ignore the probability functions to
ensure that the question will be added. |
void |
writeQuestionsAtEOSF()
Writes out the information for each question stored in this
collection in the new GAIGS XML format. |
| Methods inherited from class exe.questionCollection |
|---|
adjustProbability, animalInsertQuestion, animalInsertQuestion, animalWriteQuestionsAtEOSF, incPos, insertQuestion, insertQuestion |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLquestionCollection(java.io.PrintWriter out)
XMLquestionCollection by specifying the
PrintWriter output stream to which this collection should
write its information.
This constructor creates an XMLquestionCollection that does
not use any of the new probability functions. Therefore, this
constructor can be used by script-producing programs that use different
methods to determine when questions should be added to the
showfile.
out - Indicates the PrintWriter output stream to which
this XMLquestionCollection should write its
information.
public XMLquestionCollection(java.io.PrintWriter out,
int numq)
XMLquestionCollection by specifying the
PrintWriter output stream to which this collection should
write its information and the maximum number of questions
that can be added to this collection.
Invoking this constructor creates an XMLquestionCollection
that uses the value passed to numq to determine the
probability actually asking a question when
addQuestion is called.
out - Specifies the PrintWriter output stream to
which this XMLquestionCollection should write
its information.numq - Indicates the maximum number of questions that
can be added to this XMLquestionCollection.
This value is used to determine the probability of actually
asking thisquestion.
public XMLquestionCollection(java.io.PrintWriter out,
int numq,
int nump)
#XMLquestionCollection(PrintWriter, int)).
Due to changes in how XMLquestionCollection
handles probabilistic questioning, tne nump
parameter is no longer necessary and is simply ignored.
XMLquestionCollection by specifying the
PrintWriter output stream to which this collection should
write its information, the maximum number of questions that
can be added to this collection, and the number of possibilities to add
questions to this collection.
Calling this constructor creates an XMLquestionCollection
that uses the value passed to numq to determine the
probability of adding a question when
addQuestion is called and uses the value passed to
nump to evenly distribute the questions
throughout the showfile's snapshots.
out - Indicates the PrintWriter output stream to
which this XMLquestionCollection should write
its information.numq - Indicates the maximum number of questions that
can be added to this XMLquestionCollection.
This value is used to determine the probability of actually
asking thisquestion.nump - Specifies the number of opportunities to add a
question to this
XMLquestionCollection. This number is used to
evenly distribute questions throughout the
showfile. NO LONGER RELEVANT & NOW IGNORED| Method Detail |
|---|
public boolean addQuestion(question q)
question to this XMLquestionCollection.
addQuestion in class questionCollectionq - Indicates the question that should be added to
this collection. Note that only XMLfibQuestion,
XMLmcQuestion, XMLmsQuestion, and
XMLtfQuestion objects can be added to an
XMLquestionCollection; any other type of object
will never be added to this collection.
true if the specified
question was added to this collection; otherwise,
false is returned.
public boolean addQuestion(question q,
boolean always)
question to this XMLquestionCollection
and gives the user the option to ignore the probability functions to
ensure that the question will be added.
addQuestion in class questionCollectionq - Indicates the question that should be added
to this collection. Note that only
XMLfibQuestion, XMLmcQuestion,
XMLmsQuestion, and
XMLtfQuestion objects can be added to an
XMLquestionCollection; any other type of
object will never be added to this collection.always - Specifies if the probability functions should be used to
determine whether the question is added or
ignored. A value of true bypasses the
probability functions and causes the question
to be added as long as the maximum number of
questions has not already been reached. A
value of false makes this method function
identically to addQuestion(question).
true if the given
question was added to this collection;
otherwise returns false.public void writeQuestionsAtEOSF()
Writes out the information for each question stored in this
collection in the new GAIGS XML format.
All that must be done after calling this method is to print the
tag to the output stream and call its close() method to
finish producing the showfile. Printing the questions to
the end of the showfile with this method allows the
questions to be properly inserted into the animation at the
snapshots in which their references appear.
If no limit on the number of questions asked has been set, all questions in the collection are written out. If a limit has been set, first all questions marked as must be asked are written out (but not more than the limit). Then other questions are written out probablistically, up to the limit (for both types of questions). This ensures that exactly the limit number of questions will be asked, as long, of course, that there are at least that many questions in the collection.
writeQuestionsAtEOSF in class questionCollection
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||