public abstract class AbstractBounds<T extends RingPosition<T>>
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
AbstractBounds.AbstractBoundsSerializer<T extends RingPosition<T>> |
static class |
AbstractBounds.Boundary<T extends RingPosition<T>> |
Modifier and Type | Field and Description |
---|---|
T |
left |
T |
right |
static IPartitionerDependentSerializer<AbstractBounds<PartitionPosition>> |
rowPositionSerializer |
static IPartitionerDependentSerializer<AbstractBounds<Token>> |
tokenSerializer |
Constructor and Description |
---|
AbstractBounds(T left,
T right) |
Modifier and Type | Method and Description |
---|---|
static <T extends RingPosition<T>> |
bounds(AbstractBounds.Boundary<T> min,
AbstractBounds.Boundary<T> max) |
static <T extends RingPosition<T>> |
bounds(T min,
boolean inclusiveMin,
T max,
boolean inclusiveMax) |
abstract boolean |
contains(T start) |
protected abstract java.lang.String |
getClosingString() |
protected abstract java.lang.String |
getOpeningString() |
java.lang.String |
getString(AbstractType<?> keyValidator) |
int |
hashCode() |
abstract boolean |
inclusiveLeft() |
abstract boolean |
inclusiveRight() |
boolean |
intersects(java.lang.Iterable<Range<T>> ranges)
return true if @param range intersects any of the given @param ranges
|
static <T extends RingPosition<T>> |
isEmpty(AbstractBounds.Boundary<T> left,
AbstractBounds.Boundary<T> right) |
abstract boolean |
isEndInclusive() |
abstract boolean |
isStartInclusive() |
AbstractBounds.Boundary<T> |
leftBoundary() |
static <T extends RingPosition<T>> |
maxLeft(AbstractBounds.Boundary<T> left1,
AbstractBounds.Boundary<T> left2) |
static <T extends RingPosition<T>> |
maxLeft(AbstractBounds.Boundary<T> left1,
T left2,
boolean isInclusiveLeft2) |
static <T extends RingPosition<T>> |
minRight(AbstractBounds.Boundary<T> right1,
AbstractBounds.Boundary<T> right2) |
static <T extends RingPosition<T>> |
minRight(AbstractBounds.Boundary<T> right1,
T right2,
boolean isInclusiveRight2) |
static <T extends RingPosition<T>> |
noneStrictlyWrapsAround(java.util.Collection<AbstractBounds<T>> bounds) |
AbstractBounds.Boundary<T> |
rightBoundary() |
abstract 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.
|
static <T extends RingPosition<T>> |
strictlyWrapsAround(T left,
T right)
Whether
left and right forms a wrapping interval, that is if unwrapping wouldn't be a no-op. |
abstract java.util.List<? extends AbstractBounds<T>> |
unwrap() |
abstract AbstractBounds<T> |
withNewRight(T newRight) |
public static final IPartitionerDependentSerializer<AbstractBounds<Token>> tokenSerializer
public static final IPartitionerDependentSerializer<AbstractBounds<PartitionPosition>> rowPositionSerializer
public final T extends RingPosition<T> left
public final T extends RingPosition<T> right
public abstract Pair<AbstractBounds<T>,AbstractBounds<T>> split(T position)
public abstract boolean inclusiveLeft()
public abstract boolean inclusiveRight()
public static <T extends RingPosition<T>> boolean strictlyWrapsAround(T left, T right)
left
and right
forms a wrapping interval, that is if unwrapping wouldn't be a no-op.
Note that the semantic is slightly different from Range.isWrapAround()
in the sense that if both
right
are minimal (for the partitioner), this methods return false (doesn't wrap) while
Range.isWrapAround()
returns true (does wrap). This is confusing and we should fix it by
refactoring/rewriting the whole AbstractBounds hierarchy with cleaner semantics, but we don't want to risk
breaking something by changing Range.isWrapAround()
in the meantime.
public static <T extends RingPosition<T>> boolean noneStrictlyWrapsAround(java.util.Collection<AbstractBounds<T>> bounds)
public int hashCode()
hashCode
in class java.lang.Object
public boolean intersects(java.lang.Iterable<Range<T>> ranges)
public abstract boolean contains(T start)
public abstract java.util.List<? extends AbstractBounds<T>> unwrap()
public java.lang.String getString(AbstractType<?> keyValidator)
protected abstract java.lang.String getOpeningString()
protected abstract java.lang.String getClosingString()
public abstract boolean isStartInclusive()
public abstract boolean isEndInclusive()
public abstract AbstractBounds<T> withNewRight(T newRight)
public static <T extends RingPosition<T>> AbstractBounds<T> bounds(AbstractBounds.Boundary<T> min, AbstractBounds.Boundary<T> max)
public static <T extends RingPosition<T>> AbstractBounds<T> bounds(T min, boolean inclusiveMin, T max, boolean inclusiveMax)
public AbstractBounds.Boundary<T> leftBoundary()
public AbstractBounds.Boundary<T> rightBoundary()
public static <T extends RingPosition<T>> boolean isEmpty(AbstractBounds.Boundary<T> left, AbstractBounds.Boundary<T> right)
public static <T extends RingPosition<T>> AbstractBounds.Boundary<T> minRight(AbstractBounds.Boundary<T> right1, T right2, boolean isInclusiveRight2)
public static <T extends RingPosition<T>> AbstractBounds.Boundary<T> minRight(AbstractBounds.Boundary<T> right1, AbstractBounds.Boundary<T> right2)
public static <T extends RingPosition<T>> AbstractBounds.Boundary<T> maxLeft(AbstractBounds.Boundary<T> left1, T left2, boolean isInclusiveLeft2)
public static <T extends RingPosition<T>> AbstractBounds.Boundary<T> maxLeft(AbstractBounds.Boundary<T> left1, AbstractBounds.Boundary<T> left2)
Copyright © 2009-2021 The Apache Software Foundation