diff options
Diffstat (limited to 'subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryNullIndexer.java')
-rw-r--r-- | subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryNullIndexer.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryNullIndexer.java b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryNullIndexer.java new file mode 100644 index 00000000..0386b006 --- /dev/null +++ b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryNullIndexer.java | |||
@@ -0,0 +1,49 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2019, Tamas Szabo, Istvan Rath 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 | package tools.refinery.viatra.runtime.rete.index.timely; | ||
10 | |||
11 | import java.util.Collection; | ||
12 | import java.util.List; | ||
13 | import java.util.Map; | ||
14 | |||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | ||
16 | import tools.refinery.viatra.runtime.matchers.util.TimelyMemory; | ||
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | ||
18 | import tools.refinery.viatra.runtime.rete.index.NullIndexer; | ||
19 | import tools.refinery.viatra.runtime.rete.network.Receiver; | ||
20 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | ||
21 | import tools.refinery.viatra.runtime.rete.network.Supplier; | ||
22 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | ||
23 | |||
24 | public class TimelyMemoryNullIndexer extends NullIndexer { | ||
25 | |||
26 | protected final TimelyMemory<Timestamp> memory; | ||
27 | |||
28 | public TimelyMemoryNullIndexer(final ReteContainer reteContainer, final int tupleWidth, | ||
29 | final TimelyMemory<Timestamp> memory, final Supplier parent, | ||
30 | final Receiver activeNode, final List<ListenerSubscription> sharedSubscriptionList) { | ||
31 | super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList); | ||
32 | this.memory = memory; | ||
33 | } | ||
34 | |||
35 | @Override | ||
36 | public Map<Tuple, Timeline<Timestamp>> getTimeline(final Tuple signature) { | ||
37 | if (nullSignature.equals(signature)) { | ||
38 | return isEmpty() ? null : this.memory.asMap(); | ||
39 | } else { | ||
40 | return null; | ||
41 | } | ||
42 | } | ||
43 | |||
44 | @Override | ||
45 | protected Collection<Tuple> getTuples() { | ||
46 | return this.memory.getTuplesAtInfinity(); | ||
47 | } | ||
48 | |||
49 | } | ||