au.csiro.variantspark.algo.split.AbstractIndexedSplitterBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of variant-spark_2.11 Show documentation
Show all versions of variant-spark_2.11 Show documentation
Genomic variants interpretation toolkit
The newest version!
package au.csiro.variantspark.algo.split;
import au.csiro.variantspark.algo.IndexedSplitAggregator;
import au.csiro.variantspark.algo.IndexedSplitter;
import au.csiro.variantspark.algo.SplitImpurity;
import au.csiro.variantspark.algo.SplitInfo;
public abstract class AbstractIndexedSplitterBase implements IndexedSplitter {
protected final SplitImpurity leftRightImpurity = new SplitImpurity();
protected IndexedSplitAggregator impurityCalc;
public AbstractIndexedSplitterBase(IndexedSplitAggregator impurityCalc) {
this.impurityCalc = impurityCalc;
}
@Override
public SplitInfo findSplit(int[] splitIndices) {
if (splitIndices.length < 2) {
// nothing to split
return null;
}
impurityCalc.init(splitIndices);
return doFindSplit(splitIndices);
}
protected abstract SplitInfo doFindSplit(int[] splitIndices);
}