Package com.udojava.evalex
Class AbstractOperator
- java.lang.Object
-
- com.udojava.evalex.AbstractLazyOperator
-
- com.udojava.evalex.AbstractOperator
-
- All Implemented Interfaces:
LazyOperator,Operator
- Direct Known Subclasses:
AbstractUnaryOperator,Expression.Operator
public abstract class AbstractOperator extends AbstractLazyOperator implements Operator
Abstract implementation of an operator.
-
-
Field Summary
-
Fields inherited from class com.udojava.evalex.AbstractLazyOperator
booleanOperator, leftAssoc, oper, precedence, unaryOperator
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractOperator(java.lang.String oper, int precedence, boolean leftAssoc)Creates a new operator.protectedAbstractOperator(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator)Creates a new boolean operator.protectedAbstractOperator(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator, boolean unaryOperator)Creates a new unary operator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression.LazyNumbereval(Expression.LazyNumber v1, Expression.LazyNumber v2)Implementation of this operator supporting either 1 or 2 operands.-
Methods inherited from class com.udojava.evalex.AbstractLazyOperator
getOper, getPrecedence, isBooleanOperator, isLeftAssoc, isUnaryOperator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.udojava.evalex.LazyOperator
getOper, getPrecedence, isBooleanOperator, isLeftAssoc, isUnaryOperator
-
-
-
-
Constructor Detail
-
AbstractOperator
protected AbstractOperator(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator, boolean unaryOperator)Creates a new unary operator.- Parameters:
oper- The operator name (pattern).precedence- The operators precedence.leftAssoc-trueif the operator is left associative, elsefalse.booleanOperator- Whether this operator is boolean.unaryOperator- Whether the operator is unary (true) or not (false).
-
AbstractOperator
protected AbstractOperator(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator)Creates a new boolean operator.- Parameters:
oper- The operator name (pattern).precedence- The operators precedence.leftAssoc-trueif the operator is left associative, elsefalse.booleanOperator- Whether this operator is boolean.
-
AbstractOperator
protected AbstractOperator(java.lang.String oper, int precedence, boolean leftAssoc)Creates a new operator.- Parameters:
oper- The operator name (pattern).precedence- The operators precedence.leftAssoc-trueif the operator is left associative, elsefalse.
-
-
Method Detail
-
eval
public Expression.LazyNumber eval(Expression.LazyNumber v1, Expression.LazyNumber v2)
Implementation of this operator supporting either 1 or 2 operands.- Specified by:
evalin interfaceLazyOperator- Parameters:
v1- The first operand expected for the operation.v2- The second operand expected for the operation. For postfix unary operators, v2=null condition was added.- Returns:
- LazyNumber object. The result of the operation.
-
-