communication
Class SynchronizedBuffer<T>

java.lang.Object
  extended by communication.SynchronizedBuffer<T>

public class SynchronizedBuffer<T>
extends java.lang.Object

Utility class for implementation of services: synchronized buffer of elements of any type T


Constructor Summary
SynchronizedBuffer()
           
 
Method Summary
 void addElement(T elt)
          Add an element in the buffer
 int available()
           
 T removeElement(boolean synchronicity)
          Get and remove the next available element in the buffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedBuffer

public SynchronizedBuffer()
Method Detail

removeElement

public T removeElement(boolean synchronicity)
Get and remove the next available element in the buffer

Parameters:
synchronicity - if true, wait for an element to be available in the buffer, if not, return immediatly (and return null if the buffer was empty)
Returns:
an unread element of the buffer, or the null value

available

public int available()
Returns:
the number of elements in the buffer

addElement

public void addElement(T elt)
Add an element in the buffer

Parameters:
elt -