diff options
Diffstat (limited to 'subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/Mailbox.java')
-rw-r--r-- | subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/Mailbox.java | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/Mailbox.java b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/Mailbox.java new file mode 100644 index 00000000..05005974 --- /dev/null +++ b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/Mailbox.java | |||
@@ -0,0 +1,78 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2016, 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.network.mailbox; | ||
10 | |||
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | ||
12 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | ||
13 | import tools.refinery.viatra.runtime.matchers.util.Direction; | ||
14 | import tools.refinery.viatra.runtime.rete.network.IGroupable; | ||
15 | import tools.refinery.viatra.runtime.rete.network.Receiver; | ||
16 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | ||
17 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | ||
18 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | ||
19 | |||
20 | /** | ||
21 | * A mailbox is associated with every {@link Receiver}. Messages can be sent to a {@link Receiver} by posting them into | ||
22 | * the mailbox. Different mailbox implementations may differ in the way how they deliver the posted messages. | ||
23 | * | ||
24 | * @author Tamas Szabo | ||
25 | * @since 2.0 | ||
26 | * | ||
27 | */ | ||
28 | public interface Mailbox extends Clearable, IGroupable { | ||
29 | |||
30 | /** | ||
31 | * Posts a new message to this mailbox. | ||
32 | * | ||
33 | * @param direction | ||
34 | * the direction of the update | ||
35 | * @param update | ||
36 | * the update element | ||
37 | * @since 2.4 | ||
38 | */ | ||
39 | public void postMessage(final Direction direction, final Tuple update, final Timestamp timestamp); | ||
40 | |||
41 | /** | ||
42 | * Delivers all messages according to the given selector from this mailbox. The selector can also be null. In this case, no | ||
43 | * special separation is expected between the messages. | ||
44 | * | ||
45 | * @param selector the message selector | ||
46 | */ | ||
47 | public void deliverAll(final MessageSelector selector); | ||
48 | |||
49 | /** | ||
50 | * Returns the {@link Receiver} of this mailbox. | ||
51 | * | ||
52 | * @return the receiver | ||
53 | */ | ||
54 | public Receiver getReceiver(); | ||
55 | |||
56 | /** | ||
57 | * Returns the {@link CommunicationGroup} of the receiver of this mailbox. | ||
58 | * | ||
59 | * @return the communication group | ||
60 | */ | ||
61 | public CommunicationGroup getCurrentGroup(); | ||
62 | |||
63 | /** | ||
64 | * Sets the {@link CommunicationGroup} that the receiver of this mailbox is associated with. | ||
65 | * | ||
66 | * @param group | ||
67 | * the communication group | ||
68 | */ | ||
69 | public void setCurrentGroup(final CommunicationGroup group); | ||
70 | |||
71 | /** | ||
72 | * Returns true if this mailbox is empty. | ||
73 | * | ||
74 | * @return | ||
75 | */ | ||
76 | public boolean isEmpty(); | ||
77 | |||
78 | } | ||