joeq.Compiler.Quad
Class QuadIterator

java.lang.Object
  extended by joeq.Compiler.Quad.QuadIterator
All Implemented Interfaces:
java.util.Iterator<Quad>, java.util.ListIterator<Quad>

public class QuadIterator
extends java.lang.Object
implements java.util.ListIterator<Quad>

Version:
$Id: QuadIterator.java,v 1.14 2004/09/22 22:17:27 joewhaley Exp $
Author:
John Whaley

Constructor Summary
QuadIterator(ControlFlowGraph cfg)
          Initialize the iterator to iterate over the quads in the given control flow graph in reverse post order.
QuadIterator(ControlFlowGraph cfg, boolean direction)
          Initialize the iterator to iterate over the quads in the given control flow graph.
 
Method Summary
 void add(Quad obj)
          Adds a quad to the underlying quad list.
 BasicBlock getCurrentBasicBlock()
           
 Quad getCurrentQuad()
           
 jwutil.graphs.Navigator getNavigator()
           
 boolean hasNext()
          Returns whether there is a next quad in this iteration.
 boolean hasPrevious()
          Returns whether this iteration has a previous quad.
 Quad next()
          Return the next quad in the iteration.
 int nextIndex()
          Returns the index of the next quad to be returned.
 java.util.Iterator<Quad> predecessors()
           
 java.util.Collection<Quad> predecessors1()
           
 Quad previous()
          Returns the previous quad in the iteration.
 int previousIndex()
          Returns the index of the previous quad.
 void remove()
          Removes the last-returned-quad from the underlying list.
 boolean searchBackward(java.lang.Object node)
           
 boolean searchForward(java.lang.Object node)
           
 void set(Quad obj)
          Sets the current quad.
 java.util.Iterator<Quad> successors()
          Return an iterator of the possible successor quads of the most recently returned quad.
 java.util.Collection<Quad> successors1()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuadIterator

public QuadIterator(ControlFlowGraph cfg)
Initialize the iterator to iterate over the quads in the given control flow graph in reverse post order.

Parameters:
cfg - the control flow graph

QuadIterator

public QuadIterator(ControlFlowGraph cfg,
                    boolean direction)
Initialize the iterator to iterate over the quads in the given control flow graph. If direction is true, the order is reverse post order and the iteration starts at the first quad. If direction is false, the order is post order on the reverse graph and the iteration starts at the last quad.

Parameters:
direction - the direction to iterate, forward==true
cfg - the control flow graph
Method Detail

getCurrentBasicBlock

public BasicBlock getCurrentBasicBlock()

getCurrentQuad

public Quad getCurrentQuad()

next

public Quad next()
Return the next quad in the iteration.

Specified by:
next in interface java.util.Iterator<Quad>
Specified by:
next in interface java.util.ListIterator<Quad>

hasNext

public boolean hasNext()
Returns whether there is a next quad in this iteration.

Specified by:
hasNext in interface java.util.Iterator<Quad>
Specified by:
hasNext in interface java.util.ListIterator<Quad>

set

public void set(Quad obj)
Sets the current quad.

Specified by:
set in interface java.util.ListIterator<Quad>

nextIndex

public int nextIndex()
Returns the index of the next quad to be returned.

Specified by:
nextIndex in interface java.util.ListIterator<Quad>

previous

public Quad previous()
Returns the previous quad in the iteration.

Specified by:
previous in interface java.util.ListIterator<Quad>

remove

public void remove()
Removes the last-returned-quad from the underlying list.

Specified by:
remove in interface java.util.Iterator<Quad>
Specified by:
remove in interface java.util.ListIterator<Quad>

previousIndex

public int previousIndex()
Returns the index of the previous quad.

Specified by:
previousIndex in interface java.util.ListIterator<Quad>

hasPrevious

public boolean hasPrevious()
Returns whether this iteration has a previous quad.

Specified by:
hasPrevious in interface java.util.ListIterator<Quad>

add

public void add(Quad obj)
Adds a quad to the underlying quad list.

Specified by:
add in interface java.util.ListIterator<Quad>

successors

public java.util.Iterator<Quad> successors()
Return an iterator of the possible successor quads of the most recently returned quad. If a possible successor is the method exit, it includes the "null" value in the iteration.

Throws:
java.lang.IllegalStateException - if the nextQuad method has not yet been called.

successors1

public java.util.Collection<Quad> successors1()

predecessors

public java.util.Iterator<Quad> predecessors()

predecessors1

public java.util.Collection<Quad> predecessors1()

getNavigator

public jwutil.graphs.Navigator getNavigator()

searchForward

public boolean searchForward(java.lang.Object node)

searchBackward

public boolean searchBackward(java.lang.Object node)