From 7611fb236f1cf907e4fab53c667649a84f9ef8f1 Mon Sep 17 00:00:00 2001 From: Richard Jiang <rjiang98@cs.washington.edu> Date: Mon, 12 Oct 2020 22:50:47 -0700 Subject: [PATCH] Added MinFourHeaPComparableTests --- src/datastructures/worklists/.gitkeep | 0 src/p2/wordsuggestor/NGramToNextChoicesMap.java | 6 +++--- src/tests/gitlab/ckpt1/Ckpt1Tests.java | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) delete mode 100644 src/datastructures/worklists/.gitkeep diff --git a/src/datastructures/worklists/.gitkeep b/src/datastructures/worklists/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/p2/wordsuggestor/NGramToNextChoicesMap.java b/src/p2/wordsuggestor/NGramToNextChoicesMap.java index 7420196..c038c93 100644 --- a/src/p2/wordsuggestor/NGramToNextChoicesMap.java +++ b/src/p2/wordsuggestor/NGramToNextChoicesMap.java @@ -27,10 +27,10 @@ public class NGramToNextChoicesMap { * Increments the count of word after the particular NGram ngram. */ public void seenWordAfterNGram(NGram ngram, String word) { - Dictionary<AlphabeticString, Integer> counter = map.find((NGram) ngram); + Dictionary<AlphabeticString, Integer> counter = map.find(ngram); if (counter == null) { counter = newInner.get(); - map.insert((NGram) ngram, counter); + map.insert(ngram, counter); } Integer prev = counter.find(new AlphabeticString(word)); @@ -54,7 +54,7 @@ public class NGramToNextChoicesMap { if (ngram == null) { return (Item<String, Integer>[]) new Item[0]; } - Dictionary<AlphabeticString, Integer> counter = map.find((NGram) ngram); + Dictionary<AlphabeticString, Integer> counter = map.find(ngram); Item<String, Integer>[] result = (Item<String, Integer>[]) new Item[counter != null ? counter.size() : 0]; if (counter != null) { diff --git a/src/tests/gitlab/ckpt1/Ckpt1Tests.java b/src/tests/gitlab/ckpt1/Ckpt1Tests.java index 3e0cdbb..c2ab676 100644 --- a/src/tests/gitlab/ckpt1/Ckpt1Tests.java +++ b/src/tests/gitlab/ckpt1/Ckpt1Tests.java @@ -10,7 +10,8 @@ import org.junit.runners.Suite; @Suite.SuiteClasses({ MinFourHeapComparable.class, MoveToFrontListTests.class, - CircularArrayComparatorTests.class + CircularArrayComparatorTests.class, + MinFourHeapComparableTests.class }) public class Ckpt1Tests { -- GitLab