IndexRangeConstraint extends Constraint implements Writable { @Override public boolean equals(Object compareto) { if (!(compareto instanceof IndexRangeConstraint) || compareto == null) { return false; } IndexRangeConstraint compare = (IndexRangeConstraint) compareto; if (range == null && compare.getRange() != null) { return false; } if (range == null && compare.getRange() == null) { return true; } if (range != null && compare.getRange() == null) { return false; } return range.equals(compare.getRange()); } IndexRangeConstraint(Index index, CRange range);  IndexRangeConstraint(); @Override SeekingCurrentIterator getResultIterator(); CRange getRange(); @Override String toString(); @Override void readFields(DataInput in); @Override void write(DataOutput out); @Override boolean equals(Object compareto); @Override int hashCode(); Index getIndex();  }
@Test public void testIndexRangeEquals() { CRange range = new CRange(); CRange range2 = new CRange(new byte[] { 0 }); CRange range3 = new CRange(new byte[] { 0 }, new byte[] { 3 }); IndexRangeConstraint i1 = new IndexRangeConstraint(null, null); IndexRangeConstraint i2 = new IndexRangeConstraint(null, range); IndexRangeConstraint i3 = new IndexRangeConstraint(null, range2); IndexRangeConstraint i4 = new IndexRangeConstraint(null, range3); Assert.assertFalse(i1.equals(null)); Assert.assertTrue(i1.equals(i1)); Assert.assertFalse(i1.equals(i2)); Assert.assertFalse(i3.equals(i4)); }