at.dms.kjc.slicegraph
Class OutputSliceNode

java.lang.Object
  extended by at.dms.kjc.slicegraph.SliceNode
      extended by at.dms.kjc.slicegraph.OutputSliceNode

public class OutputSliceNode
extends SliceNode

Each slice is terminated by an OutputSliceNode that has single input (the last filter) and multiple outputs (to downstream slices through edges).

Author:
mgordon

Constructor Summary
OutputSliceNode()
          Construct a nre output slice node.
OutputSliceNode(int[] weights)
          Construct a new output slice node based on the array weights.
OutputSliceNode(int[] weights, InterSliceEdge[][] dests)
          Construct a new output slice node based on the arrays weights and dests.
OutputSliceNode(LinkedList<Integer> weights, LinkedList<LinkedList<InterSliceEdge>> dests)
          Construct a new output slice node based on the lists weights and dests.
 
Method Summary
 void canonicalize()
          Combine the weights of adajacent outputs that have equal destinations.
 String debugString(boolean escape)
           
 Set<InputSliceNode> fileOutputs()
           
 InterSliceEdge[] getDestList()
          Return a list of the dests in round-robin order flattening the duplicates.
 InterSliceEdge[][] getDests()
           
 LinkedList<InterSliceEdge> getDestSequence()
          Return a list of the edges with each edge appearing once and ordered by the order in which each edge appears in the split pattern.
 Set<InterSliceEdge> getDestSet()
          Return the set of the outgoing edges of this OutputSliceNode.
 String getIdent()
           
 FilterSliceNode getPrevFilter()
           
 InterSliceEdge getSingleEdge()
           
 List<InterSliceEdge> getSortedOutputs()
          return an iterator that iterates over the inputslicenodes in descending order of the number of items sent to the inputslicenode
 CType getType()
          type is output type of previous filter
 int getWeight(InterSliceEdge in)
          return the number of items sent by this output slice node on all instances of a particular edge.
 int[] getWeights()
           
 int getWidth()
          Return the width of this splitter meaning the number of connections it has to downstream slices, including all the edges of a duplicated item, counting each unique edge once.
 boolean hasFileOutput()
           
 boolean isDuplicateSplitter()
           
 boolean isFileInput()
           
 boolean isRRSplitter()
           
 boolean isSplitter()
           
 boolean noOutputs()
           
 boolean oneOutput()
           
 double ratio(InterSliceEdge edge)
           
 void set(LinkedList<Integer> weights, LinkedList<LinkedList<InterSliceEdge>> dests)
          Set the weights and dests of this input slice node to weights and dests.
 void setDests(InterSliceEdge[][] dests)
          Set dests
 void setWeights(int[] newW)
          Set the weights
 int totalWeights()
           
 
Methods inherited from class at.dms.kjc.slicegraph.SliceNode
getAsFilter, getAsInput, getAsOutput, getEdgeToNext, getNext, getParent, getPrevious, isFilterSlice, isInputSlice, isOutputSlice, setNext, setParent, setPrevious
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputSliceNode

public OutputSliceNode(int[] weights,
                       InterSliceEdge[][] dests)
Construct a new output slice node based on the arrays weights and dests.

Parameters:
weights - The array of weights
dests - The array of dests.

OutputSliceNode

public OutputSliceNode(LinkedList<Integer> weights,
                       LinkedList<LinkedList<InterSliceEdge>> dests)
Construct a new output slice node based on the lists weights and dests.

Parameters:
weights - The list of weights
dests - The list of dests.

OutputSliceNode

public OutputSliceNode(int[] weights)
Construct a new output slice node based on the array weights. Dests is to be set later.

Parameters:
weights - The array of weights

OutputSliceNode

public OutputSliceNode()
Construct a nre output slice node. Weights and dests to be st later.

Method Detail

setWeights

public void setWeights(int[] newW)
Set the weights


set

public void set(LinkedList<Integer> weights,
                LinkedList<LinkedList<InterSliceEdge>> dests)
Set the weights and dests of this input slice node to weights and dests.

Parameters:
weights - List of integer weights.
dests - List of Lists of Edge for splitting pattern.

getWeights

public int[] getWeights()
Returns:
the weights

isFileInput

public boolean isFileInput()
Returns:
whether previous filter was FileInput

getDests

public InterSliceEdge[][] getDests()
Returns:
dests

setDests

public void setDests(InterSliceEdge[][] dests)
Set dests


getIdent

public String getIdent()
Returns:
unique string

totalWeights

public int totalWeights()
Returns:
total of weights

canonicalize

public void canonicalize()
Combine the weights of adajacent outputs that have equal destinations. This operation exists as a cleanup operation for synch removal. Code generation for Edges may rely on InputSliceNode.canonicalize() being run on all input nodes whose edges are combined by canonicalize.


getWidth

public int getWidth()
Return the width of this splitter meaning the number of connections it has to downstream slices, including all the edges of a duplicated item, counting each unique edge once.

Returns:
The width of this splitter.

getDestSequence

public LinkedList<InterSliceEdge> getDestSequence()
Return a list of the edges with each edge appearing once and ordered by the order in which each edge appears in the split pattern.

Returns:
The list.

getWeight

public int getWeight(InterSliceEdge in)
return the number of items sent by this output slice node on all instances of a particular edge.


getType

public CType getType()
type is output type of previous filter


getDestList

public InterSliceEdge[] getDestList()
Return a list of the dests in round-robin order flattening the duplicates.

Returns:
A list of the dests in round-robin order flattening the duplicates.

getDestSet

public Set<InterSliceEdge> getDestSet()
Return the set of the outgoing edges of this OutputSliceNode.

Returns:
The set of the outgoing edges of this OutputSliceNode.

oneOutput

public boolean oneOutput()

getSingleEdge

public InterSliceEdge getSingleEdge()

noOutputs

public boolean noOutputs()

isDuplicateSplitter

public boolean isDuplicateSplitter()

isRRSplitter

public boolean isRRSplitter()

isSplitter

public boolean isSplitter()

getSortedOutputs

public List<InterSliceEdge> getSortedOutputs()
return an iterator that iterates over the inputslicenodes in descending order of the number of items sent to the inputslicenode


getPrevFilter

public FilterSliceNode getPrevFilter()

ratio

public double ratio(InterSliceEdge edge)

debugString

public String debugString(boolean escape)

hasFileOutput

public boolean hasFileOutput()

fileOutputs

public Set<InputSliceNode> fileOutputs()