public class AdaptiveMailbox extends java.lang.Object implements Mailbox
DefaultMailbox
or as an UpdateSplittingMailbox
. The decision is made by the
CommunicationTracker
based on the position of the mailbox's receiver in the communication network. See
CommunicationTracker.refreshSplitFlag(Node)
for more details.Modifier and Type | Field and Description |
---|---|
protected ReteContainer |
container |
protected boolean |
fallThrough |
protected CommunicationGroup |
group |
protected Receiver |
receiver |
protected boolean |
split |
protected AdaptableMailbox |
wrappedMailbox |
Constructor and Description |
---|
AdaptiveMailbox(Receiver receiver,
ReteContainer container) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all partial matchings stored in memory
|
void |
deliverAll(MessageKind kind)
Delivers all messages of the given kind from this mailbox.
|
CommunicationGroup |
getCurrentGroup()
Returns the
CommunicationGroup of the receiver of this mailbox. |
Receiver |
getReceiver()
Returns the
Receiver of this mailbox. |
boolean |
isEmpty()
Returns true if this mailbox is empty.
|
boolean |
isFallThrough() |
void |
postMessage(Direction direction,
Tuple update)
Posts a new message to this mailbox.
|
void |
setCurrentGroup(CommunicationGroup group)
Sets the
CommunicationGroup that the receiver of this mailbox is associated with. |
void |
setFallThrough(boolean fallThrough)
Controlled by the
CommunicationTracker which can determine based on node type and network topology
whether fall-through is allowed. |
void |
setSplitFlag(boolean splitValue) |
java.lang.String |
toString() |
protected boolean fallThrough
protected boolean split
protected AdaptableMailbox wrappedMailbox
protected final Receiver receiver
protected final ReteContainer container
protected CommunicationGroup group
public AdaptiveMailbox(Receiver receiver, ReteContainer container)
public void postMessage(Direction direction, Tuple update)
Mailbox
postMessage
in interface Mailbox
direction
- the direction of the updateupdate
- the update elementpublic void deliverAll(MessageKind kind)
Mailbox
deliverAll
in interface Mailbox
kind
- the message kindpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean isFallThrough()
public void setFallThrough(boolean fallThrough)
CommunicationTracker
which can determine based on node type and network topology
whether fall-through is allowed.public void setSplitFlag(boolean splitValue)
public boolean isEmpty()
Mailbox
public void clear()
Clearable
public Receiver getReceiver()
Mailbox
Receiver
of this mailbox.getReceiver
in interface Mailbox
public CommunicationGroup getCurrentGroup()
Mailbox
CommunicationGroup
of the receiver of this mailbox.getCurrentGroup
in interface IGroupable
getCurrentGroup
in interface Mailbox
public void setCurrentGroup(CommunicationGroup group)
Mailbox
CommunicationGroup
that the receiver of this mailbox is associated with.setCurrentGroup
in interface IGroupable
setCurrentGroup
in interface Mailbox
group
- the communication group