at.dms.kjc.cluster
Class NodeEnumerator

java.lang.Object
  extended by at.dms.kjc.cluster.NodeEnumerator

public class NodeEnumerator
extends Object

Create a mapping from SIROperators and FlatNodes to unique numbers [0..n] used for thread ids. Also provides the service of getting an estimate of the stack size needed to execute a given node.

Author:
Janis

Constructor Summary
NodeEnumerator()
           
 
Method Summary
static FlatNode getFlatNode(int nodeID)
          Get the FlatNode associated with a number.
static int getFlatNodeId(FlatNode f)
          Get the id number assigned to a FlatNode
static int getIdOffset(int nodeID, FlatNode[] arr)
          Get offset of node in array or -1 if not there.
static int getNumberOfNodes()
           
static SIROperator getOperator(int nodeID)
          Used to get the SIROperator (filter, splitter, joiner) associated with an id number.
static int getSIROperatorId(SIROperator f)
          Get the id number assigned to SIROperator (filter, splitter, or joiner)
static int getStackSize(int nodeID)
          Returns an estimate of the maximum stack size needed to execute a given node.
static void init(FlatNode top)
          Set up static data structures for NodeEnumerator
static void reset()
          NodeEnumerator uses static data structures that need to be cleaned out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeEnumerator

public NodeEnumerator()
Method Detail

reset

public static void reset()
NodeEnumerator uses static data structures that need to be cleaned out.


init

public static void init(FlatNode top)
Set up static data structures for NodeEnumerator

Parameters:
first - node in a flatgraph

getNumberOfNodes

public static int getNumberOfNodes()
Returns:
number of nodes for which ids were created.

getStackSize

public static int getStackSize(int nodeID)
Returns an estimate of the maximum stack size needed to execute a given node.

Parameters:
nodeID - ID of node in question
Returns:
Estimated number of bytes needed for stack

getOperator

public static SIROperator getOperator(int nodeID)
Used to get the SIROperator (filter, splitter, joiner) associated with an id number.

Parameters:
nodeID - (thread id)
Returns:
SIROperator associated with the id, or null if no association.

getFlatNode

public static FlatNode getFlatNode(int nodeID)
Get the FlatNode associated with a number.

Parameters:
nodeID - number.
Returns:
associated FlatNode, or null if no association.

getSIROperatorId

public static int getSIROperatorId(SIROperator f)
Get the id number assigned to SIROperator (filter, splitter, or joiner)

Parameters:
f -
Returns:
number associated with f, or -1 if f has no association

getFlatNodeId

public static int getFlatNodeId(FlatNode f)
Get the id number assigned to a FlatNode

Parameters:
f -
Returns:
number associated with f, or -1 if f has no association

getIdOffset

public static int getIdOffset(int nodeID,
                              FlatNode[] arr)
Get offset of node in array or -1 if not there.