org.qtitools.qti.node.item.interaction
Class OrderInteraction

java.lang.Object
  extended by org.qtitools.qti.node.AbstractNode
      extended by org.qtitools.qti.node.AbstractObject
          extended by org.qtitools.qti.node.content.BodyElement
              extended by org.qtitools.qti.node.item.interaction.Interaction
                  extended by org.qtitools.qti.node.item.interaction.BlockInteraction
                      extended by org.qtitools.qti.node.item.interaction.OrderInteraction
All Implemented Interfaces:
java.io.Serializable, Block, Flow, ObjectFlow, ChoiceContainer, SimpleChoiceContainer, XmlNode, XmlObject, Validatable

public class OrderInteraction
extends BlockInteraction
implements SimpleChoiceContainer

In an order interaction the candidate's task is to reorder the choices, the order in which the choices are displayed initially is significant. By default the candidate's task is to order all of the choices but A subset of the choices can be requested using the maxChoices and minChoices attributes. When specified, the candidate must select A subset of the choices and impose an ordering on them. If A default value is specified for the response variable associated with an order interaction then its value should be used to override the order of the choices specified here. By its nature, an order interaction may be difficult to render in an unanswered state, especially in the default case where all choices are to be ordered. Implementors should be aware of the issues concerning the use of default values described in the section on Response Variables. The orderInteraction must be bound to A response variable with A baseType of identifier and ordered cardinality only. Contains : simpleChoice [1..*] An ordered list of the choices that are displayed to the user. The order is the initial order of the choices presented to the user, unless shuffle is true. Attribute : shuffle [1]: boolean = false If the shuffle attribute is true then the delivery engine must randomize the order in which the choices are initially presented subject to the fixed attribute. Attribute : minChoices [0..1]: integer The minimum number of choices that the candidate must select and order to form A valid response to the interaction. If specified, minChoices must be 1 or greater but must not exceed the number of choices available. If unspecified, all of the choices must be ordered and maxChoices is ignored. Attribute : maxChoices [0..1]: integer The maximum number of choices that the candidate may select and order when responding to the interaction. Used in conjunction with minChoices, if specified, maxChoices must be greater than or equal to minChoices and must not exceed the number of choices available. If unspecified, all of the choices may be ordered. Attribute : orientation [0..1]: orientation The orientation attribute provides A hint to rendering systems that the ordering has an inherent vertical or horizontal interpretation.

Author:
Jonathon Hare
See Also:
Serialized Form

Field Summary
static java.lang.String ATTR_MAX_CHOICES_NAME
          Name of maxChoices attribute in xml schema.
static java.lang.String ATTR_MIN_CHOICES_NAME
          Name of minChoices attribute in xml schema.
static java.lang.String ATTR_ORIENTATION_NAME
          Name of orientation attribute in xml schema.
static boolean ATTR_SHUFFLE_DEFAULT_VALUE
          Default value of shuffle attribute.
static java.lang.String ATTR_SHUFFLE_NAME
          Name of shuffle attribute in xml schema.
static java.lang.String CLASS_TAG
          Name of this class in xml schema.
 
Fields inherited from class org.qtitools.qti.node.item.interaction.Interaction
ATTR_RESPONSE_IDENTIFIER_NAME, CLASS_TAG_SUFFIX, DISPLAY_NAME
 
Fields inherited from class org.qtitools.qti.node.content.BodyElement
ATTR_CLASS_NAME, ATTR_ID_NAME, ATTR_LABEL_NAME, ATTR_LANG_NAME
 
Fields inherited from interface org.qtitools.qti.node.XmlNode
INDENT, NEW_LINE, SIMPLE_NAME_INNER_SEPARATOR, SIMPLE_NAMES_SEPARATOR
 
Fields inherited from interface org.qtitools.qti.node.content.basic.Block
DISPLAY_NAME
 
Fields inherited from interface org.qtitools.qti.node.content.basic.Flow
DISPLAY_NAME
 
Constructor Summary
OrderInteraction(XmlObject parent)
          Construct new interaction.
 
Method Summary
 java.util.List<? extends XmlNode> getChildren()
          Gets an unmodifiable list of the child elements.
 java.lang.String getClassTag()
          Gets QTI class name of this node.
 java.lang.Integer getMaxChoices()
          Gets value of maxChoices attribute.
 java.lang.Integer getMinChoices()
          Gets value of minChoices attribute.
 Orientation getOrientation()
          Gets value of orientation attribute.
 java.lang.Boolean getShuffle()
          Gets value of shuffle attribute.
 java.util.List<java.lang.String> getShuffledOrder()
          If the interaction supports shuffling, then this method should return an ordered list of the shuffled elements' identifiers.
 SimpleChoice getSimpleChoice(java.lang.String identifier)
          Gets simpleChoice child with given identifier or null.
 java.util.List<SimpleChoice> getSimpleChoices()
          Gets simpleChoice children.
 void initialize()
          Initialize the interaction.
 void processResponse(java.util.List<java.lang.String> responseList)
          Given the user response to the interaction in the form of A string set the appropriate response variables.
 void setMaxChoices(java.lang.Integer maxChoices)
          Sets new value of maxChoices attribute.
 void setMinChoices(java.lang.Integer minChoices)
          Sets new value of minChoices attribute.
 void setOrientation(Orientation orientation)
          Sets new value of orientation attribute.
 void setShuffle(java.lang.Boolean shuffle)
          Sets new value of shuffle attribute.
 ValidationResult validate()
          Validates this object.
 
Methods inherited from class org.qtitools.qti.node.item.interaction.BlockInteraction
getPrompt, setPrompt
 
Methods inherited from class org.qtitools.qti.node.item.interaction.Interaction
beforeProcessResponse, getResponseDeclaration, getResponseIdentifier, processResponse, processResponse, setResponseIdentifier, validateResponse
 
Methods inherited from class org.qtitools.qti.node.content.BodyElement
appendChild, evaluate, getClassAttr, getFirstChild, getId, getLabel, getLang, getLastChild, insertBefore, removeChild, replaceChild, search, search, search, setId, setLabel, setLang
 
Methods inherited from class org.qtitools.qti.node.AbstractObject
getParent, 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, getParent, getParentRoot, getSimpleName, getSourceFile, getSourceNode, getSourceString, getSourceUrl, hasChildNodes, load, load, load, load, setSourceFile, setSourceNode, setSourceString, setSourceUrl, toXmlString, toXmlString
 

Field Detail

CLASS_TAG

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


ATTR_SHUFFLE_NAME

public static java.lang.String ATTR_SHUFFLE_NAME
Name of shuffle attribute in xml schema.


ATTR_SHUFFLE_DEFAULT_VALUE

public static boolean ATTR_SHUFFLE_DEFAULT_VALUE
Default value of shuffle attribute.


ATTR_MAX_CHOICES_NAME

public static java.lang.String ATTR_MAX_CHOICES_NAME
Name of maxChoices attribute in xml schema.


ATTR_MIN_CHOICES_NAME

public static java.lang.String ATTR_MIN_CHOICES_NAME
Name of minChoices attribute in xml schema.


ATTR_ORIENTATION_NAME

public static java.lang.String ATTR_ORIENTATION_NAME
Name of orientation attribute in xml schema.

Constructor Detail

OrderInteraction

public OrderInteraction(XmlObject parent)
Construct new interaction.

Parameters:
parent - Parent node
Method Detail

setShuffle

public void setShuffle(java.lang.Boolean shuffle)
Sets new value of shuffle attribute.

Parameters:
shuffle - new value of shuffle attribute
See Also:
getShuffle()

getShuffle

public java.lang.Boolean getShuffle()
Gets value of shuffle attribute.

Returns:
value of shuffle attribute
See Also:
setShuffle(java.lang.Boolean)

setMaxChoices

public void setMaxChoices(java.lang.Integer maxChoices)
Sets new value of maxChoices attribute.

Parameters:
maxChoices - new value of maxChoices attribute
See Also:
getMaxChoices()

getMaxChoices

public java.lang.Integer getMaxChoices()
Gets value of maxChoices attribute.

Returns:
value of maxChoices attribute
See Also:
setMaxChoices(java.lang.Integer)

setMinChoices

public void setMinChoices(java.lang.Integer minChoices)
Sets new value of minChoices attribute.

Parameters:
minChoices - new value of minChoices attribute
See Also:
getMinChoices()

getMinChoices

public java.lang.Integer getMinChoices()
Gets value of minChoices attribute.

Returns:
value of minChoices attribute
See Also:
setMinChoices(java.lang.Integer)

setOrientation

public void setOrientation(Orientation orientation)
Sets new value of orientation attribute.

Parameters:
orientation - new value of orientation attribute
See Also:
getOrientation()

getOrientation

public Orientation getOrientation()
Gets value of orientation attribute.

Returns:
value of orientation attribute
See Also:
setOrientation(org.qtitools.qti.value.Orientation)

getSimpleChoices

public java.util.List<SimpleChoice> getSimpleChoices()
Gets simpleChoice children.

Returns:
simpleChoice children

getSimpleChoice

public SimpleChoice getSimpleChoice(java.lang.String identifier)
Gets simpleChoice child with given identifier or null.

Parameters:
identifier - given identifier
Returns:
simpleChoice with given identifier or null

validate

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

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

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

processResponse

public void processResponse(java.util.List<java.lang.String> responseList)
Description copied from class: Interaction
Given the user response to the interaction in the form of A string set the appropriate response variables.

Overrides:
processResponse in class Interaction
Parameters:
responseList - Response to process
See Also:
AssessmentItem.setResponses(java.util.Map>)

initialize

public void initialize()
Description copied from class: Interaction
Initialize the interaction. Subclasses should override this method as required.

Overrides:
initialize in class Interaction

getChildren

public java.util.List<? extends XmlNode> getChildren()
Gets an unmodifiable list of the child elements. Use the other methods on OrderInteraction to add children to the correct group.

Overrides:
getChildren in class BlockInteraction
Returns:
List of child nodes

getShuffledOrder

public java.util.List<java.lang.String> getShuffledOrder()
Description copied from class: Interaction
If the interaction supports shuffling, then this method should return an ordered list of the shuffled elements' identifiers.

Overrides:
getShuffledOrder in class Interaction
Returns:
Ordered list of identifiers, or null if the interaction doesn't support shuffling


Copyright © 2009. All Rights Reserved.