Added functionality to return the final accumulator of a traversal, so external tools can get the result of a walker.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@724 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-05-15 20:20:27 +00:00
parent dae77bf14a
commit 99d4ebc26d
3 changed files with 8 additions and 3 deletions

View File

@ -65,7 +65,7 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Reduce
throw new UnsupportedOperationException("Traversal engine supports only traverse loci by reference at this time.");
}
public void execute( Walker walker, List<GenomeLoc> intervals ) {
public Object execute( Walker walker, List<GenomeLoc> intervals ) {
// Fast fail for walkers not supporting TreeReducible interface.
if( !(walker instanceof TreeReducible) )
throw new IllegalArgumentException("Hierarchical microscheduler only works with TreeReducible walkers");
@ -110,6 +110,8 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Reduce
traversalEngine.printOnTraversalDone(result);
walker.onTraversalDone(result);
return result;
}
/**

View File

@ -30,7 +30,7 @@ public class LinearMicroScheduler extends MicroScheduler {
* @param walker Computation to perform over dataset.
* @param locations Subset of the dataset over which to walk.
*/
public void execute(Walker walker, List<GenomeLoc> locations) {
public Object execute(Walker walker, List<GenomeLoc> locations) {
ShardStrategy shardStrategy = getShardStrategy(reference, locations);
walker.initialize();
@ -45,6 +45,8 @@ public class LinearMicroScheduler extends MicroScheduler {
traversalEngine.printOnTraversalDone(accumulator);
walker.onTraversalDone(accumulator);
return accumulator;
}

View File

@ -91,8 +91,9 @@ public abstract class MicroScheduler {
* Walks a walker over the given list of intervals.
* @param walker Computation to perform over dataset.
* @param intervals A list of intervals over which to walk. Null for whole dataset.
* @return the return type of the walker
*/
public abstract void execute( Walker walker, List<GenomeLoc> intervals);
public abstract Object execute( Walker walker, List<GenomeLoc> intervals);
/**
* Get the sharding strategy given a driving data source.