Implementato HeapAdaptablePriorityQueue mediante heap. Implementato SortedListAdaptablePriorityQueue estendendo SortedListPriorityQueue utilizzando l'interfacciaAdaptablePriorityQueue . L'implementazione di entrambi una una classe LocationAwareEntry estensione di Entry.

This commit is contained in:
2014-05-11 17:54:47 +02:00
parent dc7774bef6
commit 597626b34c
8 changed files with 466 additions and 20 deletions

View File

@@ -2,6 +2,7 @@ package priorityqueue.heap;
import exceptions.EmptyPriorityQueueException;
import position.Position;
import priorityqueue.Entry;
import priorityqueue.MyEntry;
import priorityqueue.PriorityQueue;
import tree.binarytree.heap.ArrayListCompleteBinaryTree;
import tree.binarytree.heap.CompleteBinaryTree;
@@ -17,17 +18,7 @@ public class HeapPriorityQueue<K,V> implements PriorityQueue<K,V> {
protected Comparator<K> comp;
protected static class MyEntry<K,V> implements Entry<K,V> {
protected K key;
protected V value;
public MyEntry(K k, V v) { key = k; value = v; }
public K getKey() { return key; }
public V getValue() { return value; }
public String toString() { return "(" + key + "," + value + ")"; }
}
public HeapPriorityQueue() {
public HeapPriorityQueue() {
heap = new ArrayListCompleteBinaryTree<Entry<K,V>>();
comp = new DefaultComparator<K>();
}