public class Range<T extends RingPosition<T>> extends AbstractBounds<T> implements java.lang.Comparable<Range<T>>, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Range.OrderedRangeContainmentChecker
Helper class to check if a token is contained within a given collection of ranges
|
AbstractBounds.AbstractBoundsSerializer<T extends RingPosition<T>>, AbstractBounds.Boundary<T extends RingPosition<T>>
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
left, right, rowPositionSerializer, tokenSerializer
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
asList() |
int |
compareTo(Range<T> rhs)
Note: this class has a natural ordering that is inconsistent with equals
|
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<T>> |
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() |
boolean |
inclusiveLeft() |
boolean |
inclusiveRight() |
java.util.Set<Range<T>> |
intersectionWith(Range<T> that) |
boolean |
intersects(AbstractBounds<T> that) |
boolean |
intersects(Bounds<T> that) |
boolean |
intersects(Range<T> that) |
boolean |
isEndInclusive() |
static <T extends RingPosition<T>> |
isInRanges(T token,
java.lang.Iterable<Range<T>> ranges) |
boolean |
isStartInclusive() |
boolean |
isWrapAround() |
static <T extends RingPosition<T>> |
isWrapAround(T left,
T right)
Tells if the given range is a wrap around.
|
static Range<PartitionPosition> |
makeRowRange(Range<Token> tokenBounds) |
static Range<PartitionPosition> |
makeRowRange(Token left,
Token right)
Compute a range of keys corresponding to a given range of token.
|
static <T extends RingPosition<T>> |
normalize(java.util.Collection<Range<T>> ranges) |
static <T extends RingPosition<T>> |
rangeSet(Range<T>... ranges) |
static <T extends RingPosition<T>> |
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) |
java.util.Set<Range<T>> |
subtractAll(java.util.Collection<Range<T>> ranges) |
java.lang.String |
toString() |
java.util.List<Range<T>> |
unwrap() |
AbstractBounds<T> |
withNewRight(T newRight) |
bounds, bounds, getString, hashCode, intersects, isEmpty, leftBoundary, maxLeft, maxLeft, minRight, minRight, noneStrictlyWrapsAround, rightBoundary, strictlyWrapsAround
public static final long serialVersionUID
public static <T extends RingPosition<T>> boolean contains(T left, T right, T point)
public boolean contains(T point)
contains
in class AbstractBounds<T extends RingPosition<T>>
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 intersection@SafeVarargs public static <T extends RingPosition<T>> java.util.Set<Range<T>> rangeSet(Range<T>... ranges)
public static <T extends RingPosition<T>> 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<T>>
public boolean inclusiveLeft()
inclusiveLeft
in class AbstractBounds<T extends RingPosition<T>>
public boolean inclusiveRight()
inclusiveRight
in class AbstractBounds<T extends RingPosition<T>>
public java.util.List<Range<T>> unwrap()
unwrap
in class AbstractBounds<T extends RingPosition<T>>
public static <T extends RingPosition<T>> boolean isWrapAround(T left, T right)
public int compareTo(Range<T> rhs)
compareTo
in interface java.lang.Comparable<Range<T extends RingPosition<T>>>
public java.util.Set<Range<T>> differenceToFetch(Range<T> rhs)
rhs
- range to calculate differencepublic static <T extends RingPosition<T>> 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<T>>
protected java.lang.String getClosingString()
getClosingString
in class AbstractBounds<T extends RingPosition<T>>
public boolean isStartInclusive()
isStartInclusive
in class AbstractBounds<T extends RingPosition<T>>
public boolean isEndInclusive()
isEndInclusive
in class AbstractBounds<T extends RingPosition<T>>
public java.util.List<java.lang.String> asList()
public boolean isWrapAround()
public static <T extends RingPosition<T>> java.util.List<Range<T>> normalize(java.util.Collection<Range<T>> ranges)
public AbstractBounds<T> withNewRight(T newRight)
withNewRight
in class AbstractBounds<T extends RingPosition<T>>
public static Range<PartitionPosition> makeRowRange(Token left, Token right)
public static Range<PartitionPosition> makeRowRange(Range<Token> tokenBounds)
Copyright © 2016 The Apache Software Foundation