org.qtitools.qti.node.item
Class CorrectResponse

java.lang.Object
  extended by org.qtitools.qti.node.AbstractNode
      extended by org.qtitools.qti.node.AbstractObject
          extended by org.qtitools.qti.node.item.CorrectResponse
All Implemented Interfaces:
java.io.Serializable, FieldValueParent, XmlNode, XmlObject, Validatable

public class CorrectResponse
extends AbstractObject
implements FieldValueParent

A response declaration may assign an optional correctResponse.

This value may indicate the only possible value of the response variable to be considered correct or merely just A correct value.

For responses that are being measured against A more complex scale than correct/incorrect this value should be set to the (or an) optimal value.

Finally, for responses for which no such optimal value is defined the correctResponse must be omitted.

Author:
Jonathon Hare
See Also:
Serialized Form

Field Summary
static java.lang.String ATTR_INTERPRETATION_DEFAULT_VALUE
          Default value of interpretation attribute.
static java.lang.String ATTR_INTERPRETATION_NAME
          Name of interpretation attribute in xml schema.
static java.lang.String CLASS_TAG
          Name of this class in xml schema.
 
Fields inherited from interface org.qtitools.qti.node.XmlNode
INDENT, NEW_LINE, SIMPLE_NAME_INNER_SEPARATOR, SIMPLE_NAMES_SEPARATOR
 
Constructor Summary
CorrectResponse(XmlObject xmlObject)
          Creates object.
CorrectResponse(XmlObject xmlObject, Value value)
          Creates object with given value.
 
Method Summary
 Value evaluate()
          Evaluates value of this defaultValue.
 BaseType getBaseType()
          Gets required baseType of result value (when all FieldValues are put together).
 Cardinality getCardinality()
          Gets required cardinality of result value (when all FieldValues are put together).
 java.lang.String getClassTag()
          Gets QTI class name of this node.
 java.util.List<FieldValue> getFieldValues()
          Gets fieldValue children.
 java.lang.String getInterpretation()
          Gets value of interpretation attribute.
 ResponseDeclaration getParent()
          Gets parent of this node or null (if node is root; for example AssessmentTest).
 Value getValue()
          Gets value of this defaultValue.
 void load(org.w3c.dom.Node sourceNode)
          Loads this node from given source node (DOM).
 void setInterpretation(java.lang.String interpretation)
          Sets new value of interpretation attribute.
protected  ValidationResult validateChildren()
          Validates children (body) of this node.
 
Methods inherited from class org.qtitools.qti.node.AbstractObject
getParentItem, getParentResult, getParentTest, setParent
 
Methods inherited from class org.qtitools.qti.node.AbstractNode
attrToXmlString, bodyToXmlString, getAttributes, getFullName, getIndent, getNode, getNode, getNode, getNodeGroups, getParentRoot, getSimpleName, getSourceFile, getSourceNode, getSourceString, getSourceUrl, hasChildNodes, load, load, load, loadAttributes, readChild, readChildren, setParent, setSourceFile, setSourceNode, setSourceString, setSourceUrl, toXmlString, toXmlString, validate, validateAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.qtitools.qti.node.XmlObject
getParentItem, getParentResult, getParentTest, setParent
 
Methods inherited from interface org.qtitools.qti.node.XmlNode
getAttributes, getFullName, getNodeGroups, getParentRoot, getSimpleName, getSourceFile, getSourceNode, getSourceString, getSourceUrl, hasChildNodes, load, load, load, setSourceFile, setSourceNode, setSourceString, setSourceUrl, toXmlString, toXmlString
 
Methods inherited from interface org.qtitools.qti.validation.Validatable
validate
 

Field Detail

CLASS_TAG

public static final java.lang.String CLASS_TAG
Name of this class in xml schema.

See Also:
Constant Field Values

ATTR_INTERPRETATION_NAME

public static final java.lang.String ATTR_INTERPRETATION_NAME
Name of interpretation attribute in xml schema.

See Also:
Constant Field Values

ATTR_INTERPRETATION_DEFAULT_VALUE

public static final java.lang.String ATTR_INTERPRETATION_DEFAULT_VALUE
Default value of interpretation attribute.

Constructor Detail

CorrectResponse

public CorrectResponse(XmlObject xmlObject)
Creates object.

Parameters:
xmlObject - parent of this object

CorrectResponse

public CorrectResponse(XmlObject xmlObject,
                       Value value)
Creates object with given value.

Parameters:
xmlObject - parent of this object
value - value to use
Method Detail

getParent

public ResponseDeclaration getParent()
Description copied from interface: XmlNode
Gets parent of this node or null (if node is root; for example AssessmentTest).

While testing some nodes (for example expressions) don't have properly set parent, but it is usable only for testing. (Some nodes cannot exists without parent even for testing).

Specified by:
getParent in interface XmlNode
Specified by:
getParent in interface XmlObject
Overrides:
getParent in class AbstractObject
Returns:
parent of this node or null (if node is root; for example AssessmentTest)

getClassTag

public java.lang.String getClassTag()
Description copied from interface: XmlNode
Gets QTI class name of this node.

QTI class name has very important role during loading/saving nodes.

For example: Java class name is AssessmentTest; QTI class name is assessmentTest.

Specified by:
getClassTag in interface XmlNode
Specified by:
getClassTag in class AbstractNode
Returns:
QTI class name of this node

getInterpretation

public java.lang.String getInterpretation()
Gets value of interpretation attribute.

Returns:
value of interpretation attribute
See Also:
setInterpretation(java.lang.String)

setInterpretation

public void setInterpretation(java.lang.String interpretation)
Sets new value of interpretation attribute.

Parameters:
interpretation - new value of interpretation attribute
See Also:
getInterpretation()

getFieldValues

public java.util.List<FieldValue> getFieldValues()
Gets fieldValue children.

Returns:
fieldValue children

getValue

public Value getValue()
Gets value of this defaultValue.

Returns:
value of this defaultValue

getCardinality

public Cardinality getCardinality()
Description copied from interface: FieldValueParent
Gets required cardinality of result value (when all FieldValues are put together).

Specified by:
getCardinality in interface FieldValueParent
Returns:
required cardinality of result value (when all FieldValues are put together)

getBaseType

public BaseType getBaseType()
Description copied from interface: FieldValueParent
Gets required baseType of result value (when all FieldValues are put together).

Specified by:
getBaseType in interface FieldValueParent
Returns:
required baseType of result value (when all FieldValues are put together)

validateChildren

protected ValidationResult validateChildren()
Description copied from class: AbstractNode
Validates children (body) of this node.

Overrides:
validateChildren in class AbstractNode
Returns:
result of validation

evaluate

public Value evaluate()
Evaluates value of this defaultValue.

Returns:
evaluated value of this defaultValue

load

public void load(org.w3c.dom.Node sourceNode)
Description copied from interface: XmlNode
Loads this node from given source node (DOM).

Specified by:
load in interface XmlNode
Overrides:
load in class AbstractNode
Parameters:
sourceNode - source node (DOM) for this node


Copyright © 2009. All Rights Reserved.