public abstract class Expr
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
ABS
Unary operator: absolute value
|
static int |
ACOS
Unary operator: arccosine
|
static int |
ADD
Binary operator: addition
|
static int |
AND
Binary operator: logical and
|
static int |
ASIN
Unary operator: arcsine
|
static int |
ATAN
Unary operator: arctangent
|
static int |
ATAN2
Binary operator: arctangent
|
static int |
CEIL
Unary operator: ceiling
|
static int |
COS
Unary operator: cosine
|
static int |
DIV
Binary operator: division
|
static int |
EQ
Binary operator: equality
|
static int |
EXP
Unary operator: e to the x
|
static int |
FLOOR
Unary operator: floor
|
static int |
GE
Binary operator: greater or equal
|
static int |
GT
Binary operator: greater than
|
static int |
LE
Binary operator: less or equal
|
static int |
LOG
Unary operator: natural log
|
static int |
LT
Binary operator: less than
|
static int |
MAX
Binary operator: maximum
|
static int |
MIN
Binary operator: minimum
|
static int |
MUL
Binary operator: multiplication
|
static int |
NE
Binary operator: inequality
|
static int |
NEG
Unary operator: negation
|
static int |
OR
Binary operator: logical or
|
static int |
POW
Binary operator: exponentiation
|
static int |
ROUND
Unary operator: rounding
|
static int |
SIN
Unary operator: sine
|
static int |
SQRT
Unary operator: square root
|
static int |
SUB
Binary operator: subtraction
|
static int |
TAN
Unary operator: tangent
|
Constructor and Description |
---|
Expr() |
Modifier and Type | Method and Description |
---|---|
static Expr |
makeApp1(int rator,
Expr rand)
Make an expression that applies a unary operator to an operand.
|
static Expr |
makeApp2(int rator,
Expr rand0,
Expr rand1)
Make an expression that applies a binary operator to two operands.
|
static Expr |
makeIfThenElse(Expr test,
Expr consequent,
Expr alternative)
Make a conditional expression.
|
static Expr |
makeLiteral(double v)
Make a literal expression.
|
abstract double |
value()
Calculate the expression's value.
|
public static final int ADD
public static final int SUB
public static final int MUL
public static final int DIV
public static final int POW
public static final int ATAN2
public static final int MAX
public static final int MIN
public static final int LT
public static final int LE
public static final int EQ
public static final int NE
public static final int GE
public static final int GT
public static final int AND
public static final int OR
public static final int ABS
public static final int ACOS
public static final int ASIN
public static final int ATAN
public static final int CEIL
public static final int COS
public static final int EXP
public static final int FLOOR
public static final int LOG
public static final int NEG
public static final int ROUND
public static final int SIN
public static final int SQRT
public static final int TAN
public abstract double value()
public static Expr makeLiteral(double v)
v
- the constant value of the expressionpublic static Expr makeApp1(int rator, Expr rand)
rator
- a code for a unary operatorrand
- operandpublic static Expr makeApp2(int rator, Expr rand0, Expr rand1)
rator
- a code for a binary operatorrand0
- left operandrand1
- right operand