net.datastructures - version 3.0

net.datastructures
Class SortedListAdaptablePriorityQueue

java.lang.Object
  extended bynet.datastructures.SortedListPriorityQueue
      extended bynet.datastructures.SortedListAdaptablePriorityQueue
All Implemented Interfaces:
AdaptablePriorityQueue, PriorityQueue

public class SortedListAdaptablePriorityQueue
extends SortedListPriorityQueue
implements AdaptablePriorityQueue

Implementation of a priority queue by means of a sorted list


Nested Class Summary
protected static class SortedListAdaptablePriorityQueue.LocationAwareEntry
          Inner class for a location-aware entry.
 
Nested classes inherited from class net.datastructures.SortedListPriorityQueue
SortedListPriorityQueue.DefaultComparator, SortedListPriorityQueue.MyEntry
 
Field Summary
 
Fields inherited from class net.datastructures.SortedListPriorityQueue
actionPos, c, L
 
Constructor Summary
SortedListAdaptablePriorityQueue()
          Creates the priority queue with the default comparator.
SortedListAdaptablePriorityQueue(Comparator comp)
          Creates the priority queue with the given comparator.
SortedListAdaptablePriorityQueue(List list, Comparator comp)
          Creates the priority queue with the given comparator and list.
 
Method Summary
protected  void checkEntry(Entry ent)
          Determines whether a given entry is valid.
 Entry insert(Object k, Object v)
          Inserts a key-value pair and returns the entry created.
 Entry remove(Entry entry)
          Removes and returns the given entry.
 Object replaceKey(Entry entry, Object k)
          Replaces the key of the given entry.
 Object replaceValue(Entry e, Object value)
          Replaces the value of the given entry.
 
Methods inherited from class net.datastructures.SortedListPriorityQueue
checkKey, insertEntry, isEmpty, key, min, removeMin, setComparator, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.datastructures.PriorityQueue
isEmpty, min, removeMin, size
 

Constructor Detail

SortedListAdaptablePriorityQueue

public SortedListAdaptablePriorityQueue()
Creates the priority queue with the default comparator.


SortedListAdaptablePriorityQueue

public SortedListAdaptablePriorityQueue(Comparator comp)
Creates the priority queue with the given comparator.


SortedListAdaptablePriorityQueue

public SortedListAdaptablePriorityQueue(List list,
                                        Comparator comp)
Creates the priority queue with the given comparator and list. The list is assumed to be sorted in nondecreasing order.

Method Detail

insert

public Entry insert(Object k,
                    Object v)
             throws InvalidKeyException
Inserts a key-value pair and returns the entry created.

Specified by:
insert in interface PriorityQueue
Overrides:
insert in class SortedListPriorityQueue
Throws:
InvalidKeyException

remove

public Entry remove(Entry entry)
Removes and returns the given entry.

Specified by:
remove in interface AdaptablePriorityQueue

replaceKey

public Object replaceKey(Entry entry,
                         Object k)
Replaces the key of the given entry.

Specified by:
replaceKey in interface AdaptablePriorityQueue

replaceValue

public Object replaceValue(Entry e,
                           Object value)
Replaces the value of the given entry.

Specified by:
replaceValue in interface AdaptablePriorityQueue

checkEntry

protected void checkEntry(Entry ent)
                   throws InvalidEntryException
Determines whether a given entry is valid.

Throws:
InvalidEntryException

net.datastructures - version 3.0