Search in sources :

Example 1 with BigIntegerToken

use of org.apache.cassandra.dht.KeyCollisionTest.BigIntegerToken in project cassandra by apache.

the class LengthPartitioner method midpoint.

public BigIntegerToken midpoint(Token ltoken, Token rtoken) {
    // the symbolic MINIMUM token should act as ZERO: the empty bit array
    BigInteger left = ltoken.equals(MINIMUM) ? ZERO : ((BigIntegerToken) ltoken).token;
    BigInteger right = rtoken.equals(MINIMUM) ? ZERO : ((BigIntegerToken) rtoken).token;
    Pair<BigInteger, Boolean> midpair = FBUtilities.midpoint(left, right, 127);
    // discard the remainder
    return new BigIntegerToken(midpair.left);
}
Also used : BigIntegerToken(org.apache.cassandra.dht.KeyCollisionTest.BigIntegerToken) BigInteger(java.math.BigInteger)

Aggregations

BigInteger (java.math.BigInteger)1 BigIntegerToken (org.apache.cassandra.dht.KeyCollisionTest.BigIntegerToken)1