Class Node

  • Direct Known Subclasses:
    Declaration, Statement

    public class Node
    extends java.lang.Object
    The base class for all graph objects that are going to be persisted in the database.
    • Field Detail

      • TO_STRING_STYLE

        public static final org.apache.commons.lang3.builder.ToStringStyle TO_STRING_STYLE
      • log

        protected static final org.slf4j.Logger log
      • name

        protected @NonNull java.lang.String name
        A human readable name.
      • code

        protected @Nullable java.lang.String code
        Original code snippet of this node. Most nodes will have a corresponding "code", but in cases where nodes are created artificially, it may be null.
      • comment

        protected @Nullable java.lang.String comment
        Optional comment of this node.
      • region

        protected Region region
        Location of the finding in source code.
      • file

        protected java.lang.String file
        Name of the containing file
      • prevEOG

        protected java.util.List<Node> prevEOG
        Incoming control flow edges.
      • nextEOG

        protected @NonNull java.util.List<Node> nextEOG
        outgoing control flow edges.
      • nextCFG

        protected @NonNull java.util.List<Node> nextCFG
        outgoing control flow edges.
      • prevDFG

        protected java.util.Set<Node> prevDFG
      • nextDFG

        protected java.util.Set<Node> nextDFG
      • dummy

        protected boolean dummy
        If a node is marked as being a dummy, it means that it was created artificially and does not necessarily have a real counterpart in the actual source code
      • implicit

        protected boolean implicit
        Specifies, whether this node is implicit, i.e. is not really existing in source code but only exists implicitly. This mostly relates to implicit casts, return statements or implicit this expressions.
    • Constructor Detail

      • Node

        public Node()
    • Method Detail

      • getId

        public java.lang.Long getId()
      • getName

        public @NonNull java.lang.String getName()
      • setName

        public void setName​(@NonNull java.lang.String name)
      • getFile

        public java.lang.String getFile()
      • setFile

        public void setFile​(java.lang.String file)
      • getCode

        public @Nullable java.lang.String getCode()
      • setCode

        public void setCode​(java.lang.String code)
      • getRegion

        public Region getRegion()
      • setRegion

        public void setRegion​(Region region)
      • getPrevEOG

        public java.util.List<Node> getPrevEOG()
      • setPrevEOG

        public void setPrevEOG​(java.util.List<Node> prevEOG)
      • getNextEOG

        public @NonNull java.util.List<Node> getNextEOG()
      • setNextEOG

        public void setNextEOG​(@NonNull java.util.List<Node> nextEOG)
      • getNextCFG

        public @NonNull java.util.List<Node> getNextCFG()
      • getNextDFG

        public java.util.Set<Node> getNextDFG()
      • setNextDFG

        public void setNextDFG​(java.util.Set<Node> nextDFG)
      • addNextDFG

        public void addNextDFG​(Node next)
      • removeNextDFG

        public void removeNextDFG​(Node next)
      • getPrevDFG

        public java.util.Set<Node> getPrevDFG()
      • setPrevDFG

        public void setPrevDFG​(java.util.Set<Node> prevDFG)
      • addPrevDFG

        public void addPrevDFG​(Node prev)
      • removePrevDFG

        public void removePrevDFG​(Node prev)
      • getArgumentIndex

        public int getArgumentIndex()
      • setArgumentIndex

        public void setArgumentIndex​(int argumentIndex)
      • isDummy

        public boolean isDummy()
      • setDummy

        @Deprecated(forRemoval=true)
        public void setDummy​(boolean dummy)
        Deprecated, for removal: This API element is subject to removal in a future version.
        You should rather use setImplicit(boolean), if it is an implicit expression
      • setImplicit

        public void setImplicit​(boolean implicit)
      • isImplicit

        public boolean isImplicit()
      • disconnectFromGraph

        public void disconnectFromGraph()
        If a node should be removed from the graph, just removing it from the AST is not enough (see issue #60). It will most probably be referenced somewhere via DFG or EOG edges. Thus, if it needs to be disconnected completely, we will have to take care of correctly disconnecting these implicit edges.

        ATTENTION! Please note that this might kill an entire subgraph, if the node to disconnect has further children that have no alternative connection paths to the rest of the graph.

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setComment

        public void setComment​(@NonNull java.lang.String comment)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object