org.qtitools.qti.node.item.template.processing
Class TemplateConditionExpressionChild

java.lang.Object
  extended by org.qtitools.qti.node.AbstractNode
      extended by org.qtitools.qti.node.AbstractObject
          extended by org.qtitools.qti.node.item.template.processing.TemplateConditionChild
              extended by org.qtitools.qti.node.item.template.processing.TemplateConditionExpressionChild
All Implemented Interfaces:
java.io.Serializable, ExpressionParent, XmlNode, XmlObject, Validatable
Direct Known Subclasses:
TemplateElseIf, TemplateIf

public abstract class TemplateConditionExpressionChild
extends TemplateConditionChild
implements ExpressionParent

Abstract parent for all templateCondition children with condition (IF, ELSE-IF).

Author:
Jonathon Hare
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.qtitools.qti.node.XmlNode
INDENT, NEW_LINE, SIMPLE_NAME_INNER_SEPARATOR, SIMPLE_NAMES_SEPARATOR
 
Constructor Summary
TemplateConditionExpressionChild(TemplateCondition parent)
          Construct condition rule child.
 
Method Summary
 boolean evaluate()
          Evaluates all child templateRules and returns true.
 Expression getExpression()
          Gets expression child (condition).
 BaseType[] getRequiredBaseTypes(int index)
          Gets list of all acceptable baseTypes which can child expression at given position produce.
 Cardinality[] getRequiredCardinalities(int index)
          Gets list of all acceptable cardinalities which can child expression at given position produce.
 void setExpression(Expression expression)
          Sets new expression child (condition).
 
Methods inherited from class org.qtitools.qti.node.item.template.processing.TemplateConditionChild
getTemplateRules, validateChildren
 
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, validate, validateAttributes
 
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.XmlObject
getParent, getParentItem, getParentResult, getParentTest, setParent
 
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
 
Methods inherited from interface org.qtitools.qti.validation.Validatable
validate
 

Constructor Detail

TemplateConditionExpressionChild

public TemplateConditionExpressionChild(TemplateCondition parent)
Construct condition rule child.

Parameters:
parent - parent of this condition rule child
Method Detail

getExpression

public Expression getExpression()
Gets expression child (condition).

Returns:
expression child (condition)
See Also:
setExpression(org.qtitools.qti.node.expression.Expression)

setExpression

public void setExpression(Expression expression)
Sets new expression child (condition).

Parameters:
expression - new expression child (condition)
See Also:
getExpression()

getRequiredCardinalities

public Cardinality[] getRequiredCardinalities(int index)
Description copied from interface: ExpressionParent
Gets list of all acceptable cardinalities which can child expression at given position produce.

For example delete expression returns single cardinality for index 0 and list of multiple and ordered cardinality for index 1.

Result of this method can change in time.

Static example is expression or. Expression or accepts only single cardinality for any index.

Dynamic example is expression match. Expression match accepts any cardinality of its children, but this cardinality must be same for all its children.

Specified by:
getRequiredCardinalities in interface ExpressionParent
Parameters:
index - position of child expression in this parent
Returns:
list of all possible cardinalities which can child expression at given position produce

getRequiredBaseTypes

public BaseType[] getRequiredBaseTypes(int index)
Description copied from interface: ExpressionParent
Gets list of all acceptable baseTypes which can child expression at given position produce.

Result of this method can change in time.

Static example is expression or. Expression or accepts only boolean baseType for any index.

Dynamic example is expression match. Expression match accepts any baseType of its children. but this baseType must be same for all its children.

Specified by:
getRequiredBaseTypes in interface ExpressionParent
Parameters:
index - position of child expression in this parent
Returns:
list of all acceptable baseTypes which can child expression at given position produce

evaluate

public boolean evaluate()
                 throws QTIProcessingInterrupt
Description copied from class: TemplateConditionChild
Evaluates all child templateRules and returns true.

Overrides:
evaluate in class TemplateConditionChild
Returns:
true
Throws:
QTIProcessingInterrupt


Copyright © 2009. All Rights Reserved.