Class NodeBinding


  • public final class NodeBinding
    extends Node
    The NodeBinding class represents set of substitutions to be considered in underlying expression subtree. List of bound variables considered immutable.
    • Constructor Detail

      • NodeBinding

        public NodeBinding​(Node expression,
                           java.util.List<NodeBinding.BoundVariable> bindings)
        Creates a node based on expression and list of bindings. List of bound variables considered immutable therefore incurring need for copying input list. List is sorted because equality comparison relies on order of bindings.
        Parameters:
        expression - Expression subtree.
        bindings - List of bound variables.
      • NodeBinding

        public NodeBinding​(Node expression,
                           NodeBinding.BoundVariable... bindings)
        Constructs a node based on an expression and a variable number of bindings. See constructor NodeBinding(Node expression, List<BoundVariable> bindings).
        Parameters:
        expression - Expression subtree.
        bindings - Bound variables.
    • Method Detail

      • getBindings

        public java.util.List<NodeBinding.BoundVariable> getBindings()
        Returns list of bound variables associated with the node.
        Returns:
        Unmodifiable list of bound variables.
      • getExpression

        public Node getExpression()
        Returns underlying expression subtree.
        Returns:
        An expression.
      • deepCopy

        public Node deepCopy()
        Description copied from class: Node
        Creates a deep copy of the current objects. All aggregated objects that are not readonly must be cloned. This excludes user data as its type is unknown.
        Specified by:
        deepCopy in class Node
        Returns:
        Full copy of the current node object.
      • bindTo

        public NodeBinding bindTo​(Node expression)
        Create binding node with same bindings for given expression. Avoids additional costs of using constructor directly.
        Parameters:
        expression - An expression subtree.
        Returns:
        A binding node object.
      • bindVariable

        public static NodeBinding.BoundVariable bindVariable​(NodeVariable variable,
                                                             Node value)
        Create bound variable using NodeVariable object and expression.
        Parameters:
        variable - An object representing bound variable.
        value - A bound value.
        Returns:
        A bound variable object.
      • getDataType

        public DataType getDataType()
        Description copied from class: Node
        Returns an object that describes the type of the value referred by the node.
        Specified by:
        getDataType in class Node
        Returns:
        A data type object.
      • toString

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

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

        public boolean equals​(java.lang.Object rhs)
        Overrides:
        equals in class java.lang.Object