aboutsummaryrefslogtreecommitdiff
path: root/WordCount.java
diff options
context:
space:
mode:
authorgithub-classroom[bot] <66690702+github-classroom[bot]@users.noreply.github.com>2023-12-10 19:07:21 +0000
committerGitHub <noreply@github.com>2023-12-10 19:07:21 +0000
commitcb491e82b5ce3dcb7e3c41973a46cb7dcbaa9008 (patch)
treec9c6a81111803facc4e3b677e394495cea696bc0 /WordCount.java
Initial commit
Diffstat (limited to 'WordCount.java')
-rw-r--r--WordCount.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/WordCount.java b/WordCount.java
new file mode 100644
index 0000000..3c224d4
--- /dev/null
+++ b/WordCount.java
@@ -0,0 +1,52 @@
+import java.util.List;
+import java.util.Map;
+
+import mapreduce.MapReduce;
+
+/**
+ *
+ * @author mph
+ */
+public class WordCount {
+
+ int numSplites;
+
+ public WordCount(int numSplites) {
+ this.numSplites = numSplites;
+ }
+
+ public Map<String, Long> run(String filename) {
+ List<String> text = FileParser.parse(filename);
+ List<List<String>> inputs = FileParser.split(text, numSplites);
+
+ // TODO: instantiate a MapReduce object with correct input, key, value, and output types
+
+ // TODO: set the mapper and reducer suppliers, and set the inputs
+
+ // TODO: execute the MapReduce object and return the result
+
+ throw new UnsupportedOperationException("WordCount.run() not implemented yet.");
+ }
+
+ class Mapper
+ extends mapreduce.Mapper<List<String>, String, Long> {
+
+ @Override
+ public Map<String, Long> compute() {
+ // TODO: implement the Map function for word count
+ throw new UnsupportedOperationException("WordCount map function not implemented yet.");
+ }
+
+ }
+
+ class Reducer
+ extends mapreduce.Reducer<String, Long, Long> {
+
+ @Override
+ public Long compute() {
+ // TODO: implement the Reduce function for word count
+ throw new UnsupportedOperationException("WordCount reduce function not implemented yet.");
+ }
+ }
+
+}