Class Loop
- java.lang.Object
-
- it.unive.lisa.program.cfg.controlFlow.ControlFlowStructure
-
- it.unive.lisa.program.cfg.controlFlow.Loop
-
public class Loop extends ControlFlowStructure
AControlFlowStructure
representing a loop.
-
-
Field Summary
-
Fields inherited from class it.unive.lisa.program.cfg.controlFlow.ControlFlowStructure
cfgMatrix
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<Statement>
bodyStatements()
Yields all theStatement
s contained in the body of this structure (thus excluding the condition and the first follower).boolean
contains(Statement st)
Yieldstrue
if the given statement is part of the body of this structure.boolean
equals(java.lang.Object obj)
java.util.Collection<Statement>
getBody()
Yields theStatement
s contained in the body of this loop.java.util.Collection<Statement>
getTargetedStatements()
Yields all the statements that are targeted by some node in this structure.int
hashCode()
void
simplify()
Simplifies this structure, removing allNoOp
s from its body.java.lang.String
toString()
-
Methods inherited from class it.unive.lisa.program.cfg.controlFlow.ControlFlowStructure
allStatements, distance, getCompleteStructure, getCondition, getFirstFollower, setFirstFollower
-
-
-
-
Constructor Detail
-
Loop
public Loop(NodeList<CFG,Statement,Edge> cfgMatrix, Statement condition, Statement firstFollower, java.util.Collection<Statement> body)
Builds the loop.- Parameters:
cfgMatrix
- the matrix of the cfg containing this loopcondition
- the condition of the loopfirstFollower
- the first statement after the loop exitsbody
- the statements in the loop body
-
-
Method Detail
-
bodyStatements
public java.util.Collection<Statement> bodyStatements()
Description copied from class:ControlFlowStructure
Yields all theStatement
s contained in the body of this structure (thus excluding the condition and the first follower).- Specified by:
bodyStatements
in classControlFlowStructure
- Returns:
- the statements of the body of this structure
-
getBody
public java.util.Collection<Statement> getBody()
Yields theStatement
s contained in the body of this loop.- Returns:
- the body of the loop
-
contains
public boolean contains(Statement st)
Description copied from class:ControlFlowStructure
Yieldstrue
if the given statement is part of the body of this structure. Note that this method will returnfalse
ifst
is either the condition of the first follower of this structure.- Specified by:
contains
in classControlFlowStructure
- Parameters:
st
- the statement to check- Returns:
true
ifst
is in the body of this structure
-
simplify
public void simplify()
Description copied from class:ControlFlowStructure
Simplifies this structure, removing allNoOp
s from its body.- Specified by:
simplify
in classControlFlowStructure
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classControlFlowStructure
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classControlFlowStructure
-
toString
public java.lang.String toString()
- Specified by:
toString
in classControlFlowStructure
-
getTargetedStatements
public java.util.Collection<Statement> getTargetedStatements()
Description copied from class:ControlFlowStructure
Yields all the statements that are targeted by some node in this structure. This always comprises destination nodes of conditional branches, and join points where more than one branch converge. Equivalently, these can be characterized as targets of conditional or unconditional branches and followers of conditional or unconditional branches.- Specified by:
getTargetedStatements
in classControlFlowStructure
- Returns:
- the targeted statements
-
-