Package org.apache.cassandra.dht
Class Splitter
- java.lang.Object
-
- org.apache.cassandra.dht.Splitter
-
public abstract class Splitter extends java.lang.ObjectPartition splitter.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSplitter.WeightedRange
-
Constructor Summary
Constructors Modifier Constructor Description protectedSplitter(IPartitioner partitioner)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.math.BigIntegerelapsedTokens(Token token, Range<Token> range)Computes the number of elapsed tokens from the range start until this tokendoublepositionInRange(Token token, Range<Token> range)Computes the normalized position of this token relative to this rangejava.util.Set<Range<Token>>split(java.util.Collection<Range<Token>> ranges, int parts)Splits the specified token ranges in at leastpartssubranges.java.util.List<Token>splitOwnedRanges(int parts, java.util.List<Splitter.WeightedRange> weightedRanges, boolean dontSplitRanges)protected abstract TokentokenForValue(java.math.BigInteger value)protected java.math.BigIntegertokensInRange(Range<Token> range)protected abstract java.math.BigIntegervalueForToken(Token token)
-
-
-
Constructor Detail
-
Splitter
protected Splitter(IPartitioner partitioner)
-
-
Method Detail
-
tokenForValue
protected abstract Token tokenForValue(java.math.BigInteger value)
-
valueForToken
protected abstract java.math.BigInteger valueForToken(Token token)
-
elapsedTokens
protected java.math.BigInteger elapsedTokens(Token token, Range<Token> range)
Computes the number of elapsed tokens from the range start until this token- Returns:
- the number of tokens from the range start to the token
-
positionInRange
public double positionInRange(Token token, Range<Token> range)
Computes the normalized position of this token relative to this range- Returns:
- A number between 0.0 and 1.0 representing this token's position in this range or -1.0 if this range doesn't contain this token.
-
splitOwnedRanges
public java.util.List<Token> splitOwnedRanges(int parts, java.util.List<Splitter.WeightedRange> weightedRanges, boolean dontSplitRanges)
-
split
public java.util.Set<Range<Token>> split(java.util.Collection<Range<Token>> ranges, int parts)
Splits the specified token ranges in at leastpartssubranges.Each returned subrange will be contained in exactly one of the specified ranges.
- Parameters:
ranges- a collection of token ranges to be splitparts- the minimum number of returned ranges- Returns:
- at least
minPartstoken ranges coveringranges
-
-