DRCL J-Sim API

drcl.util.queue
Class CalendarQueue3

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.util.queue.QueueImpl
          extended bydrcl.util.queue.CalendarQueue3
All Implemented Interfaces:
java.lang.Cloneable, ObjectCloneable, ObjectDuplicable, Queue, java.io.Serializable

public class CalendarQueue3
extends QueueImpl

See Also:
Serialized Form

Constructor Summary
CalendarQueue3()
           
 
Method Summary
 drcl.util.queue._Element _dequeue()
           
 Element[] _retrieveAll()
          Returns all the elements in the queue sorted in the ascending order of the key values and the order of enqueues.
 boolean contains(java.lang.Object o_)
          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.
 java.lang.String diag(boolean listElement_)
          Prints out for diagnosis.
 void enqueue(double key_, java.lang.Object o_)
          Enqueues the element with the associated key.
 void enqueue(java.lang.Object o_)
          Associates the element with the largest key in the queue and then enqueues the element.
 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 getSize()
           
 java.lang.String info()
          Prints the content of the queue.
 java.lang.String info(java.lang.String prefix_)
          Prints the content of the queue.
 boolean isEmpty()
          Returns true if the queue is empty.
 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.
 java.lang.String oneline()
          Prints the content of the queue in one line of string.
 java.lang.Object remove(double key_, java.lang.Object obj_)
          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 obj_)
          Removes the first element that equals() the argument.
 void removeAll(double key_, java.lang.Object o_)
          Removes all the elements that match both the argument key and element.
 void removeAll(java.lang.Object o_)
          Removes all the elements that equals() the argument.
 void reset()
          Empties the queue.
 void resize(int newsize_)
           
 java.lang.Object[] retrieveAll()
          Returns all the elements in the queue sorted in the ascending order of the key values and the order 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 length of the queue is smaller than (n+1).
 
Methods inherited from class drcl.util.queue.QueueImpl
duplicate, enqueueAfter, enqueueAt, info, merge
 
Methods inherited from class drcl.DrclObj
clone, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CalendarQueue3

public CalendarQueue3()
Method Detail

enqueue

public void enqueue(double key_,
                    java.lang.Object o_)
Description copied from interface: Queue
Enqueues the element with the associated key. The elements in queue are sorted in the ascending order of their associated keys. If same keys appear in the queue, the element is put right after the last element with the same key.

Specified by:
enqueue in interface Queue
Specified by:
enqueue in class QueueImpl

dequeue

public java.lang.Object dequeue()
Description copied from interface: Queue
Dequeues and returns the element with the smallest key. If two keys are identical, then first-in-first-out.

Specified by:
dequeue in interface Queue
Specified by:
dequeue in class QueueImpl

_dequeue

public drcl.util.queue._Element _dequeue()

firstKey

public double firstKey()
Description copied from interface: Queue
Returns the first key in the queue, no dequeue is performed. Returns java.lang.Double.NaN if the queue is empty.

Specified by:
firstKey in interface Queue
Specified by:
firstKey in class QueueImpl

firstElement

public java.lang.Object firstElement()
Description copied from interface: Queue
Returns the first element in the queue, no dequeue is performed. Returns null if the queue is empty.

Specified by:
firstElement in interface Queue
Specified by:
firstElement in class QueueImpl

resize

public void resize(int newsize_)

remove

public java.lang.Object remove(double key_,
                               java.lang.Object obj_)
Description copied from interface: Queue
Removes the first element that has the same key and equals() the argument.

Specified by:
remove in interface Queue
Specified by:
remove in class QueueImpl

remove

public java.lang.Object remove(java.lang.Object obj_)
Description copied from interface: Queue
Removes the first element that equals() the argument.

Specified by:
remove in interface Queue
Specified by:
remove in class QueueImpl

isEmpty

public boolean isEmpty()
Description copied from interface: Queue
Returns true if the queue is empty.

Specified by:
isEmpty in interface Queue
Overrides:
isEmpty in class QueueImpl

getSize

public int getSize()

getLength

public int getLength()
Description copied from interface: Queue
Returns the current length of the queue.

Specified by:
getLength in interface Queue
Specified by:
getLength in class QueueImpl

keys

public double[] keys()
Description copied from interface: Queue
Returns all the keys in the queue. Duplicate keys may appear.

Specified by:
keys in interface Queue
Specified by:
keys in class QueueImpl

retrieveAll

public java.lang.Object[] retrieveAll()
Description copied from interface: Queue
Returns all the elements in the queue sorted in the ascending order of the key values and the order of enqueues.

Specified by:
retrieveAll in interface Queue
Specified by:
retrieveAll in class QueueImpl

reset

public void reset()
Description copied from interface: Queue
Empties the queue.

Specified by:
reset in interface Queue
Specified by:
reset in class QueueImpl

info

public java.lang.String info(java.lang.String prefix_)
Prints the content of the queue.

Specified by:
info in interface Queue
Overrides:
info in class QueueImpl
Parameters:
prefix_ - prefix of each line when printing.

info

public java.lang.String info()
Prints the content of the queue.

Specified by:
info in interface Queue
Overrides:
info in class QueueImpl

oneline

public java.lang.String oneline()
Prints the content of the queue in one line of string.

Specified by:
oneline in interface Queue
Specified by:
oneline in class QueueImpl

diag

public java.lang.String diag(boolean listElement_)
Description copied from class: QueueImpl
Prints out for diagnosis. The default implementation invokes QueueImpl.info().

Specified by:
diag in interface Queue
Overrides:
diag in class QueueImpl

getElementEnumerator

public java.util.Enumeration getElementEnumerator()
Specified by:
getElementEnumerator in interface Queue
Specified by:
getElementEnumerator in class QueueImpl

getKeyEnumerator

public java.util.Enumeration getKeyEnumerator()
Specified by:
getKeyEnumerator in interface Queue
Specified by:
getKeyEnumerator in class QueueImpl

enqueue

public void enqueue(java.lang.Object o_)
Description copied from interface: Queue
Associates the element with the largest key in the queue and then enqueues the element. If the queue is originally empty, then key 0.0 is assigned.

Specified by:
enqueue in interface Queue
Overrides:
enqueue in class QueueImpl

retrieveAll

public java.lang.Object[] retrieveAll(double key_)
Description copied from interface: Queue
Returns all the elements with the keys matched to the argument. No dequeue is performed.

Specified by:
retrieveAll in interface Queue
Specified by:
retrieveAll in class QueueImpl

retrieveKey

public double retrieveKey(java.lang.Object o_)
Description copied from interface: Queue
Returns the key of the first matched element in this queue, Double.NaN if no match is found.

Specified by:
retrieveKey in interface Queue
Specified by:
retrieveKey in class QueueImpl

dequeue

public java.lang.Object dequeue(double key_)
Description copied from interface: Queue
Dequeues and returns the first element with the key matched the argument.

Specified by:
dequeue in interface Queue
Specified by:
dequeue in class QueueImpl

retrieveBy

public java.lang.Object retrieveBy(double key_)
Description copied from interface: Queue
Returns the first element with the key matched to the argument. No dequeue is performed.

Specified by:
retrieveBy in interface Queue
Specified by:
retrieveBy in class QueueImpl

removeAll

public void removeAll(java.lang.Object o_)
Description copied from interface: Queue
Removes all the elements that equals() the argument.

Specified by:
removeAll in interface Queue
Specified by:
removeAll in class QueueImpl

removeAll

public void removeAll(double key_,
                      java.lang.Object o_)
Description copied from interface: Queue
Removes all the elements that match both the argument key and element.

Specified by:
removeAll in interface Queue
Specified by:
removeAll in class QueueImpl

lastKey

public double lastKey()
Description copied from interface: Queue
Returns the last key in the queue, no dequeue is performed. Returns java.lang.Double.NaN if the queue is empty.

Specified by:
lastKey in interface Queue
Specified by:
lastKey in class QueueImpl

lastElement

public java.lang.Object lastElement()
Description copied from interface: Queue
Returns the last element in the queue, no dequeue is performed. Returns null if the queue is empty.

Specified by:
lastElement in interface Queue
Specified by:
lastElement in class QueueImpl

retrieveKeyAt

public double retrieveKeyAt(int n_)
Description copied from interface: Queue
Returns the nth key in the queue, Double.NaN if the current length of the queue is smaller than (n+1).

Specified by:
retrieveKeyAt in interface Queue
Specified by:
retrieveKeyAt in class QueueImpl

retrieveAt

public java.lang.Object retrieveAt(int n_)
Description copied from interface: Queue
Returns the nth element in the queue, no dequeue is performed.

Specified by:
retrieveAt in interface Queue
Specified by:
retrieveAt in class QueueImpl

remove

public java.lang.Object remove(int n_)
Description copied from interface: Queue
Removes and returns the nth element in the queue. Returns null if the current size of the queue is smaller than (n+1).

Specified by:
remove in interface Queue
Specified by:
remove in class QueueImpl

containsKey

public boolean containsKey(double key_)
Description copied from interface: Queue
Returns true if the queue contains the key.

Specified by:
containsKey in interface Queue
Specified by:
containsKey in class QueueImpl

_retrieveAll

public Element[] _retrieveAll()
Description copied from interface: Queue
Returns all the elements in the queue sorted in the ascending order of the key values and the order of enqueues.

Specified by:
_retrieveAll in interface Queue
Specified by:
_retrieveAll in class QueueImpl

contains

public boolean contains(java.lang.Object o_)
Description copied from interface: Queue
Returns true if the queue contains the element.

Specified by:
contains in interface Queue
Specified by:
contains in class QueueImpl

DRCL J-Sim API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~