All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.hakenadu.terms.visitor.eval.op.BinaryNumberOperationEvaluator Maven / Gradle / Ivy

Go to download

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 two operands.
 * 
 * @author Manuel Seiche
 * @since 21.01.2020
 */
public interface BinaryNumberOperationEvaluator extends NumberOperationEvaluator {

	Object evaluateNumbers(Number firstOperand, Number secondOperand);

	@Override
	default Object evaluateNumbers(final List operandValues) {
		if (operandValues.size() < 2) {
			throw new IllegalArgumentException("only one operand passed to binary operation");
		}

		if (operandValues.size() > 2) {
			throw new IllegalArgumentException("more than two operands passed to binary operation");
		}

		return evaluateNumbers(operandValues.get(0), operandValues.get(1));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy