Package org.jtool.cfg
Class CFGMethodCall
java.lang.Object
org.jtool.graph.GraphElement
org.jtool.graph.GraphNode
org.jtool.cfg.CFGNode
org.jtool.cfg.CFGStatement
org.jtool.cfg.CFGMethodCall
A node that represents a method call.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jtool.cfg.CFGNode
CFGNode.Kind
-
Field Summary
Fields inherited from class org.jtool.cfg.CFGStatement
defs, uses
Fields inherited from class org.jtool.graph.GraphNode
id, incomingEdges, outgoingEdges
-
Constructor Summary
ConstructorsConstructorDescriptionCFGMethodCall
(org.eclipse.jdt.core.dom.ASTNode node, CFGNode.Kind kind, JMethodReference jcall) Creates a new object that represents a method call. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addActualIn
(CFGParameter node) Adds an actual-in node on this method call.getActualIn
(int index) Returns an actual-in node of an argument specified by the index on this method call.Returns actual-in nodes on this method call.Returns an actual-out node on this method call.Returns the approximated type names of receiver associated to this node.Set<org.jtool.cfg.internal.refmodel.JClass>
Returns the approximated types of receiver associated to this node.int
Returns the number of arguments on this method call.Returns the name of a class declaring the called methodReturns the reference to the called methodgetName()
Returns the name of the called method.Returns the fully-qualified name of the called method.Returns the receiver node on this method call.Returns the return type of the called method.Returns the name of a variable that stores the return value.Returns the signature of the called methodReturns type parameter names.boolean
Tests if a method call corresponding to this reference has explicitly a receiver.boolean
Tests if this method call has any parameter.boolean
Tests if this method call has a receiver.boolean
Tests if this is a call to a constructor.boolean
Tests if the called method exists inside the target project.boolean
Tests if the type of the called method is primitive.boolean
Tests if the type of the called method isvoid
.void
setActualIns
(List<CFGParameter> nodes) Sets actual-in nodes on this method call.void
setActualOut
(CFGParameter node) Sets an actual-out node on this method call.void
setReturnValueName
(String returnValueName) Sets the name of a variable that stores the return value.toString()
Obtains information on this node.Methods inherited from class org.jtool.cfg.CFGStatement
addDefVariable, addDefVariables, addUseVariable, addUseVariables, clearDefVariables, clearUseVariables, defineVariable, findPrimaryUseVariables, findPrimaryUseVariables, getDefFirst, getDefLast, getDefVariable, getDefVariables, getUseFirst, getUseLast, getUseVariable, getUseVariables, hasDefVariable, hasUseVariable, removeDefVariable, removeUseVariable, setDefVariable, setDefVariables, setUseVariable, setUseVariables, toStringForVariables, useVariable
Methods inherited from class org.jtool.cfg.CFGNode
equals, equals, getASTNode, getIncomingFalseFlows, getIncomingFlows, getIncomingTrueFlows, getKind, getNumOfPredecessors, getNumOfSuccessors, getOutgoingFalseFlow, getOutgoingFlows, getOutgoingTrueFlow, getPDGNode, getPredecessors, getSuccessors, hashCode, isActual, isActualIn, isActualOut, isAssert, isAssignment, isBranch, isBreak, isCatchClause, isClassEntry, isConstructorEntry, isContinue, isDo, isDummy, isEnhancedFor, isEntry, isEnumConstantEntry, isEnumEntry, isExit, isExpression, isFieldDeclaration, isFieldEntry, isFinallyClause, isFor, isFormal, isFormalIn, isFormalOut, isIf, isInitializerEntry, isInterfaceEntry, isJoin, isLabel, isLiteral, isLocalDeclaration, isLoop, isMerge, isMethodCall, isMethodEntry, isNextToBranch, isParameter, isReceiver, isReturn, isSelection, isStatement, isStatement, isStatementNotParameter, isSwitch, isSwitchCase, isSwitchDefault, isSynchronized, isThrow, isThrowClause, isTry, isWhile, print, resetId, setASTNode, setKind, setPDGNode, sortNodes, sortNodesInverse
Methods inherited from class org.jtool.graph.GraphNode
addIncomingEdge, addIncomingEdges, addOutgoingEdge, addOutgoingEdges, clear, equals, equals, getDstNodes, getId, getIncomingEdges, getOutgoingEdges, getSrcNodes, removeIncomingEdge, removeOutgoingEdge, setId, sortGraphNode
Methods inherited from class org.jtool.graph.GraphElement
difference, equals, getIdString, intersection, subset, subsetEqual, union
-
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 nodekind
- the kind of this nodejcall
- a reference to the called method
-
-
Method Details
-
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, otherwisefalse
-
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, otherwisefalse
-
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
Returns the name of the called method.- Returns:
- the method name
-
getSignature
Returns the signature of the called method- Returns:
- the method signature
-
getQualifiedName
Returns the fully-qualified name of the called method.- Returns:
- the fully-qualified name of the method
-
getDeclaringClassName
Returns the name of a class declaring the called method- Returns:
- the class name of the called method
-
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, otherwisefalse
-
isVoidType
public boolean isVoidType()Tests if the type of the called method isvoid
.- Returns:
true
if thevoid
type, otherwisefalse
-
isConstructorCall
public boolean isConstructorCall()Tests if this is a call to a constructor.- Returns:
true
if this is a constructor call, otherwisefalse
-
getArgumentSize
public int getArgumentSize()Returns the number of arguments on this method call.- Returns:
- the number of the arguments
-
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
Returns the approximated type names of receiver associated to this node.- Returns:
- the collection of the approximated type names
-
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, otherwisefalse
-
addActualIn
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
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
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
Returns actual-in nodes on this method call.- Returns:
- the collection of the actual-in nodes
-
getActualOut
Returns an actual-out node on this method call.- Returns:
- the actual-out node
-
getActualIn
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, otherwisefalse
-
setReturnValueName
Sets the name of a variable that stores the return value.- Parameters:
returnValueName
- the variable name
-
getReturnValueName
Returns the name of a variable that stores the return value.- Returns:
- the variable name
-
toString
Obtains information on this node.- Overrides:
toString
in classCFGStatement
- Returns:
- the string representing the information
-