TreeNode |
A tree node for building a tree data structure.
Every tree node has a linked list of child nodes and a pointer to its parent node. Note that a tree data structure is build of TreeNode objects, so there is no class that manages a tree structure.
TreeNode | A tree node for building a tree data structure. |
Variables | |
parent | The parent node being referenced. |
children | A list of child nodes being referenced. |
data | The data being referened. |
Functions and Properties | |
TreeNode | Creates a tree node. |
size | Counts the total number of tree nodes starting from the current tree node. |
isRoot | Checks if the tree node is a root node. |
isLeaf | Checks if the tree node is a leaf node. |
hasChildren | Checks if the tree node has child nodes. |
hasSiblings | Checks if the tree node has siblings. |
isEmpty | Checks is the tree node is empty (has no children). |
depth | Computes the depth of the tree, starting from this node. |
numChildren | The total number of children. |
numSiblings | The total number of siblings. |
contains | @inheritDoc |
clear | @inheritDoc |
getIterator | @inheritDoc |
getTreeIterator | Creates a tree iterator pointing at this tree node. |
toArray | @inheritDoc |
toString | Prints out a string representing the current object. |
dump | Prints out all elements (for debug/demo purposes). |
The parent node being referenced.
public var parent: TreeNode
A list of child nodes being referenced.
public var children: DLinkedList
The data being referened.
public var data: *
Creates a tree node.
public function TreeNode( obj: * = null, parent: TreeNode = null )
Counts the total number of tree nodes starting from the current tree node.
public function get size():int
Checks if the tree node is a root node.
public function isRoot():Boolean
Checks if the tree node is a leaf node.
public function isLeaf():Boolean
Checks if the tree node has child nodes.
public function hasChildren():Boolean
Checks if the tree node has siblings.
public function hasSiblings():Boolean
Checks is the tree node is empty (has no children).
public function isEmpty():Boolean
Computes the depth of the tree, starting from this node.
public function get depth():int
The total number of children.
public function get numChildren():int
The total number of siblings.
public function get numSiblings():int
@inheritDoc
public function contains( obj: * ):Boolean
@inheritDoc
public function clear():void
@inheritDoc
public function getIterator():Iterator
Creates a tree iterator pointing at this tree node.
public function getTreeIterator():TreeIterator
@inheritDoc
public function toArray():Array
Prints out a string representing the current object.
public function toString():String
Prints out all elements (for debug/demo purposes).
public function dump():String