## org.apache.cassandra.dht
Class AbstractByteOrderedPartitioner

    java.lang.Object
      org.apache.cassandra.dht.AbstractByteOrderedPartitioner

All Implemented Interfaces:
  IPartitioner<BytesToken>

Direct Known Subclasses:
  ByteOrderedPartitioner, CollatingOrderPreservingPartitioner

    public abstract class AbstractByteOrderedPartitioner

extends java.lang.Object
implements IPartitioner<BytesToken>

Field Summary
`static java.math.BigInteger` `BYTE_MASK`
`static BytesToken` `MINIMUM`

Constructor Summary
`AbstractByteOrderedPartitioner()`

Method Summary
`DecoratedKey<BytesToken>` `convertFromDiskFormat(java.nio.ByteBuffer key)`
`DecoratedKey<BytesToken>` `decorateKey(java.nio.ByteBuffer key)` Transform key to object representation of the on-disk format.
`java.util.Map<Token,java.lang.Float>` `describeOwnership(java.util.List<Token> sortedTokens)` Calculate the deltas between tokens in the ring in order to compare relative sizes.
`BytesToken` `getMinimumToken()`
`BytesToken` `getRandomToken()`
`abstract BytesToken` `getToken(java.nio.ByteBuffer key)`
`Token.TokenFactory<byte[]>` `getTokenFactory()`
`BytesToken` `midpoint(Token ltoken, Token rtoken)` Calculate a Token representing the approximate "middle" of the given range.
`boolean` `preservesOrder()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MINIMUM

    public static final BytesToken MINIMUM

### BYTE_MASK

    public static final java.math.BigInteger BYTE_MASK

Constructor Detail

### AbstractByteOrderedPartitioner

    public AbstractByteOrderedPartitioner()

Method Detail

### decorateKey

    public DecoratedKey<BytesToken> decorateKey(java.nio.ByteBuffer key)

  Description copied from interface: `IPartitioner`
  Transform key to object representation of the on-disk format.

  Specified by:
    `decorateKey` in interface `IPartitioner<BytesToken>`
  Parameters:
    `key` - the raw, client-facing key
  Returns:
    decorated version of key

### convertFromDiskFormat

    public DecoratedKey<BytesToken> convertFromDiskFormat(java.nio.ByteBuffer key)

  Specified by:
    `convertFromDiskFormat` in interface `IPartitioner<BytesToken>`
  Parameters:
    `key` - On disk representation
  Returns:
    DecoratedKey object

### midpoint

    public BytesToken midpoint(Token ltoken,
                               Token rtoken)

  Description copied from interface: `IPartitioner`
  Calculate a Token representing the approximate "middle" of the given range.

  Specified by:
    `midpoint` in interface `IPartitioner<BytesToken>`
  Returns:
    The approximate midpoint between left and right.

### getMinimumToken

    public BytesToken getMinimumToken()

  Specified by:
    `getMinimumToken` in interface `IPartitioner<BytesToken>`
  Returns:
    The minimum possible Token in the range that is being partitioned.

### getRandomToken

    public BytesToken getRandomToken()

  Specified by:
    `getRandomToken` in interface `IPartitioner<BytesToken>`
  Returns:
    a randomly generated token

### getTokenFactory

    public Token.TokenFactory<byte[]> getTokenFactory()

  Specified by:
    `getTokenFactory` in interface `IPartitioner<BytesToken>`

### preservesOrder

    public boolean preservesOrder()

  Specified by:
    `preservesOrder` in interface `IPartitioner<BytesToken>`
  Returns:
    True if the implementing class preserves key order in the Tokens it generates.

### getToken

    public abstract BytesToken getToken(java.nio.ByteBuffer key)

  Specified by:
    `getToken` in interface `IPartitioner<BytesToken>`
  Returns:
    a Token that can be used to route a given key (This is NOT a method to create a Token from its string representation; for that, use TokenFactory.fromString.)

### describeOwnership

    public java.util.Map<Token,java.lang.Float> describeOwnership(java.util.List<Token> sortedTokens)

  Description copied from interface: `IPartitioner`
  Calculate the deltas between tokens in the ring in order to compare relative sizes.

  Specified by:
    `describeOwnership` in interface `IPartitioner<BytesToken>`
  Parameters:
    `sortedTokens` - a sorted List of Tokens
  Returns:
    the mapping from 'token' to 'percentage of the ring owned by that token'.

Copyright © 2012 The Apache Software Foundation