|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection
net.spy.util.RingBuffer
public class RingBuffer
A circular buffer. Ring buffers may have new entries appended to them, but may not otherwise be modified. Individual entries may not be accessed directly, only via the iterator.
| Constructor Summary | |
|---|---|
RingBuffer(int s)
Get an instance of RingBuffer. |
|
RingBuffer(int s,
java.util.Collection fill)
Get a RingBuffer at a particular size filled from the given Collection. |
|
| Method Summary | |
|---|---|
boolean |
add(java.lang.Object o)
Add an object to the ring buffer (if it's full, it'll cycle the oldest one out). |
int |
getCapacity()
Get the total capacity of this RingBuffer. |
boolean |
hasWrapped()
Check to see if the ring buffer has wrapped. |
java.util.Iterator |
iterator()
Get the iterator for this ring buffer. |
int |
size()
Get the number of objects in this RingBuffer. |
java.lang.String |
toString()
String me. |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public RingBuffer(int s)
public RingBuffer(int s,
java.util.Collection fill)
s - the maximum number of objects to be held in the ringfill - a Collection whose elements will be used to fill the buffer| Method Detail |
|---|
public boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in class java.util.AbstractCollectiono - the object to add
public boolean hasWrapped()
public java.lang.String toString()
toString in class java.util.AbstractCollectionpublic int size()
size in interface java.util.Collectionsize in class java.util.AbstractCollectionpublic int getCapacity()
public java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in class java.util.AbstractCollection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||