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>
Direct Known Subclasses:
MerkleTree.TreeRange

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

Field Summary
static long serialVersionUID
           
 
Constructor Summary
Range(Token left, Token right)
           
 
Method Summary
 int compareTo(Range rhs)
           
 boolean contains(Range that)
           
 boolean contains(Token bi)
          Helps determine if a given point on the DHT ring is contained in the range in question.
static boolean contains(Token left, Token right, Token bi)
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean intersects(Range that)
           
static boolean isTokenInRanges(Token token, java.lang.Iterable<Range> ranges)
           
static boolean isWrapAround(Token left, Token right)
          Tells if the given range is a wrap around.
 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
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
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 static boolean contains(Token left,
                               Token right,
                               Token bi)

contains

public boolean contains(Range that)

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.

intersects

public boolean intersects(Range that)
Parameters:
range - range to check for intersection
Returns:
true if the given range intersects with this range.

isWrapAround

public static boolean isWrapAround(Token left,
                                   Token right)
Tells if the given range is a wrap around.

Parameters:
range -
Returns:

compareTo

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

isTokenInRanges

public static boolean isTokenInRanges(Token token,
                                      java.lang.Iterable<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