public class ChooseNProblem extends AnswerableProblem<ChooseNAnswerValuePart,ChooseNAnswer,ChooseNAnswerValue,ChooseNResponseValue>
ChooseOneProblem
answerableClasses, probProperties
defaultResponseDescription
Modifier | Constructor and Description |
---|---|
|
ChooseNProblem(java.lang.String uid) |
protected |
ChooseNProblem(java.lang.String className,
java.lang.String uid) |
Modifier and Type | Method and Description |
---|---|
protected ChooseNAnswer |
addAnswer(java.lang.String uid,
boolean isCorrect,
ChooseNAnswerValuePart... valueParts)
Given a list of value parts, returns a subclass instance of an
Answer containing
those values. |
ChooseNAnswer |
addAnswer(java.lang.String uid,
boolean isCorrect,
java.lang.String value) |
static java.lang.String |
getClassName()
Returns this class' fully specified name.
|
static AnswerableProblemAttributes |
getProblemAttributes()
Returns the problem type attributes for ChooseNProblem.
|
java.util.List<java.lang.String> |
getResponseTypeDescription() |
boolean |
isCorrect(ChooseNResponseValue response,
java.util.Map<java.lang.String,java.lang.String> args)
Determines whether the submitted response to this question is correct.
|
ChooseNResponseValue |
makeResponse(java.lang.String... selectedItems)
Creates an object that holds the student's response to the question.
|
addAnswer, addProperty, getAnswer, getAnswerCount, getAnswerEvalType, getAnswerEvalTypes, getAnswers, getAnswers, getAnswerValuePartsList, getCorrectAnswer, getProblemTypeAttributes, getProblemTypeAttributes, getProperties, getProperty, getResponseEvalType, getResponseEvalTypes, getUnscrambledAnswerIndexes, getUnscrambledAnswerIndexes, getWrongAnswer, isAllowedAnswerEvalType, isAllowedResponseEvalType, isAnswerable, isCorrect, isCorrectDefault, isScrambleAnswers, registerProblemTypeAttributes, setAnswerEvalTypes, setAnswerEvalTypes, setAnswers, setCorrectAnswer, setProperties, setResponseEvalTypes, setResponseEvalTypes, setScrambleAnswers, setWrongAnswer, validate
getQuestion, setQuestion
initializeContent
getDescription, getName, setDescription, setName
createKey, createKey, equals, extractType, extractUID, getKey, getShortKey, getShortKey, getType, getUID, getValidatorUtilities, setValidatorUtilities, toString, validateKey
public ChooseNProblem(java.lang.String uid)
protected ChooseNProblem(java.lang.String className, java.lang.String uid)
public static AnswerableProblemAttributes getProblemAttributes()
This is a convenience method so that a caller can gain access to the problem type attributes without having to first instantiate an instance of ChooseNProblem.
public static java.lang.String getClassName()
public ChooseNAnswer addAnswer(java.lang.String uid, boolean isCorrect, java.lang.String value)
protected ChooseNAnswer addAnswer(java.lang.String uid, boolean isCorrect, ChooseNAnswerValuePart... valueParts)
AnswerableProblem
Answer
containing
those values.
It is highly recommended that each AnswerableProblem subclass implements a custom, public version of the addAnswer(...) method which hides from the calling code the variable arguments AnswerValuePart... valueParts.
For example, a fill in problem would implement:
public FillInAnswer addAnswer(String uid, boolean isCorrect, String value)
The implementation of this abstract method would be responsible for obtaining the evaluation type, and the subsequent creation of an AnswerValuePart.
addAnswer
in class AnswerableProblem<ChooseNAnswerValuePart,ChooseNAnswer,ChooseNAnswerValue,ChooseNResponseValue>
uid
- Unique identifier for this answervalueParts
- The value parts comprising this answer.AnswerableProblem.getAnswerEvalTypes()
,
AnswerValuePart
public ChooseNResponseValue makeResponse(java.lang.String... selectedItems)
makeResponse
in class AnswerableProblem<ChooseNAnswerValuePart,ChooseNAnswer,ChooseNAnswerValue,ChooseNResponseValue>
selectedItems
- An array containing the indexes of the student's selection.
For example: if the student checked off the 1st, 3rd, and 4th items, responseParts
would contain:
public boolean isCorrect(ChooseNResponseValue response, java.util.Map<java.lang.String,java.lang.String> args)
AnswerableProblem
If your problem type defines correctness as when the student's response matches any one of
the answers marked as a correct answer, then your subclass can implement this method to call
#isCorrectDefault(StudentResponseValue)
.
If your problem type requires a different semantic for determining correctness, you must
implement that logic yourself in isCorrect(). In this case, your implementation
may want (or need) to call AnswerableProblem.setWrongAnswer(Answer)
so that a common wrong answer
is available later to a caller.
isCorrect
in class AnswerableProblem<ChooseNAnswerValuePart,ChooseNAnswer,ChooseNAnswerValue,ChooseNResponseValue>
response
- The student's response to compare to this problem's answer list.args
- Map for problem specific properties that will
be used in calculating correctness for the problem.#isCorrectDefault(StudentResponseValue)
,
AnswerableProblem.setWrongAnswer(Answer)
public java.util.List<java.lang.String> getResponseTypeDescription()
getResponseTypeDescription
in class Problem