public class Texpr1CstNode extends Texpr1Node implements java.lang.Cloneable, java.io.Serializable
Texpr1Node
level 1
expression trees.
A constant value is represented by a Coeff
object.
Modifier and Type | Field and Description |
---|---|
Coeff |
cst
Constant value.
|
RDIR_DOWN, RDIR_NEAREST, RDIR_RND, RDIR_UP, RDIR_ZERO, RTYPE_DOUBLE, RTYPE_EXTENDED, RTYPE_INT, RTYPE_QUAD, RTYPE_REAL, RTYPE_SINGLE
Constructor and Description |
---|
Texpr1CstNode()
Create a zero constant node (DoubleScalar).
|
Texpr1CstNode(Coeff c)
Creates a new constant node.
|
Modifier and Type | Method and Description |
---|---|
Texpr1Node |
deepCopy()
Deep copy.
|
boolean |
equals(java.lang.Object x)
Whether x is a Texpr1 tree and structurally equal to this.
|
protected void |
fillVars(java.util.HashSet<Var> set)
Used internally for getVars.
|
Coeff |
getConstant() |
int |
getDepth()
Returns the depth of the expression tree.
|
int |
getPrecedence()
Precedence of the node, used when printing.
|
int |
getSize()
Returns the number of internal nodes in the tree.
|
int |
hashCode()
Recursive hashing.
|
boolean |
hasVar(Var var)
Whether the variable var occurs in the tree.
|
boolean |
isEqual(Texpr1Node t)
Structural (recursive) equality.
|
boolean |
isIntervalCst()
Whether the expression is constant.
|
boolean |
isIntervalLinear()
Whether the expression is linear with interval or scalar coefficients,
and there is no rounding.
|
boolean |
isIntervalPolyfrac()
Whether the expression is a polynomial fraction, with interval or
scalar coefficients, and there is no rounding.
|
boolean |
isIntervalPolynomial()
Whether the expression is polynomial, with interval or scalar
coefficients, and there is no rounding.
|
boolean |
isScalar()
Whether all coefficients are scalar (non interval).
|
void |
setConstant(Coeff c) |
Texpr1Node |
shallowCopy()
Shallow copy.
|
Texpr1Node |
substitute(Var var,
Texpr1Node t)
Substitutes all occurrences of the variable var with the tree t.
|
java.lang.String |
toString()
Converts the expression tree to a String.
|
Texpr0Node |
toTexpr0Node(Environment e)
Converts the level 1 tree to a level 0 tree in the given
environment.
|
clone, fromLinexpr1, getVars, hasVar, substitute, substituteCopy, substituteCopy
public Coeff cst
public Texpr1CstNode(Coeff c)
The coefficient is referenced, not copied.
public Texpr1CstNode()
public Texpr1Node shallowCopy()
Texpr1Node
shallowCopy
in class Texpr1Node
public Texpr1Node deepCopy()
Texpr1Node
deepCopy
in class Texpr1Node
public Texpr0Node toTexpr0Node(Environment e)
Texpr1Node
toTexpr0Node
in class Texpr1Node
public java.lang.String toString()
Texpr1Node
toString
in class Texpr1Node
public Coeff getConstant()
public void setConstant(Coeff c)
public int getDepth()
Texpr1Node
getDepth
in class Texpr1Node
public int getSize()
Texpr1Node
getSize
in class Texpr1Node
public boolean hasVar(Var var)
Texpr1Node
hasVar
in class Texpr1Node
protected void fillVars(java.util.HashSet<Var> set)
Texpr1Node
fillVars
in class Texpr1Node
public boolean isIntervalCst()
Texpr1Node
isIntervalCst
in class Texpr1Node
public boolean isIntervalLinear()
Texpr1Node
isIntervalLinear
in class Texpr1Node
public boolean isIntervalPolynomial()
Texpr1Node
isIntervalPolynomial
in class Texpr1Node
public boolean isIntervalPolyfrac()
Texpr1Node
isIntervalPolyfrac
in class Texpr1Node
public boolean isScalar()
Texpr1Node
isScalar
in class Texpr1Node
public Texpr1Node substitute(Var var, Texpr1Node t)
Texpr1Node
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
in class Texpr1Node
public int hashCode()
Texpr1Node
hashCode
in class Texpr1Node
public boolean isEqual(Texpr1Node t)
Texpr1Node
isEqual
in class Texpr1Node
public int getPrecedence()
Texpr1Node
getPrecedence
in class Texpr1Node
public boolean equals(java.lang.Object x)
Texpr1Node
equals
in class Texpr1Node