diff options
author | 2022-11-04 01:58:42 +0100 | |
---|---|---|
committer | 2022-11-05 19:41:33 +0100 | |
commit | 6252cdf7dc40e64008e919d82f823c0729f23d21 (patch) | |
tree | f2c2d539db5cac47cb558aeed25073d13627db87 /subprojects/store-query-viatra/src/main | |
parent | feat(frontend): scrollbar annotations (diff) | |
download | refinery-6252cdf7dc40e64008e919d82f823c0729f23d21.tar.gz refinery-6252cdf7dc40e64008e919d82f823c0729f23d21.tar.zst refinery-6252cdf7dc40e64008e919d82f823c0729f23d21.zip |
refactor: rename CallKind to Polarity
Diffstat (limited to 'subprojects/store-query-viatra/src/main')
2 files changed, 10 insertions, 10 deletions
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/CountExpressionEvaluator.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/CountExpressionEvaluator.java index 6fc96c05..e583e187 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/CountExpressionEvaluator.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/CountExpressionEvaluator.java | |||
@@ -3,14 +3,14 @@ package tools.refinery.store.query.viatra.internal.pquery; | |||
3 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; | 3 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; |
4 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; | 4 | import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; |
5 | import tools.refinery.store.query.atom.ComparisonOperator; | 5 | import tools.refinery.store.query.atom.ComparisonOperator; |
6 | import tools.refinery.store.query.atom.CountCallKind; | 6 | import tools.refinery.store.query.atom.CountingPolarity; |
7 | 7 | ||
8 | import java.util.List; | 8 | import java.util.List; |
9 | 9 | ||
10 | public record CountExpressionEvaluator(String variableName, ComparisonOperator operator, | 10 | public record CountExpressionEvaluator(String variableName, ComparisonOperator operator, |
11 | int threshold) implements IExpressionEvaluator { | 11 | int threshold) implements IExpressionEvaluator { |
12 | public CountExpressionEvaluator(String variableName, CountCallKind callKind) { | 12 | public CountExpressionEvaluator(String variableName, CountingPolarity polarity) { |
13 | this(variableName, callKind.operator(), callKind.threshold()); | 13 | this(variableName, polarity.operator(), polarity.threshold()); |
14 | } | 14 | } |
15 | 15 | ||
16 | @Override | 16 | @Override |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/DNF2PQuery.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/DNF2PQuery.java index 61b984ae..ae99365d 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/DNF2PQuery.java +++ b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/DNF2PQuery.java | |||
@@ -127,21 +127,21 @@ public class DNF2PQuery { | |||
127 | } | 127 | } |
128 | var variablesTuple = translateSubstitution(callAtom.getSubstitution(), body); | 128 | var variablesTuple = translateSubstitution(callAtom.getSubstitution(), body); |
129 | var translatedReferred = translate(target); | 129 | var translatedReferred = translate(target); |
130 | var callKind = callAtom.getKind(); | 130 | var polarity = callAtom.getPolarity(); |
131 | if (callKind instanceof BasicCallKind basicCallKind) { | 131 | if (polarity instanceof SimplePolarity simplePolarity) { |
132 | switch (basicCallKind) { | 132 | switch (simplePolarity) { |
133 | case POSITIVE -> new PositivePatternCall(body, variablesTuple, translatedReferred); | 133 | case POSITIVE -> new PositivePatternCall(body, variablesTuple, translatedReferred); |
134 | case TRANSITIVE -> new BinaryTransitiveClosure(body, variablesTuple, translatedReferred); | 134 | case TRANSITIVE -> new BinaryTransitiveClosure(body, variablesTuple, translatedReferred); |
135 | case NEGATIVE -> new NegativePatternCall(body, variablesTuple, translatedReferred); | 135 | case NEGATIVE -> new NegativePatternCall(body, variablesTuple, translatedReferred); |
136 | default -> throw new IllegalArgumentException("Unknown BasicCallKind: " + basicCallKind); | 136 | default -> throw new IllegalArgumentException("Unknown BasicCallKind: " + simplePolarity); |
137 | } | 137 | } |
138 | } else if (callKind instanceof CountCallKind countCallKind) { | 138 | } else if (polarity instanceof CountingPolarity countingPolarity) { |
139 | var countVariableName = DNFUtils.generateUniqueName("count"); | 139 | var countVariableName = DNFUtils.generateUniqueName("count"); |
140 | var countPVariable = body.getOrCreateVariableByName(countVariableName); | 140 | var countPVariable = body.getOrCreateVariableByName(countVariableName); |
141 | new PatternMatchCounter(body, variablesTuple, translatedReferred, countPVariable); | 141 | new PatternMatchCounter(body, variablesTuple, translatedReferred, countPVariable); |
142 | new ExpressionEvaluation(body, new CountExpressionEvaluator(countVariableName, countCallKind), null); | 142 | new ExpressionEvaluation(body, new CountExpressionEvaluator(countVariableName, countingPolarity), null); |
143 | } else { | 143 | } else { |
144 | throw new IllegalArgumentException("Unknown CallKind: " + callKind); | 144 | throw new IllegalArgumentException("Unknown CallKind: " + polarity); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||