jmce - 1_02

jmce.util
Class RingBuffer<E>

java.lang.Object
  extended by jmce.util.RingBuffer<E>

public class RingBuffer<E>
extends java.lang.Object


Constructor Summary
RingBuffer()
          Default constructor.
RingBuffer(int size)
          Constructor with specified the size
 
Method Summary
 boolean contains(java.lang.Object o)
          Check if the specified element exist in the queue
 int count()
          Return the number of element in the buffer.
 E get()
          Return the first element from the buffer and advance the pointer to the next one
 int getSize()
          Return the size of the buffer.
 boolean isEmpty()
          Return true if the buffer is empty.
 boolean isFull()
          Return true if the buffer is full.
 E peek()
          Return the first element in the buffer without advancing the pointer.
 void purge()
          Remove all element from the buffer.
 boolean put(E o)
          Add a new element to the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RingBuffer

public RingBuffer(int size)
Constructor with specified the size


RingBuffer

public RingBuffer()
Default constructor.

A new RingBuffer will be created with the default size of 256 element.

Method Detail

purge

public final void purge()
Remove all element from the buffer.


peek

public final E peek()
Return the first element in the buffer without advancing the pointer. If no element is present return null.


get

public final E get()
Return the first element from the buffer and advance the pointer to the next one


count

public final int count()
Return the number of element in the buffer.


put

public final boolean put(E o)
Add a new element to the buffer.


isEmpty

public final boolean isEmpty()
Return true if the buffer is empty.


isFull

public final boolean isFull()
Return true if the buffer is full.


getSize

public final int getSize()
Return the size of the buffer.


contains

public final boolean contains(java.lang.Object o)
Check if the specified element exist in the queue

Parameters:
o - - Element to check.
Since:
1.02

jmce - 1_02