diff options
Diffstat (limited to 'subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/CallbackNode.java')
-rw-r--r-- | subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/CallbackNode.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/CallbackNode.java b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/CallbackNode.java new file mode 100644 index 00000000..c68036b5 --- /dev/null +++ b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/CallbackNode.java | |||
@@ -0,0 +1,37 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2012, Bergmann Gabor, 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.single; | ||
10 | |||
11 | import tools.refinery.viatra.runtime.matchers.backend.IUpdateable; | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | ||
13 | import tools.refinery.viatra.runtime.matchers.util.Direction; | ||
14 | import tools.refinery.viatra.runtime.rete.misc.SimpleReceiver; | ||
15 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | ||
16 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | ||
17 | |||
18 | /** | ||
19 | * @author Bergmann Gabor | ||
20 | * | ||
21 | */ | ||
22 | public class CallbackNode extends SimpleReceiver { | ||
23 | |||
24 | IUpdateable updateable; | ||
25 | |||
26 | public CallbackNode(ReteContainer reteContainer, IUpdateable updateable) | ||
27 | { | ||
28 | super(reteContainer); | ||
29 | this.updateable = updateable; | ||
30 | } | ||
31 | |||
32 | @Override | ||
33 | public void update(Direction direction, Tuple updateElement, Timestamp timestamp) { | ||
34 | updateable.update(updateElement, direction == Direction.INSERT); | ||
35 | } | ||
36 | |||
37 | } | ||