Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This a priority queue that implements a heap
- * @author Jonathan Harris
- * May 28, 2015
- */
- public class TaskPriorityQueue<Task extends Comparable<? super Task>> implements PriorityQueue<Task> {
- Node root;
- /**
- * This is the private node class for the Queue/Heap Implementation.
- */
- private class Node {
- private Task item;
- private Node lChild;
- private Node mChild;
- private Node rChild;
- private Node(Task item, Node lChild, Node mChild, Node rChild) {
- this.item = item;
- this.lChild = lChild;
- this.mChild = mChild;
- this.rChild = rChild;
- }
- }
- public TaskPriorityQueue() {
- Node root = null;
- }
- /** Adds the given item to the queue. */
- public void add(Task task) {
- if (root == null) {
- root = new Node(task, null,null,null);
- }
- System.out.println();
- Node tempNode = root;
- System.out.println(task.getClass().getName());
- /*while(true) {
- if (tempNode.item.getDueDate().compareTo(task.getDueDate()) > 0) {
- //System.out.println(item.getDueDate() + " is less than node.");
- }
- }*/
- }
- // Some other code
- public static void main(String[] args) {
- Task task1 = new Task("05-29-1995", "task1");
- TaskPriorityQueue<Task> queue = new TaskPriorityQueue<Task>();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement