package es.tid.cosmos.mobility.adjacentextraction;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Reducer;

import es.tid.cosmos.base.data.TypedProtobufWritable;
import es.tid.cosmos.base.data.generated.BaseTypes.Int;
import es.tid.cosmos.mobility.data.generated.MobProtocol.TwoInt;

/**
 * Input: <Long, TwoInt>
 * Output: <Long, Int>
 * 
 * @author dmicol
 */
class AdjSpreadCountReducer extends Reducer<LongWritable,
        TypedProtobufWritable<TwoInt>, LongWritable, TypedProtobufWritable<Int>> {
    @Override
    protected void reduce(LongWritable key,
            Iterable<TypedProtobufWritable<TwoInt>> values, Context context)
            throws IOException, InterruptedException {
        int valueCount = 0;
        for (TypedProtobufWritable<TwoInt> value : values) {
            valueCount++;
        }
        context.write(new LongWritable(0L),
                      TypedProtobufWritable.create(valueCount));
    }
}

@@ -269,18 +269,20 @@
 ypes.Int
+64
 ;%0A
-
 import e
@@ -461,16 +461,25 @@
 Reducer%3C
+%0A        
 LongWrit
@@ -483,24 +483,16 @@
 ritable,
-%0A       
  TypedPr
@@ -514,16 +514,24 @@
 TwoInt%3E,
+%0A       
  LongWri
@@ -562,16 +562,18 @@
 able%3CInt
+64
 %3E%3E %7B%0A   
@@ -771,11 +771,12 @@
     
-int
+long
  val
@@ -786,16 +786,17 @@
 ount = 0
+L
 ;%0A      

Fix bug in AdjSpreadCountReducer