public class CyclicBuffer extends Object
LoggingEvents
for immediate or differed display.
This buffer gives read access to any element in the buffer not just the first or last element.
Modifier and Type | Field and Description |
---|---|
(package private) LoggingEvent[] |
ea |
(package private) int |
first |
(package private) int |
last |
(package private) int |
maxSize |
(package private) int |
numElems |
Constructor and Description |
---|
CyclicBuffer(int maxSize)
Instantiate a new CyclicBuffer of at most
maxSize events. |
Modifier and Type | Method and Description |
---|---|
void |
add(LoggingEvent event)
Add an
event as the last event in the buffer. |
LoggingEvent |
get()
Get the oldest (first) element in the buffer.
|
LoggingEvent |
get(int i)
Get the ith oldest event currently in the buffer.
|
int |
getMaxSize() |
int |
length()
Get the number of elements in the buffer.
|
void |
resize(int newSize)
Resize the cyclic buffer to
newSize . |
LoggingEvent[] ea
int first
int last
int numElems
int maxSize
public CyclicBuffer(int maxSize) throws IllegalArgumentException
maxSize
events.
The maxSize
argument must a positive integer.maxSize
- The maximum number of elements in the buffer.IllegalArgumentException
public void add(LoggingEvent event)
event
as the last event in the buffer.public LoggingEvent get(int i)
null
is returned.public int getMaxSize()
public LoggingEvent get()
public int length()
maxSize
(inclusive).public void resize(int newSize)
newSize
.IllegalArgumentException
- if newSize
is negative.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses