![JAR search and dependency download from the Maven repository](/logo.png)
com.g2forge.alexandria.expression.numeric.AActiveNumericExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ax-expression Show documentation
Show all versions of ax-expression Show documentation
A library for expressions and their evaluation. Includes a basic implementation for math.
package com.g2forge.alexandria.expression.numeric;
import java.util.function.Supplier;
import com.g2forge.alexandria.expression.eval.IEvaluator;
import com.g2forge.alexandria.java.function.cache.FixedCachingSupplier;
public abstract class AActiveNumericExpression implements INumericExpression {
protected final Supplier reduction = new FixedCachingSupplier<>(() -> {
final IEvaluator evaluator = EVAL.get();
return evaluator.reduce(this, () -> reduceInternal(evaluator));
});
@Override
public INumericExpression apply(NumericEnvironment environment) {
final IEvaluator evaluator = EVAL.get();
return evaluator.apply(this, environment, () -> applyInternal(evaluator, environment));
}
protected abstract INumericExpression applyInternal(IEvaluator evaluator, NumericEnvironment environment);
@Override
public INumericExpression reduce() {
return reduction.get();
}
protected abstract INumericExpression reduceInternal(IEvaluator evaluator);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy