/* * SPDX-FileCopyrightText: 2023 The Refinery Authors * * SPDX-License-Identifier: EPL-2.0 */ package tools.refinery.store.reasoning.literal; import tools.refinery.store.query.Constraint; import tools.refinery.store.query.literal.AbstractCallLiteral; import tools.refinery.store.query.literal.AbstractCountLiteral; import tools.refinery.store.query.literal.Literal; import tools.refinery.store.query.substitution.Substitution; import tools.refinery.store.query.term.DataVariable; import tools.refinery.store.query.term.Variable; import java.util.List; public class CountCandidateUpperBoundLiteral extends AbstractCountLiteral { public CountCandidateUpperBoundLiteral(DataVariable resultVariable, Constraint target, List arguments) { super(Integer.class, resultVariable, target, arguments); } @Override protected Integer zero() { return 0; } @Override protected Integer one() { return 1; } @Override protected Literal doSubstitute(Substitution substitution, List substitutedArguments) { return new CountCandidateUpperBoundLiteral(substitution.getTypeSafeSubstitute(getResultVariable()), getTarget(), substitutedArguments); } @Override public AbstractCallLiteral withArguments(Constraint newTarget, List newArguments) { return new CountCandidateUpperBoundLiteral(getResultVariable(), newTarget, newArguments); } @Override protected String operatorName() { return "@UpperBound(\"candidate\") count"; } }