Class Texpr0Node
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
Texpr0BinNode,Texpr0CstNode,Texpr0DimNode,Texpr0UnNode
A Texpr0Node represents an expression tree, which can be
constructed and inspected in Java.
Each node is actually a binary operator (Texpr0BinNode),
a unary operator (Texpr0UnNode), a variable represented
by dimension (Texpr0DimNode), or a constant
(Texpr0CstNode).
An expression tree must be converted to and from a
Texpr0Intern to be used in abstract domain transfer
functions.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intRounds towards -oo.static final intRounds to nearest.static final intNon-deterministic rounding (all four modes considered).static final intRounds towards +oo.static final intRounds towards 0 (truncation).static final intDouble-precision rounding: 64-bit IEEE 754 (double).static final intExtended-precision rounding: 80-bit (Intel's long double).static final intInteger rounding.static final intQuad-precision rounding: 128-bit (Motorola's long double).static final intReal (no rounding).static final intSingle-precision rounding: 32-bit IEEE 754 (float). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNo constructor: use constructors from a sub-class. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidAdds some dimensions and shifts coefficients accordingly .Returns a copy of this with some dimensions added.clone()Returns a deep copy of this.abstract Texpr0NodedeepCopy()Deep copy.abstract booleanWhether x is a Texpr0 tree and structurally equal to this.protected abstract voidfillDims(boolean[] ar) Used internally by getDims.static Texpr0NodeConstructs an expression tree from a linear expression.abstract intgetDepth()Returns the depth of the expression tree.int[]getDims()Returns an ordered list of all occurring dimensions.abstract intPrecedence of the node, used when printing.abstract intgetSize()Returns the number of internal nodes in the tree.abstract booleanhasDim(int dim) Whether the dimension dim is present.abstract inthashCode()Recursive hashing.abstract booleanStructural (recursive) equality.abstract booleanWhether the expression is constant.abstract booleanWhether the expression is linear with interval or scalar coefficients, and there is no rounding.abstract booleanWhether the expression is a polynomial fraction, with interval or scalar coefficients, and there is no rounding.abstract booleanWhether the expression is polynomial, with interval or scalar coefficients, and there is no rounding.abstract booleanisScalar()Whether all coefficients are scalar (non interval).abstract intmaxDim()Maximum occurring dimension + 1.abstract voidPermutes some dimensions in the expression.Returns a copy of this with some dimensions permuted.abstract Texpr0NodeRemoves some dimensions and shifts coefficients accordinglyReturns a copy of this with some dimensions removed.abstract Texpr0NodeShallow copy.abstract Texpr0Nodesubstitute(int dim, Texpr0Node t) Substitutes all occurrences of the dimension dim with the expression tree t.substituteCopy(int dim, Texpr0Node t) Returns a copy of this where all occurrences of the dimension dim are substituted with the expression tree t.static StringsuffixRDir(int rdir) Suffix String representation of a rounding direction.static StringsuffixRType(int rtype) Suffix String representation of a rounding type.toString()Converts the expression tree to a String.abstract StringConverts the expression tree to a String.abstract Texpr1NodeConverts the level 0 tree to a level 1 tree in environment e.
-
Field Details
-
RTYPE_REAL
public static final int RTYPE_REALReal (no rounding).- See Also:
-
RTYPE_INT
public static final int RTYPE_INTInteger rounding.- See Also:
-
RTYPE_SINGLE
public static final int RTYPE_SINGLESingle-precision rounding: 32-bit IEEE 754 (float).- See Also:
-
RTYPE_DOUBLE
public static final int RTYPE_DOUBLEDouble-precision rounding: 64-bit IEEE 754 (double).- See Also:
-
RTYPE_EXTENDED
public static final int RTYPE_EXTENDEDExtended-precision rounding: 80-bit (Intel's long double).- See Also:
-
RTYPE_QUAD
public static final int RTYPE_QUADQuad-precision rounding: 128-bit (Motorola's long double).- See Also:
-
RDIR_NEAREST
public static final int RDIR_NEARESTRounds to nearest.- See Also:
-
RDIR_ZERO
public static final int RDIR_ZERORounds towards 0 (truncation).- See Also:
-
RDIR_UP
public static final int RDIR_UPRounds towards +oo.- See Also:
-
RDIR_DOWN
public static final int RDIR_DOWNRounds towards -oo.- See Also:
-
RDIR_RND
public static final int RDIR_RNDNon-deterministic rounding (all four modes considered).- See Also:
-
-
Constructor Details
-
Texpr0Node
protected Texpr0Node()No constructor: use constructors from a sub-class.
-
-
Method Details
-
shallowCopy
Shallow copy. -
deepCopy
Deep copy. -
fromLinexpr0
Constructs an expression tree from a linear expression.All coefficients are copied.
-
toTexpr1Node
Converts the level 0 tree to a level 1 tree in environment e.All dimension leaves are replaced with variable leaves.
-
toString
Converts the expression tree to a String.Dimension i is denoted as xi.
-
toString
Converts the expression tree to a String.Dimension i is denoted by names[i].
-
toString
-
getDepth
public abstract int getDepth()Returns the depth of the expression tree. -
getSize
public abstract int getSize()Returns the number of internal nodes in the tree. -
maxDim
public abstract int maxDim()Maximum occurring dimension + 1. -
hasDim
public abstract boolean hasDim(int dim) Whether the dimension dim is present. -
fillDims
protected abstract void fillDims(boolean[] ar) Used internally by getDims. -
getDims
public int[] getDims()Returns an ordered list of all occurring dimensions. -
isIntervalCst
public abstract boolean isIntervalCst()Whether the expression is constant. -
isIntervalLinear
public abstract boolean isIntervalLinear()Whether the expression is linear with interval or scalar coefficients, and there is no rounding. -
isIntervalPolynomial
public abstract boolean isIntervalPolynomial()Whether the expression is polynomial, with interval or scalar coefficients, and there is no rounding. -
isIntervalPolyfrac
public abstract boolean isIntervalPolyfrac()Whether the expression is a polynomial fraction, with interval or scalar coefficients, and there is no rounding. -
isScalar
public abstract boolean isScalar()Whether all coefficients are scalar (non interval). -
substitute
Substitutes all occurrences of the dimension dim with the expression tree t.this is modified in-place.
As some nodes can change their kind (a node for a dimension dim becomes the root of the tree t), a new root node is returned.
-
substituteCopy
Returns a copy of this where all occurrences of the dimension dim are substituted with the expression tree t. -
addDimensions
Adds some dimensions and shifts coefficients accordingly . -
addDimensionsCopy
Returns a copy of this with some dimensions added. -
removeDimensions
Removes some dimensions and shifts coefficients accordinglythis is modified in-place.
As some nodes can change their kind (removed dimensions become [-oo,+oo] constants), a new root node is returned.
-
removeDimensionsCopy
Returns a copy of this with some dimensions removed. -
permuteDimensions
Permutes some dimensions in the expression. -
permuteDimensionsCopy
Returns a copy of this with some dimensions permuted. -
hashCode
public abstract int hashCode()Recursive hashing. -
isEqual
Structural (recursive) equality. -
getPrecedence
public abstract int getPrecedence()Precedence of the node, used when printing. -
suffixRType
Suffix String representation of a rounding type. -
suffixRDir
Suffix String representation of a rounding direction. -
clone
Returns a deep copy of this. -
equals
Whether x is a Texpr0 tree and structurally equal to this.
-