diff --git a/src/cse332/datastructures/trees/BinarySearchTree.java b/src/cse332/datastructures/trees/BinarySearchTree.java index 92fecb78b27804d4c6ab6e54abf6c966f8ded158..c045ca31a676d1fd3ce6f9ab138490aa9e373d69 100644 --- a/src/cse332/datastructures/trees/BinarySearchTree.java +++ b/src/cse332/datastructures/trees/BinarySearchTree.java @@ -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; diff --git a/src/cse332/interfaces/misc/ComparableDictionary.java b/src/cse332/interfaces/misc/ComparableDictionary.java index d65c900641b22cd22a624261f7fe86c6d82b646b..7a2ee2f48e8bd284d46775bf06b2c4d34b1d38db 100644 --- a/src/cse332/interfaces/misc/ComparableDictionary.java +++ b/src/cse332/interfaces/misc/ComparableDictionary.java @@ -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> { } diff --git a/src/datastructures/dictionaries/AVLTree.java b/src/datastructures/dictionaries/AVLTree.java index 02f53108d1020c76b43eaef6586a6ea916e8d87c..2d5de2a5314527d69461918fce6552df2cbeefc9 100644 --- a/src/datastructures/dictionaries/AVLTree.java +++ b/src/datastructures/dictionaries/AVLTree.java @@ -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! } diff --git a/src/tests/gitlab/ckpt1/NGramToNextChoicesMapTests.java b/src/tests/gitlab/ckpt1/NGramToNextChoicesMapTests.java index a82e790d67497ce5f32edb4f04c3058d1e0651a8..85d65dc7e1e1e41267cfe08ebf716c6fe814827e 100644 --- a/src/tests/gitlab/ckpt1/NGramToNextChoicesMapTests.java +++ b/src/tests/gitlab/ckpt1/NGramToNextChoicesMapTests.java @@ -1,19 +1,19 @@ package tests.gitlab.ckpt1; +import cse332.datastructures.containers.Item; +import cse332.datastructures.trees.BinarySearchTree; +import cse332.types.NGram; +import org.junit.Test; +import p2.wordsuggestor.NGramToNextChoicesMap; + import java.util.Arrays; import java.util.Comparator; -import java.util.TreeMap; import java.util.Map; -import java.util.function.Supplier; +import java.util.TreeMap; -import cse332.datastructures.containers.Item; -import cse332.interfaces.misc.Dictionary; -import cse332.types.AlphabeticString; -import cse332.types.NGram; -import cse332.datastructures.trees.BinarySearchTree; -import p2.wordsuggestor.NGramToNextChoicesMap; -import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; public class NGramToNextChoicesMapTests { private NGramToNextChoicesMap init() {