aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryIdentityIndexer.java
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryIdentityIndexer.java')
-rw-r--r--subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryIdentityIndexer.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryIdentityIndexer.java b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryIdentityIndexer.java
new file mode 100644
index 00000000..59b75c33
--- /dev/null
+++ b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryIdentityIndexer.java
@@ -0,0 +1,55 @@
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.List;
14
15import tools.refinery.viatra.runtime.matchers.tuple.Tuple;
16import tools.refinery.viatra.runtime.rete.network.Receiver;
17import tools.refinery.viatra.runtime.rete.network.ReteContainer;
18import tools.refinery.viatra.runtime.rete.network.Supplier;
19
20/**
21 * Defines a trivial indexer that identically projects the contents of a memory-equipped node, and can therefore save
22 * space. Can only exist in connection with a memory, and must be operated by another node. Do not attach parents
23 * directly!
24 *
25 * @noimplement Rely on the provided implementations
26 * @noreference Use only via standard Node and Indexer interfaces
27 * @noinstantiate This class is not intended to be instantiated by clients.
28 * @author Gabor Bergmann
29 */
30
31public class MemoryIdentityIndexer extends IdentityIndexer {
32
33 protected final Collection<Tuple> memory;
34
35 /**
36 * @param reteContainer
37 * @param tupleWidth
38 * the width of the tuples of memoryNode
39 * @param memory
40 * the memory whose contents are to be identity-indexed
41 * @param parent
42 * the parent node that owns the memory
43 */
44 public MemoryIdentityIndexer(ReteContainer reteContainer, int tupleWidth, Collection<Tuple> memory,
45 Supplier parent, Receiver activeNode, List<ListenerSubscription> sharedSubscriptionList) {
46 super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList);
47 this.memory = memory;
48 }
49
50 @Override
51 protected Collection<Tuple> getTuples() {
52 return this.memory;
53 }
54
55}