Class brs.EmptyNode
- class EmptyNode
- extends brs.ANode
Represents the empty state of a BiTree. Uses the singleton pattern to model
the uniqueness of "emptiness".
- Author:
- Dung X. Nguyen - Copyright 2002 - All rights reserved.

Singleton

EmptyNode
()

execute
(BiTree, IVisitor, Object[])
- Calls algo's emptyCase () method to execute the algorithm algo
getLeftSubTree
(BiTree)
- Throws java
getRightSubTree
(BiTree)
- Throws java
getRootDat
(BiTree)
- Throws java
insertRoot
(Object, BiTree)
- Asks the owner tree to set the root node to a new DatNode containing dat,
remRoot
(BiTree)
- Throws java
setLeftSubTree
(BiTree, BiTree)
- Throws java
setRightSubTree
(BiTree, BiTree)
- Throws java
setRootDat
(Object, BiTree)
- Throws java

Singleton
static final EmptyNode Singleton = new EmptyNode ()

EmptyNode
private EmptyNode()

getRootDat
Object getRootDat(BiTree owner)
- Throws java.util.NoSuchElementException.
- Parameters:
- owner - the BiTree holding this EmptyNode.
setRootDat
void setRootDat(Object dat, BiTree owner)
- Throws java.util.NoSuchElementException.
- Parameters:
- dat - a data Object.
- owner - the BiTree holding this EmptyNode.
getLeftSubTree
BiTree getLeftSubTree(BiTree owner)
- Throws java.util.NoSuchElementException.
- Parameters:
- owner - the BiTree holding this EmptyNode.
getRightSubTree
BiTree getRightSubTree(BiTree owner)
- Throws java.util.NoSuchElementException.
- Parameters:
- owner - the BiTree holding this EmptyNode.
setLeftSubTree
void setLeftSubTree(BiTree biTree, BiTree owner)
- Throws java.util.NoSuchElementException.
- Parameters:
- biTree - a given BiTree.
- owner - the BiTree holding this EmptyNode.
setRightSubTree
void setRightSubTree(BiTree biTree, BiTree owner)
- Throws java.util.NoSuchElementException.
- Parameters:
- biTree - a given BiTree.
- owner - the BiTree holding this EmptyNode.
insertRoot
void insertRoot(Object dat, BiTree owner)
- Asks the owner tree to set the root node to a new DatNode containing dat,
resulting in a state change from empty to non-empty.
- Parameters:
- dat - a given data Object.
- owner - the context of this state.
remRoot
Object remRoot(BiTree owner)
- Throws java.util.NoSuchElementException.
- Parameters:
- owner - the BiTree holding this EmptyNode.
execute
Object execute(BiTree owner, IVisitor algo, Object[] inp)
- Calls algo's emptyCase () method to execute the algorithm algo.
- Parameters:
- algo - the visiting algorithm
- inp - the input algo needs.
- owner - the BiTree holding this EmptyNode.
- Returns:
- the output for the emptyCase() of algo.