sandmark.util
Class CircularBuffer
java.lang.Object
|
+--sandmark.util.CircularBuffer
- public class CircularBuffer
- extends java.lang.Object
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 |
buffer
Node buffer
CircularBuffer
public CircularBuffer(int size)
- Create a new Buffer.
- Parameters:
size
- The number of elements in the queue.
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)