org.qtitools.qti.group
Class AbstractNodeGroup

java.lang.Object
  extended by org.qtitools.qti.group.AbstractNodeGroup
All Implemented Interfaces:
java.io.Serializable, NodeGroup, Validatable
Direct Known Subclasses:
AbstractContentNodeGroup, AreaMapEntryGroup, AreaMappingGroup, AssessmentSectionGroup, AssociableHotspotGroup, BranchRuleGroup, CandidateCommentGroup, CandidateResponseGroup, CaptionGroup, ColGroup, ColgroupGroup, ContextGroup, CorrectResponseGroup, DefaultValueGroup, DlElementGroup, ExpressionGroup, FieldValueGroup, GapImgGroup, HotspotChoiceGroup, IdentificationGroup, InlineChoiceGroup, InteractionGroup, InterpolationTableEntryGroup, ItemBodyGroup, ItemResultGroup, ItemSessionControlGroup, ItemVariableGroup, LiGroup, LookupTableGroup, MapEntryGroup, MappingGroup, MatchTableEntryGroup, ModalFeedbackGroup, ObjectGroup, OrderingGroup, OutcomeDeclarationGroup, OutcomeElseGroup, OutcomeElseIfGroup, OutcomeIfGroup, OutcomeProcessingGroup, OutcomeRuleGroup, PositionObjectInteractionGroup, PreConditionGroup, PromptGroup, ResponseDeclarationGroup, ResponseElseGroup, ResponseElseIfGroup, ResponseIfGroup, ResponseProcessingGroup, ResponseRuleGroup, RubricBlockGroup, SectionPartGroup, SelectionGroup, SessionIdentifierGroup, SimpleAssociableChoiceGroup, SimpleChoiceGroup, SimpleMatchSetGroup, StylesheetGroup, TableCellGroup, TbodyGroup, TemplateDeclarationGroup, TemplateDefaultGroup, TemplateElseGroup, TemplateElseIfGroup, TemplateIfGroup, TemplateProcessingGroup, TemplateRuleGroup, TestFeedbackGroup, TestPartGroup, TestResultGroup, TfootGroup, TheadGroup, TimeLimitGroup, TrGroup, VariableMappingGroup, WeightGroup

public abstract class AbstractNodeGroup
extends java.lang.Object
implements NodeGroup

Parent of all groups.

Author:
Jiri Kajaba
See Also:
Serialized Form

Constructor Summary
AbstractNodeGroup(XmlNode parent, java.lang.String name, boolean required)
          Constructs group with maximum set to 1.
AbstractNodeGroup(XmlNode parent, java.lang.String name, java.lang.Integer minimum, java.lang.Integer maximum)
          Constructs group.
 
Method Summary
 java.util.List<java.lang.String> getAllSupportedClasses()
          Returns list of all possible QTI class names (all possible children in this group).
 XmlNode getChild()
          Gets first child or null.
 java.util.List<XmlNode> getChildren()
          Gets list of all children.
 java.util.List<java.lang.String> getCurrentSupportedClasses(int index)
          Returns list of all currently possible QTI class names (all currently possible children in this group).
 java.lang.String getFullName()
          Gets full name of group (full path from root node up to node's parent and node's name).
 java.lang.Integer getMaximum()
          Gets allowed maximum number of children or null.
 java.lang.Integer getMinimum()
          Gets required minimum number of children or null.
 java.lang.String getName()
          Gets name of group.
 XmlNode getParent()
          Gets parent node of group.
 boolean isGeneral()
          Returns true if group can contain children with different QTI class name; false otherwise.
 void load(org.w3c.dom.Node node)
          Loads children from given source node (DOM).
protected  void setChild(XmlNode child)
          Sets new child.
 java.lang.String toXmlString(int depth, boolean printDefaultAttributes)
          Prints all children into string.
 ValidationResult validate()
          Validates this object.
 
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.group.NodeGroup
create
 

Constructor Detail

AbstractNodeGroup

public AbstractNodeGroup(XmlNode parent,
                         java.lang.String name,
                         boolean required)
Constructs group with maximum set to 1.

This is convenient constructor for group with only one child.

Parameters:
parent - parent of created group
name - name of created group
required - if true, minimum is set to 1, if false, minimum is set to 0

AbstractNodeGroup

public AbstractNodeGroup(XmlNode parent,
                         java.lang.String name,
                         java.lang.Integer minimum,
                         java.lang.Integer maximum)
Constructs group.

Parameters:
parent - parent of created group
name - name of created group
minimum - minimum required children of created group
maximum - maximum allowed children of created group
Method Detail

getParent

public XmlNode getParent()
Description copied from interface: NodeGroup
Gets parent node of group.

Specified by:
getParent in interface NodeGroup
Returns:
parent node of group

getName

public java.lang.String getName()
Description copied from interface: NodeGroup
Gets name of group.

Name of group is typically QTI class name of its children (if it is same for all children).

For example: name of TestPartNodeGroup is testPart.

If group can contain children with different QTI class name, name is display name of abstract parent.

For example: name of ExpressionNodeGroup is expression (expression is not QTI class name for any node).

Specified by:
getName in interface NodeGroup
Returns:
name of group

getFullName

public java.lang.String getFullName()
Description copied from interface: NodeGroup
Gets full name of group (full path from root node up to node's parent and node's name).

Specified by:
getFullName in interface NodeGroup
Returns:
full name of group (full path from root node up to node's parent and node's name)

isGeneral

public boolean isGeneral()
Description copied from interface: NodeGroup
Returns true if group can contain children with different QTI class name; false otherwise.

Specified by:
isGeneral in interface NodeGroup
Returns:
true if group can contain children with different QTI class name; false otherwise

getAllSupportedClasses

public java.util.List<java.lang.String> getAllSupportedClasses()
Description copied from interface: NodeGroup
Returns list of all possible QTI class names (all possible children in this group).

This list will not change in time (it contains every possible QTI class name).

For example: SectionPartNodegroups returns assessmentSection and assessmentItemRef.

Specified by:
getAllSupportedClasses in interface NodeGroup
Returns:
list of all possible QTI class names (all possible children in this group)
See Also:
NodeGroup.getCurrentSupportedClasses(int)

getCurrentSupportedClasses

public java.util.List<java.lang.String> getCurrentSupportedClasses(int index)
Description copied from interface: NodeGroup
Returns list of all currently possible QTI class names (all currently possible children in this group).

This list can change in time (it contains every possible QTI class name for current time (conditions)).

For example: expression delete can contain on first position only expressions which produce single value and on second position only expressions which produce multiple or ordered cardinality.

Specified by:
getCurrentSupportedClasses in interface NodeGroup
Parameters:
index - index of children in group
Returns:
list of all currently possible QTI class names (all currently possible children in this group)

getChild

public XmlNode getChild()
Gets first child or null. This is convenient method for groups only with one child (maximum = 1).

Returns:
first child or null
See Also:
setChild(org.qtitools.qti.node.XmlNode)

setChild

protected void setChild(XmlNode child)
Sets new child.

Removes all children from list first!

This method should be used only on groups with one child (maximum = 1), because it clears list before setting new child.

Parameters:
child - new child
See Also:
getChild()

getChildren

public java.util.List<XmlNode> getChildren()
Description copied from interface: NodeGroup
Gets list of all children.

Specified by:
getChildren in interface NodeGroup
Returns:
list of all children

getMinimum

public java.lang.Integer getMinimum()
Description copied from interface: NodeGroup
Gets required minimum number of children or null.

Specified by:
getMinimum in interface NodeGroup
Returns:
required minimum number of children or null

getMaximum

public java.lang.Integer getMaximum()
Description copied from interface: NodeGroup
Gets allowed maximum number of children or null.

Specified by:
getMaximum in interface NodeGroup
Returns:
allowed maximum number of children or null

load

public void load(org.w3c.dom.Node node)
Description copied from interface: NodeGroup
Loads children from given source node (DOM).

Specified by:
load in interface NodeGroup
Parameters:
node - source node (DOM)

toXmlString

public java.lang.String toXmlString(int depth,
                                    boolean printDefaultAttributes)
Description copied from interface: NodeGroup
Prints all children into string.

Specified by:
toXmlString in interface NodeGroup
Parameters:
depth - depth indent (0 = no indent)
printDefaultAttributes - whether print attribute's default values
Returns:
xml string of all children

validate

public ValidationResult validate()
Description copied from interface: Validatable
Validates this object.

Specified by:
validate in interface Validatable
Returns:
validation result


Copyright © 2009. All Rights Reserved.