Class SubgraphWalker


  • public class SubgraphWalker
    extends java.lang.Object
    Helper class for graph walking: Walking through ast-, cfg-, ...- edges
    • 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.Border getEOGPathEdges​(Node n)
      Function returns two lists in a list.
      static void visit​(Node stmt, java.util.function.Consumer<Node> visitor)
      Visit all nodes.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
      • visit

        public static void visit​(Node stmt,
                                 java.util.function.Consumer<Node> visitor)
        Visit all nodes.
        Parameters:
        stmt - the start note
        visitor - the visitor consumer to call