nz.ac.waikato.jdsl.core.ref
Class NodeBinaryTree.NBTSuperNode

java.lang.Object
  extended by nz.ac.waikato.jdsl.core.ref.HashtableDecorable
      extended by nz.ac.waikato.jdsl.core.ref.NodeBinaryTree.NBTNode
          extended by nz.ac.waikato.jdsl.core.ref.NodeBinaryTree.NBTSuperNode
All Implemented Interfaces:
java.io.Serializable, Accessor, Decorable, Position
Enclosing class:
NodeBinaryTree

protected static class NodeBinaryTree.NBTSuperNode
extends NodeBinaryTree.NBTNode

This is the supernode. There is one instance per tree, useful mainly so that container() calls can recur polymorphically up the tree Protected so subclasses can access it

See Also:
Serialized Form

Constructor Summary
protected NodeBinaryTree.NBTSuperNode(NodeBinaryTree t, NodeBinaryTree.NBTNode root)
          Constructs the super node with its tree and root
 
Method Summary
protected  NodeBinaryTree container()
          O(1) time
 java.lang.Object element()
          Should never be called
protected  void expand()
          Should never be called
protected  boolean isInternal()
          Should never be called
protected  boolean isSuperNode()
          Used to determine if this node is the super node (overridden)
protected  boolean isValid()
          Should never be called
protected  NodeBinaryTree.NBTNode left()
          Should never be called
protected  void makeUncontained()
          Should never be called
protected  NodeBinaryTree.NBTNode otherChild(NodeBinaryTree.NBTNode child)
          Should never be called
protected  NodeBinaryTree.NBTNode parent()
          Should never be called
protected  void removeSelfAndAbove()
          Should never be called
protected  java.lang.Object replaceElement(java.lang.Object x)
          Should never be called
protected  void replaceSelf(NodeBinaryTree.NBTNode x)
          Should never be called
protected  NodeBinaryTree.NBTNode right()
          Should never be called
protected  void setChild(NodeBinaryTree.NBTNode currchild, NodeBinaryTree.NBTNode newchild)
          O(1) time Sets this node's root; any other use of this method is invalid
protected  void setLeft()
          Should never be called
protected  void setParent()
          Should never be called
protected  void setRight()
          Should never be called
protected  void setRoot(NodeBinaryTree.NBTNode root)
          O(1) time Sets this node's root
protected  void swapWithNode(NodeBinaryTree.NBTNode x)
          Should never be called
 
Methods inherited from class nz.ac.waikato.jdsl.core.ref.NodeBinaryTree.NBTNode
isLeftChild, setContainer, setLeft, setParent, setRight, toString
 
Methods inherited from class nz.ac.waikato.jdsl.core.ref.HashtableDecorable
attributes, capacity, destroy, get, has, hash, rehash, set, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface nz.ac.waikato.jdsl.core.api.Decorable
attributes, destroy, get, has, set
 

Constructor Detail

NodeBinaryTree.NBTSuperNode

protected NodeBinaryTree.NBTSuperNode(NodeBinaryTree t,
                                      NodeBinaryTree.NBTNode root)
Constructs the super node with its tree and root

Method Detail

setRoot

protected void setRoot(NodeBinaryTree.NBTNode root)
O(1) time Sets this node's root

Parameters:
root - The new root

setChild

protected void setChild(NodeBinaryTree.NBTNode currchild,
                        NodeBinaryTree.NBTNode newchild)
O(1) time Sets this node's root; any other use of this method is invalid

Overrides:
setChild in class NodeBinaryTree.NBTNode
Parameters:
currchild - The node to replace; hopefully the root
newchild - The new root

container

protected NodeBinaryTree container()
Description copied from class: NodeBinaryTree.NBTNode
O(1) time

Overrides:
container in class NodeBinaryTree.NBTNode
Returns:
this node's container

element

public java.lang.Object element()
Should never be called

Specified by:
element in interface Accessor
Overrides:
element in class NodeBinaryTree.NBTNode
Returns:
the element currently stored at this accessor

isValid

protected boolean isValid()
Should never be called


parent

protected NodeBinaryTree.NBTNode parent()
Should never be called

Overrides:
parent in class NodeBinaryTree.NBTNode
Returns:
this node's parent.

left

protected NodeBinaryTree.NBTNode left()
Should never be called

Overrides:
left in class NodeBinaryTree.NBTNode
Returns:
this node's left child.

right

protected NodeBinaryTree.NBTNode right()
Should never be called

Overrides:
right in class NodeBinaryTree.NBTNode
Returns:
this node's right child.

otherChild

protected NodeBinaryTree.NBTNode otherChild(NodeBinaryTree.NBTNode child)
Should never be called

Overrides:
otherChild in class NodeBinaryTree.NBTNode
Parameters:
child - of my children
Returns:
my other child (asserts if the parameter isn't my child)

isInternal

protected boolean isInternal()
Should never be called

Overrides:
isInternal in class NodeBinaryTree.NBTNode
Returns:
Whether or not this node is internal

setLeft

protected void setLeft()
Should never be called


setRight

protected void setRight()
Should never be called


setParent

protected void setParent()
Should never be called


makeUncontained

protected void makeUncontained()
Should never be called

Overrides:
makeUncontained in class NodeBinaryTree.NBTNode

expand

protected void expand()
Should never be called

Overrides:
expand in class NodeBinaryTree.NBTNode

removeSelfAndAbove

protected void removeSelfAndAbove()
Should never be called

Overrides:
removeSelfAndAbove in class NodeBinaryTree.NBTNode

replaceSelf

protected void replaceSelf(NodeBinaryTree.NBTNode x)
Should never be called

Overrides:
replaceSelf in class NodeBinaryTree.NBTNode
Parameters:
x - the node to replace me with

swapWithNode

protected void swapWithNode(NodeBinaryTree.NBTNode x)
Should never be called


replaceElement

protected java.lang.Object replaceElement(java.lang.Object x)
Should never be called

Overrides:
replaceElement in class NodeBinaryTree.NBTNode
Parameters:
x - my new element
Returns:
The element I used to contain

isSuperNode

protected boolean isSuperNode()
Used to determine if this node is the super node (overridden)

Overrides:
isSuperNode in class NodeBinaryTree.NBTNode


Copyright © 2009 ModelJUnit Project. All Rights Reserved.