diff options
Diffstat (limited to 'subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/TimelessCommunicationTracker.java')
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/TimelessCommunicationTracker.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/TimelessCommunicationTracker.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/TimelessCommunicationTracker.java index 77f40fc3..02116d71 100644 --- a/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/TimelessCommunicationTracker.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/TimelessCommunicationTracker.java | |||
@@ -1,5 +1,6 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | * Copyright (c) 2010-2019, Tamas Szabo, Istvan Rath and Daniel Varro | 2 | * Copyright (c) 2010-2019, Tamas Szabo, Istvan Rath and Daniel Varro |
3 | * Copyright (c) 2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * This program and the accompanying materials are made available under the | 4 | * 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 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 6 | * http://www.eclipse.org/legal/epl-v20.html. |
@@ -8,11 +9,7 @@ | |||
8 | *******************************************************************************/ | 9 | *******************************************************************************/ |
9 | package tools.refinery.interpreter.rete.network.communication.timeless; | 10 | package tools.refinery.interpreter.rete.network.communication.timeless; |
10 | 11 | ||
11 | import java.util.Collection; | 12 | import org.apache.log4j.Logger; |
12 | import java.util.HashSet; | ||
13 | import java.util.Set; | ||
14 | import java.util.Map.Entry; | ||
15 | |||
16 | import tools.refinery.interpreter.rete.index.DualInputNode; | 13 | import tools.refinery.interpreter.rete.index.DualInputNode; |
17 | import tools.refinery.interpreter.rete.index.Indexer; | 14 | import tools.refinery.interpreter.rete.index.Indexer; |
18 | import tools.refinery.interpreter.rete.index.IndexerListener; | 15 | import tools.refinery.interpreter.rete.index.IndexerListener; |
@@ -26,6 +23,11 @@ import tools.refinery.interpreter.rete.network.communication.MessageSelector; | |||
26 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; | 23 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
27 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 24 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
28 | 25 | ||
26 | import java.util.Collection; | ||
27 | import java.util.HashSet; | ||
28 | import java.util.Map.Entry; | ||
29 | import java.util.Set; | ||
30 | |||
29 | /** | 31 | /** |
30 | * Timeless implementation of the communication tracker. | 32 | * Timeless implementation of the communication tracker. |
31 | * | 33 | * |
@@ -33,10 +35,13 @@ import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChanging | |||
33 | * @since 2.2 | 35 | * @since 2.2 |
34 | */ | 36 | */ |
35 | public class TimelessCommunicationTracker extends CommunicationTracker { | 37 | public class TimelessCommunicationTracker extends CommunicationTracker { |
38 | public TimelessCommunicationTracker(Logger logger) { | ||
39 | super(logger); | ||
40 | } | ||
36 | 41 | ||
37 | @Override | 42 | @Override |
38 | protected CommunicationGroup createGroup(Node representative, int index) { | 43 | protected CommunicationGroup createGroup(Node representative, int index) { |
39 | final boolean isSingleton = this.sccInformationProvider.sccs.getPartition(representative).size() == 1; | 44 | final boolean isSingleton = isSingleton(representative); |
40 | final boolean isReceiver = representative instanceof Receiver; | 45 | final boolean isReceiver = representative instanceof Receiver; |
41 | final boolean isPosetIndifferent = isReceiver | 46 | final boolean isPosetIndifferent = isReceiver |
42 | && ((Receiver) representative).getMailbox() instanceof BehaviorChangingMailbox; | 47 | && ((Receiver) representative).getMailbox() instanceof BehaviorChangingMailbox; |
@@ -95,14 +100,13 @@ public class TimelessCommunicationTracker extends CommunicationTracker { | |||
95 | final Mailbox mailbox = ((Receiver) node).getMailbox(); | 100 | final Mailbox mailbox = ((Receiver) node).getMailbox(); |
96 | if (mailbox instanceof BehaviorChangingMailbox) { | 101 | if (mailbox instanceof BehaviorChangingMailbox) { |
97 | final CommunicationGroup group = this.groupMap.get(node); | 102 | final CommunicationGroup group = this.groupMap.get(node); |
98 | final Set<Node> sccNodes = this.sccInformationProvider.sccs.getPartition(node); | ||
99 | // a default mailbox must split its messages iff | 103 | // a default mailbox must split its messages iff |
100 | // (1) its receiver is in a recursive group and | 104 | // (1) its receiver is in a recursive group and |
101 | final boolean c1 = group.isRecursive(); | 105 | final boolean c1 = group.isRecursive(); |
102 | // (2) its receiver is at the SCC boundary of that group | 106 | // (2) its receiver is at the SCC boundary of that group |
103 | final boolean c2 = isAtSCCBoundary(node); | 107 | final boolean c2 = isAtSCCBoundary(node); |
104 | // (3) its group consists of more than one node | 108 | // (3) its group consists of more than one node |
105 | final boolean c3 = sccNodes.size() > 1; | 109 | final boolean c3 = isSingleton(node); |
106 | ((BehaviorChangingMailbox) mailbox).setSplitFlag(c1 && c2 && c3); | 110 | ((BehaviorChangingMailbox) mailbox).setSplitFlag(c1 && c2 && c3); |
107 | } | 111 | } |
108 | } | 112 | } |