diff options
Diffstat (limited to 'subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java')
-rw-r--r-- | subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java b/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java index 1224076c..bbec1e73 100644 --- a/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java +++ b/subprojects/store/src/main/java/tools/refinery/store/query/view/RelationView.java | |||
@@ -2,49 +2,49 @@ package tools.refinery.store.query.view; | |||
2 | 2 | ||
3 | import tools.refinery.store.map.CursorAsIterator; | 3 | import tools.refinery.store.map.CursorAsIterator; |
4 | import tools.refinery.store.model.Model; | 4 | import tools.refinery.store.model.Model; |
5 | import tools.refinery.store.model.representation.Relation; | 5 | import tools.refinery.store.representation.Symbol; |
6 | import tools.refinery.store.tuple.Tuple; | 6 | import tools.refinery.store.tuple.Tuple; |
7 | 7 | ||
8 | import java.util.Objects; | 8 | import java.util.Objects; |
9 | import java.util.UUID; | 9 | import java.util.UUID; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Represents a view of a {@link Relation} that can be queried. | 12 | * Represents a view of a {@link Symbol} that can be queried. |
13 | * | 13 | * |
14 | * @param <D> | 14 | * @param <T> |
15 | * @author Oszkar Semerath | 15 | * @author Oszkar Semerath |
16 | */ | 16 | */ |
17 | public abstract non-sealed class RelationView<D> implements AnyRelationView { | 17 | public abstract non-sealed class RelationView<T> implements AnyRelationView { |
18 | private final Relation<D> representation; | 18 | private final Symbol<T> symbol; |
19 | 19 | ||
20 | private final String name; | 20 | private final String name; |
21 | 21 | ||
22 | protected RelationView(Relation<D> representation, String name) { | 22 | protected RelationView(Symbol<T> symbol, String name) { |
23 | this.representation = representation; | 23 | this.symbol = symbol; |
24 | this.name = name; | 24 | this.name = name; |
25 | } | 25 | } |
26 | 26 | ||
27 | protected RelationView(Relation<D> representation) { | 27 | protected RelationView(Symbol<T> representation) { |
28 | this(representation, UUID.randomUUID().toString()); | 28 | this(representation, UUID.randomUUID().toString()); |
29 | } | 29 | } |
30 | 30 | ||
31 | @Override | 31 | @Override |
32 | public Relation<D> getRepresentation() { | 32 | public Symbol<T> getSymbol() { |
33 | return representation; | 33 | return symbol; |
34 | } | 34 | } |
35 | 35 | ||
36 | @Override | 36 | @Override |
37 | public String getName() { | 37 | public String name() { |
38 | return representation.getName() + "#" + name; | 38 | return symbol.name() + "#" + name; |
39 | } | 39 | } |
40 | 40 | ||
41 | public abstract boolean filter(Tuple key, D value); | 41 | public abstract boolean filter(Tuple key, T value); |
42 | 42 | ||
43 | public abstract Object[] forwardMap(Tuple key, D value); | 43 | public abstract Object[] forwardMap(Tuple key, T value); |
44 | 44 | ||
45 | @Override | 45 | @Override |
46 | public Iterable<Object[]> getAll(Model model) { | 46 | public Iterable<Object[]> getAll(Model model) { |
47 | return (() -> new CursorAsIterator<>(model.getAll(representation), this::forwardMap, this::filter)); | 47 | return (() -> new CursorAsIterator<>(model.getInterpretation(symbol).getAll(), this::forwardMap, this::filter)); |
48 | } | 48 | } |
49 | 49 | ||
50 | @Override | 50 | @Override |
@@ -52,11 +52,11 @@ public abstract non-sealed class RelationView<D> implements AnyRelationView { | |||
52 | if (this == o) return true; | 52 | if (this == o) return true; |
53 | if (o == null || getClass() != o.getClass()) return false; | 53 | if (o == null || getClass() != o.getClass()) return false; |
54 | RelationView<?> that = (RelationView<?>) o; | 54 | RelationView<?> that = (RelationView<?>) o; |
55 | return Objects.equals(representation, that.representation) && Objects.equals(name, that.name); | 55 | return Objects.equals(symbol, that.symbol) && Objects.equals(name, that.name); |
56 | } | 56 | } |
57 | 57 | ||
58 | @Override | 58 | @Override |
59 | public int hashCode() { | 59 | public int hashCode() { |
60 | return Objects.hash(representation, name); | 60 | return Objects.hash(symbol, name); |
61 | } | 61 | } |
62 | } | 62 | } |