Package com.tonic.analysis.cpg.edge
Class CPGEdge
- java.lang.Object
-
- com.tonic.analysis.cpg.edge.CPGEdge
-
public class CPGEdge extends Object
Directed, typed edge between two CPG nodes; identity is (source id, target id, type).
-
-
Constructor Summary
Constructors Constructor Description CPGEdge(CPGNode source, CPGNode target, CPGEdgeType type)Creates an edge of the given type.CPGEdge(CPGNode source, CPGNode target, CPGEdgeType type, Map<String,Object> properties)Creates an edge of the given type carrying the supplied properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StringgetLabel()Map<String,Object>getProperties()ObjectgetProperty(String key)Reads a property value.CPGNodegetSource()CPGNodegetTarget()CPGEdgeTypegetType()inthashCode()booleanhasProperty(String key)Tests whether a property is present.booleanisASTEdge()booleanisCallGraphEdge()booleanisCFGEdge()booleanisControlDependenceEdge()booleanisDataFlowEdge()booleanisInterproceduralEdge()booleanisTainted()voidsetProperty(String key, Object value)Sets a property value.voidsetTainted(boolean tainted)Marks or clears this edge as part of a taint flow.StringtoString()
-
-
-
Constructor Detail
-
CPGEdge
public CPGEdge(CPGNode source, CPGNode target, CPGEdgeType type)
Creates an edge of the given type.- Parameters:
source- the edge sourcetarget- the edge targettype- the edge type
-
CPGEdge
public CPGEdge(CPGNode source, CPGNode target, CPGEdgeType type, Map<String,Object> properties)
Creates an edge of the given type carrying the supplied properties.- Parameters:
source- the edge sourcetarget- the edge targettype- the edge typeproperties- initial edge properties, may be null
-
-
Method Detail
-
getSource
public CPGNode getSource()
- Returns:
- the source
-
getTarget
public CPGNode getTarget()
- Returns:
- the target
-
getType
public CPGEdgeType getType()
- Returns:
- the type
-
isTainted
public boolean isTainted()
- Returns:
- whether tainted
-
setTainted
public void setTainted(boolean tainted)
Marks or clears this edge as part of a taint flow.- Parameters:
tainted- whether the edge is tainted
-
getProperty
public Object getProperty(String key)
Reads a property value.- Parameters:
key- the property key- Returns:
- the value, or null if absent
-
setProperty
public void setProperty(String key, Object value)
Sets a property value.- Parameters:
key- the property keyvalue- the value to store
-
hasProperty
public boolean hasProperty(String key)
Tests whether a property is present.- Parameters:
key- the property key- Returns:
- whether the property exists
-
getLabel
public String getLabel()
- Returns:
- the edge type's short display name
-
isASTEdge
public boolean isASTEdge()
- Returns:
- whether this is an AST structure edge
-
isCFGEdge
public boolean isCFGEdge()
- Returns:
- whether this is a control-flow edge
-
isDataFlowEdge
public boolean isDataFlowEdge()
- Returns:
- whether this is a data-flow edge
-
isControlDependenceEdge
public boolean isControlDependenceEdge()
- Returns:
- whether this is a control-dependence edge
-
isCallGraphEdge
public boolean isCallGraphEdge()
- Returns:
- whether this is a call-graph edge
-
isInterproceduralEdge
public boolean isInterproceduralEdge()
- Returns:
- whether this is an interprocedural parameter or summary edge
-
-