@Override public ArrayContainer and(final ArrayContainer value2) { final ArrayContainer answer = new ArrayContainer(value2.content.length); for (int k = 0; k < value2.getCardinality(); ++k) if (this.contains(value2.content[k])) answer.content[answer.cardinality++] = value2.content[k]; return answer; }
@Override public Container xor(final ArrayContainer value2) { final BitmapContainer answer = clone(); for (int k = 0; k < value2.getCardinality(); ++k) { final int index = Util.toIntUnsigned(value2.content[k]) >>> 6; answer.cardinality += 1 - 2 * ((answer.bitmap[index] & (1l << value2.content[k])) >>> value2.content[k]); answer.bitmap[index] = answer.bitmap[index] ^ (1l << value2.content[k]); } if (answer.cardinality <= ArrayContainer.DEFAULT_MAX_SIZE) return answer.toArrayContainer(); return answer; }
@Override public Container ixor(final ArrayContainer value2) { for (int k = 0; k < value2.getCardinality(); ++k) { final int index = Util.toIntUnsigned(value2.content[k]) >>> 6; this.cardinality += 1 - 2 * ((this.bitmap[index] & (1l << value2.content[k])) >>> value2.content[k]); this.bitmap[index] ^= (1l << value2.content[k]); } if (this.cardinality <= ArrayContainer.DEFAULT_MAX_SIZE) { return this.toArrayContainer(); } return this; }
@Override public boolean intersects(ArrayContainer value2) { for (int k = 0; k < value2.getCardinality(); ++k) if (this.contains(value2.content[k])) return true; return false; }