J-Sim v1.2.1-p7 API

drcl.util.queue
Interface VariableSizeQueue

All Superinterfaces:
Queue
All Known Subinterfaces:
FiniteVSQueue
All Known Implementing Classes:
FiniteVSFIFOQueue, FiniteVSQueueImpl, FiniteVSSimpleQueue, VariableSizeQueueImpl

public interface VariableSizeQueue
extends Queue

Inteface for implementing a queue with variable-size elements. Base implementation is provided by VariableSizeQueueImpl.


Method Summary
 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_, 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_, int size_)
          Enqueues the element at the position specified with the associated key.
 int getSize()
          Returns the current size of the queue.
 
Methods inherited from interface drcl.util.queue.Queue
_retrieveAll, contains, containsKey, dequeue, dequeue, diag, enqueue, enqueue, enqueueAfter, enqueueAt, firstElement, firstKey, getElementEnumerator, getKeyEnumerator, getLength, info, info, info, isEmpty, keys, lastElement, lastKey, merge, oneline, remove, remove, remove, removeAll, removeAll, reset, retrieveAll, retrieveAll, retrieveAt, retrieveBy, retrieveKey, retrieveKeyAt
 

Method Detail

enqueue

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

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_)
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.

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_)
Enqueues the element right after the previousElement_ element and associates the element with a key equal to the previous element's.

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.

enqueue

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

Parameters:
size_ - size of the element.

getSize

public int getSize()
Returns the current size of the queue.


J-Sim v1.2.1-p7 API

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