public final class VersionUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static ru.ispras.fortress.expression.NodeVariable |
getArrayElement(ru.ispras.fortress.expression.NodeVariable array,
ru.ispras.fortress.expression.Node index)
Creates a variable that represents an array item using the specified array variable and
the index value.
|
static java.util.Map<ru.ispras.fortress.expression.NodeVariable,ru.ispras.fortress.expression.Node> |
getAssignmentMap(java.util.Collection<Assignment> assignments,
VersionRegistry versionRegistry,
boolean handleMaps)
Creates a variable-assigned value map from the specified collection of assignments.
|
static ru.ispras.fortress.expression.Node |
getValueExpr(ru.ispras.fortress.expression.Node array,
ru.ispras.fortress.expression.Node index,
int intIndex,
ru.ispras.fortress.expression.Node storedValue)
Creates the following node using the specified parameters:
(index == intIndex) ? storedValue : array[intIndex] |
static java.util.Map<ru.ispras.fortress.expression.NodeVariable,java.util.List<ru.ispras.fortress.expression.NodeVariable>> |
getVersionMap(DecStatement stmt)
Searches for variable versions in the specified
DecStatement . |
static int |
tryGetIntIndex(ru.ispras.fortress.expression.Node index)
Tries to get the integer value of the specified node.
|
static ru.ispras.fortress.expression.Node |
tryIntConversion(ru.ispras.fortress.expression.Node index)
Tries to transform the specified array index node to INTEGER data type.
|
public static java.util.Map<ru.ispras.fortress.expression.NodeVariable,java.util.List<ru.ispras.fortress.expression.NodeVariable>> getVersionMap(DecStatement stmt)
DecStatement
.stmt
- - the specified statement.public static ru.ispras.fortress.expression.NodeVariable getArrayElement(ru.ispras.fortress.expression.NodeVariable array, ru.ispras.fortress.expression.Node index)
array
- - the specified array variable.index
- - the specified index.NodeVariable
that represents an array item.public static ru.ispras.fortress.expression.Node getValueExpr(ru.ispras.fortress.expression.Node array, ru.ispras.fortress.expression.Node index, int intIndex, ru.ispras.fortress.expression.Node storedValue)
(index == intIndex) ? storedValue : array[intIndex]
array
- - the specified array variable.index
- - the specified index node.intIndex
- - the specified index int value.storedValue
- - the specified alternative value node.index
is a value, then the resulting expression can be reduced to:
if index
equals intIndex
then storedValue
is returned,
array[intIndex]
otherwise.
If index
is an expression, then the whole if-then-else node is returned.public static ru.ispras.fortress.expression.Node tryIntConversion(ru.ispras.fortress.expression.Node index)
index
- - the specified index node.public static int tryGetIntIndex(ru.ispras.fortress.expression.Node index)
index
- - the specified node.-1
otherwise.public static java.util.Map<ru.ispras.fortress.expression.NodeVariable,ru.ispras.fortress.expression.Node> getAssignmentMap(java.util.Collection<Assignment> assignments, VersionRegistry versionRegistry, boolean handleMaps)
assignments
- - the specified collection of assignments.versionRegistry
- - the specified VersionRegistry
.handleMaps
- - enables map versions handling.