public class RangeProblem extends AnswerableProblem<RangeAnswerValuePart,RangeAnswer,RangeAnswerValue,RangeResponseValue>
answerableClasses, probProperties
defaultResponseDescription
Modifier | Constructor and Description |
---|---|
|
RangeProblem(java.lang.String uid)
Constructor
For use when calling code directly needs an instance of
ProblemFillIn . |
protected |
RangeProblem(java.lang.String classType,
java.lang.String uid)
Constructor
For use when
ProblemFillIn has been subclassed. |
Modifier and Type | Method and Description |
---|---|
RangeAnswer |
addAnswer(java.lang.String uid,
boolean isCorrect,
AnswerEvalType evalType,
java.lang.String lowerLimit,
java.lang.String upperLimit) |
protected RangeAnswer |
addAnswer(java.lang.String uid,
boolean isCorrect,
RangeAnswerValuePart... valueParts)
Given a list of value parts, returns a subclass instance of an
Answer containing
those values. |
static java.lang.String |
getClassName()
Returns this class' fully specified name.
|
static AnswerableProblemAttributes |
getProblemAttributes()
Returns the problem type attributes for RangeProblem.
|
java.util.List<java.lang.String> |
getResponseTypeDescription() |
boolean |
isCorrect(RangeResponseValue response,
java.util.Map<java.lang.String,java.lang.String> args)
Determines whether the submitted response to this question is correct.
|
RangeResponseValue |
makeResponse(java.lang.String... responseParts)
For the given values entered, returns an AnswerValue containing those parts.
|
RangeResponseValue |
makeResponse(java.lang.String studentResponse)
Creates and returns a student response value.
|
void |
setRangeEvalType(AnswerEvalType evalType)
Specifies how to evaluate the lower- and upper-limits for this problem.
|
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 RangeProblem(java.lang.String uid)
ProblemFillIn
.uid
- UID of this instance.protected RangeProblem(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 RangeProblem.
public static java.lang.String getClassName()
public void setRangeEvalType(AnswerEvalType evalType)
public RangeAnswer addAnswer(java.lang.String uid, boolean isCorrect, AnswerEvalType evalType, java.lang.String lowerLimit, java.lang.String upperLimit)
protected RangeAnswer addAnswer(java.lang.String uid, boolean isCorrect, RangeAnswerValuePart... 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<RangeAnswerValuePart,RangeAnswer,RangeAnswerValue,RangeResponseValue>
uid
- Unique identifier for this answervalueParts
- The value parts comprising this answer.AnswerableProblem.getAnswerEvalTypes()
,
AnswerValuePart
public RangeResponseValue makeResponse(java.lang.String studentResponse)
studentResponse
- The fill-in value entered by a student.public RangeResponseValue makeResponse(java.lang.String... responseParts)
AnswerableProblem
makeResponse
in class AnswerableProblem<RangeAnswerValuePart,RangeAnswer,RangeAnswerValue,RangeResponseValue>
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(RangeResponseValue 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<RangeAnswerValuePart,RangeAnswer,RangeAnswerValue,RangeResponseValue>
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