/** * Compares this object against the specified object. * * @param obj the object to compare with * @return true if the objects are the same; false otherwise. */ @Override public boolean equals(Object obj) { if ((obj != null) && (obj instanceof OffsetBitVector)) { if (this == obj) { // should help alias analysis return true; } OffsetBitVector set = (OffsetBitVector) obj; return sameBits(set); } return false; }
/** * Compares this object against the specified object. * * @param obj the object to compare with * @return true if the objects are the same; false otherwise. */ @Override public boolean equals(Object obj) { if ((obj != null) && (obj instanceof OffsetBitVector)) { if (this == obj) { // should help alias analysis return true; } OffsetBitVector set = (OffsetBitVector) obj; return sameBits(set); } return false; }
/** * Compares this object against the specified object. * * @param obj the object to compare with * @return true if the objects are the same; false otherwise. */ @Override public boolean equals(Object obj) { if ((obj != null) && (obj instanceof OffsetBitVector)) { if (this == obj) { // should help alias analysis return true; } OffsetBitVector set = (OffsetBitVector) obj; return sameBits(set); } return false; }
@Test public void testSpecificBugsInOffsetBitVectors() { OffsetBitVector v1 = makeBigTestOffsetVector(); System.err.println(v1); OffsetBitVector v2 = new OffsetBitVector(50000128, 512); v2.set(50000137); v2.set(50000204); v2.set(50000278); v2.set(50000315); v2.set(50000362); v2.set(50000450); v2.set(50000455); v2.set(50000471); System.err.println(v2); v1.andNot(v2); System.err.println(v1); Assert.assertTrue(v1.intersectionEmpty(v2)); v1 = makeBigTestOffsetVector(); v1.and(v2); System.err.println(v1); Assert.assertTrue(v1.sameBits(v2)); Assert.assertTrue(v1.isSubset(v2)); Assert.assertTrue(v2.isSubset(v1)); }