blob: 94c9399da2b2e13ae98b38607205ebea3de78416 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
*
* 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<Integer> {
public CountCandidateUpperBoundLiteral(DataVariable<Integer> resultVariable, Constraint target,
List<Variable> 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<Variable> substitutedArguments) {
return new CountCandidateUpperBoundLiteral(substitution.getTypeSafeSubstitute(getResultVariable()), getTarget(),
substitutedArguments);
}
@Override
public AbstractCallLiteral withArguments(Constraint newTarget, List<Variable> newArguments) {
return new CountCandidateUpperBoundLiteral(getResultVariable(), newTarget, newArguments);
}
@Override
protected String operatorName() {
return "@UpperBound(\"candidate\") count";
}
}
|