public int compare(byte[] o1, byte[] o2) { if (o1.length == 0) { return o2.length == 0 ? 0 : -1; } if (o2.length == 0) { return 1; } int res = compareTimestampBytes(o1, o2); if (res != 0) return res; return FBUtilities.compareByteArrays(o1, o2); }
public Column reconcile(Column left, Column right) { ClockRelationship cr = left.clock().compare(right.clock()); switch (cr) { case EQUAL: // tombstones take precedence. (if both are tombstones, then it doesn't matter which one we // use.) if (left.isMarkedForDelete()) return left; if (right.isMarkedForDelete()) return right; // break ties by comparing values. return FBUtilities.compareByteArrays(left.value(), right.value()) < 0 ? right : left; case GREATER_THAN: return left; case LESS_THAN: return right; default: throw new IllegalArgumentException( "Timestamp clocks must either be equal, greater then or less than: " + cr); } }