|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.CircularBuffer
Class CircularBuffer implements a circular buffer. The buffer holds a limit number of items such that when the buffer is full and an item is added the oldest item in the buffer is removed. Note that this class is not thread synchronized.
Field Summary | |
protected int |
allocBufferSize
|
protected java.lang.Object[] |
bufferObjsArray
|
protected int |
bufferPosition
|
protected long |
totalItemsCounter
|
Constructor Summary | |
CircularBuffer(int bufferSize)
Creates a circular buffer. |
Method Summary | |
void |
add(java.lang.Object obj)
Adds the given item to the buffer. |
boolean |
contains(java.lang.Object obj)
Determines whether or not an equivalent item is contained in the buffer. |
java.lang.Object[] |
getBufferItems()
Returns an array containing the items in the buffer in the order in which they were entered. |
java.lang.String |
getBufferItemsAsString(java.lang.String sepStr)
Returns a string containing items in the buffer in the order in which they were entered. |
java.lang.String[] |
getStrBufferItems()
Returns an array containing string items in the buffer in the order in which they were entered. |
long |
getTotalItemsCount()
Returns a count of the total number of items that have ever been entered into the buffer. |
void |
setBufferSize(int bufferSize)
Sets the buffer size of the circular buffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Object[] bufferObjsArray
protected int allocBufferSize
protected int bufferPosition
protected long totalItemsCounter
Constructor Detail |
public CircularBuffer(int bufferSize)
bufferSize
- size of circular buffer.Method Detail |
public final void setBufferSize(int bufferSize)
bufferSize
- size of circular buffer.public void add(java.lang.Object obj)
obj
- item to be added.public java.lang.Object[] getBufferItems()
public java.lang.String[] getStrBufferItems()
public java.lang.String getBufferItemsAsString(java.lang.String sepStr)
sepStr
- separator to be placed between each item.
public long getTotalItemsCount()
public boolean contains(java.lang.Object obj)
obj
- item to check for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |