org.qtitools.qti.node.test
Class BranchRule

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

public class BranchRule
extends AbstractJump

A branchRule is A simple expression attached to TestPart or assessmentSection or assessmentItemRef. It must evaluate to true if this branchRule should be applied.

If the expression evaluates to false, or has A NULL value, this branchRule will not be applied.

BranchRules are evaluated after part or section or item is finished (not presented).

BranchRule is not real expression (doesn't implement Expression interface).

Author:
Jiri Kajaba
See Also:
Cardinality, BaseType, Serialized Form

Field Summary
static java.lang.String ATTR_TARGET_NAME
          Name of target attribute in xml schema.
static java.lang.String CLASS_TAG
          Name of this class in xml schema.
static java.lang.String EXIT_SECTION
          Special target for exiting assessmentSection.
static java.lang.String EXIT_TEST
          Special target for exiting assessmentTest.
static java.lang.String EXIT_TEST_PART
          Special target for exiting testPart.
 
Fields inherited from interface org.qtitools.qti.node.XmlNode
INDENT, NEW_LINE, SIMPLE_NAME_INNER_SEPARATOR, SIMPLE_NAMES_SEPARATOR
 
Constructor Summary
BranchRule(AbstractPart parent)
          Constructs object.
 
Method Summary
 java.lang.String getClassTag()
          Gets QTI class name of this node.
 java.lang.String getSimpleName()
          Gets simple name of this node.
 java.lang.String getTarget()
          Gets value of target attribute.
 ControlObject getTargetControlObject()
          Gets target ControlOject of this branchRule or null it target doesn't exist.
 boolean isExitSection()
          Returns true is target is EXIT_SECTION; false otherwise.
 boolean isExitTest()
          Returns true is target is EXIT_TEST; false otherwise.
 boolean isExitTestPart()
          Returns true is target is EXIT_TEST_PART; false otherwise.
 boolean isSpecial()
          Returns true is target is EXIT_TEST or EXIT_TEST_PART or EXIT_SECTION; false otherwise.
static boolean isSpecial(java.lang.String target)
          Returns true if given target is special (EXIT_TEST, EXIT_TESTPART, EXIT_SECTION); false otherwise.
 void setTarget(java.lang.String target)
          Sets new value of target attribute.
protected  ValidationResult validateAttributes()
          Validates attributes of this node.
 
Methods inherited from class org.qtitools.qti.node.test.AbstractJump
evaluate, getExpression, getParent, getRequiredBaseTypes, getRequiredCardinalities, setExpression, validate
 
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, getSourceFile, getSourceNode, getSourceString, getSourceUrl, hasChildNodes, load, load, load, load, loadAttributes, readChild, readChildren, setParent, setSourceFile, setSourceNode, setSourceString, setSourceUrl, toXmlString, toXmlString, 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.XmlObject
getParentItem, getParentResult, getParentTest, setParent
 
Methods inherited from interface org.qtitools.qti.node.XmlNode
getAttributes, getFullName, getNodeGroups, getParentRoot, getSourceFile, getSourceNode, getSourceString, getSourceUrl, hasChildNodes, load, load, load, load, setSourceFile, setSourceNode, setSourceString, setSourceUrl, toXmlString, toXmlString
 

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_TARGET_NAME

public static final java.lang.String ATTR_TARGET_NAME
Name of target attribute in xml schema.

See Also:
Constant Field Values

EXIT_TEST

public static final java.lang.String EXIT_TEST
Special target for exiting assessmentTest.

See Also:
Constant Field Values

EXIT_TEST_PART

public static final java.lang.String EXIT_TEST_PART
Special target for exiting testPart.

See Also:
Constant Field Values

EXIT_SECTION

public static final java.lang.String EXIT_SECTION
Special target for exiting assessmentSection.

See Also:
Constant Field Values
Constructor Detail

BranchRule

public BranchRule(AbstractPart parent)
Constructs object.

Parameters:
parent - parent of created object
Method Detail

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

getSimpleName

public java.lang.String getSimpleName()
Description copied from interface: XmlNode
Gets simple name of this node. Simple name contains QTI class name and some additional information to help identify node (if these informations are available).

Simple name is not so important like QTI class name. It servers mostly for displaying informations and in messages.

For example: simple name can be assessmentTest:Test (QTI class name (assessmentTest) + identifier (Test)).

Specified by:
getSimpleName in interface XmlNode
Overrides:
getSimpleName in class AbstractNode
Returns:
simple name of this node
See Also:
XmlNode.getFullName()

getTarget

public java.lang.String getTarget()
Gets value of target attribute.

Returns:
value of target attribute
See Also:
setTarget(java.lang.String)

getTargetControlObject

public ControlObject getTargetControlObject()
Gets target ControlOject of this branchRule or null it target doesn't exist.
  1. if target is EXIT_TEST, returns assessmentTest
  2. if target is EXIT_TESTPART, returns testPart which should be exited
  3. if target is EXIT_SECTION, returns assessmentSection which should be exited
  4. otherwise returns target ControlObject

Returns:
target ControlObject of this branchRule or null it target doesn't exist

setTarget

public void setTarget(java.lang.String target)
Sets new value of target attribute.

Parameters:
target - new value of target attribute
See Also:
getTarget()

isSpecial

public boolean isSpecial()
Returns true is target is EXIT_TEST or EXIT_TEST_PART or EXIT_SECTION; false otherwise.

Returns:
true is target is EXIT_TEST or EXIT_TEST_PART or EXIT_SECTION; false otherwise

isExitTest

public boolean isExitTest()
Returns true is target is EXIT_TEST; false otherwise.

Returns:
true is target is EXIT_TEST; false otherwise

isExitTestPart

public boolean isExitTestPart()
Returns true is target is EXIT_TEST_PART; false otherwise.

Returns:
true is target is EXIT_TEST_PART; false otherwise

isExitSection

public boolean isExitSection()
Returns true is target is EXIT_SECTION; false otherwise.

Returns:
true is target is EXIT_SECTION; false otherwise

validateAttributes

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

Overrides:
validateAttributes in class AbstractNode
Returns:
result of validation

isSpecial

public static boolean isSpecial(java.lang.String target)
Returns true if given target is special (EXIT_TEST, EXIT_TESTPART, EXIT_SECTION); false otherwise.

Parameters:
target - given target
Returns:
true if given target is special (EXIT_TEST, EXIT_TESTPART, EXIT_SECTION); false otherwise


Copyright © 2009. All Rights Reserved.