dk.brics.string.intermediate
Class Statement

java.lang.Object
  extended by dk.brics.string.intermediate.Statement
All Implemented Interfaces:
Comparable<Statement>
Direct Known Subclasses:
ArrayStatement, AssertStatement, BasicBinaryOp, BasicUnaryOp, Call, Catch, ExceptionalReturn, FieldAssignment, FieldReference, Hotspot, MethodHead, Nop, ObjectAssignment, ObjectCorrupt, PrimitiveStatement, Return, StringBufferStatement, StringStatement

public abstract class Statement
extends Object
implements Comparable<Statement>

Superclass of all statements.

A statements belongs to the body of some method. It has control flow edges to and from other statements.


Constructor Summary
Statement()
           
 
Method Summary
 void addSucc(Statement s)
          Adds a control flow edge from this statement to the given.
 boolean addSuccIfAbsent(Statement s)
          Adds a control flow edge from this statement to the given, if it was not already there.
 int compareTo(Statement v)
           
 int getIndex()
          Returns the index of this statement, indicating the sequence number in which the statement was added to its method.
 Method getMethod()
          Returns the method whose body contains this statement.
 Collection<Statement> getPreds()
          Returns (unmodifiable) collection of all origins of control flow edges going to this node.
 Collection<Statement> getSuccs()
          Returns (unmodifiable) collection of all targets of control flow edges originating from this node.
 String toString()
          Returns a string representation of this statement.
abstract  void visitBy(StatementVisitor v)
          Visit this statement by the given statement visitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Statement

public Statement()
Method Detail

addSucc

public void addSucc(Statement s)
Adds a control flow edge from this statement to the given. The specified statement must not already be a successor. If the statement might already be a successor, use addSuccIfAbsent(Statement) to add it only if it is not already there.

Parameters:
s - the target statement of the edge.

addSuccIfAbsent

public boolean addSuccIfAbsent(Statement s)
Adds a control flow edge from this statement to the given, if it was not already there.

Parameters:
s - the target statement of the edge.
Returns:
true if a control flow edge was created; false if it was already there.

compareTo

public int compareTo(Statement v)
Specified by:
compareTo in interface Comparable<Statement>

getIndex

public int getIndex()
Returns the index of this statement, indicating the sequence number in which the statement was added to its method.

Returns:
the index.

getMethod

public Method getMethod()
Returns the method whose body contains this statement.

Returns:
the method.

getPreds

public Collection<Statement> getPreds()
Returns (unmodifiable) collection of all origins of control flow edges going to this node.

Returns:
a collection of Statement objects.

getSuccs

public Collection<Statement> getSuccs()
Returns (unmodifiable) collection of all targets of control flow edges originating from this node.

Returns:
a collection of Statement objects.

toString

public String toString()
Returns a string representation of this statement. This is handled by a ToStringVisitor.

Overrides:
toString in class Object
Returns:
the statement as a string.

visitBy

public abstract void visitBy(StatementVisitor v)
Visit this statement by the given statement visitor. This will invoke the corresponding method in the visitor.

Parameters:
v - the visitor.


Copyright © 2003-2009 Anders Møller, Aske Simon Christensen, Asger Feldthaus.