public class FillInProblem extends AnswerableProblem<FillInAnswerValuePart,FillInAnswer,FillInAnswerValue,FillInResponseValue>
answerableClasses, probProperties
defaultResponseDescription
Modifier | Constructor and Description |
---|---|
|
FillInProblem(java.lang.String uid)
Constructor
For use when calling code directly needs an instance of
ProblemFillIn . |
protected |
FillInProblem(java.lang.String classType,
java.lang.String uid)
Constructor
For use when
ProblemFillIn has been subclassed. |
|
FillInProblem(java.lang.String uid,
java.lang.String name,
java.lang.String description)
Constructor
For use when calling code directly needs an instance of
ProblemFillIn . |
Modifier and Type | Method and Description |
---|---|
protected FillInAnswer |
addAnswer(java.lang.String uid,
boolean isCorrect,
FillInAnswerValuePart... valueParts)
Given a list of value parts, returns a subclass instance of an
Answer containing
those values. |
FillInAnswer |
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 FillInProblem.
|
java.util.List<java.lang.String> |
getResponseTypeDescription() |
boolean |
isCorrect(FillInResponseValue response,
java.util.Map<java.lang.String,java.lang.String> args)
Determines whether the submitted response to this question is correct.
|
protected FillInResponseValue |
makeResponse(java.lang.String... responseParts)
For the given values entered, returns an AnswerValue containing those parts.
|
FillInResponseValue |
makeResponse(java.lang.String studentResponse)
Creates and returns a student response value.
|
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 FillInProblem(java.lang.String uid)
ProblemFillIn
.uid
- UID of this instance.public FillInProblem(java.lang.String uid, java.lang.String name, java.lang.String description)
ProblemFillIn
.uid
- UID of this instance.name
- The name given to the problemdescription
- A short description of the problemprotected FillInProblem(java.lang.String classType, java.lang.String uid)
ProblemFillIn
has been subclassed. In that case
the subclass will need to use this constructor to specify its classType.classType
- Subclass' class type as a fully specified name. For example:
org.assistments.core.domain.FillInWithUnitsProblem
.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 FillInProblem.
public static java.lang.String getClassName()
public FillInAnswer addAnswer(java.lang.String uid, boolean isCorrect, java.lang.String value)
uid
- isCorrect
- value
- AnswerableProblem.getAnswerEvalTypes()
protected FillInAnswer addAnswer(java.lang.String uid, boolean isCorrect, FillInAnswerValuePart... 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<FillInAnswerValuePart,FillInAnswer,FillInAnswerValue,FillInResponseValue>
uid
- Unique identifier for this answervalueParts
- The value parts comprising this answer.AnswerableProblem.getAnswerEvalTypes()
,
AnswerValuePart
public FillInResponseValue makeResponse(java.lang.String studentResponse)
studentResponse
- The fill-in value entered by a student.protected FillInResponseValue makeResponse(java.lang.String... responseParts)
AnswerableProblem
makeResponse
in class AnswerableProblem<FillInAnswerValuePart,FillInAnswer,FillInAnswerValue,FillInResponseValue>
responseParts
- One or more values entered in response to a question. For example, a fill-in
problem expects a single response string. An ordered pair problem expects two response strings.public boolean isCorrect(FillInResponseValue 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<FillInAnswerValuePart,FillInAnswer,FillInAnswerValue,FillInResponseValue>
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