@Override public int compare(Range<Token> rt1, Range<Token> rt2) { if (rt1.left.compareTo(rt2.left) == 0) return 0; return rt1.compareTo(rt2); } }
private static Set<SSTableReader> overlappingWithBounds(Token start, Token end, Map<SSTableReader, Bounds<Token>> sstables) { assert start.compareTo(end) <= 0; Set<SSTableReader> overlapped = new HashSet<>(); Bounds<Token> promotedBounds = new Bounds<Token>(start, end); for (Map.Entry<SSTableReader, Bounds<Token>> pair : sstables.entrySet()) { if (pair.getValue().intersects(promotedBounds)) overlapped.add(pair.getKey()); } return overlapped; }
public int compare(DecoratedKey o1, DecoratedKey o2) { if ((right.compareTo(o1.getToken()) < 0 && right.compareTo(o2.getToken()) < 0) || (right.compareTo(o1.getToken()) > 0 && right.compareTo(o2.getToken()) > 0)) { // both tokens are on the same side of the wrap point return o1.compareTo(o2); } return o2.compareTo(o1); } };
public int compare(DecoratedKey o1, DecoratedKey o2) { if ((right.compareTo(o1.getToken()) < 0 && right.compareTo(o2.getToken()) < 0) || (right.compareTo(o1.getToken()) > 0 && right.compareTo(o2.getToken()) > 0)) { // both tokens are on the same side of the wrap point return o1.compareTo(o2); } return o2.compareTo(o1); } };
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; int cmp = getToken().compareTo(pos.getToken()); if (cmp != 0) return cmp; if (isMinimumBound) return ((pos instanceof KeyBound) && ((KeyBound)pos).isMinimumBound) ? 0 : -1; else return ((pos instanceof KeyBound) && !((KeyBound)pos).isMinimumBound) ? 0 : 1; }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; int cmp = getToken().compareTo(pos.getToken()); if (cmp != 0) return cmp; if (isMinimumBound) return ((pos instanceof KeyBound) && ((KeyBound)pos).isMinimumBound) ? 0 : -1; else return ((pos instanceof KeyBound) && !((KeyBound)pos).isMinimumBound) ? 0 : 1; }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; int cmp = getToken().compareTo(pos.getToken()); if (cmp != 0) return cmp; if (isMinimumBound) return ((pos instanceof KeyBound) && ((KeyBound)pos).isMinimumBound) ? 0 : -1; else return ((pos instanceof KeyBound) && !((KeyBound)pos).isMinimumBound) ? 0 : 1; }
public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position) { // delegate to Token.KeyBound if needed if (!(position instanceof DecoratedKey)) return -position.compareTo(partitioner.decorateKey(key)); DecoratedKey otherKey = (DecoratedKey) position; int cmp = partitioner.getToken(key).compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp; }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; // delegate to Token.KeyBound if needed if (!(pos instanceof DecoratedKey)) return -pos.compareTo(this); DecoratedKey otherKey = (DecoratedKey) pos; int cmp = getToken().compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp; }
public int compareTo(PartitionPosition pos) { if (this == pos) return 0; // delegate to Token.KeyBound if needed if (!(pos instanceof DecoratedKey)) return -pos.compareTo(this); DecoratedKey otherKey = (DecoratedKey) pos; int cmp = getToken().compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(getKey(), otherKey.getKey()) : cmp; }
public static int compareTo(IPartitioner partitioner, ByteBuffer key, PartitionPosition position) { // delegate to Token.KeyBound if needed if (!(position instanceof DecoratedKey)) return -position.compareTo(partitioner.decorateKey(key)); DecoratedKey otherKey = (DecoratedKey) position; int cmp = partitioner.getToken(key).compareTo(otherKey.getToken()); return cmp == 0 ? ByteBufferUtil.compareUnsigned(key, otherKey.getKey()) : cmp; }