right...exponential should be exponential, so I might want to increment the exponent

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@315 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-04-07 20:12:05 +00:00
parent 6ce9e0f941
commit 8a357a88a2
1 changed files with 7 additions and 5 deletions

View File

@ -26,13 +26,13 @@ import net.sf.samtools.SAMSequenceDictionary;
* <p/> * <p/>
* Class LinearShard * Class LinearShard
* <p/> * <p/>
* A linear strategy, very very similar to adaptive * A exponential strategy
*/ */
public class ExpGrowthShardStrategy extends ShardStrategy { public class ExpGrowthShardStrategy extends ShardStrategy {
// fixed size // fixed size
private long baseSize = 100000; private long baseSize = 100000;
private long currentExp = 1; private long currentExp = 0;
/** /**
* the constructor, taking a seq dictionary to parse out contigs * the constructor, taking a seq dictionary to parse out contigs
@ -42,7 +42,7 @@ public class ExpGrowthShardStrategy extends ShardStrategy {
ExpGrowthShardStrategy(SAMSequenceDictionary dic, long startSize) { ExpGrowthShardStrategy(SAMSequenceDictionary dic, long startSize) {
super(dic); super(dic);
this.baseSize = startSize; this.baseSize = startSize;
currentExp = 1; currentExp = 0;
} }
/** /**
@ -53,7 +53,7 @@ public class ExpGrowthShardStrategy extends ShardStrategy {
ExpGrowthShardStrategy(ShardStrategy strat) { ExpGrowthShardStrategy(ShardStrategy strat) {
super(strat); super(strat);
this.baseSize = strat.nextShardSize(); this.baseSize = strat.nextShardSize();
currentExp = 1; currentExp = 0;
} }
/** /**
@ -63,7 +63,7 @@ public class ExpGrowthShardStrategy extends ShardStrategy {
*/ */
public void adjustNextShardSize(long size) { public void adjustNextShardSize(long size) {
baseSize = size; baseSize = size;
currentExp = 1; currentExp = 0;
} }
/** /**
@ -72,6 +72,8 @@ public class ExpGrowthShardStrategy extends ShardStrategy {
* @return the next shard size * @return the next shard size
*/ */
protected long nextShardSize() { protected long nextShardSize() {
// we grow the exponentially, we just have to make sure we start at zero
++currentExp;
return (long) Math.floor(Math.pow((double) baseSize, (double) currentExp)); return (long) Math.floor(Math.pow((double) baseSize, (double) currentExp));
} }