org.aitools.programd.graph
Class AbstractNodemaster

java.lang.Object
  extended by org.aitools.programd.graph.AbstractNodemaster
All Implemented Interfaces:
Nodemapper
Direct Known Subclasses:
NonOptimalNodemaster, OneOptimalNodemaster, ThreeOptimalNodemaster, TwoOptimalNodemaster

public abstract class AbstractNodemaster
extends java.lang.Object
implements Nodemapper

This is an abstract Nodemaster containing all the things that are common to the various optimization strategies.

Author:
Noel Bush

Field Summary
protected  int height
          The minimum number of words needed to reach a leaf node from here.
protected  java.util.LinkedHashMap<java.lang.String,java.lang.Object> hidden
          The hidden hashmap where some (or all) mappings may be stored, depending upon optimization strategies.
protected  Nodemapper parent
          The parent of this Nodemaster.
 
Constructor Summary
AbstractNodemaster()
           
 
Method Summary
protected  void fillInHeight(int heightToFillIn)
          Sets the height of this Nodemaster to height, and calls fillInHeight() on its parent (if not null) with a height height + 1.
 int getHeight()
          Returns the height of the Nodemapper.
 Nodemapper getParent()
          Returns the parent of the Nodemapper
 void setParent(Nodemapper parentToSet)
          Sets the parent of the Nodemaster.
 void setTop()
          Sets the Nodemaster as being at the top.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.aitools.programd.graph.Nodemapper
containsKey, get, getAverageSize, keySet, put, remove, size
 

Field Detail

hidden

protected java.util.LinkedHashMap<java.lang.String,java.lang.Object> hidden
The hidden hashmap where some (or all) mappings may be stored, depending upon optimization strategies.


height

protected int height
The minimum number of words needed to reach a leaf node from here. Defaults to zero.


parent

protected Nodemapper parent
The parent of this Nodemaster.

Constructor Detail

AbstractNodemaster

public AbstractNodemaster()
Method Detail

setParent

public void setParent(Nodemapper parentToSet)
Sets the parent of the Nodemaster.

Specified by:
setParent in interface Nodemapper
Parameters:
parentToSet - the parent to set

getParent

public Nodemapper getParent()
Description copied from interface: Nodemapper
Returns the parent of the Nodemapper

Specified by:
getParent in interface Nodemapper
Returns:
the parent of the Nodemaster

getHeight

public int getHeight()
Description copied from interface: Nodemapper
Returns the height of the Nodemapper. The height is the minimum number of words needed to reach a leaf node from here.

Specified by:
getHeight in interface Nodemapper
Returns:
the height of the Nodemaster

setTop

public void setTop()
Sets the Nodemaster as being at the top.

Specified by:
setTop in interface Nodemapper

fillInHeight

protected void fillInHeight(int heightToFillIn)
Sets the height of this Nodemaster to height, and calls fillInHeight() on its parent (if not null) with a height height + 1.

Parameters:
heightToFillIn - the height for this node