public class Range<T extends RingPosition> extends AbstractBounds<T> implements java.lang.Comparable<Range<T>>, java.io.Serializable
AbstractBounds.AbstractBoundsSerializer
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
left, partitioner, right, serializer
Constructor and Description |
---|
Range(T left,
T right) |
Range(T left,
T right,
IPartitioner partitioner) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
asList() |
int |
compareTo(Range<T> rhs) |
boolean |
contains(Range<T> that) |
boolean |
contains(T point)
Helps determine if a given point on the DHT ring is contained
in the range in question.
|
static <T extends RingPosition> |
contains(T left,
T right,
T point) |
java.util.Set<Range<T>> |
differenceToFetch(Range<T> rhs)
Calculate set of the difference ranges of given two ranges
(as current (A, B] and rhs is (C, D])
which node will need to fetch when moving to a given new token
|
boolean |
equals(java.lang.Object o) |
protected java.lang.String |
getClosingString() |
protected java.lang.String |
getOpeningString() |
java.util.Set<Range<T>> |
intersectionWith(Range<T> that) |
boolean |
intersects(AbstractBounds<T> that) |
boolean |
intersects(Bounds<T> that) |
boolean |
intersects(Range<T> that) |
static <T extends RingPosition> |
isInRanges(T token,
java.lang.Iterable<Range<T>> ranges) |
boolean |
isWrapAround() |
static <T extends RingPosition> |
isWrapAround(T left,
T right)
Tells if the given range is a wrap around.
|
static Range<RowPosition> |
makeRowRange(Token left,
Token right,
IPartitioner partitioner)
Compute a range of keys corresponding to a given range of token.
|
static <T extends RingPosition> |
normalize(java.util.Collection<Range<T>> ranges) |
static <T extends RingPosition> |
rangeSet(Range<T>... ranges) |
static <T extends RingPosition> |
rangeSet(Range<T> range) |
Pair<AbstractBounds<T>,AbstractBounds<T>> |
split(T position)
Given token T and AbstractBounds ?L,R?, returns Pair(?L,T], (T,R?),
where ? means that the same type of AbstractBounds is returned as the original.
|
java.util.Set<Range<T>> |
subtract(Range<T> rhs) |
AbstractBounds<RowPosition> |
toRowBounds()
Transform this abstract bounds to equivalent covering bounds of row positions.
|
java.lang.String |
toString() |
AbstractBounds<Token> |
toTokenBounds()
Transform this abstract bounds to a token abstract bounds.
|
java.util.List<Range<T>> |
unwrap() |
AbstractBounds<T> |
withNewRight(T newRight) |
getString, hashCode, intersects
public static final long serialVersionUID
public Range(T left, T right, IPartitioner partitioner)
public static <T extends RingPosition> boolean contains(T left, T right, T point)
public boolean contains(T point)
contains
in class AbstractBounds<T extends RingPosition>
point
- point in questionpublic boolean intersects(Range<T> that)
that
- range to check for intersectionpublic boolean intersects(AbstractBounds<T> that)
public boolean intersects(Bounds<T> that)
that
- range to check for intersectionpublic static <T extends RingPosition> java.util.Set<Range<T>> rangeSet(Range<T>... ranges)
public static <T extends RingPosition> java.util.Set<Range<T>> rangeSet(Range<T> range)
public java.util.Set<Range<T>> intersectionWith(Range<T> that)
that
- public Pair<AbstractBounds<T>,AbstractBounds<T>> split(T position)
AbstractBounds
split
in class AbstractBounds<T extends RingPosition>
public java.util.List<Range<T>> unwrap()
unwrap
in class AbstractBounds<T extends RingPosition>
public static <T extends RingPosition> boolean isWrapAround(T left, T right)
public int compareTo(Range<T> rhs)
compareTo
in interface java.lang.Comparable<Range<T extends RingPosition>>
public java.util.Set<Range<T>> differenceToFetch(Range<T> rhs)
rhs
- range to calculate differencepublic static <T extends RingPosition> boolean isInRanges(T token, java.lang.Iterable<Range<T>> ranges)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.String getOpeningString()
getOpeningString
in class AbstractBounds<T extends RingPosition>
protected java.lang.String getClosingString()
getClosingString
in class AbstractBounds<T extends RingPosition>
public java.util.List<java.lang.String> asList()
public boolean isWrapAround()
public static <T extends RingPosition> java.util.List<Range<T>> normalize(java.util.Collection<Range<T>> ranges)
public static Range<RowPosition> makeRowRange(Token left, Token right, IPartitioner partitioner)
public AbstractBounds<RowPosition> toRowBounds()
AbstractBounds
toRowBounds
in class AbstractBounds<T extends RingPosition>
public AbstractBounds<Token> toTokenBounds()
AbstractBounds
toTokenBounds
in class AbstractBounds<T extends RingPosition>
public AbstractBounds<T> withNewRight(T newRight)
withNewRight
in class AbstractBounds<T extends RingPosition>
Copyright © 2013 The Apache Software Foundation