at.dms.kjc.sir
Class SIRSplitter

java.lang.Object
  extended by at.dms.kjc.sir.SIROperator
      extended by at.dms.kjc.sir.SIRSplitter
All Implemented Interfaces:
DeepCloneable, Finalizable, Serializable

public class SIRSplitter
extends SIROperator

This represents a stream construct with a single input and multiple outputs.

See Also:
Serialized Form

Field Summary
static JMethodDeclaration WORK_FUNCTION
          This is a dummy work function that is used to represent the work of a splitter to the scheduling package.
 
Method Summary
 Object accept(AttributeStreamVisitor v)
          Accepts attribute visitor at this node.
static SIRSplitter create(SIRContainer parent, SIRSplitType type, int n)
          Constructs a splitter with given parent, type and n number of inputs.
static SIRSplitter create(SIRContainer parent, SIRSplitType type, JExpression[] weights)
           
static SIRSplitter createUniformRR(SIRContainer parent, JExpression weight)
          This is for creating a round robin with uniform weights across the stream.
static SIRSplitter createWeightedRR(SIRContainer parent, JExpression[] weights)
          Constructs a weighted round-robin splitter with the given parent and weights.
 Object deepClone()
          Returns a deep clone of this object.
protected  void deepCloneInto(SIRSplitter other)
          Clones all fields of this into
 boolean equals(SIRSplitter obj)
          Tests whether or not this has the same type and the same weights as obj.
 String getIdent()
          See doc in SIROperator.
 JExpression[] getInternalWeights()
          Returns JExpression weights of this.
 int getSumOfWeights()
          Returns the sum of all weights in this.
 SIRSplitType getType()
          Return type of this.
 int getWays()
          Return the number of outputs of this.
 int getWeight(int i)
          Return int weight at position i.
 JExpression getWeightNoChecking(int i)
           
 int[] getWeights()
          Return int weights array of this.
 boolean isUnaryRoundRobin()
          Returns whether this is a round-robin with all weights equal to 1.
 void rescale(int extent)
          If this is a splitter that has equal weight per way, then rescale the weights to be of the given
 String toString()
           
 
Methods inherited from class at.dms.kjc.sir.SIROperator
assertMutable, deepCloneInto, getAncestors, getName, getNumber, getParent, getParents, getParentStructureAccess, getRelativeName, getShortIdent, hashCode, readResolve, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

WORK_FUNCTION

public static final JMethodDeclaration WORK_FUNCTION
This is a dummy work function that is used to represent the work of a splitter to the scheduling package. In the future this could be replaced with a custom, instance-wise work function.

Method Detail

create

public static SIRSplitter create(SIRContainer parent,
                                 SIRSplitType type,
                                 JExpression[] weights)

create

public static SIRSplitter create(SIRContainer parent,
                                 SIRSplitType type,
                                 int n)
Constructs a splitter with given parent, type and n number of inputs.


createWeightedRR

public static SIRSplitter createWeightedRR(SIRContainer parent,
                                           JExpression[] weights)
Constructs a weighted round-robin splitter with the given parent and weights.


createUniformRR

public static SIRSplitter createUniformRR(SIRContainer parent,
                                          JExpression weight)
This is for creating a round robin with uniform weights across the stream.


isUnaryRoundRobin

public boolean isUnaryRoundRobin()
Returns whether this is a round-robin with all weights equal to 1.


equals

public boolean equals(SIRSplitter obj)
Tests whether or not this has the same type and the same weights as obj. This can return true for splitters with different numbers of outputs if the type is not a weighted round robin.


rescale

public void rescale(int extent)
If this is a splitter that has equal weight per way, then rescale the weights to be of the given


accept

public Object accept(AttributeStreamVisitor v)
Accepts attribute visitor at this node.

Specified by:
accept in class SIROperator

getType

public SIRSplitType getType()
Return type of this.


getWays

public int getWays()
Return the number of outputs of this.


getIdent

public String getIdent()
See doc in SIROperator.

Specified by:
getIdent in class SIROperator

toString

public String toString()
Overrides:
toString in class Object

getInternalWeights

public JExpression[] getInternalWeights()
Returns JExpression weights of this.


getSumOfWeights

public int getSumOfWeights()
Returns the sum of all weights in this.


getWeights

public int[] getWeights()
Return int weights array of this.


getWeight

public int getWeight(int i)
Return int weight at position i.


getWeightNoChecking

public JExpression getWeightNoChecking(int i)

deepClone

public Object deepClone()
Returns a deep clone of this object.

Specified by:
deepClone in interface DeepCloneable
Overrides:
deepClone in class SIROperator

deepCloneInto

protected void deepCloneInto(SIRSplitter other)
Clones all fields of this into
other