dasher
Class CNodeManager

java.lang.Object
  extended by dasher.CNodeManager
Direct Known Subclasses:
CAlphabetManager

public abstract class CNodeManager
extends java.lang.Object

A NodeManager is used by the DasherModel to perform tasks which require some knowledge about the collection of Nodes besides the Model's highly general view. This includes the handling of output when the user enters or leaves a given node and extending the Model's tree of DasherNodes, either forwards or backwards, whenever necessary.


Field Summary
protected  int m_iID
          Our unique ID
 
Constructor Summary
CNodeManager(int iID)
          Creates a new NodeManager with a given ID
 
Method Summary
abstract  void ClearNode(CDasherNode Node)
          Removes all references to this node and deallocates storage if appropriate.
 void Enter(CDasherNode Node)
          Signals that the user has entered a given Node.
 int GetID()
          Gets our unique ID
abstract  CDasherNode GetRoot(CDasherNode Parent, long iLower, long iUpper, int UserData)
          Produces a new root Node belonging to this NodeManager
 void Leave(CDasherNode Node)
          Signals that the user has left a given Node.
 void Output(CDasherNode Node, java.util.ArrayList<CSymbolProb> Added, int iNormalization)
          Performs output appropriate to a given Node, if any.
abstract  void PopulateChildren(CDasherNode Node)
          Fills this Node's child list.
 CDasherNode RebuildParent(CDasherNode Node, int iGeneration)
          Rebuild's the parent of a given Node.
abstract  void Ref()
          Increment this manager's reference count.
 void Undo(CDasherNode Node)
          Reverse or undo the output associated with a given Node
abstract  void Unref()
          Decrement this manager's reference count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_iID

protected int m_iID
Our unique ID

Constructor Detail

CNodeManager

public CNodeManager(int iID)
Creates a new NodeManager with a given ID

Parameters:
iID - ID to use
Method Detail

GetID

public int GetID()
Gets our unique ID

Returns:
UID

Ref

public abstract void Ref()
Increment this manager's reference count.


Unref

public abstract void Unref()
Decrement this manager's reference count. We can safely destroy any allocated resources when this reaches zero.


GetRoot

public abstract CDasherNode GetRoot(CDasherNode Parent,
                                    long iLower,
                                    long iUpper,
                                    int UserData)
Produces a new root Node belonging to this NodeManager

Parameters:
Parent - Parent to which the new root will be a child
iLower - New node's lower probability bound with respect to its parent
iUpper - New node's upper probability bound with respect to its parent
UserData - Usage depends on the type of NodeManager
Returns:
new root CDasherNode

PopulateChildren

public abstract void PopulateChildren(CDasherNode Node)
Fills this Node's child list.

Parameters:
Node - Node to populate

ClearNode

public abstract void ClearNode(CDasherNode Node)
Removes all references to this node and deallocates storage if appropriate. Essentially we should do whatever is necessary to make this Node available for garbage collection.

Parameters:
Node - Node to free

Output

public void Output(CDasherNode Node,
                   java.util.ArrayList<CSymbolProb> Added,
                   int iNormalization)
Performs output appropriate to a given Node, if any.

This method will be called when a user enters a given Node.

This method is defined to do nothing in this class; if a subclass does not wish to take action at this point, it is safe to avoid overriding this.

Parameters:
Node - Node to output
Added - CSymbolProbs detailing what has been output should be added to this list
iNormalization - Normalisation value (total to which node probabilities always add up)

Undo

public void Undo(CDasherNode Node)
Reverse or undo the output associated with a given Node

This method is defined to do nothing in this class; if a subclass does not wish to take action at this point, it is safe to avoid overriding this.

Parameters:
Node - Node to undo

Enter

public void Enter(CDasherNode Node)
Signals that the user has entered a given Node. Output should not be performed at this stage.

This method is defined to do nothing in this class; if a subclass does not wish to take action at this point, it is safe to avoid overriding this.

Parameters:
Node -

Leave

public void Leave(CDasherNode Node)
Signals that the user has left a given Node. Output should not be performed at this stage.

This method is defined to do nothing in this class; if a subclass does not wish to take action at this point, it is safe to avoid overriding this.

Parameters:
Node - Node to be left

RebuildParent

public CDasherNode RebuildParent(CDasherNode Node,
                                 int iGeneration)
Rebuild's the parent of a given Node.

The new Node should have all of its children populated, one of which should be the supplied Node.

See CAlphabetManager for a concrete example.

Parameters:
Node - Node whose parent is to be rebuilt
iGeneration - Tree depth of the node to be created
Returns:
Parent of the input Node