org.qtitools.qti.node.item.response.declaration
Class Mapping

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

public class Mapping
extends AbstractObject

A special class used to create A mapping from A source set of any baseType (except file and duration) to A single float. Note that mappings from values of base type float should be avoided due to the difficulty of matching floating point values, see the match operator for more details. When mapping containers the result is the sum of the mapped values from the target set.

Author:
Jonathon Hare
See Also:
for details., Serialized Form

Field Summary
static double ATTR_DEFAULT_VALUE_DEFAULT_VALUE
          Default value of the defaultValue attribute
static java.lang.String ATTR_DEFAULT_VALUE_NAME
          Name of defaultValue attribute in xml schema.
static java.lang.String ATTR_LOWER_BOUND_NAME
          Name of lowerBound attribute in xml schema.
static java.lang.String ATTR_UPPER_BOUND_NAME
          Name of upperBound 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
Mapping(ResponseDeclaration parent)
          Creates object.
 
Method Summary
 java.lang.String getClassTag()
          Gets QTI class name of this node.
 java.lang.Double getDefaultValue()
          Gets value of defaultValue attribute.
 java.lang.Double getLowerBound()
          Gets value of lowerBound attribute.
 java.util.List<MapEntry> getMapEntries()
          Gets mapEntry children.
 ResponseDeclaration getParent()
          Gets parent of this node or null (if node is root; for example AssessmentTest).
 FloatValue getTargetValue(Value sourceValue)
          Gets target value for given source value.
 java.lang.Double getUpperBound()
          Gets value of upperBound attribute.
 void setDefaultValue(java.lang.Double defaultValue)
          Sets new value of defaultValue attribute.
 void setLowerBound(java.lang.Double lowerBound)
          Sets new value of lowerBound attribute.
 void setUpperBound(java.lang.Double upperBound)
          Sets new value of upperBound attribute.
 ValidationResult validate()
          Validates this object.
 
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, load, loadAttributes, readChild, readChildren, setParent, setSourceFile, setSourceNode, setSourceString, setSourceUrl, toXmlString, toXmlString, validateAttributes, validateChildren
 
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.XmlNode
getAttributes, getFullName, getNodeGroups, getParentRoot, getSimpleName, getSourceFile, getSourceNode, getSourceString, getSourceUrl, hasChildNodes, load, load, load, load, setSourceFile, setSourceNode, setSourceString, setSourceUrl, toXmlString, toXmlString
 

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_LOWER_BOUND_NAME

public static final java.lang.String ATTR_LOWER_BOUND_NAME
Name of lowerBound attribute in xml schema.

See Also:
Constant Field Values

ATTR_UPPER_BOUND_NAME

public static final java.lang.String ATTR_UPPER_BOUND_NAME
Name of upperBound attribute in xml schema.

See Also:
Constant Field Values

ATTR_DEFAULT_VALUE_NAME

public static final java.lang.String ATTR_DEFAULT_VALUE_NAME
Name of defaultValue attribute in xml schema.

See Also:
Constant Field Values

ATTR_DEFAULT_VALUE_DEFAULT_VALUE

public static final double ATTR_DEFAULT_VALUE_DEFAULT_VALUE
Default value of the defaultValue attribute

See Also:
Constant Field Values
Constructor Detail

Mapping

public Mapping(ResponseDeclaration parent)
Creates object.

Parameters:
parent - parent of this object
Method Detail

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

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)

getDefaultValue

public java.lang.Double getDefaultValue()
Gets value of defaultValue attribute.

Returns:
value of defaultValue attribute
See Also:
setDefaultValue(java.lang.Double)

setDefaultValue

public void setDefaultValue(java.lang.Double defaultValue)
Sets new value of defaultValue attribute.

Parameters:
defaultValue - new value of defaultValue attribute
See Also:
getDefaultValue()

getLowerBound

public java.lang.Double getLowerBound()
Gets value of lowerBound attribute.

Returns:
value of lowerBound attribute
See Also:
setLowerBound(java.lang.Double)

setLowerBound

public void setLowerBound(java.lang.Double lowerBound)
Sets new value of lowerBound attribute.

Parameters:
lowerBound - new value of lowerBound attribute
See Also:
getLowerBound()

getUpperBound

public java.lang.Double getUpperBound()
Gets value of upperBound attribute.

Returns:
value of upperBound attribute
See Also:
setUpperBound(java.lang.Double)

setUpperBound

public void setUpperBound(java.lang.Double upperBound)
Sets new value of upperBound attribute.

Parameters:
upperBound - new value of upperBound attribute
See Also:
getUpperBound()

getMapEntries

public java.util.List<MapEntry> getMapEntries()
Gets mapEntry children.

Returns:
mapEntry children

validate

public ValidationResult validate()
Description copied from interface: Validatable
Validates this object.

Specified by:
validate in interface Validatable
Overrides:
validate in class AbstractNode
Returns:
validation result

getTargetValue

public FloatValue getTargetValue(Value sourceValue)
Gets target value for given source value.

Parameters:
sourceValue - given source value
Returns:
target value for given source value


Copyright © 2009. All Rights Reserved.