Class Node

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected @Nullable Block block
      The basic block this node belongs to.
      protected boolean inSource
      Does this node represent a tree that appears in the source code (true) or one that the CFG builder added while desugaring (false).
      protected boolean lvalue
      Is this node an l-value?
      protected javax.lang.model.type.TypeMirror type
      The type of this node.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Node​(javax.lang.model.type.TypeMirror type)
      Creates a new Node.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract <R,​P>
      R
      accept​(NodeVisitor<R,​P> visitor, P p)
      Accept method of the visitor pattern.
      @Nullable Block getBlock()
      Returns the basic block this node belongs to (or null if it represents the parameter of a method).
      boolean getInSource()
      Return whether this node represents a tree that appears in the source code (true) or one that the CFG or builder added while desugaring (false).
      abstract java.util.Collection<Node> getOperands()
      Returns a collection containing all of the operand Nodes of this Node.
      java.util.Collection<Node> getTransitiveOperands()
      Returns a collection containing all of the operand Nodes of this Node, as well as (transitively) the operands of its operands.
      abstract @Nullable com.sun.source.tree.Tree getTree()
      Returns the Tree in the abstract syntax tree, or null if no corresponding tree exists.
      javax.lang.model.type.TypeMirror getType()
      Returns a TypeMirror representing the type of a Node.
      long getUid()  
      boolean isLValue()
      Is the node an lvalue or not?
      static java.lang.String nodeCollectionToString​(java.util.Collection<? extends Node> nodes)
      Returns a verbose string representation of a collection of nodes, useful for debugging..
      void setBlock​(Block b)
      Set the basic block this node belongs to.
      void setInSource​(boolean inSrc)  
      void setLValue()
      Make this node an l-value.
      java.lang.String toStringDebug()
      Returns a verbose string representation of this, useful for debugging.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.plumelib.util.UniqueId

        getClassAndUid
    • Field Detail

      • lvalue

        protected boolean lvalue
        Is this node an l-value?

        Is set by setLValue().

      • inSource

        protected boolean inSource
        Does this node represent a tree that appears in the source code (true) or one that the CFG builder added while desugaring (false).

        Is set by setInSource(boolean).

      • type

        protected final javax.lang.model.type.TypeMirror type
        The type of this node. For Nodes with Trees, this type is the type of the Tree. Otherwise, it is the type is set by the CFGBuilder.
    • Constructor Detail

      • Node

        protected Node​(javax.lang.model.type.TypeMirror type)
        Creates a new Node.
        Parameters:
        type - the type of the node
    • Method Detail

      • getUid

        @Pure
        public long getUid​(@UnknownInitialization Node this)
        Specified by:
        getUid in interface org.plumelib.util.UniqueId
      • getBlock

        @Pure
        public @Nullable Block getBlock()
        Returns the basic block this node belongs to (or null if it represents the parameter of a method).
        Returns:
        the basic block this node belongs to (or null if it represents the parameter of a method)
      • setBlock

        public void setBlock​(Block b)
        Set the basic block this node belongs to.
      • getTree

        @Pure
        public abstract @Nullable com.sun.source.tree.Tree getTree()
        Returns the Tree in the abstract syntax tree, or null if no corresponding tree exists. For instance, this is the case for an ImplicitThisNode.
        Returns:
        the corresponding Tree or null
      • getType

        @Pure
        public javax.lang.model.type.TypeMirror getType()
        Returns a TypeMirror representing the type of a Node. A Node will always have a type even when it has no Tree.
        Returns:
        a TypeMirror representing the type of this Node
      • accept

        public abstract <R,​P> R accept​(NodeVisitor<R,​P> visitor,
                                             P p)
        Accept method of the visitor pattern.
        Type Parameters:
        R - result type of the operation
        P - parameter type
        Parameters:
        visitor - the visitor to be applied to this node
        p - the parameter for this operation
      • isLValue

        @Pure
        public boolean isLValue()
        Is the node an lvalue or not?
      • setLValue

        public void setLValue()
        Make this node an l-value.
      • getInSource

        @Pure
        public boolean getInSource()
        Return whether this node represents a tree that appears in the source code (true) or one that the CFG or builder added while desugaring (false).
        Returns:
        whether this node represents a tree that appears in the source code
      • setInSource

        public void setInSource​(boolean inSrc)
      • getOperands

        @SideEffectFree
        public abstract java.util.Collection<Node> getOperands()
        Returns a collection containing all of the operand Nodes of this Node.
        Returns:
        a collection containing all of the operand Nodes of this Node
      • getTransitiveOperands

        @Pure
        public java.util.Collection<Node> getTransitiveOperands()
        Returns a collection containing all of the operand Nodes of this Node, as well as (transitively) the operands of its operands.
        Returns:
        a collection containing all of the operand Nodes of this Node, as well as (transitively) the operands of its operands
      • toStringDebug

        @Pure
        public java.lang.String toStringDebug()
        Returns a verbose string representation of this, useful for debugging.
        Returns:
        a printed representation of this
      • nodeCollectionToString

        @Pure
        public static java.lang.String nodeCollectionToString​(java.util.Collection<? extends Node> nodes)
        Returns a verbose string representation of a collection of nodes, useful for debugging..
        Parameters:
        nodes - a collection of nodes to format
        Returns:
        a printed representation of the given collection