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)
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 Receiver getReceiver()
Mailbox
Receiver
of this mailbox.getReceiver
in interface Mailbox
public void clear()
Clearable
public boolean isFallThrough()
public void setFallThrough(boolean fallThrough)
CommunicationTracker
which can determine
based on node type and network topology whether fall-through is allowed.