Package net.sourceforge.plantuml.evalex
Class AbstractUnaryOperator
- java.lang.Object
-
- net.sourceforge.plantuml.evalex.AbstractLazyOperator
-
- net.sourceforge.plantuml.evalex.AbstractOperator
-
- net.sourceforge.plantuml.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 net.sourceforge.plantuml.evalex.AbstractLazyOperator
booleanOperator, leftAssoc, oper, precedence
-
-
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 java.lang.Numbereval(java.lang.Number v1, java.lang.Number v2)Implementation for this operator.Expression.LazyNumbereval(Expression.LazyNumber v1, Expression.LazyNumber v2)Implementation for this operator.abstract java.lang.NumberevalUnary(java.lang.Number v1)Implementation of this unary operator.-
Methods inherited from class net.sourceforge.plantuml.evalex.AbstractLazyOperator
getOper, getPrecedence, isBooleanOperator, isLeftAssoc
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.plantuml.evalex.LazyOperator
getOper, getPrecedence, isBooleanOperator, isLeftAssoc
-
-
-
-
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 interface:LazyOperatorImplementation for this operator.- Specified by:
evalin interfaceLazyOperator- Overrides:
evalin classAbstractOperator- Parameters:
v1- Operand 1.v2- Operand 2.- Returns:
- The result of the operation.
-
eval
public java.lang.Number eval(java.lang.Number v1, java.lang.Number v2)Description copied from interface:OperatorImplementation for this operator.- Parameters:
v1- Operand 1.v2- Operand 2.- Returns:
- The result of the operation.
-
evalUnary
public abstract java.lang.Number evalUnary(java.lang.Number v1)
Implementation of this unary operator.- Parameters:
v1- The parameter.- Returns:
- The result of the operation.
-
-