public class Quizzes
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
Configuration |
getConfiguration()
Gives the configuration.
|
static Quizzes |
getInstance()
Get a
Quizzes object. |
MathFilter |
getMathFilter()
Gives a MathFilter object.
|
QuizzesComponentBuilder |
getQuizzesComponentBuilder()
Get a
QuizzesComponentBuilder object. |
QuizzesService |
getQuizzesService()
Gives a QuizzesService object.
|
java.lang.String |
getResourceUrl(java.lang.String name)
Get the url of a static resource, to be linked from client-side.
|
QuestionRequest |
newFeaturedAssertionsRequest(Question question)
Create a QuestionRequest that deduces the possible assertions for the correct answers of the question.
|
QuestionRequest |
newFeaturedSyntaxAssertionsRequest(Question question)
Create a QuestionRequest that deduces the possible syntax assertions for the correct answers of the question.
|
QuestionRequest |
newFeedbackRequest(java.lang.String html,
QuestionInstance instance)
Create a QuestionRequest that evaluates the student answer(s) and gets the variables to be used in the feedback.
|
QuestionRequest |
newGradeRequest(QuestionInstance instance)
Creates a new
QuestionRequest object suitable to send to the quizzes
service in order to evaluate a set of student answers against a
set of correct answers using a defined criteria. |
QuestionRequest |
newMultipleAnswersGradeRequest(java.lang.String[] correctAnswers,
java.lang.String[] studentAnswers)
Like
newSimpleGradeRequest(String, String) but this method allows to compare several student's
answers with several correct answers using the default comparison criteria. |
Question |
newQuestion()
Creates a new empty
Question object. |
QuestionInstance |
newQuestionInstance(Question q)
Creates a new
QuestionInstance object from the given
Question. |
QuestionRequest |
newSimpleGradeRequest(java.lang.String correctAnswer,
java.lang.String studentAnswer)
Creates a new
QuestionRequest object suitable to send to the quizzes service
in order to evaluate a student answer against a correct answer using the default criteria. |
QuestionRequest |
newVariablesRequest(java.lang.String html,
QuestionInstance instance)
Creates a new
QuestionRequest object suitable to send to the quizzes
service in order to get variable values generated from an algorithm. |
QuestionRequest |
newVariablesRequestWithQuestionData(java.lang.String html,
QuestionInstance instance)
Creates a new
QuestionRequest object suitable to send to the quizzes
service in order to get variable values generated from an algorithm, but, unlike the
function newVariablesRequest(String, QuestionInstance), this function automatically
includes in the QuestionRequest object the variable requests for the placeholders
that are present in any of the Question data fields, such as correct answers
and initial contents. |
Question |
readQuestion(java.lang.String xml)
Creates a new
Question object reading its contents from XML. |
QuestionInstance |
readQuestionInstance(java.lang.String xml,
Question q)
Creates a new
QuestionInstance object reading its contents from XML. |
public static Quizzes getInstance()
Quizzes object. This is the entry point to the Wiris Quizzes API.Quizzes.public QuizzesComponentBuilder getQuizzesComponentBuilder()
QuizzesComponentBuilder object. This class is responsible for the creation of
UI components in the Wiris Quizzes API.QuizzesComponentBuilder.public QuestionInstance newQuestionInstance(Question q)
QuestionInstance object from the given
Question.q - The question related to the new QuestionInstance. Cannot be null.java.lang.Error - if q is null.public Question readQuestion(java.lang.String xml)
Question object reading its contents from XML. It is the
inverse operation that the Serializable.serialize() method of Question object.xml - The XML definition of the Question object. The root tag is
<question>.java.lang.Error - if the parameter is malformed XML or if the root tag is not <question>public QuestionInstance readQuestionInstance(java.lang.String xml, Question q)
QuestionInstance object reading its contents from XML. It is
the inverse operation that the Serializable.serialize() method of
QuestionInstance object.xml - The XML definition of the QuestionInstance object. The root tag
is <questionInstance>.q - The question related to the new QuestionInstance. Cannot be null.java.lang.Error - if the parameter is malformed XML, if the root tag is not <questionInstance>
or if q is null.public QuestionRequest newVariablesRequest(java.lang.String html, QuestionInstance instance)
QuestionRequest object suitable to send to the quizzes
service in order to get variable values generated from an algorithm.html - The text/html with placeholders for variables. It is used to
get the names of the variables to be requested. The placeholders are
variable names prefixed with the symbol #, and they may be inside MathML
formulas. If null the variable names will be taken from the second parameter.
It is specially useful when one want to rebuild the variables from a given
QuestionInstance because the cache is not ready.instance - The question instance with the random seed and the Question definition.java.lang.Error - if instance is null.newVariablesRequestWithQuestionData(String, QuestionInstance)public QuestionRequest newVariablesRequestWithQuestionData(java.lang.String html, QuestionInstance instance)
QuestionRequest object suitable to send to the quizzes
service in order to get variable values generated from an algorithm, but, unlike the
function newVariablesRequest(String, QuestionInstance), this function automatically
includes in the QuestionRequest object the variable requests for the placeholders
that are present in any of the Question data fields, such as correct answers
and initial contents.html - The text/html with placeholders for variables. It is used to
get the names of the variables to be requested. The placeholders are
variable names prefixed with the symbol #, and they may be inside MathML
formulas. If it is null, only the question data will be retrieved.instance - The question instance with the random seed and the Question definition.java.lang.Error - if instance is null.newVariablesRequest(String, QuestionInstance)public QuestionRequest newGradeRequest(QuestionInstance instance)
QuestionRequest object suitable to send to the quizzes
service in order to evaluate a set of student answers against a
set of correct answers using a defined criteria.instance - The question instance, with the random seed.java.lang.Error - If instance is null, or if the Question object associated to the
instance parameter is parsed (lazily) from XML within this method and it is malformed XML
or if correctAnswers or studentAnswers MathML contain malformed semantics annotation.newSimpleGradeRequest(String, String).,
newMultipleAnswersGradeRequest(String[], String[]).public QuestionRequest newSimpleGradeRequest(java.lang.String correctAnswer, java.lang.String studentAnswer)
QuestionRequest object suitable to send to the quizzes service
in order to evaluate a student answer against a correct answer using the default criteria.
This method is a shortcut for simple integrations that only need to compare student's answers and teacher's
answers using the default criteria. The method newGradeRequest(QuestionInstance) is to be used
to grade questions that have customizable grading criteria, as the ones created using the Wiris
Quizzes Studio.correctAnswer - The correct answer.studentAnswer - The student's answer.newMultipleAnswersGradeRequest(String[], String[]).,
newGradeRequest(QuestionInstance).public QuestionRequest newMultipleAnswersGradeRequest(java.lang.String[] correctAnswers, java.lang.String[] studentAnswers)
newSimpleGradeRequest(String, String) but this method allows to compare several student's
answers with several correct answers using the default comparison criteria.
This method is a shortcut for simple integrations that only need to compare student's answers and teacher's
answers using the default criteria. The method newGradeRequest(QuestionInstance) is to be used
to grade questions that have customizable grading criteria, as the ones created using the Wiris
Quizzes Studio.
The pairing between correct answers and user answers is done grouping
answers in equal sized sets. For example, if 4 correct answers {a, b, c, d}
and 2 user answers {x, y} are provided, it will be compared {a=x, b=x, c=y,
d=y}.correctAnswers - Array of correct or teacher answers.studentAnswers - Array of student answers.java.lang.Error - If Question parameter is parsed (lazily) from XML within this
method and it is malformed XML or if correctAnswers or studentAnswers MathML
contain malformed semantics annotation.newSimpleGradeRequest(String, String).,
newGradeRequest(QuestionInstance).public QuestionRequest newFeedbackRequest(java.lang.String html, QuestionInstance instance)
newGradeRequest(instance)newVariablesRequest(html, instance)html - The text where to find the variable placeholders to be used.instance - The question instance with student answers. It must be built using the methods of this
class rather than the deprecated ones at QuizzesBuilder to make sure it
is properly associated to a Question object.newVariablesRequest(String, QuestionInstance),
newGradeRequest(QuestionInstance),
PropertyName.STUDENT_ANSWER_PARAMETER_NAMEpublic QuizzesService getQuizzesService()
public MathFilter getMathFilter()
public Configuration getConfiguration()
public java.lang.String getResourceUrl(java.lang.String name)
name - The filename of the resource eg: wirisquizzes.css.public QuestionRequest newFeaturedSyntaxAssertionsRequest(Question question)
question - The question definition.public QuestionRequest newFeaturedAssertionsRequest(Question question)
question - The question definition.Copyright © 2021 Maths for More S.L. All Rights Reserved.