Class Loop
- java.lang.Object
-
- it.unive.lisa.program.cfg.controlFlow.ControlFlowStructure
-
- it.unive.lisa.program.cfg.controlFlow.Loop
-
public class Loop extends ControlFlowStructure
AControlFlowStructurerepresenting 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 theStatements contained in the body of this structure (thus excluding the condition and the first follower).booleancontains(Statement st)Yieldstrueif the given statement is part of the body of this structure.booleanequals(java.lang.Object obj)java.util.Collection<Statement>getBody()Yields theStatements contained in the body of this loop.inthashCode()voidsimplify()Simplifies this structure, removing allNoOps from its body.java.lang.StringtoString()-
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:ControlFlowStructureYields all theStatements contained in the body of this structure (thus excluding the condition and the first follower).- Specified by:
bodyStatementsin classControlFlowStructure- Returns:
- the statements of the body of this structure
-
getBody
public java.util.Collection<Statement> getBody()
Yields theStatements contained in the body of this loop.- Returns:
- the body of the loop
-
contains
public boolean contains(Statement st)
Description copied from class:ControlFlowStructureYieldstrueif the given statement is part of the body of this structure. Note that this method will returnfalseifstis either the condition of the first follower of this structure.- Specified by:
containsin classControlFlowStructure- Parameters:
st- the statement to check- Returns:
trueifstis in the body of this structure
-
simplify
public void simplify()
Description copied from class:ControlFlowStructureSimplifies this structure, removing allNoOps from its body.- Specified by:
simplifyin classControlFlowStructure
-
hashCode
public int hashCode()
- Overrides:
hashCodein classControlFlowStructure
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classControlFlowStructure
-
toString
public java.lang.String toString()
- Specified by:
toStringin classControlFlowStructure
-
-