@Test public void testAndNot() { Roaring64Bitmap left = newDefaultCtor(); Roaring64Bitmap right = newDefaultCtor(); left.addLong(123); right.addLong(234); left.andNot(right); assertEquals(1, left.getLongCardinality()); assertEquals(123, left.select(0)); }
public void andNot(final Roaring64Bitmap x2) { KeyIterator thisKeyIterator = highLowContainer.highKeyIterator(); while (thisKeyIterator.hasNext()) { byte[] high = thisKeyIterator.next(); long containerIdx = thisKeyIterator.currentContainerIdx(); ContainerWithIndex containerWithIdx2 = x2.highLowContainer.searchContainer(high); if (containerWithIdx2 != null) { Container thisContainer = highLowContainer.getContainer(containerIdx); Container freshContainer = thisContainer.iandNot(containerWithIdx2.getContainer()); highLowContainer.replaceContainer(containerIdx, freshContainer); if (!freshContainer.isEmpty()) { highLowContainer.replaceContainer(containerIdx, freshContainer); } else { thisKeyIterator.remove(); } } } }
Roaring64Bitmap implements Externalizable, LongBitmapDataProvider { public void andNot(final Roaring64Bitmap x2) { KeyIterator thisKeyIterator = highLowContainer.highKeyIterator(); while (thisKeyIterator.hasNext()) { byte[] high = thisKeyIterator.next(); long containerIdx = thisKeyIterator.currentContainerIdx(); ContainerWithIndex containerWithIdx2 = x2.highLowContainer.searchContainer(high); if (containerWithIdx2 != null) { Container thisContainer = highLowContainer.getContainer(containerIdx); Container freshContainer = thisContainer.iandNot(containerWithIdx2.getContainer()); highLowContainer.replaceContainer(containerIdx, freshContainer); if (!freshContainer.isEmpty()) { highLowContainer.replaceContainer(containerIdx, freshContainer); } else { thisKeyIterator.remove(); } } } } }
Roaring64Bitmap implements Externalizable, LongBitmapDataProvider { public void andNot(final Roaring64Bitmap x2) { KeyIterator thisKeyIterator = highLowContainer.highKeyIterator(); while (thisKeyIterator.hasNext()) { byte[] high = thisKeyIterator.next(); long containerIdx = thisKeyIterator.currentContainerIdx(); ContainerWithIndex containerWithIdx2 = x2.highLowContainer.searchContainer(high); if (containerWithIdx2 != null) { Container thisContainer = highLowContainer.getContainer(containerIdx); Container freshContainer = thisContainer.iandNot(containerWithIdx2.getContainer()); highLowContainer.replaceContainer(containerIdx, freshContainer); if (!freshContainer.isEmpty()) { highLowContainer.replaceContainer(containerIdx, freshContainer); } else { thisKeyIterator.remove(); } } } } Roaring64Bitmap(); }
Roaring64Bitmap implements Externalizable, LongBitmapDataProvider { public void andNot(final Roaring64Bitmap x2) { KeyIterator thisKeyIterator = highLowContainer.highKeyIterator(); while (thisKeyIterator.hasNext()) { byte[] high = thisKeyIterator.next(); long containerIdx = thisKeyIterator.currentContainerIdx(); ContainerWithIndex containerWithIdx2 = x2.highLowContainer.searchContainer(high); if (containerWithIdx2 != null) { Container thisContainer = highLowContainer.getContainer(containerIdx); Container freshContainer = thisContainer.iandNot(containerWithIdx2.getContainer()); highLowContainer.replaceContainer(containerIdx, freshContainer); if (!freshContainer.isEmpty()) { highLowContainer.replaceContainer(containerIdx, freshContainer); } else { thisKeyIterator.remove(); } } } } Roaring64Bitmap(); void addInt(int x); @Override void addLong(long x); @Override long getLongCardinality(); int getIntCardinality(); @Override long select(final long j); Iterator<Long> iterator(); @Override void forEach(final LongConsumer lc); @Override long rankLong(long id); void or(final Roaring64Bitmap x2); void xor(final Roaring64Bitmap x2); void and(final Roaring64Bitmap x2); void andNot(final Roaring64Bitmap x2); @Override void writeExternal(ObjectOutput out); @Override void readExternal(ObjectInput in); @Override String toString(); @Override LongIterator getLongIterator(); @Override boolean contains(long x); @Override int getSizeInBytes(); @Override long getLongSizeInBytes(); @Override boolean isEmpty(); @Override ImmutableLongBitmapDataProvider limit(long x); boolean runOptimize(); @Override void serialize(DataOutput out); void serialize(ByteBuffer byteBuffer); void deserialize(DataInput in); void deserialize(ByteBuffer in); @Override long serializedSizeInBytes(); void clear(); @Override long[] toArray(); static Roaring64Bitmap bitmapOf(final long... dat); void add(long... dat); void add(final long rangeStart, final long rangeEnd); @Override LongIterator getReverseLongIterator(); @Override void removeLong(long x); @Override void trim(); @Override int hashCode(); @Override boolean equals(Object obj); void flip(final long x); @Override Roaring64Bitmap clone(); }
Roaring64Bitmap implements Externalizable, LongBitmapDataProvider { public void andNot(final Roaring64Bitmap x2) { KeyIterator thisKeyIterator = highLowContainer.highKeyIterator(); while (thisKeyIterator.hasNext()) { byte[] high = thisKeyIterator.next(); long containerIdx = thisKeyIterator.currentContainerIdx(); ContainerWithIndex containerWithIdx2 = x2.highLowContainer.searchContainer(high); if (containerWithIdx2 != null) { Container thisContainer = highLowContainer.getContainer(containerIdx); Container freshContainer = thisContainer.iandNot(containerWithIdx2.getContainer()); highLowContainer.replaceContainer(containerIdx, freshContainer); if (!freshContainer.isEmpty()) { highLowContainer.replaceContainer(containerIdx, freshContainer); } else { thisKeyIterator.remove(); } } } } Roaring64Bitmap(); void addInt(int x); @Override void addLong(long x); @Override long getLongCardinality(); int getIntCardinality(); @Override long select(final long j); Iterator<Long> iterator(); @Override void forEach(final LongConsumer lc); @Override long rankLong(long id); void or(final Roaring64Bitmap x2); void xor(final Roaring64Bitmap x2); void and(final Roaring64Bitmap x2); void andNot(final Roaring64Bitmap x2); @Override void writeExternal(ObjectOutput out); @Override void readExternal(ObjectInput in); @Override String toString(); @Override LongIterator getLongIterator(); @Override boolean contains(long x); @Override int getSizeInBytes(); @Override long getLongSizeInBytes(); @Override boolean isEmpty(); @Override ImmutableLongBitmapDataProvider limit(long x); boolean runOptimize(); @Override void serialize(DataOutput out); void serialize(ByteBuffer byteBuffer); void deserialize(DataInput in); void deserialize(ByteBuffer in); @Override long serializedSizeInBytes(); void clear(); @Override long[] toArray(); static Roaring64Bitmap bitmapOf(final long... dat); void add(long... dat); void add(final long rangeStart, final long rangeEnd); @Override LongIterator getReverseLongIterator(); @Override void removeLong(long x); @Override void trim(); @Override int hashCode(); @Override boolean equals(Object obj); void flip(final long x); @Override Roaring64Bitmap clone();  }