| Package | de.polygonal.ds |
| Class | public class TreeIterator |
| Inheritance | TreeIterator Object |
| Implements | Iterator |
| Property | Defined By | ||
|---|---|---|---|
| childData : * [read-only]
Returns the item the child iterator is pointing to. | TreeIterator | ||
| childNode : TreeNode [read-only]
The current child node being referenced. | TreeIterator | ||
| data : *
Grants access to the current item being referenced by the iterator. | TreeIterator | ||
| node : TreeNode
The tree node being referenced. | TreeIterator | ||
| Method | Defined By | ||
|---|---|---|---|
TreeIterator(node:TreeNode = null)
Initializes a tree iterator pointing to a given tree node. | TreeIterator | ||
appendChild(obj:*):void
Appends a child node to the child list. | TreeIterator | ||
childEnd():void
Moves the child iterator to the last child. | TreeIterator | ||
childStart():void
Moves the child iterator to the first child. | TreeIterator | ||
childValid():Boolean
Determines if the child iterator is valid. | TreeIterator | ||
down():void
Moves the iterator down by one level of the tree, so that it points
to the first child of the current tree node. | TreeIterator | ||
hasNext():Boolean
Checks if a next item exists. | TreeIterator | ||
insertAfterChild(obj:*):void
Inserts a child node after the current child node. | TreeIterator | ||
insertBeforeChild(obj:*):void
Inserts a child node before the current child node. | TreeIterator | ||
next():*
Returns the current item and moves the iterator to the next item
in the collection. | TreeIterator | ||
nextChild():void
Moves the child iterator forward by one position. | TreeIterator | ||
[static]
Performs a postorder traversal on a tree. | TreeIterator | ||
[static]
Performs a preorder traversal on a tree. | TreeIterator | ||
prependChild(obj:*):void
Prepends a child node to the child list. | TreeIterator | ||
prevChild():void
Moves the child iterator back by one position. | TreeIterator | ||
removeChild():void
Unlinks the current child node from the tree. | TreeIterator | ||
root():void
Moves the iterator to the root of the tree. | TreeIterator | ||
start():void
Resets the vertical iterator so that it points to the root of the
tree. | TreeIterator | ||
toString():String
Prints out a string representing the current object. | TreeIterator | ||
up():void
Moves the iterator up by one level of the tree, so that it points to
the parent of the current tree node. | TreeIterator | ||
valid():Boolean
Checks if the node is valid. | TreeIterator | ||
| childData | property |
childData:* [read-only] Returns the item the child iterator is pointing to.
public function get childData():*| childNode | property |
childNode:TreeNode [read-only] The current child node being referenced.
public function get childNode():TreeNode| data | property |
data:*Grants access to the current item being referenced by the iterator. This provides a quick way to read or write the current data.
public function get data():* public function set data(value:any):void| node | property |
public var node:TreeNodeThe tree node being referenced.
| TreeIterator | () | Constructor |
public function TreeIterator(node:TreeNode = null)Initializes a tree iterator pointing to a given tree node.
Parametersnode:TreeNode (default = null) — The node the iterator should point to.
|
| appendChild | () | method |
public function appendChild(obj:*):voidAppends a child node to the child list.
Parameters
obj:* — The data to append as a child node.
|
| childEnd | () | method |
public function childEnd():voidMoves the child iterator to the last child.
| childStart | () | method |
public function childStart():voidMoves the child iterator to the first child.
| childValid | () | method |
public function childValid():BooleanDetermines if the child iterator is valid.
ReturnsBoolean |
| down | () | method |
public function down():voidMoves the iterator down by one level of the tree, so that it points to the first child of the current tree node.
| hasNext | () | method |
public function hasNext():BooleanChecks if a next item exists.
ReturnsBoolean — True if a next item exists, otherwise false.
|
| insertAfterChild | () | method |
public function insertAfterChild(obj:*):voidInserts a child node after the current child node.
Parameters
obj:* — The data to insert as a child node.
|
| insertBeforeChild | () | method |
public function insertBeforeChild(obj:*):voidInserts a child node before the current child node.
Parameters
obj:* — The data to insert as a child node.
|
| next | () | method |
public function next():*Returns the current item and moves the iterator to the next item in the collection. Note that the next() method returns the first item in the collection when it's first called.
Returns* — The next item in the collection.
|
| nextChild | () | method |
public function nextChild():voidMoves the child iterator forward by one position.
| postorder | () | method |
public static function postorder(node:TreeNode, process:Function):voidPerforms a postorder traversal on a tree. This processes the current node after its children.
Parameters
node:TreeNode — The tree node to start from.
| |
process:Function — A process function applied to each traversed node.
|
| preorder | () | method |
public static function preorder(node:TreeNode, process:Function):voidPerforms a preorder traversal on a tree. This processes the current tree node before its children.
Parameters
node:TreeNode — The tree node to start from.
| |
process:Function — A process function applied to each traversed node.
|
| prependChild | () | method |
public function prependChild(obj:*):voidPrepends a child node to the child list.
Parameters
obj:* — The data to prepend as a child node.
|
| prevChild | () | method |
public function prevChild():voidMoves the child iterator back by one position.
| removeChild | () | method |
public function removeChild():voidUnlinks the current child node from the tree. This does not delete the node.
| root | () | method |
public function root():voidMoves the iterator to the root of the tree.
| start | () | method |
public function start():voidResets the vertical iterator so that it points to the root of the tree. Also make sures the horizontal iterator points to the first child.
| toString | () | method |
public function toString():StringPrints out a string representing the current object.
ReturnsString — A string representing the current object.
|
| up | () | method |
public function up():voidMoves the iterator up by one level of the tree, so that it points to the parent of the current tree node.
| valid | () | method |
public function valid():BooleanChecks if the node is valid.
ReturnsBoolean |