public abstract class Splitter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Splitter.WeightedRange |
Modifier | Constructor and Description |
---|---|
protected |
Splitter(IPartitioner partitioner) |
Modifier and Type | Method and Description |
---|---|
protected java.math.BigInteger |
elapsedTokens(Token token,
Range<Token> range)
Computes the number of elapsed tokens from the range start until this token
|
double |
positionInRange(Token token,
Range<Token> range)
Computes the normalized position of this token relative to this range
|
java.util.Set<Range<Token>> |
split(java.util.Collection<Range<Token>> ranges,
int parts)
Splits the specified token ranges in at least
parts subranges. |
java.util.List<Token> |
splitOwnedRanges(int parts,
java.util.List<Splitter.WeightedRange> weightedRanges,
boolean dontSplitRanges) |
protected abstract Token |
tokenForValue(java.math.BigInteger value) |
protected java.math.BigInteger |
tokensInRange(Range<Token> range) |
protected abstract java.math.BigInteger |
valueForToken(Token token) |
protected Splitter(IPartitioner partitioner)
protected abstract Token tokenForValue(java.math.BigInteger value)
protected abstract java.math.BigInteger valueForToken(Token token)
protected java.math.BigInteger elapsedTokens(Token token, Range<Token> range)
public double positionInRange(Token token, Range<Token> range)
public java.util.List<Token> splitOwnedRanges(int parts, java.util.List<Splitter.WeightedRange> weightedRanges, boolean dontSplitRanges)
public java.util.Set<Range<Token>> split(java.util.Collection<Range<Token>> ranges, int parts)
parts
subranges.
Each returned subrange will be contained in exactly one of the specified ranges.
ranges
- a collection of token ranges to be splitparts
- the minimum number of returned rangesminParts
token ranges covering ranges
Copyright © 2009-2021 The Apache Software Foundation