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

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.InlineInteraction
                      extended by org.qtitools.qti.node.item.interaction.InlineChoiceInteraction
All Implemented Interfaces:
java.io.Serializable, Flow, Inline, ObjectFlow, XmlNode, XmlObject, Validatable

public class InlineChoiceInteraction
extends InlineInteraction

An inline choice is an inlineInteraction that presents the user with A set of choices, each of which is A simple piece of text. The candidate's task is to select one of the choices. Unlike the choiceInteraction, the delivery engine must allow the candidate to review their choice within the context of the surrounding text. The inlineChoiceInteraction must be bound to A response variable with A baseType of identifier and single cardinality only. Contains : inlineChoice [1..*] An ordered list of the choices that are displayed to the user. The order is the 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 presented subject to the fixed attribute. Attribute : required [0..1]: boolean = false If true then A choice must be selected by the candidate in order to form A valid response to the interaction.

Author:
Jonathon Hare
See Also:
Serialized Form

Field Summary
static boolean ATTR_REQUIRED_DEFAULT_VALUE
          Default value of required attribute.
static java.lang.String ATTR_REQUIRED_NAME
          Name of required 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.content.basic.Inline
DISPLAY_NAME
 
Fields inherited from interface org.qtitools.qti.node.content.basic.Flow
DISPLAY_NAME
 
Constructor Summary
InlineChoiceInteraction(XmlObject parent)
          Construct new interaction.
 
Method Summary
 java.util.List<? extends XmlNode> getChildren()
          Get A list of the content child nodes of this element
 java.lang.String getClassTag()
          Gets QTI class name of this node.
 InlineChoice getInlineChoice(java.lang.String identifier)
          Gets simpleChoice child with given identifier or null.
 java.util.List<InlineChoice> getInlineChoices()
          Gets simpleChoice children.
 java.lang.Boolean getRequired()
          Gets value of required 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.
 void initialize()
          Initialize the interaction.
 void setRequired(java.lang.Boolean required)
          Sets new value of required attribute.
 void setShuffle(java.lang.Boolean shuffle)
          Sets new value of shuffle attribute.
 ValidationResult validate()
          Validates this object.
 boolean validateResponse()
          Validate the response associated with this interaction Subclasses should override this method as required.
 
Methods inherited from class org.qtitools.qti.node.item.interaction.Interaction
beforeProcessResponse, getResponseDeclaration, getResponseIdentifier, processResponse, processResponse, processResponse, setResponseIdentifier
 
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
 

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_REQUIRED_NAME

public static java.lang.String ATTR_REQUIRED_NAME
Name of required attribute in xml schema.


ATTR_REQUIRED_DEFAULT_VALUE

public static boolean ATTR_REQUIRED_DEFAULT_VALUE
Default value of required attribute.

Constructor Detail

InlineChoiceInteraction

public InlineChoiceInteraction(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)

setRequired

public void setRequired(java.lang.Boolean required)
Sets new value of required attribute.

Parameters:
required - new value of required attribute
See Also:
getRequired()

getRequired

public java.lang.Boolean getRequired()
Gets value of required attribute.

Returns:
value of required attribute
See Also:
setRequired(java.lang.Boolean)

getInlineChoices

public java.util.List<InlineChoice> getInlineChoices()
Gets simpleChoice children.

Returns:
simpleChoice children

getInlineChoice

public InlineChoice getInlineChoice(java.lang.String identifier)
Gets simpleChoice child with given identifier or null.

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

validateResponse

public boolean validateResponse()
Description copied from class: Interaction
Validate the response associated with this interaction Subclasses should override this method as required.

Overrides:
validateResponse in class Interaction
Returns:
true if the response is valid, false otherwise

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

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()
Description copied from class: BodyElement
Get A list of the content child nodes of this element

Specified by:
getChildren in class BodyElement
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.