|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjist.swans.net.MessageQueue.NoDropMessageQueue
public static class MessageQueue.NoDropMessageQueue
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface jist.swans.net.MessageQueue |
---|
MessageQueue.NoDropMessageQueue |
Field Summary | |
---|---|
private byte |
capacity
List size limit. |
private QueuedMessage[] |
heads
Heads of message queues for different priorities. |
private byte |
size
Length of list. |
private QueuedMessage[] |
tails
Tails of message queues for different priorities. |
private byte |
topPri
Index of highest priority. |
Constructor Summary | |
---|---|
MessageQueue.NoDropMessageQueue(byte priorities,
byte capacity)
Initialize prioritized message queue. |
Method Summary | |
---|---|
QueuedMessage |
get()
Return first message, but do not dequeue. |
QueuedMessage |
get(int pri)
Return first message of given priority, but do not dequeue. |
int |
getPri()
Return priority of first queued message. |
void |
insert(QueuedMessage msg)
Insert message into queue at end (with lowest priority). |
void |
insert(QueuedMessage msg,
int pri)
Insert message into queue with given priority. |
boolean |
isEmpty()
Return whether list is empty. |
boolean |
isFull()
Return whether the list is filled to capacity. |
QueuedMessage |
remove()
Return first message and dequeue. |
QueuedMessage |
remove(int pri)
Return first message with given priority and dequeue. |
int |
size()
Return number of items in the list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private QueuedMessage[] heads
private QueuedMessage[] tails
private byte topPri
private byte size
private byte capacity
Constructor Detail |
---|
public MessageQueue.NoDropMessageQueue(byte priorities, byte capacity)
priorities
- number of priority levelscapacity
- maximum number of items allowed in listMethod Detail |
---|
public boolean isEmpty()
isEmpty
in interface MessageQueue
public boolean isFull()
isFull
in interface MessageQueue
public int size()
size
in interface MessageQueue
public void insert(QueuedMessage msg, int pri)
insert
in interface MessageQueue
msg
- message to insertpri
- message prioritypublic void insert(QueuedMessage msg)
insert
in interface MessageQueue
msg
- message to insertpublic int getPri()
getPri
in interface MessageQueue
public QueuedMessage get(int pri)
get
in interface MessageQueue
pri
- priority of message requested
public QueuedMessage get()
get
in interface MessageQueue
public QueuedMessage remove(int pri)
remove
in interface MessageQueue
pri
- priority of message requested
public QueuedMessage remove()
remove
in interface MessageQueue
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |