IncludingExcludingBounds(T left, T right, IPartitioner partitioner) { super(left, right, partitioner); // unlike a Range, an IncludingExcludingBounds may not wrap, nor have // right == left unless the right is the min token assert left.compareTo(right) < 0 || right.isMinimum(partitioner) : "[" + left + "," + right + ")"; }
public boolean contains(T position) { // Range.contains doesnt work correctly if left == right (unless both // are minimum) because for Range that means a wrapping range that select // the whole ring. So we must explicitely handle this case return left.equals(position) || ((right.isMinimum() || !left.equals(right)) && Range.contains(left, right, position)); }
public boolean contains(T position) { // Range.contains doesnt work correctly if left == right (unless both // are minimum) because for Range that means a wrapping range that select // the whole ring. So we must explicitely handle this case return left.equals(position) || ((right.isMinimum() || !left.equals(right)) && Range.contains(left, right, position)); }
ExcludingBounds(T left, T right, IPartitioner partitioner) { super(left, right, partitioner); // unlike a Range, an ExcludingBounds may not wrap, nor be empty assert left.compareTo(right) < 0 || right.isMinimum(partitioner) : "(" + left + "," + right + ")"; }
public boolean contains(T position) { // Range.contains doesnt work correctly if left == right (unless both // are minimum) because for Range that means a wrapping range that select // the whole ring. So we must explicitely handle this case return left.equals(position) || ((right.isMinimum() || !left.equals(right)) && Range.contains(left, right, position)); }
public boolean contains(T position) { // Range.contains doesnt work correctly if left == right (unless both // are minimum) because for Range that means a wrapping range that select // the whole ring. So we must explicitely handle this case return left.equals(position) || ((right.isMinimum() || !left.equals(right)) && Range.contains(left, right, position)); }
public Bounds(T left, T right, IPartitioner partitioner) { super(left, right, partitioner); // unlike a Range, a Bounds may not wrap assert left.compareTo(right) <= 0 || right.isMinimum(partitioner) : "[" + left + "," + right + "]"; }
public boolean contains(T position) { // Range.contains doesnt work correctly if left == right (unless both // are minimum) because for Range that means a wrapping range that select // the whole ring. So we must explicitely handle this case return left.equals(position) || ((right.isMinimum(partitioner) || !left.equals(right)) && Range.contains(left, right, position)); }
/** * Whether {@code left} and {@code right} forms a wrapping interval, that is if unwrapping wouldn't be a no-op. * <p> * Note that the semantic is slightly different from {@link Range#isWrapAround()} in the sense that if both * {@code right} are minimal (for the partitioner), this methods return false (doesn't wrap) while * {@link 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 {@link Range#isWrapAround()} in the meantime. */ public static <T extends RingPosition<T>> boolean strictlyWrapsAround(T left, T right) { return !(left.compareTo(right) <= 0 || right.isMinimum()); }
/** * Whether {@code left} and {@code right} forms a wrapping interval, that is if unwrapping wouldn't be a no-op. * <p> * Note that the semantic is slightly different from {@link Range#isWrapAround()} in the sense that if both * {@code right} are minimal (for the partitioner), this methods return false (doesn't wrap) while * {@link 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 {@link Range#isWrapAround()} in the meantime. */ public static <T extends RingPosition<T>> boolean strictlyWrapsAround(T left, T right) { return !(left.compareTo(right) <= 0 || right.isMinimum()); }
/** * Whether {@code left} and {@code right} forms a wrapping interval, that is if unwrapping wouldn't be a no-op. * <p> * Note that the semantic is slightly different from {@link Range#isWrapAround()} in the sense that if both * {@code right} are minimal (for the partitioner), this methods return false (doesn't wrap) while * {@link 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 {@link Range#isWrapAround()} in the meantime. */ public static <T extends RingPosition<T>> boolean strictlyWrapsAround(T left, T right) { return !(left.compareTo(right) <= 0 || right.isMinimum()); }
/** * Whether {@code left} and {@code right} forms a wrapping interval, that is if unwrapping wouldn't be a no-op. * <p> * Note that the semantic is slightly different from {@link Range#isWrapAround()} in the sense that if both * {@code right} are minimal (for the partitioner), this methods return false (doesn't wrap) while * {@link 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 {@link Range#isWrapAround()} in the meantime. */ public static <T extends RingPosition<T>> boolean strictlyWrapsAround(T left, T right) { return !(left.compareTo(right) <= 0 || right.isMinimum()); }
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 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 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 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 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 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 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 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 + ")"; }