org.jwarp.util
Class CircularBuffer

java.lang.Object
  |
  +--org.jwarp.util.CircularBuffer

public class CircularBuffer
extends java.lang.Object

Author:
Federico Barbieri

Constructor Summary
CircularBuffer()
          Creates a new buffer.
CircularBuffer(int size)
          Creates a new buffer with the given size
 
Method Summary
 void append(java.lang.Object o)
          Append an object to the buffer.
 java.lang.Object get()
          Get an object from the buffer
 int getBufferSize()
          Get the current buffer size.
 int getContentSize()
          Get the current content size.
 boolean isEmpty()
          Is the buffer empty.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CircularBuffer

public CircularBuffer(int size)
Creates a new buffer with the given size
Parameters:
size - The size

CircularBuffer

public CircularBuffer()
Creates a new buffer. The size will be 32 elements.
Method Detail

isEmpty

public boolean isEmpty()
Is the buffer empty.
Returns:
true if the buffer is empty

getContentSize

public int getContentSize()
Get the current content size.
Returns:
the size

getBufferSize

public int getBufferSize()
Get the current buffer size.
Returns:
The buffer size

append

public void append(java.lang.Object o)
Append an object to the buffer.
Parameters:
o - The new object

get

public java.lang.Object get()
Get an object from the buffer
Returns:
the next object.

©   O R C A   S y s t e m s