at.dms.kjc.sir
Class SIRNavigationUtils

java.lang.Object
  extended by at.dms.kjc.sir.SIRNavigationUtils

public class SIRNavigationUtils
extends Object


Constructor Summary
SIRNavigationUtils()
           
 
Method Summary
static SIROperator commonAncestor(Collection<SIROperator> ss)
          Get the common ancestor of all SIROperators in collection.
static SIROperator commonSIRAncestor(SIROperator s1, SIROperator s2)
          Get the common ancestor of s1 and s2.
static SIROperator getFirstOper(SIROperator op)
          Return the first non-container operator in the graph structure of op
static SIROperator getLastOper(SIROperator op)
          Return the final non-container operator in the graph structure of op
static Set<SIRFilter> getPredecessorFilters(SIROperator str)
          Return set of all filters immediately preceeding this operator or preceeding through some sequence of splitters and joiners.
static SIROperator getPredecessorOper(SIRStream str)
          Find a stream's predecessor operator in its parent.
static Set<SIROperator> getPredecessorOpers(SIROperator str)
          Get set of all SIROperators that are not SIRContainers immediately preceeding a SIROperator (If passed first oper in graph then returns empty set).
static Set<SIRFilter> getSuccessorFilters(SIROperator str)
          Return set of all filters immediately following this operator or following through some sequence of splitters and joiners.
static SIROperator getSuccessorOper(SIRStream str)
          Find a stream's successor operator in its parent.
static Set<SIROperator> getSuccessorOpers(SIROperator str)
          Get set of all SIROperators that are not SIRContainers immediately following a SIROperator (If passed last oper in graph then returns empty set).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SIRNavigationUtils

public SIRNavigationUtils()
Method Detail

getPredecessorOpers

public static Set<SIROperator> getPredecessorOpers(SIROperator str)
Get set of all SIROperators that are not SIRContainers immediately preceeding a SIROperator (If passed first oper in graph then returns empty set). Difference from getPredecessorOper(SIRStream) is that handles SIRSplitter and handles SIRJoiner returning set containing last operator on each incoming edge.

Parameters:
str - SIROperator that we want to find preceeding operators for.
Returns:
Set of preceeding operators.

getLastOper

public static SIROperator getLastOper(SIROperator op)
Return the final non-container operator in the graph structure of op

Parameters:
op - A SIROperator, may be a SIRContainer, not null
Returns:
The final SIROperator in the passed structure that is not a SIRContainer.

getFirstOper

public static SIROperator getFirstOper(SIROperator op)
Return the first non-container operator in the graph structure of op

Parameters:
op - A SIROperator, may be a SIRContainer, not null
Returns:
The first SIROperator in the passed structure that is not a SIRContainer.

getSuccessorOpers

public static Set<SIROperator> getSuccessorOpers(SIROperator str)
Get set of all SIROperators that are not SIRContainers immediately following a SIROperator (If passed last oper in graph then returns empty set). Difference from getSuccessorOper(SIRStream) is that handles SIRJoiner and handles SIRSplitter returning set containing first operator on each outgoing edge.

Parameters:
str - SIROperator that we want to find following operators for.
Returns:
Set of following operators.

getSuccessorFilters

public static Set<SIRFilter> getSuccessorFilters(SIROperator str)
Return set of all filters immediately following this operator or following through some sequence of splitters and joiners.

Parameters:
str - as per description
Returns:
as per description

getPredecessorFilters

public static Set<SIRFilter> getPredecessorFilters(SIROperator str)
Return set of all filters immediately preceeding this operator or preceeding through some sequence of splitters and joiners.

Parameters:
str - as per description
Returns:
as per description

getPredecessorOper

public static SIROperator getPredecessorOper(SIRStream str)
Find a stream's predecessor operator in its parent. Should return filter, splitter, joiner, or possibly recursive stub.

Parameters:
str - stream that we wish to find predecessor of.
Returns:
null if at beginning of program, else following SIROperator which is not a SIRContainer in stream graph.

getSuccessorOper

public static SIROperator getSuccessorOper(SIRStream str)
Find a stream's successor operator in its parent. Should return filter, splitter, joiner.

Parameters:
str - stream that we wish to find successor of.
Returns:
null if at end of program, else following SIROperator which is not a SIRContainer in stream graph.

commonAncestor

public static SIROperator commonAncestor(Collection<SIROperator> ss)
Get the common ancestor of all SIROperators in collection. The usual boundary cases apply: The common ancestor of an empty collection is null; The common ancestor of a singleton collection is the element; The common ancestor of a collection where two elements have no common ancestor is null.

Parameters:
ss - a collection of SIROperators (or of any subtype of SIROperator).
Returns:
the common ancestor, may be null.

commonSIRAncestor

public static SIROperator commonSIRAncestor(SIROperator s1,
                                            SIROperator s2)
Get the common ancestor of s1 and s2. Common ancestor of s and s is s. Return null if no common ancestor.

Parameters:
s1 - one SIROperator
s2 - the other SIROperator
Returns:
the common ancestor or null