Package org.jtool.cfg

Class CFGMethodCall


public class CFGMethodCall extends CFGStatement
A node that represents a method call.
  • Constructor Details

    • CFGMethodCall

      public CFGMethodCall(org.eclipse.jdt.core.dom.ASTNode node, CFGNode.Kind kind, JMethodReference jcall)
      Creates a new object that represents a method call.
      Parameters:
      node - the AST node corresponding to this node
      kind - the kind of this node
      jcall - a reference to the called method
  • Method Details

    • getMethodCall

      public JMethodReference getMethodCall()
      Returns the reference to the called method
      Returns:
      the method reference
    • hasReceiver

      public boolean hasReceiver()
      Tests if this method call has a receiver.
      Returns:
      true if this method call has a receiver, otherwise false
    • hasExplicitReceiver

      public boolean hasExplicitReceiver()
      Tests if a method call corresponding to this reference has explicitly a receiver.
      Returns:
      true a method call corresponding to this reference has a receiver, otherwise false
    • getReceiver

      public CFGReceiver getReceiver()
      Returns the receiver node on this method call.
      Returns:
      the receiver node, or null if this method call done within the same class
    • getName

      public String getName()
      Returns the name of the called method.
      Returns:
      the method name
    • getSignature

      public String getSignature()
      Returns the signature of the called method
      Returns:
      the method signature
    • getQualifiedName

      public QualifiedName getQualifiedName()
      Returns the fully-qualified name of the called method.
      Returns:
      the fully-qualified name of the method
    • getDeclaringClassName

      public String getDeclaringClassName()
      Returns the name of a class declaring the called method
      Returns:
      the class name of the called method
    • getReturnType

      public String getReturnType()
      Returns the return type of the called method.
      Returns:
      the return type
    • isPrimitiveType

      public boolean isPrimitiveType()
      Tests if the type of the called method is primitive.
      Returns:
      true if the primitive type, otherwise false
    • isVoidType

      public boolean isVoidType()
      Tests if the type of the called method is void.
      Returns:
      true if the void type, otherwise false
    • isConstructorCall

      public boolean isConstructorCall()
      Tests if this is a call to a constructor.
      Returns:
      true if this is a constructor call, otherwise false
    • getArgumentSize

      public int getArgumentSize()
      Returns the number of arguments on this method call.
      Returns:
      the number of the arguments
    • getApproximatedTypes

      public Set<org.jtool.cfg.internal.refmodel.JClass> getApproximatedTypes()
      Returns the approximated types of receiver associated to this node. These types include classes declaring method that might be dynamically called. In the case of a field access, the approximated types are not supported because no dynamic binding is performed.
      Returns:
      the collection of the approximated types
    • getApproximatedTypeNames

      public Set<String> getApproximatedTypeNames()
      Returns the approximated type names of receiver associated to this node.
      Returns:
      the collection of the approximated type names
    • getTypeParameters

      public List<String> getTypeParameters()
      Returns type parameter names.
      Returns:
      the collection of the type parameter names
    • isInProject

      public boolean isInProject()
      Tests if the called method exists inside the target project.
      Returns:
      true if this is a call to the inside method, otherwise false
    • addActualIn

      public void addActualIn(CFGParameter node)
      Adds an actual-in node on this method call. This method is not intended to be invoked by clients.
      Parameters:
      node - the actual-in node to be added
    • setActualIns

      public void setActualIns(List<CFGParameter> nodes)
      Sets actual-in nodes on this method call. This method is not intended to be invoked by clients.
      Parameters:
      nodes - the collection of actual-in nodes to be set
    • setActualOut

      public void setActualOut(CFGParameter node)
      Sets an actual-out node on this method call. This method is not intended to be invoked by clients.
      Parameters:
      node - the actual-out node to be set
    • getActualIns

      public List<CFGParameter> getActualIns()
      Returns actual-in nodes on this method call.
      Returns:
      the collection of the actual-in nodes
    • getActualOut

      public CFGParameter getActualOut()
      Returns an actual-out node on this method call.
      Returns:
      the actual-out node
    • getActualIn

      public CFGParameter getActualIn(int index)
      Returns an actual-in node of an argument specified by the index on this method call.
      Parameters:
      index - the index number of the argument to be retrieved
      Returns:
      the found actual-in node, or null if no argument is found
    • hasParameters

      public boolean hasParameters()
      Tests if this method call has any parameter.
      Returns:
      true if this method call has any parameter, otherwise false
    • setReturnValueName

      public void setReturnValueName(String returnValueName)
      Sets the name of a variable that stores the return value.
      Parameters:
      returnValueName - the variable name
    • getReturnValueName

      public String getReturnValueName()
      Returns the name of a variable that stores the return value.
      Returns:
      the variable name
    • toString

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