In this commit I have:

Added JavaDoc to every package except for "heaps"
This commit is contained in:
zacharyjones123
2017-04-18 07:57:17 -07:00
parent 94871b7e6a
commit 9411d5be56
29 changed files with 1406 additions and 425 deletions

View File

@@ -84,7 +84,13 @@ public class MaxHeap implements Heap {
@Override
public void deleteElement(int elementIndex) {
if (isempty(maxHeap)) throw new EmptyHeapException("Attempt to delete an element from an empty heap");
if (maxHeap.isEmpty())
try {
throw new EmptyHeapException("Attempt to delete an element from an empty heap");
} catch (EmptyHeapException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if ((elementIndex > maxHeap.size()) && (elementIndex <= 0)) throw new IndexOutOfBoundsException("Index out of heap range");
// The last element in heap replaces the one to be deleted
maxHeap.set(elementIndex - 1, getElement(maxHeap.size()));