Package org.jtool.cfg

Class ControlFlow


public class ControlFlow extends GraphEdge
An edge of CFGs, which represents a control flow between CFG nodes.
  • Field Details

    • loopback

      protected CFGNode loopback
      The node that causes the loop-back when this is a loop-back edge.
    • kind

      protected ControlFlow.Kind kind
      The kind of this control flow edge.
  • Constructor Details

    • ControlFlow

      public ControlFlow(CFGNode src, CFGNode dst)
      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 edge
      dst - the destination node of this edge
  • Method Details

    • setKind

      public void setKind(ControlFlow.Kind kind)
      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

      public ControlFlow.Kind 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, otherwise false
    • 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, otherwise false
    • 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, otherwise false
    • 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, otherwise false
    • 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, otherwise false
    • getSrcNode

      public CFGNode getSrcNode()
      Returns the source node of this control flow edge.
      Overrides:
      getSrcNode in class GraphEdge
      Returns:
      the source node
    • getDstNode

      public CFGNode getDstNode()
      Returns the destination node of this control flow edge.
      Overrides:
      getDstNode in class GraphEdge
      Returns:
      the destination node
    • setLoopBack

      public void setLoopBack(CFGNode node)
      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

      public CFGNode 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, otherwise false
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class GraphElement
    • equals

      public boolean equals(ControlFlow flow)
      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()
      Overrides:
      hashCode in class GraphEdge
    • print

      public void print()
      Displays information on this control flow.
    • toString

      public String toString()
      Obtains information on this control flow.
      Overrides:
      toString in class GraphEdge
      Returns:
      the string representing the information
    • sortEdges

      public static List<ControlFlow> sortEdges(Collection<? extends ControlFlow> collection)
      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