org.qtitools.qti.node.test
Class Selection

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

public class Selection
extends AbstractObject

The selection class specifies the rules used to select the child elements of A section for each test session. If no selection rules are given we assume that all elements are to be selected.

Author:
Jiri Kajaba
See Also:
Serialized Form

Field Summary
static java.lang.String ATTR_SELECT_NAME
          Name of select attribute in xml schema.
static java.lang.Boolean ATTR_WITH_REPLACEMENT_DEFAULT_VALUE
          Default value of withReplacement attribute.
static java.lang.String ATTR_WITH_REPLACEMENT_NAME
          Name of withReplacement 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
Selection(AssessmentSection parent)
          Constructs object.
 
Method Summary
 java.lang.String getClassTag()
          Gets QTI class name of this node.
 AssessmentSection getParent()
          Gets parent of this node or null (if node is root; for example AssessmentTest).
 java.lang.Integer getSelect()
          Gets value of select attribute.
 java.lang.Boolean getWithReplacement()
          Gets value of withReplacement attribute.
 void process()
          Applies this selection to its parent children.
 void setSelect(java.lang.Integer select)
          Sets new value of select attribute.
 void setWithReplacement(java.lang.Boolean withReplacement)
          Sets new value of withReplacement attribute.
protected  ValidationResult validateAttributes()
          Validates attributes 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, load, loadAttributes, readChild, readChildren, setParent, setSourceFile, setSourceNode, setSourceString, setSourceUrl, toXmlString, toXmlString, validate, 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
 
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_SELECT_NAME

public static final java.lang.String ATTR_SELECT_NAME
Name of select attribute in xml schema.

See Also:
Constant Field Values

ATTR_WITH_REPLACEMENT_NAME

public static final java.lang.String ATTR_WITH_REPLACEMENT_NAME
Name of withReplacement attribute in xml schema.

See Also:
Constant Field Values

ATTR_WITH_REPLACEMENT_DEFAULT_VALUE

public static final java.lang.Boolean ATTR_WITH_REPLACEMENT_DEFAULT_VALUE
Default value of withReplacement attribute.

Constructor Detail

Selection

public Selection(AssessmentSection parent)
Constructs object.

Parameters:
parent - parent of created object.
Method Detail

getParent

public AssessmentSection 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

getSelect

public java.lang.Integer getSelect()
Gets value of select attribute.

Returns:
value of select attribute
See Also:
setSelect(java.lang.Integer)

setSelect

public void setSelect(java.lang.Integer select)
Sets new value of select attribute.

Parameters:
select - new value of select attribute
See Also:
getSelect()

getWithReplacement

public java.lang.Boolean getWithReplacement()
Gets value of withReplacement attribute.

Returns:
value of withReplacement attribute
See Also:
setWithReplacement(java.lang.Boolean)

setWithReplacement

public void setWithReplacement(java.lang.Boolean withReplacement)
Sets new value of withReplacement attribute.

Parameters:
withReplacement - new value of withReplacement attribute
See Also:
getWithReplacement()

validateAttributes

protected ValidationResult validateAttributes()
Description copied from class: AbstractNode
Validates attributes of this node.

Overrides:
validateAttributes in class AbstractNode
Returns:
result of validation

process

public void process()
Applies this selection to its parent children.

Current implementation is not fully compatible with QTI 2.1 specification (identifier of duplicated items is changed to identifier_N).



Copyright © 2009. All Rights Reserved.