org.aitools.programd.graph
Interface Nodemapper

All Known Implementing Classes:
AbstractNodemaster, NonOptimalNodemaster, OneOptimalNodemaster, ThreeOptimalNodemaster, TwoOptimalNodemaster

public interface Nodemapper

A Nodemapper maps the branches in a Graphmaster structure.

Author:
Richard Wallace, Noel Bush

Method Summary
 boolean containsKey(java.lang.String key)
          Tells whether the Nodemapper contains the given key.
 java.lang.Object get(java.lang.String key)
          Gets an object from the Nodemapper.
 double getAverageSize()
          Returns a weighted average of the sizes of this Nodemapper and its children.
 int getHeight()
          Returns the height of the Nodemapper.
 Nodemapper getParent()
          Returns the parent of the Nodemapper
 java.util.Set<java.lang.String> keySet()
          Returns the key set for the Nodemapper.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Puts an object into the Nodemapper.
 void remove(java.lang.Object value)
          Removes a node from the Nodemapper.
 void setParent(Nodemapper parent)
          Sets the parent of the Nodemapper
 void setTop()
          Sets the height of this Nodemapper to "top", i.e.
 int size()
          Returns the size of the Nodemapper
 

Method Detail

put

java.lang.Object put(java.lang.String key,
                     java.lang.Object value)
Puts an object into the Nodemapper.

Parameters:
key - the key with which the object should be stored / will be retrieved
value - the object to be stored
Returns:
the same object that is stored

get

java.lang.Object get(java.lang.String key)
Gets an object from the Nodemapper.

Parameters:
key - the key to use in retrieving the object
Returns:
the object with that key (if found)

remove

void remove(java.lang.Object value)
Removes a node from the Nodemapper.

Parameters:
value - the value to remove

keySet

java.util.Set<java.lang.String> keySet()
Returns the key set for the Nodemapper.

Returns:
the Set of keys

containsKey

boolean containsKey(java.lang.String key)
Tells whether the Nodemapper contains the given key.

Parameters:
key - the key to look for
Returns:
boolean indicating whether the Nodemapper contains the key

size

int size()
Returns the size of the Nodemapper

Returns:
the size of the Nodemapper

setParent

void setParent(Nodemapper parent)
Sets the parent of the Nodemapper

Parameters:
parent - the parent of the Nodemapper

getParent

Nodemapper getParent()
Returns the parent of the Nodemapper

Returns:
the parent of the Nodemapper

getHeight

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

Returns:
the height of the Nodemapper

setTop

void setTop()
Sets the height of this Nodemapper to "top", i.e. 0 (zero), causing each ancestor n to have a minimum height of n, unless the ancestor is the root node. Not sure if this is correct.


getAverageSize

double getAverageSize()
Returns a weighted average of the sizes of this Nodemapper and its children. The average is "weighted" by giving this Nodemapper's size and the average size of its children equal weight. If this Nodemapper does not have a parent (i.e., is the root), then its size is excluded from the calculation.

Returns:
the sizes of this Nodemapper and all its children.