/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors
*
* SPDX-License-Identifier: EPL-2.0
*/
package tools.refinery.store.query.term.real;
import tools.refinery.store.query.substitution.Substitution;
import tools.refinery.store.query.term.Term;
public class RealMaxTerm extends RealBinaryTerm {
public RealMaxTerm(Term left, Term right) {
super(left, right);
}
@Override
public Term doSubstitute(Substitution substitution, Term substitutedLeft,
Term substitutedRight) {
return new RealMaxTerm(substitutedLeft, substitutedRight);
}
@Override
protected Double doEvaluate(Double leftValue, Double rightValue) {
return Math.max(leftValue, rightValue);
}
@Override
public String toString() {
return "max(%s, %s)".formatted(getLeft(), getRight());
}
}