SandMark version 2.0


sandmark.util
Class CircularBuffer

java.lang.Object
  |
  +--sandmark.util.CircularBuffer

public class CircularBuffer
extends java.lang.Object


Nested Class Summary
(package private)  class CircularBuffer.Iterator
           
 
Field Summary
(package private)  Node buffer
           
 
Constructor Summary
CircularBuffer(int size)
          Create a new Buffer.
 
Method Summary
 void add(java.lang.Object obj)
          Add a new element at the current position of the queue.
 java.util.Iterator iterator()
          Generate the elements of the queue, in reverse order by time.
static void main(java.lang.String[] args)
           
 java.lang.String toString()
          Generate a printable version of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buffer

Node buffer
Constructor Detail

CircularBuffer

public CircularBuffer(int size)
Create a new Buffer.

Parameters:
size - The number of elements in the queue.
Method Detail

add

public void add(java.lang.Object obj)
Add a new element at the current position of the queue.

Parameters:
obj - The new element.

iterator

public java.util.Iterator iterator()
Generate the elements of the queue, in reverse order by time. I.e. the last added element is produced first.


toString

public java.lang.String toString()
Generate a printable version of the queue.

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)

SandMark version 2.0

Mon Jun 17 12:30:47 MST 2002