Package jade.core
Interface MessageQueue
-
- All Known Implementing Classes:
ExtendedMessageQueue,TemplateBasedMessageQueue
public interface MessageQueueThe interface to be implemented by agent message queue implementations- Author:
- Arend Freije
- See Also:
Agent.createMessageQueue()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddFirst(ACLMessage msg)Add a message to the front of this queue.voidaddLast(ACLMessage msg)Add a message to the end of this queue.voidcopyTo(List list)Copy all messages to a given list.intgetMaxSize()Return the maximum size of this queue.booleanisEmpty()Return true when this queue contains no messages.ACLMessagereceive(MessageTemplate pattern)Return and remove the first message that matches the specified message template.List<ACLMessage>receive(MessageTemplate pattern, int max)Return and remove the first n messages that match the specified message template.voidsetMaxSize(int newSize)Set the maximum size of this queue.intsize()
-
-
-
Method Detail
-
addFirst
void addFirst(ACLMessage msg)
Add a message to the front of this queue.
-
addLast
void addLast(ACLMessage msg)
Add a message to the end of this queue.
-
getMaxSize
int getMaxSize()
Return the maximum size of this queue. This queue may remove old messages to prevent exeding the maximum size.
-
setMaxSize
void setMaxSize(int newSize)
Set the maximum size of this queue. This queue may remove old messages to prevent exeding the maximum size.
-
isEmpty
boolean isEmpty()
Return true when this queue contains no messages.
-
receive
ACLMessage receive(MessageTemplate pattern)
Return and remove the first message that matches the specified message template.
-
receive
List<ACLMessage> receive(MessageTemplate pattern, int max)
Return and remove the first n messages that match the specified message template.
-
copyTo
void copyTo(List list)
Copy all messages to a given list.
-
size
int size()
- Returns:
- the number of messages currently in the queue
-
-