public class DefaultMailbox extends java.lang.Object implements Mailbox
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.
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<Tuple,java.lang.Integer> |
buffer |
protected ReteContainer |
container |
protected boolean |
delivering |
protected boolean |
fallThrough |
protected java.util.Map<Tuple,java.lang.Integer> |
queue |
protected Receiver |
receiver |
protected CommunicationTracker |
tracker |
| Constructor and Description |
|---|
DefaultMailbox() |
DefaultMailbox(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.
|
protected java.lang.Integer |
get(Tuple key) |
protected java.util.Map<Tuple,java.lang.Integer> |
getActiveQueue() |
Receiver |
getReceiver()
Returns the
Receiver of this mailbox. |
protected boolean |
isEmpty() |
boolean |
isFallThrough() |
protected java.util.Set<Tuple> |
keySet() |
void |
postMessage(Direction direction,
Tuple update)
Posts a new message to this mailbox.
|
void |
setFallThrough(boolean fallThrough)
Controlled by the
CommunicationTracker which can determine
based on node type and network topology whether fall-through is allowed. |
java.lang.String |
toString() |
protected java.util.Map<Tuple,java.lang.Integer> queue
protected java.util.Map<Tuple,java.lang.Integer> buffer
protected final Receiver receiver
protected final ReteContainer container
protected boolean delivering
protected final CommunicationTracker tracker
protected boolean fallThrough
public DefaultMailbox()
public DefaultMailbox(Receiver receiver, ReteContainer container)
protected java.util.Map<Tuple,java.lang.Integer> getActiveQueue()
protected java.lang.Integer get(Tuple key)
protected boolean isEmpty()
protected java.util.Set<Tuple> keySet()
public void postMessage(Direction direction, Tuple update)
MailboxpostMessage in interface Mailboxdirection - the direction of the updateupdate - the update elementpublic void deliverAll(MessageKind kind)
MailboxdeliverAll in interface Mailboxkind - the message kindpublic java.lang.String toString()
toString in class java.lang.Objectpublic Receiver getReceiver()
MailboxReceiver of this mailbox.getReceiver in interface Mailboxpublic void clear()
Clearablepublic boolean isFallThrough()
public void setFallThrough(boolean fallThrough)
CommunicationTracker which can determine
based on node type and network topology whether fall-through is allowed.