|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjade.util.InputQueue
public class InputQueue
This class implements a FIFO queue of objects that can be put and got
in a synchronized way. This is useful when an external thread,
e.g. a GUI, has to communicate with an agent: The external thread
puts objects in the queue and the agent gets and processes them.
The queue can be associated to a Behaviour. This
Behaviour will be restarted each time an object is inserted in the
queue.
This class can be effectively used in combination with the
Event class to support a synchronization between the
external therad (posting the event in the InputQueue)
and the Agent thread (processing the event).
Event| Constructor Summary | |
|---|---|
InputQueue()
Default constructor. |
|
| Method Summary | |
|---|---|
void |
associate(Behaviour b)
Associate this InputQueue object with the indicated
Behaviour so that it will be restarted each time
a new object is inserted. |
void |
clear()
Remove all elements from this queue. |
java.lang.Object |
get()
Extract the first object in the queue (if any). |
void |
put(java.lang.Object obj)
Insert an object into the queue. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public InputQueue()
| Method Detail |
|---|
public void associate(Behaviour b)
InputQueue object with the indicated
Behaviour so that it will be restarted each time
a new object is inserted.
b - The Behaviour to associate.public void put(java.lang.Object obj)
Behaviour
associated to this InputQueue it will be restarted.
obj - The object to insert.public java.lang.Object get()
null if
the queue is empty.public void clear()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||