uk.ac.essex.ia.util
Class ObjectFIFO
java.lang.Object
uk.ac.essex.ia.util.ObjectFIFO
public class ObjectFIFO
- extends java.lang.Object
An Object First In First Out data structure. After this has been initialised
with it's initial capacity once that capacity has been reached any calls to
add will block. Similarly if the FIFO is empty any calls to remove will block.
This can be useful in synchronizing threads.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ObjectFIFO
public ObjectFIFO(int cap)
getCapacity
public int getCapacity()
getSize
public int getSize()
isEmpty
public boolean isEmpty()
isFull
public boolean isFull()
add
public void add(java.lang.Object obj)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
addEach
public void addEach(java.lang.Object[] list)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
remove
public java.lang.Object remove()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
removeAll
public java.lang.Object[] removeAll()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
removeAtLeastOne
public java.lang.Object[] removeAtLeastOne()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
waitUntilEmpty
public boolean waitUntilEmpty(long msTimeout)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
waitUntilEmpty
public void waitUntilEmpty()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
waitWhileEmpty
public void waitWhileEmpty()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
waitUntilFull
public void waitUntilFull()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
waitWhileFull
public void waitWhileFull()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException