Class DefaultMailbox
java.lang.Object
tools.refinery.interpreter.rete.network.mailbox.timeless.DefaultMailbox
- All Implemented Interfaces:
Clearable
,IGroupable
,AdaptableMailbox
,Mailbox
Default mailbox implementation.
Usually, the mailbox performs counting of messages so that they can cancel each other out. However, if marked as a fall-through mailbox, than update messages are delivered directly to the receiver node to reduce overhead.
- Since:
- 2.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
void
deliverAll
(MessageSelector kind) Delivers all messages according to the given selector from this mailbox.Returns theCommunicationGroup
of the receiver of this mailbox.Returns theReceiver
of this mailbox.boolean
isEmpty()
Returns true if this mailbox is empty.void
postMessage
(Direction direction, Tuple update, Timestamp timestamp) Posts a new message to this mailbox.void
setAdapter
(Mailbox adapter) void
Sets theCommunicationGroup
that the receiver of this mailbox is associated with.toString()
-
Field Details
-
queue
-
buffer
-
receiver
-
container
-
delivering
protected boolean delivering -
adapter
-
group
-
-
Constructor Details
-
DefaultMailbox
-
-
Method Details
-
getActiveQueue
-
getAdapter
- Specified by:
getAdapter
in interfaceAdaptableMailbox
-
setAdapter
- Specified by:
setAdapter
in interfaceAdaptableMailbox
-
isEmpty
public boolean isEmpty()Description copied from interface:Mailbox
Returns true if this mailbox is empty. -
postMessage
Description copied from interface:Mailbox
Posts a new message to this mailbox.- Specified by:
postMessage
in interfaceMailbox
- Parameters:
direction
- the direction of the updateupdate
- the update element
-
deliverAll
Description copied from interface:Mailbox
Delivers all messages according to the given selector from this mailbox. The selector can also be null. In this case, no special separation is expected between the messages.- Specified by:
deliverAll
in interfaceMailbox
- Parameters:
kind
- the message selector
-
toString
-
getReceiver
Description copied from interface:Mailbox
Returns theReceiver
of this mailbox.- Specified by:
getReceiver
in interfaceMailbox
- Returns:
- the receiver
-
clear
public void clear() -
getCurrentGroup
Description copied from interface:Mailbox
Returns theCommunicationGroup
of the receiver of this mailbox.- Specified by:
getCurrentGroup
in interfaceIGroupable
- Specified by:
getCurrentGroup
in interfaceMailbox
- Returns:
- the communication group
-
setCurrentGroup
Description copied from interface:Mailbox
Sets theCommunicationGroup
that the receiver of this mailbox is associated with.- Specified by:
setCurrentGroup
in interfaceIGroupable
- Specified by:
setCurrentGroup
in interfaceMailbox
- Parameters:
group
- the communication group
-