public final class NodeUtils
extends java.lang.Object
Node
objects.Node
Modifier and Type | Method and Description |
---|---|
static ru.ispras.fortress.expression.Node |
getValue(int value,
ru.ispras.fortress.data.DataType type)
Returns object of the specified type that contains the specified value.
|
static java.util.Collection<java.lang.String> |
getVariableNames(java.util.Collection<? extends ru.ispras.fortress.expression.Node> nodes)
Returns a collection of names for variables from the specified collection.
|
static ru.ispras.fortress.expression.Node |
greater(ru.ispras.fortress.expression.Node first,
ru.ispras.fortress.expression.Node second)
Returns a "greater-or-equal" operation for the specified operands of the same type.
|
static boolean |
oneConstAnotherNot(ru.ispras.fortress.expression.Node oneNode,
ru.ispras.fortress.expression.Node anotherNode)
Checks that one node is a constant, but another is not for the two specified.
|
static org.apache.commons.lang3.tuple.Pair<ru.ispras.fortress.expression.Node,ru.ispras.fortress.expression.Node> |
splitByVar(ru.ispras.fortress.expression.Node node,
java.util.Collection<ru.ispras.fortress.expression.NodeVariable> variables)
Splits the specified node into two parts - one that depends exactly from the specified
variables and another that does not depend.
|
static ru.ispras.fortress.expression.Node |
substituteAllBindings(ru.ispras.fortress.expression.Node node,
java.util.List<ru.ispras.fortress.expression.NodeBinding.BoundVariable> boundVariables)
Substitutes variables that are used in the node by the specified bound variables.
|
public static ru.ispras.fortress.expression.Node getValue(int value, ru.ispras.fortress.data.DataType type)
value
- The value of the object.type
- The type of the object.public static java.util.Collection<java.lang.String> getVariableNames(java.util.Collection<? extends ru.ispras.fortress.expression.Node> nodes)
nodes
- Collection of nodes.java.lang.IllegalArgumentException
- when argument is null
.public static org.apache.commons.lang3.tuple.Pair<ru.ispras.fortress.expression.Node,ru.ispras.fortress.expression.Node> splitByVar(ru.ispras.fortress.expression.Node node, java.util.Collection<ru.ispras.fortress.expression.NodeVariable> variables)
node
- Node to be split.variables
- Variables dependence to which is a splitting criterion.public static ru.ispras.fortress.expression.Node substituteAllBindings(ru.ispras.fortress.expression.Node node, java.util.List<ru.ispras.fortress.expression.NodeBinding.BoundVariable> boundVariables)
node
- The node to be performed.boundVariables
- The substitutions.public static ru.ispras.fortress.expression.Node greater(ru.ispras.fortress.expression.Node first, ru.ispras.fortress.expression.Node second)
first
- The operand that is supposed to be greater or equalsecond
- The operand that is supposed to be lessfalse
otherwise.public static boolean oneConstAnotherNot(ru.ispras.fortress.expression.Node oneNode, ru.ispras.fortress.expression.Node anotherNode)
oneNode
- The first node.anotherNode
- The second node.true
if in the specified pair of nodes the one is a constant and another is
not, false
otherwise.