diff --git a/exceptions/EmptyPriorityQueueException.java b/exceptions/EmptyPriorityQueueException.java new file mode 100644 index 0000000..754ef0b --- /dev/null +++ b/exceptions/EmptyPriorityQueueException.java @@ -0,0 +1,18 @@ +package exceptions; + +/** + * Signals that the boundaries of a data structure have been illegally + * traversed (e.g. past the end of a list). + * @author Roberto Tamassia + */ +//Copyright (c) 2003 Brown University, Providence, RI +//Additional modifications and methods by xgiovio + +public class EmptyPriorityQueueException extends RuntimeException { + public EmptyPriorityQueueException(String message) { + super (message); + } + public EmptyPriorityQueueException() { + super ("EmptyPriorityQueueException"); + } +} diff --git a/priorityqueue/Entry.java b/priorityqueue/Entry.java new file mode 100644 index 0000000..94d2703 --- /dev/null +++ b/priorityqueue/Entry.java @@ -0,0 +1,12 @@ +package priorityqueue; + +/** + * Created with xgiovio.macbookair. + * User: xgiovio + * Date: 01/04/14 + * Time: 16:27 + */ +public interface Entry { + public K getKey(); + public V getValue(); +} diff --git a/priorityqueue/PriorityQueue.java b/priorityqueue/PriorityQueue.java new file mode 100644 index 0000000..361fec4 --- /dev/null +++ b/priorityqueue/PriorityQueue.java @@ -0,0 +1,18 @@ +package priorityqueue; + +import exceptions.EmptyPriorityQueueException; +import java.security.InvalidKeyException; + +/** + * Created with xgiovio.macbookair. + * User: xgiovio + * Date: 01/04/14 + * Time: 16:29 + */ +public interface PriorityQueue { + public int size(); + public boolean isEmpty(); + public Entry min() throws EmptyPriorityQueueException; + public Entry insert(K key, V value) throws InvalidKeyException; + public Entry removeMin() throws EmptyPriorityQueueException; +}