public abstract static class CalculatorExpr.Operator
extends java.lang.Object
CalculatorExpr.Operation
,
or for some additional values in stack.
The operation are such as a set operation (set the arg to accu), add, subtract, negate, boolean operators etc or standard maths routines.
Instances of this class are defined in the CalculatorExpr
.Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name |
Modifier | Constructor and Description |
---|---|
protected |
Operator(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
isBoolCheck()
Returns true if this is a bool check operation.
|
protected abstract boolean |
isUnary()
Returns true on an unary operation, false on a operation with both operands.
|
protected abstract void |
operate(CalculatorExpr.Value accu,
CalculatorExpr.Value arg)
Operates and returns the result type.
|
java.lang.String |
toString() |
protected abstract void operate(CalculatorExpr.Value accu, CalculatorExpr.Value arg) throws java.lang.Exception
ExpressionType#checkArgument(Value, Value)
with respect to the current type of the expression
starting with the CalculatorExpr#startExpr
.Type
- The current typeaccu
- First operand, used cumulatively or the only one operand for unary operations.arg
- The second argument for binary operations.java.lang.Exception
- If the operation is not admissible.protected abstract boolean isUnary()
protected abstract boolean isBoolCheck()
public java.lang.String toString()
toString
in class java.lang.Object