soot.jimple.toolkits.annotation.logic
Class Loop

java.lang.Object
  extended by soot.jimple.toolkits.annotation.logic.Loop

public class Loop
extends Object

A (natural) loop in Jimple. A back-edge (t,h) is a control-flog edge for which h dominates t. In this case h is the header and the loop consists of all statements s which reach t without passing through h.

Author:
Eric Bodden

Field Summary
protected  Stmt backJump
           
protected  UnitGraph g
           
protected  Stmt header
           
protected  Collection<Stmt> loopExists
           
protected  List<Stmt> loopStatements
           
 
Method Summary
 boolean equals(Object obj)
          
 Stmt getBackJumpStmt()
          Returns the statement that jumps back to the head, thereby constituing the loop.
 Stmt getHead()
           
 Collection<Stmt> getLoopExits()
          Returns all loop exists.
 List<Stmt> getLoopStatements()
           
 int hashCode()
          
 boolean hasSingleExit()
          Returns true if this loop has a single exit statement.
 boolean loopsForever()
          Returns true if this loop certainly loops forever, i.e.
 Collection<Stmt> targetsOfLoopExit(Stmt loopExit)
          Computes all targets of the given loop exit, i.e.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

header

protected final Stmt header

backJump

protected final Stmt backJump

loopStatements

protected final List<Stmt> loopStatements

g

protected final UnitGraph g

loopExists

protected Collection<Stmt> loopExists
Method Detail

getHead

public Stmt getHead()
Returns:
the loop head

getBackJumpStmt

public Stmt getBackJumpStmt()
Returns the statement that jumps back to the head, thereby constituing the loop.


getLoopStatements

public List<Stmt> getLoopStatements()
Returns:
all statements of the loop, including the header; the header will be the first element returned and then the other statements follow in the natural ordering of the loop

getLoopExits

public Collection<Stmt> getLoopExits()
Returns all loop exists. A loop exit is a statement which has a successor that is not contained in the loop.


targetsOfLoopExit

public Collection<Stmt> targetsOfLoopExit(Stmt loopExit)
Computes all targets of the given loop exit, i.e. statements that the exit jumps to but which are not part of this loop.


loopsForever

public boolean loopsForever()
Returns true if this loop certainly loops forever, i.e. if it has not exit.

See Also:
getLoopExits()

hasSingleExit

public boolean hasSingleExit()
Returns true if this loop has a single exit statement.

See Also:
getLoopExits()

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object