org.qtitools.qti.node.test
Class ControlObject

java.lang.Object
  extended by org.qtitools.qti.node.AbstractNode
      extended by org.qtitools.qti.node.AbstractObject
          extended by org.qtitools.qti.node.UniqueObject
              extended by org.qtitools.qti.node.test.ControlObject
All Implemented Interfaces:
java.io.Serializable, XmlNode, XmlObject, Validatable
Direct Known Subclasses:
AbstractPart, AssessmentTest

public abstract class ControlObject
extends UniqueObject

Abstract parent for assessmentTest, testPart, assessmentSection and assessmentItemRef.

Author:
Jiri Kajaba
See Also:
Serialized Form

Field Summary
protected  boolean finished
           
static java.lang.String VARIABLE_DURATION_NAME
          Name of duration built-in variable.
 
Fields inherited from class org.qtitools.qti.node.UniqueObject
ATTR_IDENTIFIER_NAME
 
Fields inherited from interface org.qtitools.qti.node.XmlNode
INDENT, NEW_LINE, SIMPLE_NAME_INNER_SEPARATOR, SIMPLE_NAMES_SEPARATOR
 
Constructor Summary
ControlObject(ControlObject parent)
          Constructs object.
 
Method Summary
abstract  java.util.List<? extends AbstractPart> getChildren()
          Gets abstractPart children.
 long getDuration()
          Gets value of duration built-in variable.
 int getFinishedCount()
          Gets total number of finished item references of this control object.
 int getGlobalIndex()
          Returns global index (position) of this object in test.
 ControlObject getParent()
          Gets parent of this node or null (if node is root; for example AssessmentTest).
 int getPresentedCount()
          Gets total number of presented item references of this control object.
 long getResponseTime()
          Gets total time spent inside this object excluding navigation time.
 TimeLimit getTimeLimit()
          Gets timeLimit child.
 int getTotalCount()
          Gets total number of item references of this control object.
 long getTotalTime()
          Gets total time spent inside this object including navigation time.
 void initialize()
          Initialises this object and all its abstractPart children.
 boolean isBuiltInVariable(java.lang.String identifier)
          Returns true if given identifier is identifier of one of built-in variables; false otherwise.
 boolean isChildOf(ControlObject parent)
          Returns true if given parameter is direct or indirect parent of this object; false otherwise.
 boolean isFinished()
          Returns true if this object is finished; false otherwise.
 boolean isPresented()
          Returns true if at least one child item reference was already presented to user; false otherwise.
 ControlObject lookup(java.lang.String identifier)
          Lookups for object with given identifier.
 AssessmentItemRef lookupItemRef(java.lang.String identifier)
          Lookups for item reference with given identifier.
 java.util.List<AssessmentItemRef> lookupItemRefs(java.lang.String identifier)
          Returns all item references of given parent (identifier).
 java.util.List<AssessmentItemRef> lookupItemRefs(java.lang.String identifier, java.util.List<java.lang.String> includeCategories, java.util.List<java.lang.String> excludeCategories)
          Returns all item references of given parent (identifier) with given conditions.
 Value lookupValue(java.lang.String identifier)
          Lookups for value of variable with given identifier.
 boolean passMaximumTimeLimit()
          Returns true if time used by this control object is lower or equal than maximum time limit; false otherwise.
 boolean passMinimumTimeLimit()
          Returns true if time used by this control object is higher or equal than minimum time limit; false otherwise.
 void setFinished()
          Sets this object to finished state.
 void setTimeLimit(TimeLimit timeLimit)
          Sets new timeLimit child.
 
Methods inherited from class org.qtitools.qti.node.UniqueObject
getIdentifier, getSimpleName, setIdentifier, validateAttributes
 
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, getClassTag, 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, validate, 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, 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
 

Field Detail

VARIABLE_DURATION_NAME

public static final java.lang.String VARIABLE_DURATION_NAME
Name of duration built-in variable.

See Also:
Constant Field Values

finished

protected boolean finished
Constructor Detail

ControlObject

public ControlObject(ControlObject parent)
Constructs object.

Parameters:
parent - parent of constructed object
Method Detail

getParent

public ControlObject getParent()
Description copied from interface: XmlNode
Gets parent of this node or null (if node is root; for example AssessmentTest).

While testing some nodes (for example expressions) don't have properly set parent, but it is usable only for testing. (Some nodes cannot exists without parent even for testing).

Specified by:
getParent in interface XmlNode
Specified by:
getParent in interface XmlObject
Overrides:
getParent in class AbstractObject
Returns:
parent of this node or null (if node is root; for example AssessmentTest)

getTimeLimit

public TimeLimit getTimeLimit()
Gets timeLimit child.

Returns:
timeLimit child
See Also:
setTimeLimit(org.qtitools.qti.node.test.TimeLimit)

setTimeLimit

public void setTimeLimit(TimeLimit timeLimit)
Sets new timeLimit child.

Parameters:
timeLimit - new timeLimit child
See Also:
getTimeLimit()

getChildren

public abstract java.util.List<? extends AbstractPart> getChildren()
Gets abstractPart children.

Returns:
abstractPart children

initialize

public void initialize()
Initialises this object and all its abstractPart children.


isPresented

public boolean isPresented()
Returns true if at least one child item reference was already presented to user; false otherwise.

Once object is presented it remains presented for ever.

Returns:
true if at least one child item reference was already presented to user; false otherwise

isFinished

public boolean isFinished()
Returns true if this object is finished; false otherwise.

Finished state has different meaning for different object types (see overriding methods).

Once object is finished it remains finished for ever.

Returns:
true if this object is finished; false otherwise
See Also:
setFinished()

setFinished

public void setFinished()
Sets this object to finished state.

See Also:
isFinished()

getGlobalIndex

public int getGlobalIndex()
Returns global index (position) of this object in test.

This method is used for validation of branchRule. It is not possible to jump back (jump on object with lower global index).

Returns:
global index (position) of this object in test

isChildOf

public boolean isChildOf(ControlObject parent)
Returns true if given parameter is direct or indirect parent of this object; false otherwise.

Parameters:
parent - given parameter
Returns:
true if given parameter is direct or indirect parent of this object; false otherwise

lookup

public ControlObject lookup(java.lang.String identifier)
Lookups for object with given identifier.

Parameters:
identifier - identifier of requested object
Returns:
object with given identifier or null

lookupItemRef

public AssessmentItemRef lookupItemRef(java.lang.String identifier)
Lookups for item reference with given identifier.

Parameters:
identifier - identifier of requested item reference
Returns:
item reference with given identifier or null

lookupItemRefs

public java.util.List<AssessmentItemRef> lookupItemRefs(java.lang.String identifier)
Returns all item references of given parent (identifier).

Parameters:
identifier - identifier of requested parent
Returns:
all item references of given parent (identifier)
See Also:
lookupItemRefs(String, List, List)

lookupItemRefs

public java.util.List<AssessmentItemRef> lookupItemRefs(java.lang.String identifier,
                                                        java.util.List<java.lang.String> includeCategories,
                                                        java.util.List<java.lang.String> excludeCategories)
Returns all item references of given parent (identifier) with given conditions.

Parameters:
identifier - identifier of requested parent
includeCategories - returned item reference must contain this category
excludeCategories - returned item reference must not contain this category
Returns:
all item references of given parent (identifier) with given conditions
See Also:
lookupItemRefs(String)

isBuiltInVariable

public boolean isBuiltInVariable(java.lang.String identifier)
Returns true if given identifier is identifier of one of built-in variables; false otherwise.

Parameters:
identifier - given identifier
Returns:
true if given identifier is identifier of one of built-in variables; false otherwise

lookupValue

public Value lookupValue(java.lang.String identifier)
Lookups for value of variable with given identifier.

Parameters:
identifier - identifier of requested variable
Returns:
value of variable with given identifier or null

getTotalCount

public int getTotalCount()
Gets total number of item references of this control object.

Returns:
total number of item references of this control object

getPresentedCount

public int getPresentedCount()
Gets total number of presented item references of this control object.

Returns:
total number of presented item references of this control object

getFinishedCount

public int getFinishedCount()
Gets total number of finished item references of this control object.

Returns:
total number of finished item references of this control object

getTotalTime

public long getTotalTime()
Gets total time spent inside this object including navigation time.

Returns:
total time spent inside this object including navigation time
See Also:
getResponseTime()

getResponseTime

public long getResponseTime()
Gets total time spent inside this object excluding navigation time.

This methods returns pure response (thinking) time (navigation time is not included).

Returns:
total time spent inside this object excluding navigation time
See Also:
getTotalTime()

getDuration

public long getDuration()
Gets value of duration built-in variable.

Duration for test or test part or section means total time (thinking time including navigation time).

Duration for item reference means response time (thinking time excluding navigation time).

Returns:
value of duration built-in variable

passMinimumTimeLimit

public boolean passMinimumTimeLimit()
Returns true if time used by this control object is higher or equal than minimum time limit; false otherwise.

Time used by this control object is calculated as:

This method is not implemented and returns always true.

Returns:
true if time used by this control object is higher or equal than minimum time limit; false otherwise

passMaximumTimeLimit

public boolean passMaximumTimeLimit()
Returns true if time used by this control object is lower or equal than maximum time limit; false otherwise. This method checks first this control object and then recursively all its parents and returns true only if every tested object passed check.

Time used by this control object is calculated as:

This method is used for check if item can be shown to the user.

Returns:
true if time used by this control object is lower or equal than maximum time limit; false otherwise


Copyright © 2009. All Rights Reserved.