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

com.g2forge.alexandria.expression.numeric.LazyNumericExpression Maven / Gradle / Ivy

Go to download

A library for expressions and their evaluation. Includes a basic implementation for math.

There is a newer version: 0.0.18
Show newest version
package com.g2forge.alexandria.expression.numeric;

import java.util.function.BiFunction;
import java.util.function.Supplier;

import com.g2forge.alexandria.expression.ALazyExpression;
import com.g2forge.alexandria.expression.eval.IEvaluator;

public class LazyNumericExpression extends ALazyExpressionimplements INumericExpression {
	public LazyNumericExpression(Supplier input, Supplier environment, BiFunction function) {
		super(input, environment, function);
	}

	@Override
	public INumericExpression apply(NumericEnvironment environment) {
		return new LazyNumericExpression(getInput(), getEnvironment(), getFunction().andThen(e -> e.apply(environment)));
	}

	@Override
	protected IEvaluator getEvaluator() {
		return EVAL.get();
	}

	@Override
	public INumericExpression reduce() {
		return resolve().reduce();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy