edu.princeton.cs.algs4.growingtree.framework
Class NodeAndKey<P extends NodeProperties>

java.lang.Object
  extended by edu.princeton.cs.algs4.growingtree.framework.NodeAndKey<P>

public class NodeAndKey<P extends NodeProperties>
extends java.lang.Object

An object which keeps both a BSTTree node and an integer key. Useful when dealing with waitingActions that must involve both a node and key. This class makes that possible within one object.


Constructor Summary
NodeAndKey()
          Constructor, making an empty NodeAndKey Object.
NodeAndKey(GrowingTreeNode<P> node, int key)
          Constructor, making a NodeAndKey Object with the speficied node and key.
 
Method Summary
 int getKey()
          Gets the key for the object.
 GrowingTreeNode<P> getNode()
          Gets the node for the object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeAndKey

public NodeAndKey()
Constructor, making an empty NodeAndKey Object. Using the set methods, it can be set.


NodeAndKey

public NodeAndKey(GrowingTreeNode<P> node,
                  int key)
Constructor, making a NodeAndKey Object with the speficied node and key.

Parameters:
node - BSTTree node for the current NodeAndKey.
key - int for the NodeAndKey.
Method Detail

getNode

public GrowingTreeNode<P> getNode()
Gets the node for the object.

Returns:
BSTTree node for the object.

getKey

public int getKey()
Gets the key for the object.

Returns:
int key for the object.