Package com.udojava.evalex
Class AbstractUnaryOperator
- java.lang.Object
-
- com.udojava.evalex.AbstractLazyOperator
-
- com.udojava.evalex.AbstractOperator
-
- com.udojava.evalex.AbstractUnaryOperator
-
- All Implemented Interfaces:
LazyOperator,Operator
- Direct Known Subclasses:
Expression.UnaryOperator
public abstract class AbstractUnaryOperator extends AbstractOperator
Abstract implementation of an unary operator.
This abstract implementation implements eval so that it forwards its first parameter to evalUnary.
-
-
Field Summary
-
Fields inherited from class com.udojava.evalex.AbstractLazyOperator
booleanOperator, leftAssoc, oper, precedence, unaryOperator
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractUnaryOperator(java.lang.String oper, int precedence, boolean leftAssoc)Creates a new operator.
-
Method Summary
All Methods Instance Methods Abstract 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.java.math.BigDecimaleval(java.math.BigDecimal v1, java.math.BigDecimal v2)Implementation of this operator calling unary operator evaluation method..abstract java.math.BigDecimalevalUnary(java.math.BigDecimal v1)Implementation of this prefix unary operator.-
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
-
AbstractUnaryOperator
protected AbstractUnaryOperator(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)
Description copied from class:AbstractOperatorImplementation of this operator supporting either 1 or 2 operands.- Specified by:
evalin interfaceLazyOperator- Overrides:
evalin classAbstractOperator- 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.
-
eval
public java.math.BigDecimal eval(java.math.BigDecimal v1, java.math.BigDecimal v2)Implementation of this operator calling unary operator evaluation method..- Parameters:
v1- The first parameter.v2- The second parameter. Expected to be null- Returns:
- The result of the operation.
-
evalUnary
public abstract java.math.BigDecimal evalUnary(java.math.BigDecimal v1)
Implementation of this prefix unary operator.- Parameters:
v1- The parameter.- Returns:
- The result of the operation.
-
-