public class Texpr1BinNode extends Texpr1Node implements java.lang.Cloneable, java.io.Serializable
Texpr1Node
level 1
expression trees.Modifier and Type | Field and Description |
---|---|
Texpr1Node |
lArg
Left argument.
|
int |
op
Operation (
OP_ADD , etc.). |
static int |
OP_ADD
Addition.
|
static int |
OP_DIV
Division.
|
static int |
OP_MOD
Modulo (for integers or reals).
|
static int |
OP_MUL
Multiplication.
|
static int |
OP_POW
Power.
|
static int |
OP_SUB
Subtraction.
|
Texpr1Node |
rArg
Right argument.
|
int |
rdir
Rounding direction (
Texpr1Node.RDIR_NEAREST , etc.). |
int |
rtype
Rounding type (
Texpr1Node.RTYPE_REAL , etc). |
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 |
---|
Texpr1BinNode(int o,
int rtyp,
int rdi,
Texpr1Node lAr,
Texpr1Node rAr)
Creates a new binary operator node, with the specified operator,
rounding type, rounding direction, left and right arguments.
|
Texpr1BinNode(int o,
Texpr1Node lAr,
Texpr1Node rAr)
Creates a new binary operator node, with the specified operator,
and left and right arguments, and no rounding.
|
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.
|
int |
getDepth()
Returns the depth of the expression tree.
|
Texpr1Node |
getLeftArgument() |
int |
getOperation() |
int |
getPrecedence()
Precedence of the node, used when printing.
|
Texpr1Node |
getRightArgument() |
int |
getRoundingDirection() |
int |
getRoundingType() |
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 |
setLeftArgument(Texpr1Node n) |
void |
setOperation(int o) |
void |
setRightArgument(Texpr1Node n) |
void |
setRoundingDirection(int d) |
void |
setRoundingType(int t) |
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 int op
OP_ADD
, etc.).public int rtype
Texpr1Node.RTYPE_REAL
, etc).public int rdir
Texpr1Node.RDIR_NEAREST
, etc.).public Texpr1Node lArg
public Texpr1Node rArg
public static final int OP_ADD
public static final int OP_SUB
public static final int OP_MUL
public static final int OP_DIV
public static final int OP_MOD
public static final int OP_POW
public Texpr1BinNode(int o, int rtyp, int rdi, Texpr1Node lAr, Texpr1Node rAr)
The subtree arguments are referenced, not copied.
public Texpr1BinNode(int o, Texpr1Node lAr, Texpr1Node rAr)
The subtree arguments are referenced, not copied.
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 int getOperation()
public void setOperation(int o)
public int getRoundingType()
public void setRoundingType(int t)
public int getRoundingDirection()
public void setRoundingDirection(int d)
public Texpr1Node getLeftArgument()
public void setLeftArgument(Texpr1Node n)
public Texpr1Node getRightArgument()
public void setRightArgument(Texpr1Node n)
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