nl.tudelft.simulation.messaging.queues
Class MessageQueue
java.lang.Object
nl.tudelft.simulation.messaging.queues.MessageQueue
- All Implemented Interfaces:
- MessageQueueInterface, java.io.Serializable
- public class MessageQueue
- extends java.lang.Object
- implements MessageQueueInterface
The MessageQueue sorts messages on priority, and within the same priority on
the moment the messages entered the queue.
Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
Delft, the Netherlands. All rights reserved.
See for project information
www.simulation.tudelft.nl .
The source code and binary code of this software is proprietary information
of Delft University of Technology.
- Version:
- $$Revision: 1.3 $$ $$Date: 2005/04/08 11:29:13 $$
- Author:
- Peter
Jacobs , Stijn-Pieter van Houten
, Alexander
Verbraeck
- See Also:
- Serialized Form
|
Constructor Summary |
MessageQueue(java.util.Comparator comparator)
Make a new MessageQueue |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MessageQueue
public MessageQueue(java.util.Comparator comparator)
- Make a new MessageQueue
- Parameters:
comparator - (or chain) the comparator to use
add
public void add(Message message)
- Specified by:
add in interface MessageQueueInterface
- Parameters:
message - new message to add- See Also:
#add(nl.tudelft.simulation.messaging.Message)
remove
public void remove(Message message)
- Specified by:
remove in interface MessageQueueInterface
- Parameters:
message - message to remove- See Also:
#remove(nl.tudelft.simulation.messaging.Message)
first
public Message first()
- Specified by:
first in interface MessageQueueInterface
- Returns:
- the first message according to the sorting mechanism
- See Also:
MessageQueueInterface.first()
removeFirst
public Message removeFirst()
- Specified by:
removeFirst in interface MessageQueueInterface
- Returns:
- the first message removed according to the sorting mechanism
- See Also:
MessageQueueInterface.removeFirst()
size
public int size()
- Specified by:
size in interface MessageQueueInterface
- Returns:
- the number of messages in the queue
- See Also:
MessageQueueInterface.size()
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface MessageQueueInterface
- Returns:
- whether the queue is empty or not
- See Also:
MessageQueueInterface.isEmpty()
Copyright © 2004-2005 Delft University of Technology, the Netherlands. All Rights Reserved.