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 int
Rounds towards -oo.static final int
Rounds to nearest.static final int
Non-deterministic rounding (all four modes considered).static final int
Rounds towards +oo.static final int
Rounds towards 0 (truncation).static final int
Double-precision rounding: 64-bit IEEE 754 (double).static final int
Extended-precision rounding: 80-bit (Intel's long double).static final int
Integer rounding.static final int
Quad-precision rounding: 128-bit (Motorola's long double).static final int
Real (no rounding).static final int
Single-precision rounding: 32-bit IEEE 754 (float). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
No constructor: use constructors from a sub-class. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Adds some dimensions and shifts coefficients accordingly .Returns a copy of this with some dimensions added.clone()
Returns a deep copy of this.abstract Texpr0Node
deepCopy()
Deep copy.abstract boolean
Whether x is a Texpr0 tree and structurally equal to this.protected abstract void
fillDims
(boolean[] ar) Used internally by getDims.static Texpr0Node
Constructs an expression tree from a linear expression.abstract int
getDepth()
Returns the depth of the expression tree.int[]
getDims()
Returns an ordered list of all occurring dimensions.abstract int
Precedence of the node, used when printing.abstract int
getSize()
Returns the number of internal nodes in the tree.abstract boolean
hasDim
(int dim) Whether the dimension dim is present.abstract int
hashCode()
Recursive hashing.abstract boolean
Structural (recursive) equality.abstract boolean
Whether the expression is constant.abstract boolean
Whether the expression is linear with interval or scalar coefficients, and there is no rounding.abstract boolean
Whether the expression is a polynomial fraction, with interval or scalar coefficients, and there is no rounding.abstract boolean
Whether the expression is polynomial, with interval or scalar coefficients, and there is no rounding.abstract boolean
isScalar()
Whether all coefficients are scalar (non interval).abstract int
maxDim()
Maximum occurring dimension + 1.abstract void
Permutes some dimensions in the expression.Returns a copy of this with some dimensions permuted.abstract Texpr0Node
Removes some dimensions and shifts coefficients accordinglyReturns a copy of this with some dimensions removed.abstract Texpr0Node
Shallow copy.abstract Texpr0Node
substitute
(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 String
suffixRDir
(int rdir) Suffix String representation of a rounding direction.static String
suffixRType
(int rtype) Suffix String representation of a rounding type.toString()
Converts the expression tree to a String.abstract String
Converts the expression tree to a String.abstract Texpr1Node
Converts 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.
-