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 protected
AbstractUnaryOperator(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.Number
eval(java.lang.Number v1, java.lang.Number v2)
Implementation for this operator.Expression.LazyNumber
eval(Expression.LazyNumber v1, Expression.LazyNumber v2)
Implementation for this operator.abstract java.lang.Number
evalUnary(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
-true
if the operator is left associative, elsefalse
.
-
-
Method Detail
-
eval
public Expression.LazyNumber eval(Expression.LazyNumber v1, Expression.LazyNumber v2)
Description copied from interface:LazyOperator
Implementation for this operator.- Specified by:
eval
in interfaceLazyOperator
- Overrides:
eval
in 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:Operator
Implementation 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.
-
-