|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.primordion.xholon.base.Xholon
org.primordion.xholon.base.Queue
This is a generic Queue data structure that can be used to store references to any type of data. Items are added at one end of the Queue and taken off at the other end, which is why a Queue is called a First In First Out (FIFO) structure. WARNING: A Queue can fill up to maximum capacity, or it may become empty. Check the return value when calling the enqueue and dequeue functions to see if it is Q_FULL or null.
| Field Summary |
| Fields inherited from class org.primordion.xholon.base.Xholon |
DEFAULT_LEVEL, interaction, interactionsEnabled |
| Fields inherited from interface org.primordion.xholon.base.IQueue |
Q_FULL, Q_OK |
| Fields inherited from interface org.primordion.xholon.base.IXholon |
DEFAULT_SIZE_MSG_Q, NINCLUDE_PSC, NINCLUDE_PSx, NINCLUDE_PxC, NINCLUDE_Pxx, NINCLUDE_xSC, NINCLUDE_xSx, NINCLUDE_xxC, NINCLUDE_xxx |
| Constructor Summary | |
Queue(int numItems)
Use this constructor. |
|
| Method Summary | |
java.lang.Object |
dequeue()
Take an object off the queue. |
int |
enqueue(java.lang.Object p_item)
Add an object to the queue. |
java.util.Vector |
getItems()
Get the internal item array. |
int |
getMaxSize()
Get maximum number of items that can be in the queue. |
int |
getSize()
Get number of items currently in the queue. |
void |
sendMessage(int signal,
java.lang.Object data,
IXholon sender)
Send a ROOM/UML2 message to a receiving Xholon instance. |
void |
setMaxSize(int maxSize)
Set the maximum number of items that can be in the queue, and allocate space for that many items. |
void |
shuffle()
Randomize the order of the items in the queue. |
void |
sort()
Sort the items in the queue. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Queue(int numItems)
numItems - Maximum number of items that can be in the queue.| Method Detail |
public int enqueue(java.lang.Object p_item)
IQueue
enqueue in interface IQueuep_item - The object.
public java.lang.Object dequeue()
IQueue
dequeue in interface IQueuepublic int getSize()
IQueue
getSize in interface IQueuepublic int getMaxSize()
IQueue
getMaxSize in interface IQueuepublic void setMaxSize(int maxSize)
IQueue
setMaxSize in interface IQueuemaxSize - Maximum queue size.public void shuffle()
IQueue
shuffle in interface IQueuepublic void sort()
IQueue
sort in interface IQueue
public void sendMessage(int signal,
java.lang.Object data,
IXholon sender)
IXholon
sendMessage in interface IXholonsendMessage in class Xholonpublic java.util.Vector getItems()
IQueue
getItems in interface IQueue
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||