| Package | de.polygonal.ds |
| Class | public class TreeNode |
| Inheritance | TreeNode Object |
| Implements | Collection |
| Property | Defined By | ||
|---|---|---|---|
| children : DLinkedList
A list of child nodes being referenced. | TreeNode | ||
| data : *
The data being referened. | TreeNode | ||
| depth : int [read-only]
Computes the depth of the tree, starting from this node. | TreeNode | ||
| numChildren : int [read-only]
The total number of children. | TreeNode | ||
| numSiblings : int [read-only]
The total number of siblings. | TreeNode | ||
| parent : TreeNode
The parent node being referenced. | TreeNode | ||
| size : int [read-only]
Counts the total number of tree nodes starting from the current
tree node. | TreeNode | ||
| Method | Defined By | ||
|---|---|---|---|
Creates a tree node. | TreeNode | ||
clear():void
Clears all items. | TreeNode | ||
contains(obj:*):Boolean
Determines if the collection contains a given item. | TreeNode | ||
dump():String
Prints out all elements (for debug/demo purposes). | TreeNode | ||
Initializes an iterator object pointing to the first item in the
collection. | TreeNode | ||
Creates a tree iterator pointing at this tree node. | TreeNode | ||
hasChildren():Boolean
Checks if the tree node has child nodes. | TreeNode | ||
hasSiblings():Boolean
Checks if the tree node has siblings. | TreeNode | ||
isEmpty():Boolean
Checks is the tree node is empty (has no children). | TreeNode | ||
isLeaf():Boolean
Checks if the tree node is a leaf node. | TreeNode | ||
isRoot():Boolean
Checks if the tree node is a root node. | TreeNode | ||
toArray():Array
Converts the collection into an array. | TreeNode | ||
toString():String
Prints out a string representing the current object. | TreeNode | ||
| children | property |
public var children:DLinkedListA list of child nodes being referenced.
| data | property |
public var data:*The data being referened.
| depth | property |
depth:int [read-only] Computes the depth of the tree, starting from this node.
public function get depth():int| numChildren | property |
numChildren:int [read-only] The total number of children.
public function get numChildren():int| numSiblings | property |
numSiblings:int [read-only] The total number of siblings.
public function get numSiblings():int| parent | property |
public var parent:TreeNodeThe parent node being referenced.
| size | property |
size:int [read-only] Counts the total number of tree nodes starting from the current tree node.
public function get size():int| TreeNode | () | Constructor |
public function TreeNode(obj:* = null, parent:TreeNode = null)Creates a tree node.
Parametersobj:* (default = null) — The data to store inside the node.
| |
parent:TreeNode (default = null) — The node's parent.
|
| clear | () | method |
public function clear():voidClears all items.
| contains | () | method |
public function contains(obj:*):BooleanDetermines if the collection contains a given item.
Parameters
obj:* — The item to search for.
|
Boolean — True if the item exists, otherwise false.
|
| dump | () | method |
public function dump():StringPrints out all elements (for debug/demo purposes).
ReturnsString — A human-readable representation of the structure.
|
| getIterator | () | method |
public function getIterator():IteratorInitializes an iterator object pointing to the first item in the collection.
ReturnsIterator — An iterator object.
|
| getTreeIterator | () | method |
public function getTreeIterator():TreeIteratorCreates a tree iterator pointing at this tree node.
ReturnsTreeIterator |
| hasChildren | () | method |
public function hasChildren():BooleanChecks if the tree node has child nodes.
ReturnsBoolean |
| hasSiblings | () | method |
public function hasSiblings():BooleanChecks if the tree node has siblings.
ReturnsBoolean |
| isEmpty | () | method |
public function isEmpty():BooleanChecks is the tree node is empty (has no children).
ReturnsBoolean |
| isLeaf | () | method |
public function isLeaf():BooleanChecks if the tree node is a leaf node.
ReturnsBoolean |
| isRoot | () | method |
public function isRoot():BooleanChecks if the tree node is a root node.
ReturnsBoolean |
| toArray | () | method |
public function toArray():ArrayConverts the collection into an array.
ReturnsArray — An array.
|
| toString | () | method |
public function toString():StringPrints out a string representing the current object.
ReturnsString — A string representing the current object.
|