From fa286f2d9208a2fe79c383fa927be41ee175d78e Mon Sep 17 00:00:00 2001 From: Adam Blank <blank@cs.washington.edu> Date: Fri, 12 Feb 2016 23:41:17 -0800 Subject: [PATCH] Adds bst and avl constructor methods to NGramTester --- src/p2/clients/NGramTester.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/p2/clients/NGramTester.java b/src/p2/clients/NGramTester.java index 33b035c..d7e9227 100644 --- a/src/p2/clients/NGramTester.java +++ b/src/p2/clients/NGramTester.java @@ -3,10 +3,12 @@ package p2.clients; import java.io.IOException; import java.util.function.Supplier; +import cse332.datastructures.trees.BinarySearchTree; import cse332.interfaces.misc.BString; import cse332.interfaces.misc.Dictionary; import cse332.types.AlphabeticString; import cse332.types.NGram; +import datastructures.dictionaries.AVLTree; import datastructures.dictionaries.ChainingHashTable; import datastructures.dictionaries.HashTrieMap; import p2.wordsuggestor.WordSuggestor; @@ -20,6 +22,17 @@ public class NGramTester { Supplier<Dictionary<K, V>> constructor) { return () -> new ChainingHashTable<K, V>(constructor); } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static <K, V> Supplier<Dictionary<K, V>> binarySearchTreeConstructor() { + return () -> new BinarySearchTree(); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static <K, V> Supplier<Dictionary<K, V>> avlTreeConstructor() { + return () -> new AVLTree(); + } + public static void main(String[] args) { try { -- GitLab