예제 #1
0
 @Override
 public Container iand(final BitmapContainer b2) {
   int newCardinality = 0;
   for (int k = 0; k < this.bitmap.length; ++k) {
     newCardinality += Long.bitCount(this.bitmap[k] & b2.bitmap[k]);
   }
   if (newCardinality > ArrayContainer.DEFAULT_MAX_SIZE) {
     for (int k = 0; k < this.bitmap.length; ++k) {
       this.bitmap[k] = this.bitmap[k] & b2.bitmap[k];
     }
     this.cardinality = newCardinality;
     return this;
   }
   ArrayContainer ac = new ArrayContainer(newCardinality);
   Util.fillArrayAND(ac.content, this.bitmap, b2.bitmap);
   ac.cardinality = newCardinality;
   return ac;
 }
예제 #2
0
 @Override
 public Container and(final BitmapContainer value2) {
   int newCardinality = 0;
   for (int k = 0; k < this.bitmap.length; ++k) {
     newCardinality += Long.bitCount(this.bitmap[k] & value2.bitmap[k]);
   }
   if (newCardinality > ArrayContainer.DEFAULT_MAX_SIZE) {
     final BitmapContainer answer = new BitmapContainer();
     for (int k = 0; k < answer.bitmap.length; ++k) {
       answer.bitmap[k] = this.bitmap[k] & value2.bitmap[k];
     }
     answer.cardinality = newCardinality;
     return answer;
   }
   ArrayContainer ac = new ArrayContainer(newCardinality);
   Util.fillArrayAND(ac.content, this.bitmap, value2.bitmap);
   ac.cardinality = newCardinality;
   return ac;
 }