public AbstractBounds<T> withNewRight(T newRight) { return new ExcludingBounds<T>(left, newRight); } }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position) || left.equals(position); if (left.equals(position)) return null; AbstractBounds<T> lb = new Range<T>(left, position); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right); return Pair.create(lb, rb); }
public ExcludingBounds(T left, T right) { super(left, right); // unlike a Range, an ExcludingBounds may not wrap, nor be empty 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) : (ExcludingBounds<RowPosition>)this; }
public AbstractBounds<T> withNewRight(T newRight) { return new ExcludingBounds<T>(left, newRight); } }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position) || left.equals(position); if (left.equals(position)) return null; AbstractBounds<T> lb = new Range<T>(left, position); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right); return Pair.create(lb, rb); }
public ExcludingBounds(T left, T right) { super(left, right); // unlike a Range, an ExcludingBounds may not wrap, nor be empty assert !strictlyWrapsAround(left, right) && (right.isMinimum() || left.compareTo(right) != 0) : "(" + left + "," + right + ")"; }
public AbstractBounds<T> withNewRight(T newRight) { return new ExcludingBounds<T>(left, newRight); } }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position) || left.equals(position); if (left.equals(position)) return null; AbstractBounds<T> lb = new Range<T>(left, position); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right); return Pair.create(lb, rb); }
public ExcludingBounds(T left, T right) { super(left, right); // unlike a Range, an ExcludingBounds may not wrap, nor be empty assert !strictlyWrapsAround(left, right) && (right.isMinimum() || left.compareTo(right) != 0) : "(" + left + "," + right + ")"; }
public AbstractBounds<T> withNewRight(T newRight) { return new ExcludingBounds<T>(left, newRight); } }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position) || left.equals(position); if (left.equals(position)) return null; AbstractBounds<T> lb = new Range<T>(left, position, partitioner); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right, partitioner); return Pair.create(lb, rb); }
public ExcludingBounds(T left, T right) { super(left, right); // unlike a Range, an ExcludingBounds may not wrap, nor be empty assert !strictlyWrapsAround(left, right) && (right.isMinimum() || left.compareTo(right) != 0) : "(" + left + "," + right + ")"; }
public AbstractBounds<T> withNewRight(T newRight) { return new ExcludingBounds<T>(left, newRight); } }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position) || left.equals(position); if (left.equals(position)) return null; AbstractBounds<T> lb = new Range<T>(left, position); AbstractBounds<T> rb = new ExcludingBounds<T>(position, right); return Pair.create(lb, rb); }
private AbstractBounds<RowPosition> makeExcludingKeyBounds(RowPosition lastReturnedKey) { // We return a range that always exclude lastReturnedKey, since we've already // returned it. AbstractBounds<RowPosition> bounds = command.keyRange; if (bounds instanceof Range || bounds instanceof Bounds) { return new Range<RowPosition>(lastReturnedKey, bounds.right); } else { return new ExcludingBounds<RowPosition>(lastReturnedKey, bounds.right); } } }
@SuppressWarnings("unchecked") public AbstractBounds<Token> toTokenBounds() { return (left instanceof RowPosition) ? new ExcludingBounds<Token>(((RowPosition)left).getToken(), ((RowPosition)right).getToken(), partitioner) : (ExcludingBounds<Token>)this; }
/** * Compute a bounds of keys corresponding to a given bounds of token. */ private static ExcludingBounds<RowPosition> makeRowBounds(Token left, Token right, IPartitioner partitioner) { return new ExcludingBounds<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); }