edu.princeton.cs.algs4.growingtree.experiments
Interface IExperimentLogger<P extends NodeProperties>

Type Parameters:
P -
All Known Implementing Classes:
ExperimentTree, RotationHeightLogger

public interface IExperimentLogger<P extends NodeProperties>

This class provides the ability to log events in a series of operations. When added to a TreeVisualization or TreeExperiment, it receives callbacks for each event.

Author:
Josh Israel

Field Summary
static int HEIGHT_UPDATE
          event_id for logOther call for height changing
static int SIZE_UPDATE
          event_id for logOther call for size changing
 
Method Summary
 void logDeletion(ShadowNode<P> n)
          Called on IDeletingNode.predecessorHibbardDelete and IDeletingNode.successorHibbardDelete PRIOR to the actual deletion.
 void logInsertion(ShadowNode<P> n)
          Called on IInsertNode.insertLeft and IInsertNode.insertRight
 void logOther(IAlgorithmNode<P> n, int event_id)
          Catch-all logging function for anything missed by the others.
 void logRotation(ShadowNode<P> n)
          Called on IAlgorithmNode.rotateLeft and IAlgorithmNode.rotateRight PRIOR to the actual rotation.
 void logSearchHit(ShadowNode<P> n)
          Called on ISearchingNode.markFound
 

Field Detail

HEIGHT_UPDATE

static final int HEIGHT_UPDATE
event_id for logOther call for height changing

See Also:
Constant Field Values

SIZE_UPDATE

static final int SIZE_UPDATE
event_id for logOther call for size changing

See Also:
Constant Field Values
Method Detail

logInsertion

void logInsertion(ShadowNode<P> n)
Called on IInsertNode.insertLeft and IInsertNode.insertRight

Parameters:
n - Node that was just inserted

logRotation

void logRotation(ShadowNode<P> n)
Called on IAlgorithmNode.rotateLeft and IAlgorithmNode.rotateRight PRIOR to the actual rotation.

Parameters:
n - Node is being rotated down the tree

logDeletion

void logDeletion(ShadowNode<P> n)
Called on IDeletingNode.predecessorHibbardDelete and IDeletingNode.successorHibbardDelete PRIOR to the actual deletion.

Parameters:
n - Node being deleted

logSearchHit

void logSearchHit(ShadowNode<P> n)
Called on ISearchingNode.markFound

Parameters:
n - Node that has been found

logOther

void logOther(IAlgorithmNode<P> n,
              int event_id)
Catch-all logging function for anything missed by the others. Meant in part to be used by an actual operator if necessary.

Parameters:
n - Node being logged
event_id - Used to identify the event this call represents