diff options
Diffstat (limited to 'subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/CountCandidateUpperBoundLiteral.java')
-rw-r--r-- | subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/CountCandidateUpperBoundLiteral.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/CountCandidateUpperBoundLiteral.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/CountCandidateUpperBoundLiteral.java new file mode 100644 index 00000000..94c9399d --- /dev/null +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/literal/CountCandidateUpperBoundLiteral.java | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.reasoning.literal; | ||
7 | |||
8 | import tools.refinery.store.query.Constraint; | ||
9 | import tools.refinery.store.query.literal.AbstractCallLiteral; | ||
10 | import tools.refinery.store.query.literal.AbstractCountLiteral; | ||
11 | import tools.refinery.store.query.literal.Literal; | ||
12 | import tools.refinery.store.query.substitution.Substitution; | ||
13 | import tools.refinery.store.query.term.DataVariable; | ||
14 | import tools.refinery.store.query.term.Variable; | ||
15 | |||
16 | import java.util.List; | ||
17 | |||
18 | public class CountCandidateUpperBoundLiteral extends AbstractCountLiteral<Integer> { | ||
19 | public CountCandidateUpperBoundLiteral(DataVariable<Integer> resultVariable, Constraint target, | ||
20 | List<Variable> arguments) { | ||
21 | super(Integer.class, resultVariable, target, arguments); | ||
22 | } | ||
23 | |||
24 | @Override | ||
25 | protected Integer zero() { | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | @Override | ||
30 | protected Integer one() { | ||
31 | return 1; | ||
32 | } | ||
33 | |||
34 | @Override | ||
35 | protected Literal doSubstitute(Substitution substitution, List<Variable> substitutedArguments) { | ||
36 | return new CountCandidateUpperBoundLiteral(substitution.getTypeSafeSubstitute(getResultVariable()), getTarget(), | ||
37 | substitutedArguments); | ||
38 | } | ||
39 | |||
40 | @Override | ||
41 | public AbstractCallLiteral withArguments(Constraint newTarget, List<Variable> newArguments) { | ||
42 | return new CountCandidateUpperBoundLiteral(getResultVariable(), newTarget, newArguments); | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | protected String operatorName() { | ||
47 | return "@UpperBound(\"candidate\") count"; | ||
48 | } | ||
49 | } | ||