at.dms.kjc.sir
Class SIRSplitJoin

java.lang.Object
  extended by at.dms.kjc.sir.SIROperator
      extended by at.dms.kjc.sir.SIRStream
          extended by at.dms.kjc.sir.SIRContainer
              extended by at.dms.kjc.sir.SIRSplitJoin
All Implemented Interfaces:
DeepCloneable, Finalizable, SIRCodeUnit, Serializable, Cloneable

public class SIRSplitJoin
extends SIRContainer
implements Cloneable

This represents a SplitJoin construct.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class at.dms.kjc.sir.SIRStream
fields, ident, init, methods, work
 
Constructor Summary
SIRSplitJoin()
          Construct a new SIRPipeline with null fields, parent, and methods.
SIRSplitJoin(SIRContainer parent, String ident)
          Construct a new SIRSplitJoin with empty fields and methods.
SIRSplitJoin(SIRContainer parent, String ident, JFieldDeclaration[] fields, JMethodDeclaration[] methods)
          Construct a new SIRSplitJoin with the given fields and methods.
 
Method Summary
 Object accept(AttributeStreamVisitor v)
          Accepts attribute visitor at this node.
 Object deepClone()
          Returns a deep clone of this object.
protected  void deepCloneInto(SIRSplitJoin other)
          Clones all fields of this into
 List<SIROperator> getChildren()
          Returns a list of the children of this.
 CType getInputType()
          Returns the input type of this.
 SIRJoiner getJoiner()
          gets the joinger.
 CType getOutputType()
          Returns the output type of this.
 List<SIRStream> getParallelStreams()
          Returns a list of the parallel streams in this.
 int getPopForSchedule(HashMap[] counts)
          Same as getPushForSchedule, but with pop instead of push.
 int getPushForSchedule(HashMap[] counts)
          Returns the number of items pushed out of this stream in one execution of the steady-state, given the steady-state execution counts specified by (as in SIRScheduler.) Requires that contains a firing for each *filter* that contained in the hierarchy of this (does not depend on splitters / joiners.) The intent of this method is that can be calculated once for a stream graph, then the splitjoins & pipelines of the graph can be refactored, and one can still call this to get the push count of new constructs without re-invoking the scheduler.
 int getRectangularHeight()
          If this is a rectangular splitjoin, returns the "height" of all streams in the rectangule (see getComponentHeight).
 SIRSplitter getSplitter()
          gets the splitter.
 LIRStreamType getStreamType()
          Returns the type of this stream.
 SIROperator getSuccessor(SIRStream child)
          Overrides SIRStream.getSuccessor.
 List<SIROperator[]> getTapePairs()
          Returns a list of tuples (two-element arrays) of SIROperators, representing a tape from the first element of each tuple to the second.
 boolean isRectangular()
          Returns whether or not all streams in this have the same "height" (see getComponentHeight).
 void makeRectangular()
          If this is not rectangular, then pad the shorter streams in this with Identity filters until all component streams have the same length.
 void reclaimChildren()
          Resets all children of this to have this as their parent, and calls reclaimChildren on all children that are containers.
 void replace(SIRStream oldStr, SIRStream newStr)
          See documentation in SIRContainer.
 void rescale()
           
 void setJoiner(SIRJoiner j)
          sets the joiner for this SplitJoin, and sets the parent of to be this.
 void setParallelStreams(LinkedList<Object> children)
          Sets the parallel streams in this, and resets the count on the splitters and joiners, if they depended on the number of before.
 void setSplitter(SIRSplitter s)
          sets the splitter for this SplitJoin, and sets the parent of s to be this.
 String toString()
           
 
Methods inherited from class at.dms.kjc.sir.SIRContainer
add, add, add, add, clear, contains, deepCloneInto, destroy, get, getParams, getParams, indexOf, makeWrapper, myChildren, myParams, remove, remove, set, setParams, size
 
Methods inherited from class at.dms.kjc.sir.SIRStream
addField, addField, addFields, addFields, addMethod, addMethods, addReplacementMethod, deepCloneInto, getFields, getIdent, getInit, getMethods, getStreamWithNumber, getTypeNameInC, getWork, hasMethod, insideFeedbackLoop, makeEmptyInit, makeEmptyInitWork, makeEmptyWork, needsInit, needsWork, setFields, setIdent, setInit, setInitWithoutReplacement, setMethods, setWork
 
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
 

Constructor Detail

SIRSplitJoin

public SIRSplitJoin(SIRContainer parent,
                    String ident,
                    JFieldDeclaration[] fields,
                    JMethodDeclaration[] methods)
Construct a new SIRSplitJoin with the given fields and methods.


SIRSplitJoin

public SIRSplitJoin(SIRContainer parent,
                    String ident)
Construct a new SIRSplitJoin with empty fields and methods.


SIRSplitJoin

public SIRSplitJoin()
Construct a new SIRPipeline with null fields, parent, and methods.

Method Detail

setSplitter

public void setSplitter(SIRSplitter s)
sets the splitter for this SplitJoin, and sets the parent of s to be this.


getSplitter

public SIRSplitter getSplitter()
gets the splitter.


setJoiner

public void setJoiner(SIRJoiner j)
sets the joiner for this SplitJoin, and sets the parent of to be this.


getJoiner

public SIRJoiner getJoiner()
gets the joinger.


getOutputType

public CType getOutputType()
Returns the output type of this.

Specified by:
getOutputType in class SIRStream

getInputType

public CType getInputType()
Returns the input type of this.

Specified by:
getInputType in class SIRStream

getPushForSchedule

public int getPushForSchedule(HashMap[] counts)
Description copied from class: SIRStream
Returns the number of items pushed out of this stream in one execution of the steady-state, given the steady-state execution counts specified by (as in SIRScheduler.) Requires that contains a firing for each *filter* that contained in the hierarchy of this (does not depend on splitters / joiners.) The intent of this method is that can be calculated once for a stream graph, then the splitjoins & pipelines of the graph can be refactored, and one can still call this to get the push count of new constructs without re-invoking the scheduler.

Specified by:
getPushForSchedule in class SIRStream

getPopForSchedule

public int getPopForSchedule(HashMap[] counts)
Description copied from class: SIRStream
Same as getPushForSchedule, but with pop instead of push.

Specified by:
getPopForSchedule in class SIRStream

setParallelStreams

public void setParallelStreams(LinkedList<Object> children)
Sets the parallel streams in this, and resets the count on the splitters and joiners, if they depended on the number of before. Only clears the argument list if there are a different number of streams than before.


replace

public void replace(SIRStream oldStr,
                    SIRStream newStr)
See documentation in SIRContainer.

Specified by:
replace in class SIRContainer

getStreamType

public LIRStreamType getStreamType()
Returns the type of this stream.

Specified by:
getStreamType in class SIRStream

getChildren

public List<SIROperator> getChildren()
Returns a list of the children of this. The children are stream objects that are contained within this (including the splitter and joiner. Specifically, the first element in the list is the splitter(SIRSplitter), the next elements are the child streams (SIRStream) ordered from left to right, and the final element is the joiner(SIRJoiner).

Overrides:
getChildren in class SIRContainer

reclaimChildren

public void reclaimChildren()
Description copied from class: SIRContainer
Resets all children of this to have this as their parent, and calls reclaimChildren on all children that are containers. This is needed because a stream can have exactly one parent, but sometimes a stream is shuffled around between different parents (e.g. in partitioning).

Overrides:
reclaimChildren in class SIRContainer

getParallelStreams

public List<SIRStream> getParallelStreams()
Returns a list of the parallel streams in this.


rescale

public void rescale()

isRectangular

public boolean isRectangular()
Returns whether or not all streams in this have the same "height" (see getComponentHeight).


makeRectangular

public void makeRectangular()
If this is not rectangular, then pad the shorter streams in this with Identity filters until all component streams have the same length. Put the identity filters at the end of the shorter streams (unless shorter stream is a sink, in which case put them at the beginning.)


getRectangularHeight

public int getRectangularHeight()
If this is a rectangular splitjoin, returns the "height" of all streams in the rectangule (see getComponentHeight). If this is non-rectangular, returns -1.


getTapePairs

public List<SIROperator[]> getTapePairs()
Returns a list of tuples (two-element arrays) of SIROperators, representing a tape from the first element of each tuple to the second.

Specified by:
getTapePairs in class SIRContainer

getSuccessor

public SIROperator getSuccessor(SIRStream child)
Overrides SIRStream.getSuccessor. All parallel streams should have the joiner as their successor. The splitter has the first parallel stream as its successor.

Overrides:
getSuccessor in class SIRContainer

accept

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

Specified by:
accept in class SIROperator

toString

public String toString()
Overrides:
toString in class SIRStream

deepClone

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

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

deepCloneInto

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