Package de.fraunhofer.aisec.cpg.helpers
Class SubgraphWalker
- java.lang.Object
-
- de.fraunhofer.aisec.cpg.helpers.SubgraphWalker
-
public class SubgraphWalker extends java.lang.ObjectHelper class for graph walking: Walking through ast-, cfg-, ...- edges
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSubgraphWalker.BorderFor better readability:result.entriesinstead ofresult.get(0)when working with getEOGPathEdges.static classSubgraphWalker.IterativeGraphWalkerstatic classSubgraphWalker.ScopedWalkerHandles declaration scope monitoring for iterative traversals.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<Node>flattenAST(Node n)Flattens the tree, starting at Node n into a list.static java.util.Set<Node>getAstChildren(Node node)Calls handler function of all super-classes of the current node to get the AST children of the node.static SubgraphWalker.BordergetEOGPathEdges(Node n)Function returns two lists in a list.
-
-
-
Method Detail
-
getAstChildren
public static java.util.Set<Node> getAstChildren(Node node)
Calls handler function of all super-classes of the current node to get the AST children of the node.- Parameters:
node- - Node to get the children from the AST tree structure- Returns:
- a set of children from the nodes member variables
-
flattenAST
public static java.util.List<Node> flattenAST(Node n)
Flattens the tree, starting at Node n into a list.- Parameters:
n- the node which contains the ast children to flatten- Returns:
- the flattened nodes
-
getEOGPathEdges
public static SubgraphWalker.Border getEOGPathEdges(Node n)
Function returns two lists in a list. The first list contains all eog nodes with no predecesor in the subgraph with root 'n'. The second list contains eog edges that have no successor in the subgraph with root 'n'. The first List marks the entry and the second marks the exit nodes of the cfg in this subgraph.- Parameters:
n- - root of the subgraph.- Returns:
- Two lists, list 1 contains all eog entries and list 2 contains all exits.
-
-