/** Sets this bitmap to the contents of the argument. Both bitmaps must be the same size. */ public void setFrom(BitMap other) { if (Assert.ASSERTS_ENABLED) { Assert.that(size() == other.size(), "must have same size"); } for (int index = 0; index < sizeInWords(); index++) { data[index] = other.data[index]; } }
/** Both bitmaps must be the same size. */ public boolean isSame(BitMap other) { if (Assert.ASSERTS_ENABLED) { Assert.that(size() == other.size(), "must have same size"); } for (int index = 0; index < sizeInWords(); index++) { if (data[index] != (other.data[index])) return false; } return true; }
/** * Sets this bitmap to the logical union of it and the argument. Both bitmaps must be the same * size. Returns true if a change was caused in this bitmap. */ public boolean setUnion(BitMap other) { if (Assert.ASSERTS_ENABLED) { Assert.that(size() == other.size(), "must have same size"); } boolean changed = false; for (int index = 0; index < sizeInWords(); index++) { int temp = data[index] | other.data[index]; changed = changed || (temp != data[index]); data[index] = temp; } return changed; }