uk.ac.essex.ia.util
Class ObjectFIFO

java.lang.Object
  extended by 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.


Constructor Summary
ObjectFIFO(int cap)
           
 
Method Summary
 void add(java.lang.Object obj)
           
 void addEach(java.lang.Object[] list)
           
 int getCapacity()
           
 int getSize()
           
 boolean isEmpty()
           
 boolean isFull()
           
 java.lang.Object remove()
           
 java.lang.Object[] removeAll()
           
 java.lang.Object[] removeAtLeastOne()
           
 void waitUntilEmpty()
           
 boolean waitUntilEmpty(long msTimeout)
           
 void waitUntilFull()
           
 void waitWhileEmpty()
           
 void waitWhileFull()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectFIFO

public ObjectFIFO(int cap)
Method Detail

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