diff options
Diffstat (limited to 'subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteSupplier.java')
-rw-r--r-- | subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteSupplier.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteSupplier.java b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteSupplier.java new file mode 100644 index 00000000..cbe4d177 --- /dev/null +++ b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteSupplier.java | |||
@@ -0,0 +1,54 @@ | |||
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 | |||
10 | package tools.refinery.viatra.runtime.rete.remote; | ||
11 | |||
12 | import java.util.Collection; | ||
13 | import java.util.Map; | ||
14 | |||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | ||
16 | import tools.refinery.viatra.runtime.matchers.util.Direction; | ||
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | ||
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | ||
19 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | ||
20 | import tools.refinery.viatra.runtime.rete.single.SingleInputNode; | ||
21 | |||
22 | /** | ||
23 | * This node receives updates from a remote supplier; no local updates are expected. | ||
24 | * | ||
25 | * @author Gabor Bergmann | ||
26 | * | ||
27 | */ | ||
28 | public class RemoteSupplier extends SingleInputNode { | ||
29 | |||
30 | RemoteReceiver counterpart; | ||
31 | |||
32 | public RemoteSupplier(ReteContainer reteContainer, RemoteReceiver counterpart) { | ||
33 | super(reteContainer); | ||
34 | this.counterpart = counterpart; | ||
35 | counterpart.addTarget(reteContainer.makeAddress(this)); | ||
36 | } | ||
37 | |||
38 | @Override | ||
39 | public void pullInto(Collection<Tuple> collector, boolean flush) { | ||
40 | Collection<Tuple> pulled = counterpart.remotePull(flush); | ||
41 | collector.addAll(pulled); | ||
42 | } | ||
43 | |||
44 | @Override | ||
45 | public void pullIntoWithTimeline(Map<Tuple, Timeline<Timestamp>> collector, boolean flush) { | ||
46 | throw new UnsupportedOperationException(); | ||
47 | } | ||
48 | |||
49 | @Override | ||
50 | public void update(Direction direction, Tuple updateElement, Timestamp timestamp) { | ||
51 | propagateUpdate(direction, updateElement, timestamp); | ||
52 | } | ||
53 | |||
54 | } | ||