public interface Question extends Serializable
slots
, which represent a slot for the student to enter an answer. Each Slot
contains:
syntax
assertion that specifies the expected
syntax of the student's answer being entered into that Slot
.
AnswerField
.
AuthorAnswer
, which represent evaluation criteria for the student's answer to be graded
against. Each AuthorAnswer
contains:
AuthorAnswer.getValue()
).
Comparison
assertion that specifies the type of comparison
the will be performed between the student's answer and the correct answer.
Validation
assertions that the student's
answer has to fulfill in order to be correct.
AuthorAnswer
(that is, the grade that students will obtain if their answer
is graded as correct according to the criteria contained in that AuthorAnswer
).
Slot
,
AuthorAnswer
Modifier and Type | Method and Description |
---|---|
void |
addAssertion(java.lang.String name,
int correctAnswer,
int studentAnswer,
java.lang.String[] parameters)
Deprecated.
|
Slot |
addNewSlot()
Adds a new slot to this question.
|
Slot |
addNewSlotFromModel(Slot slot)
Deprecated.
Use
Slot.copy(Slot) and AuthorAnswer.copy(AuthorAnswer) instead. |
java.lang.String |
getAlgorithm()
Get the algorithm that generates this question.
|
AnswerFieldType |
getAnswerFieldType()
Get the type of input field that will be used for the student answer.
|
java.lang.String |
getCorrectAnswer(int index)
Deprecated.
Use
AuthorAnswer.getValue() instead. |
int |
getCorrectAnswersLength()
Deprecated.
Use the arrays
getSlots() and Slot.getAuthorAnswers() instead. |
com.wiris.std.Array<java.lang.String> |
getDeprecationWarnings() |
java.lang.String |
getProperty(PropertyName name)
Get a question property.
|
Slot[] |
getSlots()
Gets the array of slots of this question.
|
Question |
getStudentQuestion()
Creates a new Question only with the data needed to properly render the
student's answer page.
|
void |
removeSlot(Slot slot)
Removes a slot from this question.
|
void |
setAlgorithm(java.lang.String session)
Set the algorithm that generates this question.
|
void |
setAnswerFieldType(AnswerFieldType type)
Set the type of input field that will be used for the student answer.
|
void |
setCorrectAnswer(int index,
java.lang.String answer)
Deprecated.
Use
AuthorAnswer.setValue(String) instead. |
void |
setOption(java.lang.String name,
java.lang.String value)
Deprecated.
Use {
setProperty(PropertyName, String) } instead. |
void |
setProperty(PropertyName name,
java.lang.String value)
Set a question property.
|
serialize
Slot[] getSlots()
Slot addNewSlot()
@Deprecated Slot addNewSlotFromModel(Slot slot)
Slot.copy(Slot)
and AuthorAnswer.copy(AuthorAnswer)
instead.slot
- A slot that belongs to this question.void removeSlot(Slot slot)
slot
- The slot to be removed.void setAnswerFieldType(AnswerFieldType type)
AnswerFieldType
AnswerFieldType getAnswerFieldType()
AnswerFieldType
void setAlgorithm(java.lang.String session)
session
- The XML Wiris cas session with the defined algorithm. Note
that if the session has a library, only the code inside the library will
be executed.java.lang.String getAlgorithm()
void setProperty(PropertyName name, java.lang.String value)
name
- The property name, from PropertyName
.value
- The property value.getProperty(PropertyName)
java.lang.String getProperty(PropertyName name)
name
- The property name, from PropertyName
.setProperty(PropertyName, String)
Question getStudentQuestion()
@Deprecated void setCorrectAnswer(int index, java.lang.String answer)
AuthorAnswer.setValue(String)
instead.index
- The index of the teacher answer starting from 0. Most
questions have only one single correct answer so the index will be 0.answer
- The MathML or plain text with the teacher's answer to the
question.@Deprecated java.lang.String getCorrectAnswer(int index)
AuthorAnswer.getValue()
instead.index
- The index of the teacher's answer within this question starting
from 0.@Deprecated int getCorrectAnswersLength()
getSlots()
and Slot.getAuthorAnswers()
instead.@Deprecated void addAssertion(java.lang.String name, int correctAnswer, int studentAnswer, java.lang.String[] parameters)
Slot.setSyntax(SyntaxName)
, AuthorAnswer.setComparison(ComparisonName)
or AuthorAnswer.addNewValidation(ValidationName)
instead.name
- The assertion name. Use the constants defined in Assertions
class.correctAnswer
- The correct answer index, starting from 0. If there
is only one correct answer set it to 0.studentAnswer
- The student answer index, starting from 0. If there
is only one student answer set it to 0.parameters
- A String array of ordered parameter values. If set to
null the parameters will have its default value.
See http://www.wiris.net/demo/quizzes/assertion.xml for a specification of
every assertion.@Deprecated void setOption(java.lang.String name, java.lang.String value)
setProperty(PropertyName, String)
} instead.name
- The name of the option. See the option constants in
QuizzesConstants
for a list and description
of all available options.value
- The value of the option. If set to null the option will be
removed from the question.com.wiris.std.Array<java.lang.String> getDeprecationWarnings()
Copyright © 2021 Maths for More S.L. All Rights Reserved.