Package org.apache.cassandra.dht
Class Bounds<T extends RingPosition<T>>
- java.lang.Object
-
- org.apache.cassandra.dht.AbstractBounds<T>
-
- org.apache.cassandra.dht.Bounds<T>
-
- All Implemented Interfaces:
java.io.Serializable
public class Bounds<T extends RingPosition<T>> extends AbstractBounds<T>
AbstractBounds containing both its endpoints: [left, right]. Used by "classic" by-key range scans.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.cassandra.dht.AbstractBounds
AbstractBounds.AbstractBoundsSerializer<T extends RingPosition<T>>, AbstractBounds.Boundary<T extends RingPosition<T>>
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.dht.AbstractBounds
left, right, rowPositionSerializer, tokenSerializer
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(T position)
boolean
equals(java.lang.Object o)
protected java.lang.String
getClosingString()
static <T extends RingPosition<T>>
java.util.Set<Bounds<T>>getNonOverlappingBounds(java.lang.Iterable<Bounds<T>> bounds)
Retrieves non-overlapping bounds for the list of input bounds Assume we have the following bounds (brackets representing left/right bound): [ ] [ ] [ ] [ ] [ ] [ ] This method will return the following bounds: [ ] [ ]protected java.lang.String
getOpeningString()
boolean
inclusiveLeft()
boolean
inclusiveRight()
boolean
intersects(Bounds<T> that)
boolean
isEndInclusive()
static <T extends RingPosition<T>>
booleanisInBounds(T token, java.lang.Iterable<Bounds<T>> bounds)
boolean
isStartInclusive()
static Bounds<PartitionPosition>
makeRowBounds(Token left, Token right)
Compute a bounds of keys corresponding to a given bounds of token.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.lang.String
toString()
java.util.List<? extends AbstractBounds<T>>
unwrap()
AbstractBounds<T>
withNewRight(T newRight)
-
Methods inherited from class org.apache.cassandra.dht.AbstractBounds
bounds, bounds, getString, hashCode, intersects, isEmpty, leftBoundary, maxLeft, maxLeft, minRight, minRight, noneStrictlyWrapsAround, rightBoundary, strictlyWrapsAround
-
-
-
-
Method Detail
-
contains
public boolean contains(T position)
- Specified by:
contains
in classAbstractBounds<T extends RingPosition<T>>
-
split
public Pair<AbstractBounds<T>,AbstractBounds<T>> split(T position)
Description copied from class:AbstractBounds
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. Put another way, returns a Pair of everything this AbstractBounds contains up to and including the split position, and everything it contains after (not including the split position). The original AbstractBounds must either contain the position T, or T should be equals to the left bound L. If the split would only yield the same AbstractBound, null is returned instead.- Specified by:
split
in classAbstractBounds<T extends RingPosition<T>>
-
inclusiveLeft
public boolean inclusiveLeft()
- Specified by:
inclusiveLeft
in classAbstractBounds<T extends RingPosition<T>>
-
inclusiveRight
public boolean inclusiveRight()
- Specified by:
inclusiveRight
in classAbstractBounds<T extends RingPosition<T>>
-
unwrap
public java.util.List<? extends AbstractBounds<T>> unwrap()
- Specified by:
unwrap
in classAbstractBounds<T extends RingPosition<T>>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getOpeningString
protected java.lang.String getOpeningString()
- Specified by:
getOpeningString
in classAbstractBounds<T extends RingPosition<T>>
-
getClosingString
protected java.lang.String getClosingString()
- Specified by:
getClosingString
in classAbstractBounds<T extends RingPosition<T>>
-
isInBounds
public static <T extends RingPosition<T>> boolean isInBounds(T token, java.lang.Iterable<Bounds<T>> bounds)
-
isStartInclusive
public boolean isStartInclusive()
- Specified by:
isStartInclusive
in classAbstractBounds<T extends RingPosition<T>>
-
isEndInclusive
public boolean isEndInclusive()
- Specified by:
isEndInclusive
in classAbstractBounds<T extends RingPosition<T>>
-
makeRowBounds
public static Bounds<PartitionPosition> makeRowBounds(Token left, Token right)
Compute a bounds of keys corresponding to a given bounds of token.
-
withNewRight
public AbstractBounds<T> withNewRight(T newRight)
- Specified by:
withNewRight
in classAbstractBounds<T extends RingPosition<T>>
-
getNonOverlappingBounds
public static <T extends RingPosition<T>> java.util.Set<Bounds<T>> getNonOverlappingBounds(java.lang.Iterable<Bounds<T>> bounds)
Retrieves non-overlapping bounds for the list of input bounds Assume we have the following bounds (brackets representing left/right bound): [ ] [ ] [ ] [ ] [ ] [ ] This method will return the following bounds: [ ] [ ]- Parameters:
bounds
- unsorted bounds to find overlaps- Returns:
- the non-overlapping bounds
-
-