org.apache.cassandra.dht
Class Range

java.lang.Object
  extended by org.apache.cassandra.dht.Range
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Range>

public class Range
extends java.lang.Object
implements java.lang.Comparable<Range>, java.io.Serializable

A representation of the range that a node is responsible for on the DHT ring. A Range is responsible for the tokens between [left, right).

See Also:
Serialized Form

Constructor Summary
Range(Token left, Token right)
           
 
Method Summary
 int compareTo(Range rhs)
           
 boolean contains(Token bi)
          Helps determine if a given point on the DHT ring is contained in the range in question.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
static boolean isTokenInRanges(Token token, java.util.List<Range> ranges)
           
 Token left()
          Returns the left endpoint of a range.
 Token right()
          Returns the right endpoint of a range.
static ICompactSerializer<Range> serializer()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Range

public Range(Token left,
             Token right)
Method Detail

serializer

public static ICompactSerializer<Range> serializer()

left

public Token left()
Returns the left endpoint of a range.

Returns:
left endpoint

right

public Token right()
Returns the right endpoint of a range.

Returns:
right endpoint

contains

public boolean contains(Token bi)
Helps determine if a given point on the DHT ring is contained in the range in question.

Parameters:
bi - point in question
Returns:
true if the point contains within the range else false.

compareTo

public int compareTo(Range rhs)
Specified by:
compareTo in interface java.lang.Comparable<Range>

isTokenInRanges

public static boolean isTokenInRanges(Token token,
                                      java.util.List<Range> ranges)

equals

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

hashCode

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009 The Apache Software Foundation