TSim
Class SynchronizedFIFO
java.lang.Object
|
+--TSim.SynchronizedFIFO
- public class SynchronizedFIFO
- extends java.lang.Object
The SynchronizedFIFO class implements a freely growable FIFO.
It is based on the java.util.Vecor class that has been wrapped
with synchronized access methods.
Field Summary |
protected java.util.Vector |
data
|
Constructor Summary |
SynchronizedFIFO(int size)
Creates a new SynchronizedFIFO with given initial size. |
Method Summary |
java.lang.Object |
get()
Removes and returns the first object in the FIFO if such
exists. |
void |
put(java.lang.Object o)
Puts an object first in the FIFO. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
data
protected java.util.Vector data
SynchronizedFIFO
public SynchronizedFIFO(int size)
- Creates a new SynchronizedFIFO with given initial size.
- Parameters:
size
- the initial size of the SynchronizedFIFO.
put
public void put(java.lang.Object o)
- Puts an object first in the FIFO. Since the FIFO automatically
grows the method don't block.
- Parameters:
o
- the object to be insertet first in the FIFO.
get
public java.lang.Object get()
- Removes and returns the first object in the FIFO if such
exists. If not this method blocks until an object is inserted
into the FIFO.
- Returns:
- the first object in the FIFO.