From a1f4ceb3e81dbdaee4f9785280bdf76f6f5bc2d0 Mon Sep 17 00:00:00 2001 From: Winston Jodjana <winj@cs.washington.edu> Date: Wed, 20 Oct 2021 12:19:40 -0700 Subject: [PATCH] Update CircularArrayFIFOQueue.java to fit with p1-public --- .../worklists/CircularArrayFIFOQueue.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/main/java/datastructures/worklists/CircularArrayFIFOQueue.java b/src/main/java/datastructures/worklists/CircularArrayFIFOQueue.java index 4e92774..412244a 100644 --- a/src/main/java/datastructures/worklists/CircularArrayFIFOQueue.java +++ b/src/main/java/datastructures/worklists/CircularArrayFIFOQueue.java @@ -3,18 +3,11 @@ package datastructures.worklists; import cse332.exceptions.NotYetImplementedException; import cse332.interfaces.worklists.FixedSizeFIFOWorkList; -import java.util.NoSuchElementException; - /** * See cse332/interfaces/worklists/FixedSizeFIFOWorkList.java * for method specifications. */ -public class CircularArrayFIFOQueue<E extends Comparable<E>> extends FixedSizeFIFOWorkList<E> { - - private E[] queue; - private int front; - private int size; - +public class CircularArrayFIFOQueue<E> extends FixedSizeFIFOWorkList<E> { public CircularArrayFIFOQueue(int capacity) { super(capacity); throw new NotYetImplementedException(); @@ -57,17 +50,31 @@ public class CircularArrayFIFOQueue<E extends Comparable<E>> extends FixedSizeFI @Override public int compareTo(FixedSizeFIFOWorkList<E> other) { + // You will implement this method in project 2. Leave this method unchanged for project 1. throw new NotYetImplementedException(); } @Override @SuppressWarnings("unchecked") public boolean equals(Object obj) { - throw new NotYetImplementedException(); + // You will finish implementing this method in project 2. Leave this method unchanged for project 1. + if (this == obj) { + return true; + } else if (!(obj instanceof FixedSizeFIFOWorkList<?>)) { + return false; + } else { + // Uncomment the line below for p2 when you implement equals + // FixedSizeFIFOWorkList<E> other = (FixedSizeFIFOWorkList<E>) obj; + + // Your code goes here + + throw new NotYetImplementedException(); + } } @Override public int hashCode() { + // You will implement this method in project 2. Leave this method unchanged for project 1. throw new NotYetImplementedException(); } } -- GitLab