aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/Indexer.java
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/Indexer.java')
-rw-r--r--subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/Indexer.java71
1 files changed, 71 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/Indexer.java b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/Indexer.java
new file mode 100644
index 00000000..fc9d7781
--- /dev/null
+++ b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/Indexer.java
@@ -0,0 +1,71 @@
1/*******************************************************************************
2 * Copyright (c) 2004-2008 Gabor Bergmann and Daniel Varro
3 * This program and the accompanying materials are made available under the
4 * terms of the Eclipse Public License v. 2.0 which is available at
5 * http://www.eclipse.org/legal/epl-v20.html.
6 *
7 * SPDX-License-Identifier: EPL-2.0
8 *******************************************************************************/
9
10package tools.refinery.viatra.runtime.rete.index;
11
12import java.util.Collection;
13import java.util.Map;
14
15import tools.refinery.viatra.runtime.matchers.tuple.Tuple;
16import tools.refinery.viatra.runtime.matchers.tuple.TupleMask;
17import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline;
18import tools.refinery.viatra.runtime.rete.network.Node;
19import tools.refinery.viatra.runtime.rete.network.Supplier;
20import tools.refinery.viatra.runtime.rete.network.communication.Timestamp;
21
22/**
23 * A node that indexes incoming Tuples by their signatures as specified by a TupleMask. Notifies listeners about such
24 * update events through the IndexerListener.
25 *
26 * Signature tuples are created by transforming the update tuples using the mask. Tuples stored with the same signature
27 * are grouped together. The group or a reduction thereof is retrievable.
28 *
29 * @author Gabor Bergmann
30 */
31public interface Indexer extends Node {
32 /**
33 * @return the mask by which the contents are indexed.
34 */
35 public TupleMask getMask();
36
37 /**
38 * @return the node whose contents are indexed.
39 */
40 public Supplier getParent();
41
42 /**
43 * @return all stored tuples that conform to the specified signature, null if there are none such. CONTRACT: do not
44 * modify!
45 */
46 public Collection<Tuple> get(Tuple signature);
47
48 /**
49 * @since 2.4
50 */
51 default public Map<Tuple, Timeline<Timestamp>> getTimeline(Tuple signature) {
52 throw new UnsupportedOperationException();
53 }
54
55 /**
56 * This indexer will be updated whenever a Rete update is sent to the active node (or an equivalent time slot
57 * allotted to it). The active node is typically the indexer itself, but it can be a different node such as its
58 * parent.
59 *
60 * @return the active node that operates this indexer
61 */
62 public Node getActiveNode();
63
64
65 public Collection<IndexerListener> getListeners();
66
67 public void attachListener(IndexerListener listener);
68
69 public void detachListener(IndexerListener listener);
70
71}