blob: 204fe433a6ddf6e41f7300e733e06c059d9e0946 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*******************************************************************************
* Copyright (c) 2004-2008 Gabor Bergmann and Daniel Varro
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-v20.html.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package tools.refinery.viatra.runtime.rete.index;
import java.util.Collection;
import java.util.List;
import tools.refinery.viatra.runtime.matchers.tuple.Tuple;
import tools.refinery.viatra.runtime.rete.network.Receiver;
import tools.refinery.viatra.runtime.rete.network.ReteContainer;
import tools.refinery.viatra.runtime.rete.network.Supplier;
/**
* Defines a trivial indexer that projects the contents of a memory-equipped node to the empty tuple, and can therefore
* save space. Can only exist in connection with a memory, and must be operated by another node. Do not attach parents
* directly!
*
* @author Gabor Bergmann
* @noimplement Rely on the provided implementations
* @noreference Use only via standard Node and Indexer interfaces
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class MemoryNullIndexer extends NullIndexer {
Collection<Tuple> memory;
/**
* @param reteContainer
* @param tupleWidth
* the width of the tuples of memoryNode
* @param memory
* the memory whose contents are to be null-indexed
* @param parent
* the parent node that owns the memory
*/
public MemoryNullIndexer(ReteContainer reteContainer, int tupleWidth, Collection<Tuple> memory,
Supplier parent, Receiver activeNode, List<ListenerSubscription> sharedSubscriptionList) {
super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList);
this.memory = memory;
}
@Override
protected Collection<Tuple> getTuples() {
return this.memory;
}
}
|