Class brs.ANode
- abstract class ANode
- extends Object
Represents the state of the owner binary tree structure. Union pattern
- Author:
- Dung X. Nguyen - Copyright 2001 - All rights reserved.

execute
(BiTree, IVisitor, Object[])
- Calls the appropriate visitor's method to execute the visiting algorithm
getLeftSubTree
(BiTree)
- Gets the left subtree of the owner tree
getRightSubTree
(BiTree)
- Gets the right subtree of the owner tree
getRootDat
(BiTree)
- Gets the root data of the owner tree if it exists
insertRoot
(Object, BiTree)
- Inserts a root element to the owner tree
remRoot
(BiTree)
- Removes and returns the root element from the owner tree
setLeftSubTree
(BiTree, BiTree)
- Sets the left subtree of the owner tree to a given tree
setRightSubTree
(BiTree, BiTree)
- Sets the right subtree of the owner tree to a given tree
setRootDat
(Object, BiTree)
- Sets the root element of the owner tree to a given data object

getRootDat
abstract Object getRootDat(BiTree owner)
- Gets the root data of the owner tree if it exists.
- Parameters:
- owner - the BiTree that holds this node.
- Returns:
- the data element of this node if it exists.
- Throws: NoSuchElementException
- if the owner is empty.
setRootDat
abstract void setRootDat(Object dat, BiTree owner)
- Sets the root element of the owner tree to a given data object.
- Parameters:
- dat -
- owner - the BiTree that holds this node.
- Throws: NoSuchElementException
- if the owner is empty.
getLeftSubTree
abstract BiTree getLeftSubTree(BiTree owner)
- Gets the left subtree of the owner tree.
- Parameters:
- owner - the BiTree that holds this node.
- Returns:
- the left subtree of this node if it exists.
- Throws: NoSuchElementException
- if the owner is empty.
getRightSubTree
abstract BiTree getRightSubTree(BiTree owner)
- Gets the right subtree of the owner tree.
- Parameters:
- owner - the BiTree that holds this node.
- Returns:
- the right subtree of this node if it exists.
- Throws: NoSuchElementException
- if the owner is empty.
setLeftSubTree
abstract void setLeftSubTree(BiTree biTree, BiTree owner)
- Sets the left subtree of the owner tree to a given tree.
- Parameters:
- biTree - != null.
- owner - the BiTree that holds this node.
- Throws: NoSuchElementException
- if the owner is empty.
setRightSubTree
abstract void setRightSubTree(BiTree biTree, BiTree owner)
- Sets the right subtree of the owner tree to a given tree.
- Parameters:
- biTree - != null.
- owner - the BiTree that holds this node.
- Throws: NoSuchElementException
- if the owner is empty.
insertRoot
abstract void insertRoot(Object dat, BiTree owner)
- Inserts a root element to the owner tree. Allows the owner tree to change
state from empty to non-empty.
- Parameters:
- dat -
- owner - the BiTree that holds this node.
- Throws: IllegaStateException
- if the owner is not empty.
remRoot
abstract Object remRoot(BiTree owner)
- Removes and returns the root element from the owner tree. Allows the
owner tree to change state from non-empty to empty.
- Parameters:
- dat -
- owner - the BiTree that holds this node.
- Throws: IllegaStateException
- if the owner has more than one element.
execute
abstract Object execute(BiTree owner, IVisitor algo, Object[] inp)
- Calls the appropriate visitor's method to execute the visiting algorithm.
- Parameters:
- algo - the visiting algorithm
- inp - the input the algorithm needs.
- owner - the BiTree that holds this node.
- Returns:
- the output for the algorithm.