Package ru.ispras.fortress.expression
Class NodeBinding
- java.lang.Object
-
- ru.ispras.fortress.expression.Node
-
- ru.ispras.fortress.expression.NodeBinding
-
public final class NodeBinding extends Node
TheNodeBinding
class represents set of substitutions to be considered in underlying expression subtree. List of bound variables considered immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NodeBinding.BoundVariable
TheNodeBinding.BoundVariable
class represents key-value binding pair.
-
Constructor Summary
Constructors Constructor Description NodeBinding(Node expression, java.util.List<NodeBinding.BoundVariable> bindings)
Creates a node based on expression and list of bindings.NodeBinding(Node expression, NodeBinding.BoundVariable... bindings)
Constructs a node based on an expression and a variable number of bindings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeBinding
bindTo(Node expression)
Create binding node with same bindings for given expression.static NodeBinding.BoundVariable
bindVariable(NodeVariable variable, Node value)
Create bound variable using NodeVariable object and expression.Node
deepCopy()
Creates a deep copy of the current objects.boolean
equals(java.lang.Object rhs)
java.util.List<NodeBinding.BoundVariable>
getBindings()
Returns list of bound variables associated with the node.DataType
getDataType()
Returns an object that describes the type of the value referred by the node.Node
getExpression()
Returns underlying expression subtree.int
hashCode()
java.lang.String
toString()
-
Methods inherited from class ru.ispras.fortress.expression.Node
deepestCopy, getDataTypeId, getKind, getUserData, isType, isType, isType, isType, setUserData
-
-
-
-
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 constructorNodeBinding(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.
-
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 classNode
- Returns:
- A data type object.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object rhs)
- Overrides:
equals
in classjava.lang.Object
-
-