at.dms.kjc.sir
Class SIRContainer

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

public abstract class SIRContainer
extends SIRStream

This represents a 1-to-1 stream that can contain other streams as a hierarchical unit.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class at.dms.kjc.sir.SIRStream
fields, ident, init, methods, work
 
Constructor Summary
protected SIRContainer()
           
protected SIRContainer(SIRContainer parent, String ident, JFieldDeclaration[] fields, JMethodDeclaration[] methods)
           
 
Method Summary
 void add(int index, SIRStream str)
          Adds at index with empty parameters.
 void add(int index, SIRStream str, List param)
          Adds str at index index with parameters param, and sets parent of str to this.
 void add(SIRStream str)
          Add a with empty parameters.
 void add(SIRStream str, List param)
          Adds at the end of this with parameters .
 void clear()
          Clears the child/param lists.
 boolean contains(SIROperator str)
          Whether or not is an immediate child of this.
 Object deepClone()
          Returns a deep clone of this object.
protected  void deepCloneInto(SIRContainer other)
          Clones all fields of this into
static void destroy()
           
 SIRStream get(int i)
          Returns the i'th child of this.
 List<SIROperator> getChildren()
          Returns a list of the children of this (does not return the internal representation list of this.) The children are stream objects that are contained within this.
 List getParams()
          Returns copy of list of parameters passed to children of this.
 List getParams(int i)
          Returns a list of the parameters (JExpressions) that are being passed to the i'th child of this, or null if the parameters have not been resolved yet.
 SIROperator getSuccessor(SIRStream child)
          Returns the successor of child.
abstract  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.
 int indexOf(SIRStream str)
          Returns the index of in this, or -1 if does not appear in this.
static SIRPipeline makeWrapper(SIRStream str)
          Returns a wrapper for str.
protected  ConstList myChildren()
          So subclasses can view children.
protected  ConstList myParams()
          So subclasses can view parameter list.
 void reclaimChildren()
          Resets all children of this to have this as their parent, and calls reclaimChildren on all children that are containers.
 void remove(int i)
          Removes the i'th child of this.
 void remove(SIRStream str)
          Removes from this.
abstract  void replace(SIRStream oldStr, SIRStream newStr)
          Replaces with in this.
 void set(int index, SIRStream str)
          Set child at index to
 void setParams(int index, List params)
          Set parameters for 'th child to
 int size()
          Returns number of child streams of this.
 
Methods inherited from class at.dms.kjc.sir.SIRStream
addField, addField, addFields, addFields, addMethod, addMethods, addReplacementMethod, deepCloneInto, getFields, getIdent, getInit, getInputType, getMethods, getOutputType, getPopForSchedule, getPushForSchedule, getStreamType, getStreamWithNumber, getTypeNameInC, getWork, hasMethod, insideFeedbackLoop, makeEmptyInit, makeEmptyInitWork, makeEmptyWork, needsInit, needsWork, setFields, setIdent, setInit, setInitWithoutReplacement, setMethods, setWork, toString
 
Methods inherited from class at.dms.kjc.sir.SIROperator
accept, 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

SIRContainer

protected SIRContainer()

SIRContainer

protected SIRContainer(SIRContainer parent,
                       String ident,
                       JFieldDeclaration[] fields,
                       JMethodDeclaration[] methods)
Method Detail

destroy

public static void destroy()

getChildren

public List<SIROperator> getChildren()
Returns a list of the children of this (does not return the internal representation list of this.) The children are stream objects that are contained within this. Should be over-ridden by subclasses to include splitters/joiners etc.


getParams

public List getParams()
Returns copy of list of parameters passed to children of this.

Overrides:
getParams in class SIRStream

myParams

protected ConstList myParams()
So subclasses can view parameter list.


indexOf

public int indexOf(SIRStream str)
Returns the index of in this, or -1 if does not appear in this.


clear

public void clear()
Clears the child/param lists.


myChildren

protected ConstList myChildren()
So subclasses can view children.


add

public void add(SIRStream str)
Add a with empty parameters.


add

public void add(int index,
                SIRStream str)
Adds at index with empty parameters.


add

public void add(SIRStream str,
                List param)
Adds at the end of this with parameters .


add

public void add(int index,
                SIRStream str,
                List param)
Adds str at index index with parameters param, and sets parent of str to this.


get

public SIRStream get(int i)
Returns the i'th child of this. For FeedbackLoops, can use the constant indices defined in SIRFeedbackLoop, or getBody/getLoop.


reclaimChildren

public void reclaimChildren()
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).


getSuccessor

public SIROperator getSuccessor(SIRStream child)
Returns the successor of child. If child is the last child of this, then returns the next succesor of this in the parent of this. Note that this is as fine-grained as possible - e.g., the successor of a parallel stream in a SplitJoin should be a joiner. Note on note: note is not true, getSuccessor of last filter in a pipeline in a splitjoin will get you the first element in the next pipeline in the splitjoin! Try SIRNavigationUtils.getSuccessorOper(SIRStream).


remove

public void remove(int i)
Removes the i'th child of this.


remove

public void remove(SIRStream str)
Removes from this.


set

public void set(int index,
                SIRStream str)
Set child at index to


setParams

public void setParams(int index,
                      List params)
Set parameters for 'th child to


getParams

public List getParams(int i)
Returns a list of the parameters (JExpressions) that are being passed to the i'th child of this, or null if the parameters have not been resolved yet.


size

public int size()
Returns number of child streams of this. (Will always be two for feedbackloop's).


getTapePairs

public abstract 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.


replace

public abstract void replace(SIRStream oldStr,
                             SIRStream newStr)
Replaces with in this. Requires that is an immediate child of this. (It does not do a deep-replacement.) Also, it sets the parent of to be this, but does NOT mend the calls in the init function to call the init function of newStr (if there are any SIRInitStatments remaining.)


contains

public boolean contains(SIROperator str)
Whether or not is an immediate child of this.


makeWrapper

public static SIRPipeline makeWrapper(SIRStream str)
Returns a wrapper for str. Also mutates parent of str to contain the wrapper in between itself and str.


deepClone

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

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

deepCloneInto

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