Class Texpr1Node
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
Texpr1BinNode
,Texpr1CstNode
,Texpr1UnNode
,Texpr1VarNode
A Texpr1Node represents an expression tree, which can be
constructed and inspected in Java.
Each node is actually a binary operator (Texpr1BinNode
),
a unary operator (Texpr1UnNode
), a variable represented
by name (Texpr1VarNode
), or a constant
(Texpr1CstNode
).
An expression tree must be converted to and from a
Texpr1Intern
to be used in abstract domain transfer
functions.
Unlike other level 1 objects, level 1 concrete expression trees are not
defined with respect to a given environment. The environment
is specified during the conversion to an opaque level 1 expression tree.
- 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 TypeMethodDescriptionclone()
Returns a deep copy of this.abstract Texpr1Node
deepCopy()
Deep copy.abstract boolean
Whether x is a Texpr1 tree and structurally equal to this.protected abstract void
Used internally for getVars.static Texpr1Node
Constructs an expression tree from a linear expression.abstract int
getDepth()
Returns the depth of the expression tree.abstract int
Precedence of the node, used when printing.abstract int
getSize()
Returns the number of internal nodes in the tree.Var[]
getVars()
Returns the list of all occurring variables.abstract int
hashCode()
Recursive hashing.abstract boolean
Whether the variable var occurs in the tree.boolean
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 Texpr1Node
Shallow copy.abstract Texpr1Node
substitute
(Var var, Texpr1Node t) Substitutes all occurrences of the variable var with the tree t.substitute
(String var, Texpr1Node t) substituteCopy
(Var var, Texpr1Node t) Returns a copy of this where all occurrences of the variable var are substituted with the expression tree t.substituteCopy
(String var, Texpr1Node t) abstract String
toString()
Converts the expression tree to a String.abstract Texpr0Node
Converts the level 1 tree to a level 0 tree in the given environment.
-
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
-
Texpr1Node
protected Texpr1Node()No constructor: use constructors from a sub-class.
-
-
Method Details
-
shallowCopy
Shallow copy. -
deepCopy
Deep copy. -
fromLinexpr1
Constructs an expression tree from a linear expression.All coefficients are copied.
-
toTexpr0Node
Converts the level 1 tree to a level 0 tree in the given environment. -
toString
Converts the expression tree to a String. -
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. -
hasVar
Whether the variable var occurs in the tree. -
hasVar
-
fillVars
Used internally for getVars. -
getVars
Returns the list of all occurring variables.The ordering is unspecified.
-
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 variable var with the tree t.this is modified in-place.
As some nodes can change their kind (a node for a variable var becomes the root of the tree t), a new root node is returned.
-
substitute
-
substituteCopy
Returns a copy of this where all occurrences of the variable var are substituted with the expression tree t. -
substituteCopy
-
hashCode
public abstract int hashCode()Recursive hashing. -
isEqual
Structural (recursive) equality. -
getPrecedence
public abstract int getPrecedence()Precedence of the node, used when printing. -
equals
Whether x is a Texpr1 tree and structurally equal to this. -
clone
Returns a deep copy of this.
-