J-Sim v1.2.1-p7 API

drcl.util.queue
Class VariableSizeQueueImpl

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.util.queue.QueueImpl
          extended bydrcl.util.queue.VariableSizeQueueImpl
All Implemented Interfaces:
java.lang.Cloneable, ObjectDuplicable, Queue, java.io.Serializable, VariableSizeQueue
Direct Known Subclasses:
FiniteVSQueueImpl, VSBSQueue, VSFIFOQueue, VSSimpleQueue, VSTreeMapQueue

public abstract class VariableSizeQueueImpl
extends QueueImpl
implements VariableSizeQueue

Base class for implementing a queue with variable-size elements.

See Also:
Serialized Form

Constructor Summary
VariableSizeQueueImpl()
           
 
Method Summary
 void duplicate(java.lang.Object source_)
          opies the content of the source_ object to this object.
 void enqueue(double key_, java.lang.Object element_)
          Enqueues the element with the associated key.
abstract  void enqueue(double key_, java.lang.Object element_, int size_)
          Enqueues the element with the associated key.
 void 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.
abstract  int getSize()
          Returns the current size of the queue.
 java.lang.String info(java.lang.String prefix_, boolean listElement_)
          Prints the content of the queue.
 void merge(Queue that_)
          Enqueues the elements in that_ by the order of that_.dequeue().
 
Methods inherited from class drcl.util.queue.QueueImpl
_retrieveAll, contains, containsKey, dequeue, dequeue, diag, enqueue, firstElement, firstKey, getElementEnumerator, getKeyEnumerator, getLength, info, info, isEmpty, keys, lastElement, lastKey, oneline, remove, remove, remove, removeAll, removeAll, reset, retrieveAll, retrieveAll, retrieveAt, retrieveBy, retrieveKey, retrieveKeyAt
 
Methods inherited from class drcl.DrclObj
clone, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface drcl.util.queue.Queue
_retrieveAll, contains, containsKey, dequeue, dequeue, diag, enqueue, firstElement, firstKey, getElementEnumerator, getKeyEnumerator, getLength, info, info, isEmpty, keys, lastElement, lastKey, oneline, remove, remove, remove, removeAll, removeAll, reset, retrieveAll, retrieveAll, retrieveAt, retrieveBy, retrieveKey, retrieveKeyAt
 

Constructor Detail

VariableSizeQueueImpl

public VariableSizeQueueImpl()
Method Detail

enqueue

public void enqueue(double key_,
                    java.lang.Object element_)
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

enqueueAt

public boolean enqueueAt(int pos_,
                         double key_,
                         java.lang.Object element_)
Description copied from interface: Queue
Enqueues the element at the position specified with the associated key. Note that the elements in queue are sorted in the ascending order of their associated keys. Enqueue fails if position and key create a conflict to the above condition.

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

enqueueAfter

public boolean enqueueAfter(java.lang.Object previousElement_,
                            java.lang.Object element_)
Description copied from interface: Queue
Enqueues the element right after the previousElement_ element and associates the element with a key equal to the previous element's.

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

enqueue

public abstract void enqueue(double key_,
                             java.lang.Object element_,
                             int size_)
Description copied from interface: VariableSizeQueue
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 VariableSizeQueue
Parameters:
key_ - the associated key.
element_ - the element to be put in the queue.
size_ - size of the element.

enqueueAt

public boolean enqueueAt(int pos_,
                         double key_,
                         java.lang.Object element_,
                         int size_)
Description copied from interface: VariableSizeQueue
Enqueues the element at the position specified with the associated key. Note that the elements in queue are sorted in the ascending order of their associated keys. Enqueue fails if position and key create a conflict to the above condition.

Specified by:
enqueueAt in interface VariableSizeQueue
Parameters:
pos_ - the position.
key_ - the associated key.
element_ - the element to be put in the queue.
size_ - size of the element.
Returns:
false if key and position create a conflict.

enqueueAfter

public boolean enqueueAfter(java.lang.Object previousElement_,
                            java.lang.Object element_,
                            int size_)
Description copied from interface: VariableSizeQueue
Enqueues the element right after the previousElement_ element and associates the element with a key equal to the previous element's.

Specified by:
enqueueAfter in interface VariableSizeQueue
Parameters:
previousElement_ - the previous element.
element_ - the element to be put in the queue.
size_ - size of the element.
Returns:
false if previousElement_ does not appear.

merge

public void merge(Queue that_)
Description copied from interface: Queue
Enqueues the elements in that_ by the order of that_.dequeue().

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

enqueue

public void enqueue(java.lang.Object element_,
                    int size_)
Description copied from interface: VariableSizeQueue
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 VariableSizeQueue
Parameters:
size_ - size of the element.

getSize

public abstract int getSize()
Description copied from interface: VariableSizeQueue
Returns the current size of the queue.

Specified by:
getSize in interface VariableSizeQueue

info

public java.lang.String info(java.lang.String prefix_,
                             boolean listElement_)
Description copied from interface: Queue
Prints the content of the queue.

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

duplicate

public void duplicate(java.lang.Object source_)
Description copied from class: DrclObj
opies the content of the source_ object to this object. he subclass must implement this method to realize DrclObj.clone().

Specified by:
duplicate in interface ObjectDuplicable
Overrides:
duplicate in class QueueImpl

J-Sim v1.2.1-p7 API

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