Class CPGNode

    • Method Detail

      • getId

        public long getId()
        Returns:
        the id
      • getNodeType

        public CPGNodeType getNodeType()
        Returns:
        the node type
      • getProperties

        public Map<String,​Object> getProperties()
        Returns:
        the properties
      • getOutgoingEdges

        public Set<CPGEdge> getOutgoingEdges()
        Returns:
        the outgoing edges
      • getIncomingEdges

        public Set<CPGEdge> getIncomingEdges()
        Returns:
        the incoming edges
      • isTainted

        public boolean isTainted()
        Returns:
        whether tainted
      • getTaintLabel

        public String getTaintLabel()
        Returns:
        the taint label
      • setTainted

        public void setTainted​(boolean tainted)
        Marks or clears this node as taint-reached.
        Parameters:
        tainted - whether the node is tainted
      • setTaintLabel

        public void setTaintLabel​(String taintLabel)
        Records which taint source reached this node.
        Parameters:
        taintLabel - the taint label
      • getLabel

        public abstract String getLabel()
        Returns:
        a short human-readable display label
      • getUnderlying

        public abstract <T> T getUnderlying()
        Type Parameters:
        T - the expected underlying type
        Returns:
        the wrapped IR or analysis object
      • 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 key
        value - 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
      • removeProperty

        public void removeProperty​(String key)
        Removes a property.
        Parameters:
        key - the property key
      • addOutgoingEdge

        public void addOutgoingEdge​(CPGEdge edge)
        Registers an edge leaving this node.
        Parameters:
        edge - the edge to add
      • addIncomingEdge

        public void addIncomingEdge​(CPGEdge edge)
        Registers an edge entering this node.
        Parameters:
        edge - the edge to add
      • removeOutgoingEdge

        public void removeOutgoingEdge​(CPGEdge edge)
        Unregisters an edge leaving this node.
        Parameters:
        edge - the edge to remove
      • removeIncomingEdge

        public void removeIncomingEdge​(CPGEdge edge)
        Unregisters an edge entering this node.
        Parameters:
        edge - the edge to remove
      • getEdges

        public Set<CPGEdge> getEdges​(CPGEdgeType type)
        Collects incident edges of one type in either direction.
        Parameters:
        type - the edge type
        Returns:
        the matching edges
      • getOutgoingEdges

        public Set<CPGEdge> getOutgoingEdges​(CPGEdgeType type)
        Collects outgoing edges of one type.
        Parameters:
        type - the edge type
        Returns:
        the matching edges
      • getIncomingEdges

        public Set<CPGEdge> getIncomingEdges​(CPGEdgeType type)
        Collects incoming edges of one type.
        Parameters:
        type - the edge type
        Returns:
        the matching edges
      • cfgSuccessors

        public List<CPGNode> cfgSuccessors()
        Follows outgoing control-flow edges.
        Returns:
        the CFG successor nodes
      • cfgPredecessors

        public List<CPGNode> cfgPredecessors()
        Follows incoming control-flow edges.
        Returns:
        the CFG predecessor nodes
      • astParent

        public Optional<CPGNode> astParent()
        Follows the incoming AST child edge to the parent.
        Returns:
        the AST parent node, if any
      • astChildren

        public List<CPGNode> astChildren()
        Follows outgoing AST child edges.
        Returns:
        the AST child nodes
      • dataDependencies

        public Set<CPGNode> dataDependencies()
        Follows incoming data-flow edges to the values this node depends on.
        Returns:
        the data dependency sources
      • controlDependencies

        public Set<CPGNode> controlDependencies()
        Follows incoming control-dependence edges to the nodes controlling this one.
        Returns:
        the control dependency sources
      • getInDegree

        public int getInDegree()
        Returns:
        the number of incoming edges
      • getOutDegree

        public int getOutDegree()
        Returns:
        the number of outgoing edges
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object