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
This commit is contained in:
parent
a5154d99a3
commit
7a9cfe1f75
|
|
@ -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) {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,4 @@ public abstract class LocusWalker<MapType, ReduceType> extends Walker<MapType, R
|
|||
|
||||
// Map over the org.broadinstitute.sting.gatk.LocusContext
|
||||
public abstract MapType map(RefMetaDataTracker tracker, char ref, LocusContext context);
|
||||
|
||||
// Given result of map function
|
||||
public abstract ReduceType reduceInit();
|
||||
public abstract ReduceType reduce(MapType value, ReduceType sum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,4 @@ public abstract class ReadWalker<MapType, ReduceType> extends Walker<MapType, Re
|
|||
|
||||
// Map over the org.broadinstitute.sting.gatk.LocusContext
|
||||
public abstract MapType map(LocusContext context, SAMRecord read);
|
||||
|
||||
// Given result of map function
|
||||
public abstract ReduceType reduceInit();
|
||||
public abstract ReduceType reduce(MapType value, ReduceType sum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,20 @@ public abstract class Walker<MapType, ReduceType> {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue