View Javadoc

1   /*
2    * @(#)MessageQueueInterface.java Feb 17, 2004
3    * 
4    * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * See for project information <a href="http://www.simulation.tudelft.nl/">
8    * www.simulation.tudelft.nl </a>.
9    * 
10   * The source code and binary code of this software is proprietary information
11   * of Delft University of Technology.
12   */
13  package nl.tudelft.simulation.messaging.queues;
14  
15  import java.io.Serializable;
16  
17  import nl.tudelft.simulation.messaging.Message;
18  
19  /***
20   * The MessageQueueInterface gives the possibility to store and retrieve
21   * messages, according to different types of sorting mechanisms. Examples are
22   * FIFO and LIFO mechanisms.
23   * 
24   * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
25   * Delft, the Netherlands. All rights reserved.
26   * 
27   * See for project information <a href="http://www.simulation.tudelft.nl/">
28   * www.simulation.tudelft.nl </a>.
29   * 
30   * The source code and binary code of this software is proprietary information
31   * of Delft University of Technology.
32   * 
33   * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
34   *         Jacobs </a>, <a
35   *         href="mailto:s.p.a.vanhouten@tbm.tudelft.nl">Stijn-Pieter van Houten
36   *         </a>, <a
37   *         href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
38   *         Verbraeck </a>
39   * @version $$Revision: 1.2 $$ $$Date: 2005/04/08 10:56:35 $$
40   */
41  
42  public interface MessageQueueInterface extends Serializable
43  {
44  	/***
45  	 * @param message new message to add
46  	 */
47  	void add(final Message message);
48  
49  	/***
50  	 * @param message message to remove
51  	 */
52  	void remove(final Message message);
53  
54  	/***
55  	 * @return the first message according to the sorting mechanism
56  	 */
57  	Message first();
58  
59  	/***
60  	 * @return the first message removed according to the sorting mechanism
61  	 */
62  	Message removeFirst();
63  
64  	/***
65  	 * @return the number of messages in the queue
66  	 */
67  	int size();
68  
69  	/***
70  	 * @return whether the queue is empty or not
71  	 */
72  	boolean isEmpty();
73  }