Package org.jtool.cfg
Class ControlFlow
java.lang.Object
org.jtool.graph.GraphElement
org.jtool.graph.GraphEdge
org.jtool.cfg.ControlFlow
An edge of CFGs, which represents a control flow between CFG nodes.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ControlFlow.Kind
The kind of this control flow edge.protected CFGNode
The node that causes the loop-back when this is a loop-back edge. -
Constructor Summary
ConstructorsConstructorDescriptionControlFlow
(CFGNode src, CFGNode dst) Creates a new object that represents a control flow edge. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
equals
(ControlFlow flow) Tests if a given control flow edge is equal to this edge.Returns the destination node of this control flow edge.getKind()
Returns the kind of this control flow.Returns the node that causes the loop-back.Returns the source node of this control flow edge.int
hashCode()
boolean
isCall()
Tests if this edge represents a call flow.boolean
Tests if this edge represents an exception flow.boolean
Tests if this edge represents a fall-through control flow.boolean
isFalse()
Tests if this edge represents a false control flow.boolean
Tests if this is a loop-back edge.boolean
isTrue()
Tests if this edge represents a true control flow.void
print()
Displays information on this control flow.void
setCall()
Sets as this edge is a method call flow.void
Sets as this edge is an exception flow.void
Sets as this edge is a fall-through control flow.void
setFalse()
Sets as this edge is a false control flow.void
setKind
(ControlFlow.Kind kind) Sets the kind of this control flow.void
setLoopBack
(CFGNode node) Sets a node that causes the loop-back.void
setTrue()
Sets as this edge is a true control flow.static List<ControlFlow>
sortEdges
(Collection<? extends ControlFlow> collection) Sorts the list of control flow edgestoString()
Obtains information on this control flow.Methods inherited from class org.jtool.graph.GraphEdge
equals, equals, getDstId, getSrcId, setDstNode, setSrcNode, sortGrapgEdge
Methods inherited from class org.jtool.graph.GraphElement
difference, equals, getIdString, intersection, subset, subsetEqual, union
-
Field Details
-
loopback
The node that causes the loop-back when this is a loop-back edge. -
kind
The kind of this control flow edge.
-
-
Constructor Details
-
ControlFlow
Creates a new object that represents a control flow edge. This method is not intended to be invoked by clients.- Parameters:
src
- the source node of this edgedst
- the destination node of this edge
-
-
Method Details
-
setKind
Sets the kind of this control flow. This method is not intended to be invoked by clients.- Parameters:
kind
- the kind of this edge
-
getKind
Returns the kind of this control flow.- Returns:
- the kind of the edge
-
setTrue
public void setTrue()Sets as this edge is a true control flow. This method is not intended to be invoked by clients. -
isTrue
public boolean isTrue()Tests if this edge represents a true control flow.- Returns:
true
if this is a true edge, otherwisefalse
-
setFalse
public void setFalse()Sets as this edge is a false control flow. This method is not intended to be invoked by clients. -
isFalse
public boolean isFalse()Tests if this edge represents a false control flow.- Returns:
true
if this is a false edge, otherwisefalse
-
setFallThrough
public void setFallThrough()Sets as this edge is a fall-through control flow. This method is not intended to be invoked by clients. -
isFallThrough
public boolean isFallThrough()Tests if this edge represents a fall-through control flow.- Returns:
true
if this is a fall-through edge, otherwisefalse
-
setCall
public void setCall()Sets as this edge is a method call flow. This method is not intended to be invoked by clients. -
isCall
public boolean isCall()Tests if this edge represents a call flow.- Returns:
true
if this is a call edge, otherwisefalse
-
setExceptionCatch
public void setExceptionCatch()Sets as this edge is an exception flow. This method is not intended to be invoked by clients. -
isExceptionCatch
public boolean isExceptionCatch()Tests if this edge represents an exception flow.- Returns:
true
if this is an exception edge, otherwisefalse
-
getSrcNode
Returns the source node of this control flow edge.- Overrides:
getSrcNode
in classGraphEdge
- Returns:
- the source node
-
getDstNode
Returns the destination node of this control flow edge.- Overrides:
getDstNode
in classGraphEdge
- Returns:
- the destination node
-
setLoopBack
Sets a node that causes the loop-back. This method is not intended to be invoked by clients.- Parameters:
node
- the node for the loop-back edge
-
getLoopBack
Returns the node that causes the loop-back.- Returns:
- the node for the loop-back edge
-
isLoopBack
public boolean isLoopBack()Tests if this is a loop-back edge.- Returns:
true
if this is a loop-back edge, otherwisefalse
-
equals
- Overrides:
equals
in classGraphElement
-
equals
Tests if a given control flow edge is equal to this edge.- Parameters:
flow
- the flow edge to be checked- Returns:
- the
true
if the given edge is equal to this edge
-
hashCode
public int hashCode() -
print
public void print()Displays information on this control flow. -
toString
Obtains information on this control flow. -
sortEdges
Sorts the list of control flow edges- Parameters:
collection
- the list of the control flow edges to be sorted- Returns:
- the sorted list of the control flow edges
-