diff options
author | Kristóf Marussy <marussy@mit.bme.hu> | 2023-09-14 19:29:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 19:29:36 +0200 |
commit | 98ed3b6db5f4e51961a161050cc31c66015116e8 (patch) | |
tree | 8bfd6d9bc8d6ed23b9eb0f889dd40b6c24fe8f92 /subprojects/store-query/src/main/java/tools/refinery/store/query/view/AbstractFunctionView.java | |
parent | Merge pull request #38 from nagilooh/design-space-exploration (diff) | |
parent | Merge remote-tracking branch 'upstream/main' into partial-interpretation (diff) | |
download | refinery-98ed3b6db5f4e51961a161050cc31c66015116e8.tar.gz refinery-98ed3b6db5f4e51961a161050cc31c66015116e8.tar.zst refinery-98ed3b6db5f4e51961a161050cc31c66015116e8.zip |
Merge pull request #39 from kris7t/partial-interpretation
Implement partial interpretation based model generation
Diffstat (limited to 'subprojects/store-query/src/main/java/tools/refinery/store/query/view/AbstractFunctionView.java')
-rw-r--r-- | subprojects/store-query/src/main/java/tools/refinery/store/query/view/AbstractFunctionView.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AbstractFunctionView.java b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AbstractFunctionView.java index fd37604e..f130fa59 100644 --- a/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AbstractFunctionView.java +++ b/subprojects/store-query/src/main/java/tools/refinery/store/query/view/AbstractFunctionView.java | |||
@@ -5,6 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.view; | 6 | package tools.refinery.store.query.view; |
7 | 7 | ||
8 | import tools.refinery.store.map.CursorAsIterator; | ||
8 | import tools.refinery.store.model.Model; | 9 | import tools.refinery.store.model.Model; |
9 | import tools.refinery.store.query.dnf.FunctionalDependency; | 10 | import tools.refinery.store.query.dnf.FunctionalDependency; |
10 | import tools.refinery.store.query.term.Parameter; | 11 | import tools.refinery.store.query.term.Parameter; |
@@ -83,6 +84,20 @@ public abstract class AbstractFunctionView<T> extends SymbolView<T> { | |||
83 | } | 84 | } |
84 | 85 | ||
85 | @Override | 86 | @Override |
87 | public boolean canIndexSlot(int slot) { | ||
88 | return slot >= 0 && slot < getSymbol().arity(); | ||
89 | } | ||
90 | |||
91 | @Override | ||
92 | public Iterable<Object[]> getAdjacent(Model model, int slot, Object value) { | ||
93 | if (!(value instanceof Tuple1 tuple1)) { | ||
94 | return Set.of(); | ||
95 | } | ||
96 | return (() -> new CursorAsIterator<>(model.getInterpretation(getSymbol()).getAdjacent(slot, tuple1.get(0)), | ||
97 | this::forwardMap, this::filter)); | ||
98 | } | ||
99 | |||
100 | @Override | ||
86 | public List<Parameter> getParameters() { | 101 | public List<Parameter> getParameters() { |
87 | return parameters; | 102 | return parameters; |
88 | } | 103 | } |