blob: 759b1db5aaa5795b5fffbae43f409f21f0bda273 (
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.interpreter.rete.remote;
import java.util.Collection;
import java.util.Map;
import tools.refinery.interpreter.rete.network.ReteContainer;
import tools.refinery.interpreter.rete.network.communication.Timestamp;
import tools.refinery.interpreter.rete.single.SingleInputNode;
import tools.refinery.interpreter.matchers.tuple.Tuple;
import tools.refinery.interpreter.matchers.util.Direction;
import tools.refinery.interpreter.matchers.util.timeline.Timeline;
/**
* This node receives updates from a remote supplier; no local updates are expected.
*
* @author Gabor Bergmann
*
*/
public class RemoteSupplier extends SingleInputNode {
RemoteReceiver counterpart;
public RemoteSupplier(ReteContainer reteContainer, RemoteReceiver counterpart) {
super(reteContainer);
this.counterpart = counterpart;
counterpart.addTarget(reteContainer.makeAddress(this));
}
@Override
public void pullInto(Collection<Tuple> collector, boolean flush) {
Collection<Tuple> pulled = counterpart.remotePull(flush);
collector.addAll(pulled);
}
@Override
public void pullIntoWithTimeline(Map<Tuple, Timeline<Timestamp>> collector, boolean flush) {
throw new UnsupportedOperationException();
}
@Override
public void update(Direction direction, Tuple updateElement, Timestamp timestamp) {
propagateUpdate(direction, updateElement, timestamp);
}
}
|