org.apache.cassandra.dht
Class AbstractBounds

java.lang.Object
  extended by org.apache.cassandra.dht.AbstractBounds
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Bounds, Range

public abstract class AbstractBounds
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
static class AbstractBounds.AbstractBoundsSerializer
           
 
Field Summary
 Token left
           
protected  IPartitioner partitioner
           
 Token right
           
 
Constructor Summary
AbstractBounds(Token left, Token right, IPartitioner partitioner)
           
 
Method Summary
abstract  boolean contains(Token start)
           
abstract  AbstractBounds createFrom(Token right)
           
abstract  boolean equals(java.lang.Object obj)
           
 int hashCode()
           
static java.util.List<AbstractBounds> normalize(java.util.Collection<? extends AbstractBounds> bounds)
           
static AbstractBounds.AbstractBoundsSerializer serializer()
           
 Pair<AbstractBounds,AbstractBounds> split(Token token)
          Given token T and AbstractBounds ?L,R], returns Pair(?L,T], ?T,R]) (where ? means that the same type of Bounds is returned -- Range or Bounds -- as the original.) The original AbstractBounds must contain the token T.
abstract  java.util.List<AbstractBounds> unwrap()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

left

public final Token left

right

public final Token right

partitioner

protected final transient IPartitioner partitioner
Constructor Detail

AbstractBounds

public AbstractBounds(Token left,
                      Token right,
                      IPartitioner partitioner)
Method Detail

serializer

public static AbstractBounds.AbstractBoundsSerializer serializer()

split

public Pair<AbstractBounds,AbstractBounds> split(Token token)
Given token T and AbstractBounds ?L,R], returns Pair(?L,T], ?T,R]) (where ? means that the same type of Bounds is returned -- Range or Bounds -- as the original.) The original AbstractBounds must contain the token T. If the split would cause one of the left or right side to be empty, it will be null in the result pair.


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public abstract boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

contains

public abstract boolean contains(Token start)

createFrom

public abstract AbstractBounds createFrom(Token right)
Returns:
A clone of this AbstractBounds with a new right Token, or null if an identical range would be created.

unwrap

public abstract java.util.List<AbstractBounds> unwrap()

normalize

public static java.util.List<AbstractBounds> normalize(java.util.Collection<? extends AbstractBounds> bounds)
Returns:
A copy of the given list of with all bounds unwrapped, sorted by bound.left and with overlapping bounds merged. This method does not allow allow to mix Range and Bound in the input list.


Copyright © 2011 The Apache Software Foundation