Package org.jtool.pdg

Class PDGStatement


public class PDGStatement extends PDGNode
A statement node of a PDG, which stores defined and used variables.
  • Constructor Details

    • PDGStatement

      public PDGStatement(CFGStatement node)
      Creates a new object that represents a statement. This method is not intended to be invoked by clients.
      Parameters:
      node - the CFG node corresponding to this node
  • Method Details

    • getCFGStatement

      public CFGStatement getCFGStatement()
      Returns the CFG node for a statement corresponding to this node.
      Returns:
      the CFG node for the statement
    • getDefVariables

      public List<JVariableReference> getDefVariables()
      Returns variables defined in this node.
      Returns:
      the collection of the defined variables
    • getUseVariables

      public List<JVariableReference> getUseVariables()
      Returns variables used in this node.
      Returns:
      the collection of the used variables
    • getDefFirst

      public JVariableReference getDefFirst()
      Returns the first one from the collection of variables defined in this node.
      Returns:
      the defined variable at the first position, or null if this node never defines any variable
    • getUseFirst

      public JVariableReference getUseFirst()
      Returns the first one from the collection of variables used in this node.
      Returns:
      the used variable at the first position, or null if this node never uses any variable
    • definesVariable

      public boolean definesVariable(JVariableReference jv)
      Tests if this node defines a given variable.
      Parameters:
      jv - the variable to be checked
      Returns:
      true if the variable is defined in this node, otherwise false
    • usesVariable

      public boolean usesVariable(JVariableReference jv)
      Tests if this node uses a given variable.
      Parameters:
      jv - the variable to be checked
      Returns:
      true if the variable is used in this node, otherwise false
    • toString

      public String toString()
      Obtains information on this statement node.
      Overrides:
      toString in class PDGNode
      Returns:
      the string representing the information