de.hakenadu.terms.visitor.eval.op.UnaryNumberOperationEvaluator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of composite-terms Show documentation
Show all versions of composite-terms Show documentation
A light extensible java 8+ library for creating composites of terms which are evaluatable using a visitor pattern.
The newest version!
package de.hakenadu.terms.visitor.eval.op;
import java.util.List;
/**
* convenience interface for {@link NumberOperationEvaluator} implementations
* which operate on exactly one operand.
*
* @author Manuel Seiche
* @since 21.01.2020
*/
public interface UnaryNumberOperationEvaluator extends NumberOperationEvaluator {
Object evaluateNumber(Number operand);
@Override
default Object evaluateNumbers(final List operandValues) {
if (operandValues.size() > 1) {
throw new IllegalArgumentException("more than one operand passed to unary operation");
}
return evaluateNumber(operandValues.get(0));
}
}