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:
parent
dae77bf14a
commit
99d4ebc26d
|
|
@ -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.");
|
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.
|
// Fast fail for walkers not supporting TreeReducible interface.
|
||||||
if( !(walker instanceof TreeReducible) )
|
if( !(walker instanceof TreeReducible) )
|
||||||
throw new IllegalArgumentException("Hierarchical microscheduler only works with TreeReducible walkers");
|
throw new IllegalArgumentException("Hierarchical microscheduler only works with TreeReducible walkers");
|
||||||
|
|
@ -110,6 +110,8 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Reduce
|
||||||
|
|
||||||
traversalEngine.printOnTraversalDone(result);
|
traversalEngine.printOnTraversalDone(result);
|
||||||
walker.onTraversalDone(result);
|
walker.onTraversalDone(result);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class LinearMicroScheduler extends MicroScheduler {
|
||||||
* @param walker Computation to perform over dataset.
|
* @param walker Computation to perform over dataset.
|
||||||
* @param locations Subset of the dataset over which to walk.
|
* @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);
|
ShardStrategy shardStrategy = getShardStrategy(reference, locations);
|
||||||
|
|
||||||
walker.initialize();
|
walker.initialize();
|
||||||
|
|
@ -45,6 +45,8 @@ public class LinearMicroScheduler extends MicroScheduler {
|
||||||
traversalEngine.printOnTraversalDone(accumulator);
|
traversalEngine.printOnTraversalDone(accumulator);
|
||||||
|
|
||||||
walker.onTraversalDone(accumulator);
|
walker.onTraversalDone(accumulator);
|
||||||
|
|
||||||
|
return accumulator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,9 @@ public abstract class MicroScheduler {
|
||||||
* Walks a walker over the given list of intervals.
|
* Walks a walker over the given list of intervals.
|
||||||
* @param walker Computation to perform over dataset.
|
* @param walker Computation to perform over dataset.
|
||||||
* @param intervals A list of intervals over which to walk. Null for whole 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.
|
* Get the sharding strategy given a driving data source.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue