|
DRCL JavaSim API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--drcl.DrclObj
|
+--drcl.util.queue.Queue
|
+--drcl.util.queue.SimpleQueue
Queue with double type of keys. Although PriorityQueue implements Serializable, for the class to be it, the stored objects must be serializable also.
| Inner Class Summary | |
protected static class |
SimpleQueue._Element
|
protected static class |
SimpleQueue.SizedElement
|
| Constructor Summary | |
SimpleQueue()
|
|
SimpleQueue(int maxSize_)
|
|
| Method Summary | |
Element[] |
_retrieveAll()
Returns all the elements in the queue sorted in the ascending order of the key values and the order of time of enqueues. |
boolean |
contains(java.lang.Object element_)
Returns true if the queue contains the element. |
boolean |
containsKey(double key_)
Returns true if the queue contains the key. |
java.lang.Object |
dequeue()
Dequeues and returns the element with the smallest key. |
java.lang.Object |
dequeue(double key_)
Dequeues and returns the first element with the key matched the argument. |
boolean |
enqueue(double key_,
java.lang.Object element_)
Enqueues the element with the associated key. |
boolean |
enqueue(double key_,
java.lang.Object element_,
int size_)
Enqueues the element with the associated key. |
boolean |
enqueue(java.lang.Object element_)
Associates the element with the largest key in the queue and then enqueues the element. |
boolean |
enqueue(java.lang.Object element_,
int size_)
Associates the element with the largest key in the queue and then enqueues the element. |
boolean |
enqueueAfter(java.lang.Object previousElement_,
java.lang.Object element_)
Enqueues the element right after the previousElement_ element and
associates the element with a key equal to the previous element's. |
boolean |
enqueueAfter(java.lang.Object previousElement_,
java.lang.Object element_,
int size_)
Enqueues the element right after the previousElement_ element and
associates the element with a key equal to the previous element's. |
boolean |
enqueueAt(int pos_,
double key_,
java.lang.Object element_)
Enqueues the element at the position specified with the associated key. |
boolean |
enqueueAt(int pos_,
double key_,
java.lang.Object element_,
int size_)
Enqueues the element at the position specified with the associated key. |
java.lang.Object |
firstElement()
Returns the first element in the queue, no dequeue is performed. |
double |
firstKey()
Returns the first key in the queue, no dequeue is performed. |
java.util.Enumeration |
getElementEnumerator()
|
java.util.Enumeration |
getKeyEnumerator()
|
int |
getLength()
Returns the current length of the queue. |
int |
getMaxSize()
Returns the maximum size of the queue. |
int |
getSize()
Returns the current size of the queue. |
boolean |
isEmpty()
Returns true if the queue is empty. |
boolean |
isFull()
Returns true if the queue is full. |
boolean |
isFull(int size_)
Returns true if the queue will be overflowed by an object of the size. |
double[] |
keys()
Returns all the keys in the queue. |
java.lang.Object |
lastElement()
Returns the last element in the queue, no dequeue is performed. |
double |
lastKey()
Returns the last key in the queue, no dequeue is performed. |
boolean |
merge(Queue that_)
Enqueues the elements in the queue that_ by the order of
that_.dequeue(). |
java.lang.String |
oneline()
Prints the content of the queue in one line of string. |
java.lang.Object |
remove(double key_,
java.lang.Object element_)
Removes the first element that has the same key and equals() the argument. |
java.lang.Object |
remove(int n_)
Removes and returns the nth element in the queue. |
java.lang.Object |
remove(java.lang.Object element_)
Removes the first element that equals() the argument. |
void |
removeAll(double key_,
java.lang.Object element_)
Removes all the elements that match both the argument key and element. |
void |
removeAll(java.lang.Object element_)
Removes all the elements that equals() the argument. |
void |
reset()
Empties the queue. |
java.lang.Object[] |
retrieveAll()
Returns all the elements in the queue sorted in the ascending order of the key values and the order of time of enqueues. |
java.lang.Object[] |
retrieveAll(double key_)
Returns all the elements with the keys matched to the argument. |
java.lang.Object |
retrieveAt(int n_)
Returns the nth element in the queue, no dequeue is performed. |
java.lang.Object |
retrieveBy(double key_)
Returns the first element with the key matched to the argument. |
double |
retrieveKey(java.lang.Object o_)
Returns the key of the first matched element in this queue, Double.NaN if no match is found. |
double |
retrieveKeyAt(int n_)
Returns the nth key in the queue, Double.NaN if the current size of the queue is smaller than (n+1). |
void |
setMaxSize(int maxSize_,
boolean truncate_)
Sets the maximum size of the queue. |
| Methods inherited from class drcl.util.queue.Queue |
diag, duplicate, getAvailableSize, info, info, info |
| Methods inherited from class drcl.DrclObj |
clone, toString |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public SimpleQueue()
public SimpleQueue(int maxSize_)
| Method Detail |
public void reset()
Queuereset in class Queuepublic boolean isEmpty()
QueueisEmpty in class Queuepublic boolean isFull()
QueueisFull in class Queuepublic boolean isFull(int size_)
QueueisFull in class Queue
public boolean enqueue(double key_,
java.lang.Object element_)
Queueenqueue in class Queuedrcl.util.queue.Queuekey_ - the associated key.element_ - the element to be put in the queue.
public boolean enqueue(double key_,
java.lang.Object element_,
int size_)
Queueenqueue in class Queuedrcl.util.queue.Queuekey_ - the associated key.element_ - the element to be put in the queue.size_ - size of the element.
public boolean enqueueAfter(java.lang.Object previousElement_,
java.lang.Object element_)
QueuepreviousElement_ element and
associates the element with a key equal to the previous element's.enqueueAfter in class Queuedrcl.util.queue.QueuepreviousElement_ - the previous element.element_ - the element to be put in the queue.previousElement_ does not appear or the queue is full.
public boolean enqueueAfter(java.lang.Object previousElement_,
java.lang.Object element_,
int size_)
QueuepreviousElement_ element and
associates the element with a key equal to the previous element's.enqueueAfter in class Queuedrcl.util.queue.QueuepreviousElement_ - the previous element.element_ - the element to be put in the queue.size_ - size of the element.previousElement_ does not appear or the queue is full.
public boolean enqueueAt(int pos_,
double key_,
java.lang.Object element_)
QueueenqueueAt in class Queuedrcl.util.queue.Queuepos_ - the position.key_ - the associated key.element_ - the element to be put in the queue.
public boolean enqueueAt(int pos_,
double key_,
java.lang.Object element_,
int size_)
QueueenqueueAt in class Queuedrcl.util.queue.Queuepos_ - the position.key_ - the associated key.element_ - the element to be put in the queue.size_ - size of the element.public boolean merge(Queue that_)
Queuethat_ by the order of
that_.dequeue().merge in class Queuedrcl.util.queue.Queuethat_ are successfully enqueued.public boolean enqueue(java.lang.Object element_)
Queueenqueue in class Queuedrcl.util.queue.Queue
public boolean enqueue(java.lang.Object element_,
int size_)
Queueenqueue in class Queuedrcl.util.queue.Queuesize_ - size of the element.public java.lang.Object dequeue()
Queuedequeue in class Queuedrcl.util.queue.Queuepublic java.lang.Object dequeue(double key_)
Queuedequeue in class Queuedrcl.util.queue.Queue
public java.lang.Object remove(double key_,
java.lang.Object element_)
Queueequals() the argument.remove in class Queuedrcl.util.queue.Queuepublic java.lang.Object remove(java.lang.Object element_)
Queueequals() the argument.remove in class Queuedrcl.util.queue.Queuepublic void removeAll(java.lang.Object element_)
Queueequals() the argument.removeAll in class Queue
public void removeAll(double key_,
java.lang.Object element_)
QueueremoveAll in class Queuepublic java.lang.Object remove(int n_)
Queueremove in class Queuepublic java.lang.Object firstElement()
QueuefirstElement in class Queuepublic double firstKey()
Queuejava.lang.Double.NaN if the queue is empty.firstKey in class Queuepublic java.lang.Object lastElement()
QueuelastElement in class Queuepublic double lastKey()
Queuejava.lang.Double.NaN if the queue is empty.lastKey in class Queuepublic java.lang.Object retrieveAt(int n_)
QueueretrieveAt in class Queuepublic double retrieveKeyAt(int n_)
QueueretrieveKeyAt in class Queuepublic java.lang.Object retrieveBy(double key_)
QueueretrieveBy in class Queuepublic java.lang.Object[] retrieveAll(double key_)
QueueretrieveAll in class Queuepublic java.lang.Object[] retrieveAll()
QueueretrieveAll in class Queuepublic Element[] _retrieveAll()
Queue_retrieveAll in class Queuepublic double retrieveKey(java.lang.Object o_)
QueueretrieveKey in class Queuepublic boolean contains(java.lang.Object element_)
Queuecontains in class Queuepublic boolean containsKey(double key_)
QueuecontainsKey in class Queuepublic double[] keys()
Queuekeys in class Queuepublic java.util.Enumeration getKeyEnumerator()
getKeyEnumerator in class Queuepublic java.util.Enumeration getElementEnumerator()
getElementEnumerator in class Queuepublic int getSize()
QueuegetSize in class Queuepublic int getLength()
QueuegetLength in class Queuepublic int getMaxSize()
QueuegetMaxSize in class Queue
public void setMaxSize(int maxSize_,
boolean truncate_)
Queuetruncate_ is set,
then the size_th element, and the elements after,
are removed from the queue.
- Overrides:
setMaxSize in class Queue
public java.lang.String oneline()
Queueoneline in class Queue
|
DRCL JavaSim API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||