package org.broadinstitute.sting.gatk.walkers;

import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: mdepristo
 * Date: Feb 22, 2009
 * Time: 3:22:14 PM
 * To change this template use File | Settings | File Templates.
 */
public class CountLociWalker extends LocusWalker<Integer, Integer> implements TreeReducible<Integer> {
    public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) {
        return 1;
    }

    public Integer reduceInit() { return 0; }

    public Integer reduce(Integer value, Integer sum) {
        return value + sum;
    }

    /**
     * Reduces two subtrees together.  In this case, the implementation of the tree reduce
     * is exactly the same as the implementation of the single reduce.
     */
    public Integer treeReduce(Integer lhs, Integer rhs) {
        return lhs + rhs;
    }
}

@@ -471,23 +471,20 @@
 nteger, 
-Integer
+Long
 %3E implem
@@ -502,23 +502,20 @@
 ducible%3C
-Integer
+Long
 %3E %7B%0A    
@@ -627,31 +627,28 @@
 %0A    public 
-Integer
+Long
  reduceInit(
@@ -659,16 +659,17 @@
 return 0
+l
 ; %7D%0A%0A   
@@ -676,23 +676,20 @@
  public 
-Integer
+Long
  reduce(
@@ -703,23 +703,20 @@
  value, 
-Integer
+Long
  sum) %7B%0A
@@ -939,23 +939,20 @@
  public 
-Integer
+Long
  treeRed
@@ -959,28 +959,22 @@
 uce(
-Integer lhs, Integer
+Long lhs, Long
  rhs

The number of loci can easily overflow an int. Change reduce type to a Long.