| Package | de.polygonal.ds |
| Class | public class BinaryTreeNode |
| Inheritance | BinaryTreeNode Object |
| Property | Defined By | ||
|---|---|---|---|
| data : *
The node's data. | BinaryTreeNode | ||
| left : BinaryTreeNode
The left child node being referenced. | BinaryTreeNode | ||
| parent : BinaryTreeNode
The parent node being referenced. | BinaryTreeNode | ||
| right : BinaryTreeNode
The right child node being referenced. | BinaryTreeNode | ||
| Method | Defined By | ||
|---|---|---|---|
BinaryTreeNode(obj:*)
Creates an empty node. | BinaryTreeNode | ||
count():int
Recursively counts the total number of nodes including this node. | BinaryTreeNode | ||
destroy():void
Recursively clears the tree by deleting all child nodes underneath
the node the method is called on. | BinaryTreeNode | ||
getDepth(node:BinaryTreeNode = null):int
Computes the depth of a tree. | BinaryTreeNode | ||
inorder(node:BinaryTreeNode, process:Function):void [static]
Performs an inorder traversal on a tree. | BinaryTreeNode | ||
isLeft():Boolean
Checks if the node is a left node relative to its parent node. | BinaryTreeNode | ||
isRight():Boolean
Checks if the node is a right node relative to its parent node. | BinaryTreeNode | ||
postorder(node:BinaryTreeNode, process:Function):void [static]
Performs a postorder traversal on a tree. | BinaryTreeNode | ||
preorder(node:BinaryTreeNode, process:Function):void [static]
Performs a preorder traversal on a tree. | BinaryTreeNode | ||
setLeft(obj:*):void
Writes data into the left child. | BinaryTreeNode | ||
setRight(obj:*):void
Writes data into the right child. | BinaryTreeNode | ||
toString():String
Prints out a string representing the current object. | BinaryTreeNode | ||
| data | property |
public var data:*The node's data.
| left | property |
public var left:BinaryTreeNodeThe left child node being referenced.
| parent | property |
public var parent:BinaryTreeNodeThe parent node being referenced.
| right | property |
public var right:BinaryTreeNodeThe right child node being referenced.
| BinaryTreeNode | () | Constructor |
public function BinaryTreeNode(obj:*)Creates an empty node.
Parametersobj:* — The node's data.
|
| count | () | method |
public function count():intRecursively counts the total number of nodes including this node.
Returnsint |
| destroy | () | method |
public function destroy():voidRecursively clears the tree by deleting all child nodes underneath the node the method is called on.
| getDepth | () | method |
public function getDepth(node:BinaryTreeNode = null):intComputes the depth of a tree.
Parameters
node:BinaryTreeNode (default = null) |
int — The depth of the tree.
|
| inorder | () | method |
public static function inorder(node:BinaryTreeNode, process:Function):voidPerforms an inorder traversal on a tree. This processes the current node in between the child nodes.
Parameters
node:BinaryTreeNode — The node to start from.
| |
process:Function — A process function applied to each traversed node.
|
| isLeft | () | method |
public function isLeft():BooleanChecks if the node is a left node relative to its parent node.
ReturnsBoolean — True if this node is left, otherwise false.
|
| isRight | () | method |
public function isRight():BooleanChecks if the node is a right node relative to its parent node.
ReturnsBoolean — True if this node is right, otherwise false.
|
| postorder | () | method |
public static function postorder(node:BinaryTreeNode, process:Function):voidPerforms a postorder traversal on a tree. This processes the current node after its children.
Parameters
node:BinaryTreeNode — The node to start from.
| |
process:Function — A process function applied to each traversed node.
|
| preorder | () | method |
public static function preorder(node:BinaryTreeNode, process:Function):voidPerforms a preorder traversal on a tree. This processes the current tree node before its children.
Parameters
node:BinaryTreeNode — The node to start from.
| |
process:Function — A process function applied to each traversed node.
|
| setLeft | () | method |
public function setLeft(obj:*):voidWrites data into the left child.
Parameters
obj:* — The data.
|
| setRight | () | method |
public function setRight(obj:*):voidWrites data into the right child.
Parameters
obj:* — The data.
|
| toString | () | method |
public function toString():StringPrints out a string representing the current object.
ReturnsString — A string representing the current object.
|