public abstract class Texpr1Node
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
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.
Modifier and Type | Field and Description |
---|---|
static int |
RDIR_DOWN
Rounds towards -oo.
|
static int |
RDIR_NEAREST
Rounds to nearest.
|
static int |
RDIR_RND
Non-deterministic rounding (all four modes considered).
|
static int |
RDIR_UP
Rounds towards +oo.
|
static int |
RDIR_ZERO
Rounds towards 0 (truncation).
|
static int |
RTYPE_DOUBLE
Double-precision rounding: 64-bit IEEE 754 (double).
|
static int |
RTYPE_EXTENDED
Extended-precision rounding: 80-bit (Intel's long double).
|
static int |
RTYPE_INT
Integer rounding.
|
static int |
RTYPE_QUAD
Quad-precision rounding: 128-bit (Motorola's long double).
|
static int |
RTYPE_REAL
Real (no rounding).
|
static int |
RTYPE_SINGLE
Single-precision rounding: 32-bit IEEE 754 (float).
|
Modifier | Constructor and Description |
---|---|
protected |
Texpr1Node()
No constructor: use constructors from a sub-class.
|
Modifier and Type | Method and Description |
---|---|
Texpr1Node |
clone()
Returns a deep copy of this.
|
abstract Texpr1Node |
deepCopy()
Deep copy.
|
abstract boolean |
equals(java.lang.Object x)
Whether x is a Texpr1 tree and structurally equal to this.
|
protected abstract void |
fillVars(java.util.HashSet<Var> set)
Used internally for getVars.
|
static Texpr1Node |
fromLinexpr1(Linexpr1 c)
Constructs an expression tree from a linear expression.
|
abstract int |
getDepth()
Returns the depth of the expression tree.
|
abstract int |
getPrecedence()
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.
|
boolean |
hasVar(java.lang.String var) |
abstract boolean |
hasVar(Var var)
Whether the variable var occurs in the tree.
|
abstract boolean |
isEqual(Texpr1Node t)
Structural (recursive) equality.
|
abstract boolean |
isIntervalCst()
Whether the expression is constant.
|
abstract boolean |
isIntervalLinear()
Whether the expression is linear with interval or scalar coefficients,
and there is no rounding.
|
abstract boolean |
isIntervalPolyfrac()
Whether the expression is a polynomial fraction, with interval or
scalar coefficients, and there is no rounding.
|
abstract boolean |
isIntervalPolynomial()
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 |
shallowCopy()
Shallow copy.
|
Texpr1Node |
substitute(java.lang.String var,
Texpr1Node t) |
abstract Texpr1Node |
substitute(Var var,
Texpr1Node t)
Substitutes all occurrences of the variable var with the tree t.
|
Texpr1Node |
substituteCopy(java.lang.String var,
Texpr1Node t) |
Texpr1Node |
substituteCopy(Var var,
Texpr1Node t)
Returns a copy of this where all occurrences of the variable var
are substituted with the expression tree t.
|
abstract java.lang.String |
toString()
Converts the expression tree to a String.
|
abstract Texpr0Node |
toTexpr0Node(Environment e)
Converts the level 1 tree to a level 0 tree in the given
environment.
|
public static final int RTYPE_REAL
public static final int RTYPE_INT
public static final int RTYPE_SINGLE
public static final int RTYPE_DOUBLE
public static final int RTYPE_EXTENDED
public static final int RTYPE_QUAD
public static final int RDIR_NEAREST
public static final int RDIR_ZERO
public static final int RDIR_UP
public static final int RDIR_DOWN
public static final int RDIR_RND
protected Texpr1Node()
public abstract Texpr1Node shallowCopy()
public abstract Texpr1Node deepCopy()
public static Texpr1Node fromLinexpr1(Linexpr1 c)
All coefficients are copied.
public abstract Texpr0Node toTexpr0Node(Environment e)
public abstract java.lang.String toString()
toString
in class java.lang.Object
public abstract int getDepth()
public abstract int getSize()
public abstract boolean hasVar(Var var)
public boolean hasVar(java.lang.String var)
protected abstract void fillVars(java.util.HashSet<Var> set)
public Var[] getVars()
The ordering is unspecified.
public abstract boolean isIntervalCst()
public abstract boolean isIntervalLinear()
public abstract boolean isIntervalPolynomial()
public abstract boolean isIntervalPolyfrac()
public abstract boolean isScalar()
public abstract Texpr1Node substitute(Var var, Texpr1Node 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.
public Texpr1Node substitute(java.lang.String var, Texpr1Node t)
public Texpr1Node substituteCopy(Var var, Texpr1Node t)
public Texpr1Node substituteCopy(java.lang.String var, Texpr1Node t)
public abstract int hashCode()
hashCode
in class java.lang.Object
public abstract boolean isEqual(Texpr1Node t)
public abstract int getPrecedence()
public abstract boolean equals(java.lang.Object x)
equals
in class java.lang.Object
public Texpr1Node clone()
clone
in class java.lang.Object