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

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
All Implemented Interfaces:
java.io.Serializable, XmlNode, XmlObject, Validatable
Direct Known Subclasses:
BlockInteraction, CustomInteraction, InlineInteraction

public abstract class Interaction
extends BodyElement

Interactions allow the candidate to interact with the item. Through an interaction, the candidate selects or constructs A response. The candidate's responses are stored in the response variables. Each interaction is associated with (at least) one response variable.

Author:
Jonathon Hare
See Also:
Serialized Form

Field Summary
static java.lang.String ATTR_RESPONSE_IDENTIFIER_NAME
          Name of responseIdentifier attribute in xml schema.
static java.lang.String CLASS_TAG_SUFFIX
          All interactions in xml schema end in "Interaction"
static java.lang.String DISPLAY_NAME
          Display name of this class.
 
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
 
Constructor Summary
Interaction(XmlObject parent)
          Construct new interaction.
 
Method Summary
 void beforeProcessResponse()
          Perform any required processing for the interaction immediately before processResponse is called.
 ResponseDeclaration getResponseDeclaration()
          Gets the responseDeclaration for this interaction.
 java.lang.String getResponseIdentifier()
          Gets value of responseIdentifier 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 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.
protected  Value processResponse(java.util.List<java.lang.String> responseList, ResponseDeclaration responseDeclaration)
           
 void processResponse(java.lang.String responseString)
          Given the user response to the interaction in the form of A string set the appropriate response variables.
 void setResponseIdentifier(java.lang.String responseIdentifier)
          Sets new value of responseIdentifier 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.content.BodyElement
appendChild, evaluate, getChildren, 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, getClassTag, 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, getClassTag, getFullName, getNodeGroups, getParentRoot, getSimpleName, getSourceFile, getSourceNode, getSourceString, getSourceUrl, hasChildNodes, load, load, load, load, setSourceFile, setSourceNode, setSourceString, setSourceUrl, toXmlString, toXmlString
 

Field Detail

DISPLAY_NAME

public static final java.lang.String DISPLAY_NAME
Display name of this class.

See Also:
Constant Field Values

ATTR_RESPONSE_IDENTIFIER_NAME

public static final java.lang.String ATTR_RESPONSE_IDENTIFIER_NAME
Name of responseIdentifier attribute in xml schema.

See Also:
Constant Field Values

CLASS_TAG_SUFFIX

public static final java.lang.String CLASS_TAG_SUFFIX
All interactions in xml schema end in "Interaction"

See Also:
Constant Field Values
Constructor Detail

Interaction

public Interaction(XmlObject parent)
Construct new interaction.

Parameters:
parent - Parent node
Method Detail

getResponseIdentifier

public java.lang.String getResponseIdentifier()
Gets value of responseIdentifier attribute.

Returns:
value of responseIdentifier attribute
See Also:
setResponseIdentifier(java.lang.String)

setResponseIdentifier

public void setResponseIdentifier(java.lang.String responseIdentifier)
Sets new value of responseIdentifier attribute.

Parameters:
responseIdentifier - new value of responseIdentifier attribute
See Also:
getResponseIdentifier()

getResponseDeclaration

public ResponseDeclaration getResponseDeclaration()
Gets the responseDeclaration for this interaction.

Returns:
the responseDeclaration for this interactions responseIdentifier

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

validateResponse

public boolean validateResponse()
Validate the response associated with this interaction Subclasses should override this method as required.

Returns:
true if the response is valid, false otherwise

initialize

public void initialize()
Initialize the interaction. Subclasses should override this method as required.


beforeProcessResponse

public void beforeProcessResponse()
Perform any required processing for the interaction immediately before processResponse is called. Most interactions wont need to do anything here - it is basically useful for interactions that need to set or reset A particular value (like EndAttemptInteraction).


processResponse

public void processResponse(java.lang.String responseString)
Given the user response to the interaction in the form of A string set the appropriate response variables.

Parameters:
responseString - the string form of the response

processResponse

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

Parameters:
responseList - Response to process
See Also:
AssessmentItem.setResponses(java.util.Map>)

processResponse

protected Value processResponse(java.util.List<java.lang.String> responseList,
                                ResponseDeclaration responseDeclaration)

getShuffledOrder

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

Returns:
Ordered list of identifiers, or null if the interaction doesn't support shuffling


Copyright © 2009. All Rights Reserved.