public class DefaultMailbox extends java.lang.Object implements AdaptableMailbox
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 Mailbox |
adapter |
protected java.util.Map<Tuple,java.lang.Integer> |
buffer |
protected ReteContainer |
container |
protected boolean |
delivering |
protected CommunicationGroup |
group |
protected java.util.Map<Tuple,java.lang.Integer> |
queue |
protected Receiver |
receiver |
Constructor and Description |
---|
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.util.Map<Tuple,java.lang.Integer> |
getActiveQueue() |
Mailbox |
getAdapter() |
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.
|
void |
postMessage(Direction direction,
Tuple update)
Posts a new message to this mailbox.
|
void |
setAdapter(Mailbox adapter) |
void |
setCurrentGroup(CommunicationGroup group)
Sets the
CommunicationGroup that the receiver of this mailbox is associated with. |
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 Mailbox adapter
protected CommunicationGroup group
public DefaultMailbox(Receiver receiver, ReteContainer container)
protected java.util.Map<Tuple,java.lang.Integer> getActiveQueue()
public Mailbox getAdapter()
getAdapter
in interface AdaptableMailbox
public void setAdapter(Mailbox adapter)
setAdapter
in interface AdaptableMailbox
public boolean isEmpty()
Mailbox
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 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