From 7a9cfe1f75d8c354e553192360ceffa129d50bbf Mon Sep 17 00:00:00 2001 From: hanna Date: Fri, 8 May 2009 13:46:28 +0000 Subject: [PATCH] Push reduceInit down a level so that the walker can call into it without weird casts. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@638 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/gatk/executive/LinearMicroScheduler.java | 2 +- .../sting/gatk/walkers/LocusWalker.java | 4 ---- .../sting/gatk/walkers/ReadWalker.java | 4 ---- .../broadinstitute/sting/gatk/walkers/Walker.java | 14 ++++++++++++++ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java b/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java index 8744221af..0be399f48 100644 --- a/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java +++ b/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java @@ -55,7 +55,7 @@ public class LinearMicroScheduler extends MicroScheduler { SAMDataSource dataSource = getReadsDataSource(); walker.initialize(); - Object accumulator = ((LocusWalker) walker).reduceInit(); + Object accumulator = walker.reduceInit(); for (Shard shard : shardStrategy) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/LocusWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/LocusWalker.java index 42fee73df..2c186534b 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/LocusWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/LocusWalker.java @@ -28,8 +28,4 @@ public abstract class LocusWalker extends Walker extends Walker { public void initialize() { } + /** + * Provide an initial value for reduce computations. + * @return Initial value of reduce. + */ + public abstract ReduceType reduceInit(); + + /** + * Reduces a single map with the accumulator provided as the ReduceType. + * @param value result of the map. + * @param sum accumulator for the reduce. + * @return accumulator with result of the map taken into account. + */ + public abstract ReduceType reduce(MapType value, ReduceType sum); + public void onTraversalDone(ReduceType result) { out.println("[REDUCE RESULT] Traversal result is: " + result); }