package com.collective.celos.examples.wordcount;

import java.io.IOException;
import java.util.*;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.*;
import org.apache.hadoop.util.*;

public class WordCount {

    public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
      private final static IntWritable one = new IntWritable(1);
      private Text word = new Text();

      public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
        String line = value.toString();
        StringTokenizer tokenizer = new StringTokenizer(line);
        while (tokenizer.hasMoreTokens()) {
          word.set(tokenizer.nextToken());
          output.collect(word, one);
        }
      }
    }

    public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
      public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
        int sum = 0;
        while (values.hasNext()) {
          sum += values.next().get();
        }
        output.collect(key, new IntWritable(sum));
      }
    }

    public static void main(String[] args) throws Exception {
      JobConf conf = new JobConf(WordCount.class);
      conf.setJobName("wordcount");

      conf.setOutputKeyClass(Text.class);
      conf.setOutputValueClass(IntWritable.class);

      conf.setMapperClass(Map.class);
      conf.setCombinerClass(Reduce.class);
      conf.setReducerClass(Reduce.class);

      conf.setInputFormat(TextInputFormat.class);
      conf.setOutputFormat(TextOutputFormat.class);

      FileInputFormat.setInputPaths(conf, new Path(args[0]));
      FileOutputFormat.setOutputPath(conf, new Path(args[1]));

      JobClient.runJob(conf);
    }
}
@@ -396,24 +396,26 @@
 le%3E %7B%0A      
+  
 private fina
@@ -463,24 +463,26 @@
 e(1);%0A      
+  
 private Text
@@ -498,24 +498,26 @@
 ew Text();%0A%0A
+  
       public
@@ -643,24 +643,28 @@
 n %7B%0A        
+    
 String line 
@@ -687,24 +687,28 @@
 ();%0A        
+ 
+   
 StringTokeni
@@ -754,24 +754,28 @@
 e);%0A        
+    
 while (token
@@ -808,16 +808,22 @@
         
+    
+  
 word.set
@@ -849,32 +849,38 @@
 n());%0A          
+      
 output.collect(w
@@ -886,24 +886,38 @@
 word, one);%0A
+            %7D%0A
         %7D%0A  
@@ -914,24 +914,16 @@
       %7D%0A
-      %7D%0A
     %7D%0A%0A 
@@ -1035,24 +1035,26 @@
 le%3E %7B%0A      
+  
 public void 
@@ -1191,16 +1191,20 @@
         
+    
 int sum 
@@ -1208,16 +1208,20 @@
 um = 0;%0A
+    
         
@@ -1257,16 +1257,22 @@
         
+   
+   
 sum += v
@@ -1291,34 +1291,42 @@
 .get();%0A        
-%7D%0A
+    %7D%0A    
         output.c
@@ -1362,24 +1362,26 @@
 um));%0A      
+ 
+ 
 %7D%0A    %7D%0A%0A   
@@ -1441,24 +1441,26 @@
 ion %7B%0A      
+  
 JobConf conf
@@ -1490,32 +1490,34 @@
 t.class);%0A      
+ 
+ 
 conf.setJobName(
@@ -1527,24 +1527,26 @@
 rdcount%22);%0A%0A
+  
       conf.s
@@ -1573,32 +1573,34 @@
 t.class);%0A      
+  
 conf.setOutputVa
@@ -1627,32 +1627,34 @@
 .class);%0A%0A      
+  
 conf.setMapperCl
@@ -1661,32 +1661,34 @@
 ass(Map.class);%0A
+  
       conf.setCo
@@ -1712,32 +1712,34 @@
 e.class);%0A      
+  
 conf.setReducerC
@@ -1755,24 +1755,26 @@
 ce.class);%0A%0A
+  
       conf.s
@@ -1807,24 +1807,26 @@
 mat.class);%0A
+  
       conf.s
@@ -1868,24 +1868,26 @@
 ss);%0A%0A      
+  
 FileInputFor
@@ -1926,24 +1926,26 @@
 (args%5B0%5D));%0A
+  
       FileOu
@@ -1992,24 +1992,26 @@
 args%5B1%5D));%0A%0A
+  
       JobCli

change indentation