public class CircularQueue<T>
extends java.lang.Object
Currently we store the event data twice: Both the StructuredEvent with Corba Anys inside (incl. the user data), and also the user data separately. This design relieves us from transforming the user data back from Corba Any to IDL-generated struct. If this becomes a memory issue, we may have to change it.
NCPublisher#publishCORBAEvent(StructuredEvent, T)| Modifier and Type | Class and Description |
|---|---|
class |
CircularQueue.Data |
| Constructor and Description |
|---|
CircularQueue()
Initializes the Queue with default value = 100
|
CircularQueue(int size)
Initializes the Queue with custom value size
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Remove all the elements of the queue
|
int |
getMaxSize() |
CircularQueue.Data |
pop()
Remove the first element in the queue and return it.
|
CircularQueue.Data |
push(StructuredEvent e,
T userData)
Insert a structured event at the end of the queue.
|
boolean |
setMaxSize(int size)
Set the capacity of the queue.
|
public CircularQueue(int size)
size - the size of the queuepublic CircularQueue()
public CircularQueue.Data push(StructuredEvent e, T userData)
e - the event to be inserted in the queuenull if all went well,
or otherwise the data for another event that had to be pushed out of the queue
if the queue was full.public void clear()
public CircularQueue.Data pop()
public boolean setMaxSize(int size)
public int getMaxSize()