Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • sarafa/p2
  • mertht/p2
  • cse332-19au/p2
  • sandchow/p2
  • hanzhang/p2
  • cse332-19sp/p2
  • cse332-20sp/p2
  • cse332-20su-tasks/p2
  • cse332-20su/p2
  • cse332-21su/p2
  • cse332-21wi/p2
  • cse332-21sp/p2
  • cse332-20au/p2
13 results
Show changes
Commits on Source (14)
Showing
with 120 additions and 5 deletions
File added
File added
File added
File added
File added
File added
javafx.version=11.0.2
javafx.runtime.version=11.0.2+1
javafx.runtime.build=1
File added
File added
File added
package cse332.datastructures.containers;
import java.util.Objects;
/**
* Simple class to hold a piece of data and its value.
*
......@@ -40,4 +42,18 @@ public class Item<K, V> {
public String toString() {
return this.key + "=" + this.value + "";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Item<?, ?> item = (Item<?, ?>) o;
return Objects.equals(key, item.key) &&
Objects.equals(value, item.value);
}
@Override
public int hashCode() {
return Objects.hash(key, value);
}
}
......@@ -13,7 +13,7 @@ import datastructures.worklists.ArrayStack;
* BinarySearchTree implements the ComparableDictionary interface using a binary
* search tree. Notice that the key type must be Comparable.
*/
public class BinarySearchTree<K extends Comparable<K>, V>
public class BinarySearchTree<K extends Comparable<? super K>, V>
extends ComparableDictionary<K, V> {
// The root of the BST. Root is null if and only if the tree is empty.
protected BSTNode root;
......
......@@ -10,6 +10,6 @@ package cse332.interfaces.misc;
*
* @author Adam Blank
*/
public abstract class ComparableDictionary<K extends Comparable<K>, V>
public abstract class ComparableDictionary<K extends Comparable<? super K>, V>
extends DeletelessDictionary<K, V> {
}
......@@ -28,6 +28,6 @@ import cse332.datastructures.trees.BinarySearchTree;
* 6. Do NOT override the toString method. It is used for grading.
*/
public class AVLTree<K extends Comparable<K>, V> extends BinarySearchTree<K, V> {
public class AVLTree<K extends Comparable<? super K>, V> extends BinarySearchTree<K, V> {
// TODO: Implement me!
}
......@@ -3,7 +3,7 @@ package datastructures.dictionaries;
import java.util.Iterator;
import java.util.function.Supplier;
import cse332.datastructures.containers.*;
import cse332.datastructures.containers.Item;
import cse332.exceptions.NotYetImplementedException;
import cse332.interfaces.misc.DeletelessDictionary;
import cse332.interfaces.misc.Dictionary;
......
......@@ -2,7 +2,7 @@ package datastructures.dictionaries;
import java.util.Iterator;
import cse332.datastructures.containers.*;
import cse332.datastructures.containers.Item;
import cse332.exceptions.NotYetImplementedException;
import cse332.interfaces.misc.DeletelessDictionary;
......
package datastructures.worklists;
import cse332.exceptions.NotYetImplementedException;
import cse332.interfaces.worklists.PriorityWorkList;
import java.util.Comparator;
/**
* See cse332/interfaces/worklists/PriorityWorkList.java
* for method specifications.
*/
public class MinFourHeap<E> extends PriorityWorkList<E> {
/* Do not change the name of this field; the tests rely on it to work correctly. */
private E[] data;
public MinFourHeap(Comparator<E> c) {
throw new NotYetImplementedException();
}
@Override
public boolean hasWork() {
throw new NotYetImplementedException();
}
@Override
public void add(E work) {
throw new NotYetImplementedException();
}
@Override
public E peek() {
throw new NotYetImplementedException();
}
@Override
public E next() {
throw new NotYetImplementedException();
}
@Override
public int size() {
throw new NotYetImplementedException();
}
@Override
public void clear() {
throw new NotYetImplementedException();
}
}
package datastructures.worklists;
import cse332.exceptions.NotYetImplementedException;
import cse332.interfaces.worklists.PriorityWorkList;
/**
* See cse332/interfaces/worklists/PriorityWorkList.java
* for method specifications.
*/
public class MinFourHeapComparable<E extends Comparable<E>> extends PriorityWorkList<E> {
/* Do not change the name of this field; the tests rely on it to work correctly. */
private E[] data;
public MinFourHeapComparable() {
throw new NotYetImplementedException();
}
@Override
public boolean hasWork() {
throw new NotYetImplementedException();
}
@Override
public void add(E work) {
throw new NotYetImplementedException();
}
@Override
public E peek() {
throw new NotYetImplementedException();
}
@Override
public E next() {
throw new NotYetImplementedException();
}
@Override
public int size() {
throw new NotYetImplementedException();
}
@Override
public void clear() {
throw new NotYetImplementedException();
}
}