at.dms.kjc.iterator
Class SIRIterator

java.lang.Object
  extended by at.dms.kjc.iterator.SIRIterator
All Implemented Interfaces:
Iterator, IteratorBase
Direct Known Subclasses:
SIRFeedbackLoopIter, SIRFilterIter, SIRPhasedFilterIter, SIRPipelineIter, SIRRecursiveStubIter, SIRSplitJoinIter

public abstract class SIRIterator
extends Object
implements Iterator

Abstract class from which 'Iter's inherit.


Field Summary
protected  IterFactory factory
          Factory we should use for making children iterators.
 
Constructor Summary
protected SIRIterator(IterFactory _factory)
          Make an iterator with no parent
protected SIRIterator(IterFactory _factory, SIRIterator parent, int pos)
          Make an iterator for parent that contains this at position
 
Method Summary
abstract  void accept(StreamVisitor v)
           
protected  void checkValidity()
          Check the validity of this iterator, and print an error message with a stack trace if not valid.
 boolean equals(Object o)
          Overload equals so that iterators are equal according to the stream objects they're iterating over.
 Object getObject()
          Return the stream pointed to by this.
 SIRIterator getParent()
          Get the parent of this.
 SIRContainer[] getParents()
          Returns list of all parent streams of this.
 int getPos()
          Returns position of this in parent.
 String getRelativeName()
          Gets the name by which the parent would refer to the object pointed to by this iterator.
abstract  SIRStream getStream()
          Return the stream pointed to by this.
 int hashCode()
          Overload hashCode so that iterators hash according to the stream objects they're iterating over.
 void invalidateNode()
          Invalidates this individual node, but does not invalidate the tree above it.
 void invalidateTree()
          Invalidates the entire tree of which this iterator is a part -- that is, everyone that shares the same root as this.
 FeedbackLoopIter isFeedbackLoop()
          Checks if the iterator points to a FeedbackLoop.
 FilterIter isFilter()
          Checks if the iterator points to a Filter.
 PipelineIter isPipeline()
          Checks if the iterator points to a Pipeline.
 SplitJoinIter isSplitJoin()
          Checks if the iterator points to a SplitJoin.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected IterFactory factory
Factory we should use for making children iterators.

Constructor Detail

SIRIterator

protected SIRIterator(IterFactory _factory)
Make an iterator with no parent


SIRIterator

protected SIRIterator(IterFactory _factory,
                      SIRIterator parent,
                      int pos)
Make an iterator for parent that contains this at position

Method Detail

isFilter

public FilterIter isFilter()
Description copied from interface: Iterator
Checks if the iterator points to a Filter. If so, returns a Filter iterator that points to the same object. If not, returns null.

Specified by:
isFilter in interface Iterator
Returns:
iterator to a Filter or null if self doesn't point to a Filter

isPipeline

public PipelineIter isPipeline()
Description copied from interface: Iterator
Checks if the iterator points to a Pipeline. If so, returns a Pipeline iterator that points to the same object. If not, returns null.

Specified by:
isPipeline in interface Iterator
Returns:
iterator to a Pipeline or null if self doesn't point to a Pipeline

isSplitJoin

public SplitJoinIter isSplitJoin()
Description copied from interface: Iterator
Checks if the iterator points to a SplitJoin. If so, returns a SplitJoin iterator that points to the same object. If not, returns null.

Specified by:
isSplitJoin in interface Iterator
Returns:
iterator to a SplitJoin or null if self doesn't point to a SplitJoin

isFeedbackLoop

public FeedbackLoopIter isFeedbackLoop()
Description copied from interface: Iterator
Checks if the iterator points to a FeedbackLoop. If so, returns a FeedbackLoop iterator that points to the same object. If not, returns null.

Specified by:
isFeedbackLoop in interface Iterator
Returns:
iterator to a FeedbackLoop or null if self doesn't point to a FeedbackLoop

getParents

public SIRContainer[] getParents()
Returns list of all parent streams of this. The first element of the list is the immediate parent of this, and the last element is the final non-null ancestor of this.


getRelativeName

public String getRelativeName()
Gets the name by which the parent would refer to the object pointed to by this iterator. For instance, child_1, child_2, loop, body, etc.


getObject

public Object getObject()
Return the stream pointed to by this. (Redundant with getStream(), but required for Iterator interface.)

Specified by:
getObject in interface IteratorBase

getStream

public abstract SIRStream getStream()
Return the stream pointed to by this.


getParent

public SIRIterator getParent()
Get the parent of this.


getPos

public int getPos()
Returns position of this in parent.


invalidateNode

public void invalidateNode()
Invalidates this individual node, but does not invalidate the tree above it.


invalidateTree

public void invalidateTree()
Invalidates the entire tree of which this iterator is a part -- that is, everyone that shares the same root as this.


checkValidity

protected void checkValidity()
Check the validity of this iterator, and print an error message with a stack trace if not valid.


accept

public abstract void accept(StreamVisitor v)

hashCode

public int hashCode()
Overload hashCode so that iterators hash according to the stream objects they're iterating over. This is required for the scheduler interface.

Specified by:
hashCode in interface IteratorBase
Overrides:
hashCode in class Object
Returns:
hash code for this iterator

equals

public boolean equals(Object o)
Overload equals so that iterators are equal according to the stream objects they're iterating over. This is required for the scheduler interface.

Specified by:
equals in interface IteratorBase
Overrides:
equals in class Object
Returns:
true if this iterator is the same as the other iterator