public AbstractBounds<T> withNewRight(T newRight) { return new IncludingExcludingBounds<T>(left, newRight); } }
public IncludingExcludingBounds(T left, T right) { super(left, right); // unlike a Range, an IncludingExcludingBounds may not wrap, nor have // right == left unless the right is the min token assert !strictlyWrapsAround(left, right) && (right.isMinimum() || left.compareTo(right) != 0) : "(" + left + "," + right + ")"; }
@SuppressWarnings("unchecked") public AbstractBounds<RowPosition> toRowBounds() { return (left instanceof Token) ? makeRowBounds((Token)left, (Token)right, partitioner) : (IncludingExcludingBounds<RowPosition>)this; }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position); AbstractBounds<T> lb = new Bounds<T>(left, position, partitioner); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right, partitioner); return Pair.create(lb, rb); }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position); AbstractBounds<T> lb = new Bounds<T>(left, position); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right); return Pair.create(lb, rb); }
public AbstractBounds<T> withNewRight(T newRight) { return new IncludingExcludingBounds<T>(left, newRight); } }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position); AbstractBounds<T> lb = new Bounds<T>(left, position); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right); return Pair.create(lb, rb); }
public IncludingExcludingBounds(T left, T right) { super(left, right); // unlike a Range, an IncludingExcludingBounds may not wrap, nor have // right == left unless the right is the min token assert !strictlyWrapsAround(left, right) && (right.isMinimum() || left.compareTo(right) != 0) : "(" + left + "," + right + ")"; }
public AbstractBounds<T> withNewRight(T newRight) { return new IncludingExcludingBounds<T>(left, newRight); } }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position); AbstractBounds<T> lb = new Bounds<T>(left, position); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right); return Pair.create(lb, rb); }
public IncludingExcludingBounds(T left, T right) { super(left, right); // unlike a Range, an IncludingExcludingBounds may not wrap, nor have // right == left unless the right is the min token assert !strictlyWrapsAround(left, right) && (right.isMinimum() || left.compareTo(right) != 0) : "(" + left + "," + right + ")"; }
public AbstractBounds<T> withNewRight(T newRight) { return new IncludingExcludingBounds<T>(left, newRight); } }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position); AbstractBounds<T> lb = new Bounds<T>(left, position); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right); return Pair.create(lb, rb); }
public IncludingExcludingBounds(T left, T right) { super(left, right); // unlike a Range, an IncludingExcludingBounds may not wrap, nor have // right == left unless the right is the min token assert !strictlyWrapsAround(left, right) && (right.isMinimum() || left.compareTo(right) != 0) : "(" + left + "," + right + ")"; }
public AbstractBounds<T> withNewRight(T newRight) { return new IncludingExcludingBounds<T>(left, newRight); } }
private AbstractBounds<RowPosition> makeIncludingKeyBounds(RowPosition lastReturnedKey) { // We always include lastReturnedKey since we may still be paging within a row, // and PagedRangeCommand will move over if we're not anyway AbstractBounds<RowPosition> bounds = command.keyRange; if (bounds instanceof Range || bounds instanceof Bounds) { return new Bounds<RowPosition>(lastReturnedKey, bounds.right); } else { return new IncludingExcludingBounds<RowPosition>(lastReturnedKey, bounds.right); } } }
@SuppressWarnings("unchecked") public AbstractBounds<Token> toTokenBounds() { return (left instanceof RowPosition) ? new IncludingExcludingBounds<Token>(((RowPosition)left).getToken(), ((RowPosition)right).getToken(), partitioner) : (IncludingExcludingBounds<Token>)this; }
/** * Compute a bounds of keys corresponding to a given bounds of token. */ private static IncludingExcludingBounds<RowPosition> makeRowBounds(Token left, Token right, IPartitioner partitioner) { return new IncludingExcludingBounds<RowPosition>(left.maxKeyBound(partitioner), right.minKeyBound(partitioner), partitioner); }
public static <T extends RingPosition<T>> AbstractBounds<T> bounds(T min, boolean inclusiveMin, T max, boolean inclusiveMax) { if (inclusiveMin && inclusiveMax) return new Bounds<T>(min, max); else if (inclusiveMax) return new Range<T>(min, max); else if (inclusiveMin) return new IncludingExcludingBounds<T>(min, max); else return new ExcludingBounds<T>(min, max); }
public static <T extends RingPosition<T>> AbstractBounds<T> bounds(T min, boolean inclusiveMin, T max, boolean inclusiveMax) { if (inclusiveMin && inclusiveMax) return new Bounds<T>(min, max); else if (inclusiveMax) return new Range<T>(min, max); else if (inclusiveMin) return new IncludingExcludingBounds<T>(min, max); else return new ExcludingBounds<T>(min, max); }