All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.gatech.cc.is.util.CircularBuffer

java.lang.Object
   |
   +----EDU.gatech.cc.is.util.CircularBuffer

public class CircularBuffer
extends Object
implements Cloneable, Serializable
Implements a circular buffer for storing things.

Copyright (c)1998 Tucker Balch

Version:
$Revision: 1.3 $
Author:
Tucker Balch

Variable Index

 o buf_size
size of the buffer.
 o buffer
the buffer itself.
 o current
current cell in the buffer.
 o total
total number of items ever added to the buffer.

Constructor Index

 o CircularBuffer()
create a CircularBuffer with default values.
 o CircularBuffer(int)
create a CircularBuffer with a specific number of slots.

Method Index

 o clear()
clears this circular buffer.
 o elements()
returns an enumeration of the values in this circular buffer.
 o put(Object)
adds an item to the CircularBuffer.

Variables

 o buf_size
 protected int buf_size
size of the buffer. Default size is 10.

 o current
 protected int current
current cell in the buffer.

 o total
 protected int total
total number of items ever added to the buffer. This can help reveal if data is ever lost by an enumeration.

 o buffer
 protected Object buffer[]
the buffer itself.

Constructors

 o CircularBuffer
 public CircularBuffer()
create a CircularBuffer with default values.

 o CircularBuffer
 public CircularBuffer(int s)
create a CircularBuffer with a specific number of slots.

Parameters:
s - int, number of slots.

Methods

 o put
 public synchronized void put(Object i)
adds an item to the CircularBuffer.

Parameters:
i - Object, the item to add to the buffer.
 o clear
 public void clear()
clears this circular buffer.

 o elements
 public Enumeration elements()
returns an enumeration of the values in this circular buffer.

Returns:
the enumeration.

All Packages  Class Hierarchy  This Package  Previous  Next  Index