at.dms.kjc.vanillaSlice
Class UniProcessors

java.lang.Object
  extended by at.dms.kjc.vanillaSlice.UniProcessors
All Implemented Interfaces:
ComputeNodesI<UniComputeCodeStore>

public class UniProcessors
extends Object
implements ComputeNodesI<UniComputeCodeStore>

Implementation of at.backendSupport.ComputeNodesI to provide a collection of UniProcessors. Provides mapping of int -> UniProcessor.

Author:
dimock

Constructor Summary
UniProcessors(Integer numberOfNodes)
          Construct a new collection and fill it with ComputeNodes.
 
Method Summary
 boolean canAllocateNewComputeNode()
          Assume that it is easy to add more nodes...
 UniProcessor getNthComputeNode(int n)
          Get the nth element of the collection of compute nodes.
 boolean isValidComputeNodeNumber(int nodeNumber)
          Does a number correspond to a compute node?
 int newComputeNode()
          Create a new compute node if compute nodes are dynamically creatable.
 int size()
          Return the (current) number of compute nodes.
 UniProcessor[] toArray()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniProcessors

public UniProcessors(Integer numberOfNodes)
Construct a new collection and fill it with ComputeNodes.

Parameters:
numberOfNodes -
Method Detail

canAllocateNewComputeNode

public boolean canAllocateNewComputeNode()
Assume that it is easy to add more nodes...

Specified by:
canAllocateNewComputeNode in interface ComputeNodesI<UniComputeCodeStore>
Returns:
if false, ComputeNodesI.newComputeNode() may throw any throwable.

getNthComputeNode

public UniProcessor getNthComputeNode(int n)
Description copied from interface: ComputeNodesI
Get the nth element of the collection of compute nodes.

Specified by:
getNthComputeNode in interface ComputeNodesI<UniComputeCodeStore>

isValidComputeNodeNumber

public boolean isValidComputeNodeNumber(int nodeNumber)
Description copied from interface: ComputeNodesI
Does a number correspond to a compute node?

Specified by:
isValidComputeNodeNumber in interface ComputeNodesI<UniComputeCodeStore>
Parameters:
nodeNumber - number to check
Returns:
true if a valid compute node number, false otherwise.

newComputeNode

public int newComputeNode()
Description copied from interface: ComputeNodesI
Create a new compute node if compute nodes are dynamically creatable.

Specified by:
newComputeNode in interface ComputeNodesI<UniComputeCodeStore>
Returns:
unique number for the new compute node, usable with #getComputeNode(int).

size

public int size()
Description copied from interface: ComputeNodesI
Return the (current) number of compute nodes.

Specified by:
size in interface ComputeNodesI<UniComputeCodeStore>
Returns:
size of collection of compute nodes.

toArray

public UniProcessor[] toArray()