@Test public void testNeedsToBeChopped() { MergeInfo info = new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.DELETE); assertTrue(info.needsToBeChopped(ke("x", "c", "b"))); assertTrue(info.overlaps(ke("x", "c", "b"))); assertFalse(info.needsToBeChopped(ke("y", "c", "b"))); assertFalse(info.needsToBeChopped(ke("x", "c", "bb"))); assertFalse(info.needsToBeChopped(ke("x", "b", "a"))); info = new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.MERGE); assertTrue(info.needsToBeChopped(ke("x", "c", "a"))); assertTrue(info.needsToBeChopped(ke("x", "aa", "a"))); assertTrue(info.needsToBeChopped(ke("x", null, null))); assertFalse(info.needsToBeChopped(ke("x", "c", "b"))); assertFalse(info.needsToBeChopped(ke("y", "c", "b"))); assertFalse(info.needsToBeChopped(ke("x", "c", "bb"))); assertTrue(info.needsToBeChopped(ke("x", "b", "a"))); }
public boolean needsToBeChopped(KeyExtent otherExtent) { if (!otherExtent.tableId().equals(extent.tableId())) return false; if (isDelete()) return otherExtent.prevEndRow() != null && otherExtent.prevEndRow().equals(extent.endRow()); else return this.extent.overlaps(otherExtent); }
MergeInfo implements Writable { public boolean needsToBeChopped(KeyExtent otherExtent) { if (!otherExtent.tableId().equals(extent.tableId())) return false; if (isDelete()) return otherExtent.prevEndRow() != null && otherExtent.prevEndRow().equals(extent.endRow()); else return this.extent.overlaps(otherExtent); } }
MergeInfo implements Writable { public boolean needsToBeChopped(KeyExtent otherExtent) { if (!otherExtent.tableId().equals(extent.tableId())) return false; if (isDelete()) return otherExtent.prevEndRow() != null && otherExtent.prevEndRow().equals(extent.endRow()); else return this.extent.overlaps(otherExtent); } MergeInfo();  MergeInfo(KeyExtent range, Operation op); }
MergeInfo implements Writable { public boolean needsToBeChopped(KeyExtent otherExtent) { if (!otherExtent.tableId().equals(extent.tableId())) return false; if (isDelete()) return otherExtent.prevEndRow() != null && otherExtent.prevEndRow().equals(extent.endRow()); else return this.extent.overlaps(otherExtent); } MergeInfo();  MergeInfo(KeyExtent range, Operation op); @Override void readFields(DataInput in); @Override void write(DataOutput out); MergeState getState(); KeyExtent getExtent(); Operation getOperation(); void setState(MergeState state); boolean isDelete(); boolean needsToBeChopped(KeyExtent otherExtent); boolean overlaps(KeyExtent otherExtent); @Override String toString(); }
MergeInfo implements Writable { public boolean needsToBeChopped(KeyExtent otherExtent) { if (!otherExtent.tableId().equals(extent.tableId())) return false; if (isDelete()) return otherExtent.prevEndRow() != null && otherExtent.prevEndRow().equals(extent.endRow()); else return this.extent.overlaps(otherExtent); } MergeInfo();  MergeInfo(KeyExtent range, Operation op); @Override void readFields(DataInput in); @Override void write(DataOutput out); MergeState getState(); KeyExtent getExtent(); Operation getOperation(); void setState(MergeState state); boolean isDelete(); boolean needsToBeChopped(KeyExtent otherExtent); boolean overlaps(KeyExtent otherExtent); @Override String toString();  }