diff options
author | 2023-02-20 20:23:27 +0100 | |
---|---|---|
committer | 2023-02-20 20:23:27 +0100 | |
commit | b3f7c4d7707435803921c4fec2c4d95b3dd45c53 (patch) | |
tree | 18a90112efe3ece8678709db322dddcefafaace1 /subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java | |
parent | feat: type inference for class hierarchies (diff) | |
download | refinery-b3f7c4d7707435803921c4fec2c4d95b3dd45c53.tar.gz refinery-b3f7c4d7707435803921c4fec2c4d95b3dd45c53.tar.zst refinery-b3f7c4d7707435803921c4fec2c4d95b3dd45c53.zip |
refactor: split query and partial from store
Allows more complicated dependency hiearchies (e.g., use
store-query-viatra for testing store-partial) and better separation of
test fixtures.
Diffstat (limited to 'subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java')
-rw-r--r-- | subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java new file mode 100644 index 00000000..2ba1fcc4 --- /dev/null +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/RelationViewImplication.java | |||
@@ -0,0 +1,19 @@ | |||
1 | package tools.refinery.store.query.view; | ||
2 | |||
3 | import java.util.List; | ||
4 | |||
5 | public record RelationViewImplication(AnyRelationView implyingRelationView, AnyRelationView impliedRelationView, | ||
6 | List<Integer> impliedIndices) { | ||
7 | public RelationViewImplication { | ||
8 | if (impliedIndices.size() != impliedRelationView.arity()) { | ||
9 | throw new IllegalArgumentException("Expected %d implied indices for %s, but %d are provided" | ||
10 | .formatted(impliedRelationView.arity(), impliedRelationView, impliedIndices.size())); | ||
11 | } | ||
12 | for (var index : impliedIndices) { | ||
13 | if (impliedRelationView.invalidIndex(index)) { | ||
14 | throw new IllegalArgumentException("%d is not a valid index for %s".formatted(index, | ||
15 | implyingRelationView)); | ||
16 | } | ||
17 | } | ||
18 | } | ||
19 | } | ||