nus-yam/ex-repair huggingface dataset:
Program: 90293
Project: 90293
Buggy source:
@Override public MappeableContainer add(int begin,int end){
  int indexstart=BufferUtil.unsignedBinarySearch(content,0,cardinality,(short)begin);
  if (indexstart < 0)   indexstart=-indexstart - 1;
  int indexend=BufferUtil.unsignedBinarySearch(content,0,cardinality,(short)(end - 1));
  if (indexend < 0)   indexend=-indexend - 1;
 else   indexend++;
  int rangelength=end - begin;
  int newcardinality=indexstart + (cardinality - indexend) + rangelength;
  if (newcardinality >= DEFAULT_MAX_SIZE) {
    MappeableBitmapContainer a=this.toBitmapContainer();
    return a.iadd(begin,end);
  }
  MappeableArrayContainer answer=new MappeableArrayContainer(newcardinality,content);
  BufferUtil.arraycopy(content,indexend,answer.content,indexstart + rangelength,cardinality - indexend);
  short[] answerarray=answer.content.array();
  for (int k=0; k < rangelength; ++k) {
    answerarray[k + indexstart]=(short)(begin + k);
  }
  answer.cardinality=newcardinality;
  return answer;
}

Fixed version (ground truth):
@Override public MappeableContainer add(int begin,int end){
  int indexstart=BufferUtil.unsignedBinarySearch(content,0,cardinality,(short)begin);
  if (indexstart < 0)   indexstart=-indexstart - 1;
  int indexend=BufferUtil.unsignedBinarySearch(content,0,cardinality,(short)(end - 1));
  if (indexend < 0)   indexend=-indexend - 1;
 else   indexend++;
  int rangelength=end - begin;
  int newcardinality=indexstart + (cardinality - indexend) + rangelength;
  if (newcardinality > DEFAULT_MAX_SIZE) {
    MappeableBitmapContainer a=this.toBitmapContainer();
    return a.iadd(begin,end);
  }
  MappeableArrayContainer answer=new MappeableArrayContainer(newcardinality,content);
  BufferUtil.arraycopy(content,indexend,answer.content,indexstart + rangelength,cardinality - indexend);
  short[] answerarray=answer.content.array();
  for (int k=0; k < rangelength; ++k) {
    answerarray[k + indexstart]=(short)(begin + k);
  }
  answer.cardinality=newcardinality;
  return answer;
}
Program: 90294
Project: 90294
Buggy source:
@Override public MappeableContainer iadd(int begin,int end){
  int indexstart=BufferUtil.unsignedBinarySearch(content,0,cardinality,(short)begin);
  if (indexstart < 0)   indexstart=-indexstart - 1;
  int indexend=BufferUtil.unsignedBinarySearch(content,0,cardinality,(short)(end - 1));
  if (indexend < 0)   indexend=-indexend - 1;
 else   indexend++;
  int rangelength=end - begin;
  int newcardinality=indexstart + (cardinality - indexend) + rangelength;
  if (newcardinality >= DEFAULT_MAX_SIZE) {
    MappeableBitmapContainer a=this.toBitmapContainer();
    return a.iadd(begin,end);
  }
  if (newcardinality >= this.content.limit())   increaseCapacity(newcardinality);
  BufferUtil.arraycopy(content,indexend,content,indexstart + rangelength,cardinality - indexend);
  if (BufferUtil.isBackedBySimpleArray(content)) {
    short[] contentarray=content.array();
    for (int k=0; k < rangelength; ++k) {
      contentarray[k + indexstart]=(short)(begin + k);
    }
  }
 else {
    for (int k=0; k < rangelength; ++k) {
      content.put(k + indexstart,(short)(begin + k));
    }
  }
  cardinality=newcardinality;
  return this;
}

Fixed version (ground truth):
@Override public MappeableContainer iadd(int begin,int end){
  int indexstart=BufferUtil.unsignedBinarySearch(content,0,cardinality,(short)begin);
  if (indexstart < 0)   indexstart=-indexstart - 1;
  int indexend=BufferUtil.unsignedBinarySearch(content,0,cardinality,(short)(end - 1));
  if (indexend < 0)   indexend=-indexend - 1;
 else   indexend++;
  int rangelength=end - begin;
  int newcardinality=indexstart + (cardinality - indexend) + rangelength;
  if (newcardinality > DEFAULT_MAX_SIZE) {
    MappeableBitmapContainer a=this.toBitmapContainer();
    return a.iadd(begin,end);
  }
  if (newcardinality >= this.content.limit())   increaseCapacity(newcardinality);
  BufferUtil.arraycopy(content,indexend,content,indexstart + rangelength,cardinality - indexend);
  if (BufferUtil.isBackedBySimpleArray(content)) {
    short[] contentarray=content.array();
    for (int k=0; k < rangelength; ++k) {
      contentarray[k + indexstart]=(short)(begin + k);
    }
  }
 else {
    for (int k=0; k < rangelength; ++k) {
      content.put(k + indexstart,(short)(begin + k));
    }
  }
  cardinality=newcardinality;
  return this;
}
Program: 90296
Project: 90296
Buggy source:
/** 
 * Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.
 * @param x other parameter
 * @return aggregated container
 */
public Container xor(Container x){
  if (x instanceof ArrayContainer)   return xor((ArrayContainer)x);
  return xor((BitmapContainer)x);
}

Fixed version (ground truth):
/** 
 * Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.
 * @param x other parameter
 * @return aggregated container
 */
public Container xor(Container x){
  if (x instanceof ArrayContainer)   return xor((ArrayContainer)x);
  return xor((BitmapContainer)x);
}
Program: 90297
Project: 90297
Buggy source:
/** 
 * Computes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
 * @param x other container
 * @return aggregated container
 */
public Container ixor(Container x){
  if (x instanceof ArrayContainer)   return ixor((ArrayContainer)x);
  return ixor((BitmapContainer)x);
}

Fixed version (ground truth):
/** 
 * Computes the in-place bitwise XOR of this container with another (symmetric difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
 * @param x other container
 * @return aggregated container
 */
public Container ixor(Container x){
  if (x instanceof ArrayContainer)   return ixor((ArrayContainer)x);
  return ixor((BitmapContainer)x);
}
Program: 90298
Project: 90298
Buggy source:
/** 
 * Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected.
 * @param x other parameter
 * @return aggregated container
 */
public MappeableContainer xor(MappeableContainer x){
  if (x instanceof MappeableArrayContainer)   return xor((MappeableArrayContainer)x);
  return xor((MappeableBitmapContainer)x);
}

Fixed version (ground truth):
/** 
 * Computes the bitwise XOR of this container with another (symmetric difference). This container as well as the provided container are left unaffected.
 * @param x other parameter
 * @return aggregated container
 */
public MappeableContainer xor(MappeableContainer x){
  if (x instanceof MappeableArrayContainer)   return xor((MappeableArrayContainer)x);
  return xor((MappeableBitmapContainer)x);
}
Program: 90299
Project: 90299
Buggy source:
/** 
 * Computes the in-place bitwise OR of this container with another (union). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
 * @param x other container
 * @return aggregated container
 */
public MappeableContainer ixor(MappeableContainer x){
  if (x instanceof MappeableArrayContainer)   return ixor((MappeableArrayContainer)x);
 else   return ixor((MappeableBitmapContainer)x);
}

Fixed version (ground truth):
/** 
 * Computes the in-place bitwise XOR of this container with another (symmetric difference). The current container is generally modified, whereas the provided container (x) is unaffected. May generate a new container.
 * @param x other container
 * @return aggregated container
 */
public MappeableContainer ixor(MappeableContainer x){
  if (x instanceof MappeableArrayContainer)   return ixor((MappeableArrayContainer)x);
 else   return ixor((MappeableBitmapContainer)x);
}
Program: 90301
Project: 90301
Buggy source:
@Override public MappeableContainer flip(short i){
  final int x=BufferUtil.toIntUnsigned(i);
  if (cardinality == MappeableArrayContainer.DEFAULT_MAX_SIZE + 1) {
    if ((bitmap.get(x / 64) & (1l << x)) != 0) {
      --cardinality;
      bitmap.put(x / 64,bitmap.get(x / 64) & ~(1l << x));
      return this.toArrayContainer();
    }
  }
  cardinality+=2 * ((bitmap.get(x / 64) ^ (1l << x)) >>> x) - 1;
  bitmap.put(x / 64,bitmap.get(x / 64) ^ (1l << x));
  return this;
}

Fixed version (ground truth):
@Override public MappeableContainer flip(short i){
  final int x=BufferUtil.toIntUnsigned(i);
  if (cardinality == MappeableArrayContainer.DEFAULT_MAX_SIZE + 1) {
    if ((bitmap.get(x / 64) & (1l << x)) != 0) {
      --cardinality;
      bitmap.put(x / 64,bitmap.get(x / 64) & ~(1l << x));
      return this.toArrayContainer();
    }
  }
  cardinality+=1 - 2 * ((bitmap.get(x / 64) & (1l << x)) >>> x);
  bitmap.put(x / 64,bitmap.get(x / 64) ^ (1l << x));
  return this;
}
Program: 90302
Project: 90302
Buggy source:
/** 
 * Create a container initialized with a range of consecutive values
 * @param start first index
 * @param last last index (range in exclusive)
 * @return a new container initialized with the specified values
 */
public static MappeableContainer rangeOfOnes(final int start,final int last){
  if (last - start > MappeableArrayContainer.DEFAULT_MAX_SIZE)   return new MappeableBitmapContainer(start,last);
  return new MappeableArrayContainer(start,last);
}

Fixed version (ground truth):
/** 
 * Create a container initialized with a range of consecutive values
 * @param start first index
 * @param last last index (range is exclusive)
 * @return a new container initialized with the specified values
 */
public static MappeableContainer rangeOfOnes(final int start,final int last){
  if (last - start > MappeableArrayContainer.DEFAULT_MAX_SIZE)   return new MappeableBitmapContainer(start,last);
  return new MappeableArrayContainer(start,last);
}
Program: 90303
Project: 90303
Buggy source:
/** 
 * Modifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 */
public void flip(final int rangeStart,final int rangeEnd){
  if (rangeStart >= rangeEnd)   return;
  final int hbStart=BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeStart));
  final int lbStart=BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeStart));
  final int hbLast=BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeEnd - 1));
  final int lbLast=BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeEnd - 1));
  final int max=BufferUtil.toIntUnsigned(BufferUtil.maxLowBit());
  for (int hb=hbStart; hb <= hbLast; ++hb) {
    final int containerStart=(hb == hbStart) ? lbStart : 0;
    final int containerLast=(hb == hbLast) ? lbLast : max;
    final int i=highLowContainer.getIndex((short)hb);
    if (i >= 0) {
      final MappeableContainer c=highLowContainer.getContainerAtIndex(i).inot(containerStart,containerLast);
      if (c.getCardinality() > 0)       getMappeableRoaringArray().setContainerAtIndex(i,c);
 else       getMappeableRoaringArray().removeAtIndex(i);
    }
 else {
      getMappeableRoaringArray().insertNewKeyValueAt(-i - 1,(short)hb,MappeableContainer.rangeOfOnes(containerStart,containerLast + 1));
    }
  }
}

Fixed version (ground truth):
/** 
 * Modifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 */
public void flip(final int rangeStart,final int rangeEnd){
  if (rangeStart >= rangeEnd)   return;
  final int hbStart=BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeStart));
  final int lbStart=BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeStart));
  final int hbLast=BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeEnd - 1));
  final int lbLast=BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeEnd - 1));
  final int max=BufferUtil.toIntUnsigned(BufferUtil.maxLowBit());
  for (int hb=hbStart; hb <= hbLast; ++hb) {
    final int containerStart=(hb == hbStart) ? lbStart : 0;
    final int containerLast=(hb == hbLast) ? lbLast : max;
    final int i=highLowContainer.getIndex((short)hb);
    if (i >= 0) {
      final MappeableContainer c=highLowContainer.getContainerAtIndex(i).inot(containerStart,containerLast + 1);
      if (c.getCardinality() > 0)       getMappeableRoaringArray().setContainerAtIndex(i,c);
 else       getMappeableRoaringArray().removeAtIndex(i);
    }
 else {
      getMappeableRoaringArray().insertNewKeyValueAt(-i - 1,(short)hb,MappeableContainer.rangeOfOnes(containerStart,containerLast + 1));
    }
  }
}
Program: 90304
Project: 90304
Buggy source:
@Test public void notTest9(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(0,65200);
  assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(32438,c1.getCardinality());
  final MappeableContainer c2=c1.not(0,65200);
  assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}

Fixed version (ground truth):
@Test public void notTest9(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(0,65201);
  assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(32438,c1.getCardinality());
  final MappeableContainer c2=c1.not(0,65201);
  assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}
Program: 90305
Project: 90305
Buggy source:
@Test public void inotTest10(){
  System.out.println("String_Node_Str");
  final short[] content=new short[3];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.inot(65190,65200);
  assertTrue(c1 instanceof MappeableArrayContainer);
  assertEquals(14,c1.getCardinality());
  assertTrue(checkContent(c1,new short[]{0,2,4,(short)65190,(short)65191,(short)65192,(short)65193,(short)65194,(short)65195,(short)65196,(short)65197,(short)65198,(short)65199,(short)65200}));
}

Fixed version (ground truth):
@Test public void inotTest10(){
  System.out.println("String_Node_Str");
  final short[] content=new short[3];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.inot(65190,65201);
  assertTrue(c1 instanceof MappeableArrayContainer);
  assertEquals(14,c1.getCardinality());
  assertTrue(checkContent(c1,new short[]{0,2,4,(short)65190,(short)65191,(short)65192,(short)65193,(short)65194,(short)65195,(short)65196,(short)65197,(short)65198,(short)65199,(short)65200}));
}
Program: 90306
Project: 90306
Buggy source:
@Test public void notTest7(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(5,31000);
  if (c1.getCardinality() <= MappeableArrayContainer.DEFAULT_MAX_SIZE)   assertTrue(c1 instanceof MappeableArrayContainer);
 else   assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(1773,c1.getCardinality());
  final MappeableContainer c2=c1.not(5,31000);
  if (c2.getCardinality() <= MappeableArrayContainer.DEFAULT_MAX_SIZE)   assertTrue(c2 instanceof MappeableArrayContainer);
 else   assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}

Fixed version (ground truth):
@Test public void notTest7(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(5,31001);
  if (c1.getCardinality() <= MappeableArrayContainer.DEFAULT_MAX_SIZE)   assertTrue(c1 instanceof MappeableArrayContainer);
 else   assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(1773,c1.getCardinality());
  final MappeableContainer c2=c1.not(5,31001);
  if (c2.getCardinality() <= MappeableArrayContainer.DEFAULT_MAX_SIZE)   assertTrue(c2 instanceof MappeableArrayContainer);
 else   assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}
Program: 90307
Project: 90307
Buggy source:
@Test public void notTest8(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(4,65535);
  assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(32773,c1.getCardinality());
  final MappeableContainer c2=c1.not(4,65535);
  assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}

Fixed version (ground truth):
@Test public void notTest8(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(4,65536);
  assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(32773,c1.getCardinality());
  final MappeableContainer c2=c1.not(4,65536);
  assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}
Program: 90308
Project: 90308
Buggy source:
@Test public void notTest5(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(4,999);
  assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(31773,c1.getCardinality());
  final MappeableContainer c2=c1.not(4,999);
  assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}

Fixed version (ground truth):
@Test public void notTest5(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(4,1000);
  assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(31773,c1.getCardinality());
  final MappeableContainer c2=c1.not(4,1000);
  assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}
Program: 90309
Project: 90309
Buggy source:
@Test public void notTest6(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(4,8);
  assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(32762,c1.getCardinality());
  final MappeableContainer c2=c1.not(4,8);
  assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}

Fixed version (ground truth):
@Test public void notTest6(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(4,9);
  assertTrue(c1 instanceof MappeableBitmapContainer);
  assertEquals(32762,c1.getCardinality());
  final MappeableContainer c2=c1.not(4,9);
  assertTrue(c2 instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c2,content));
}
Program: 90310
Project: 90310
Buggy source:
@Test public void inotTest4(){
  final short[] content={1,3,5,7,9};
  MappeableContainer c=makeContainer(content);
  c=c.inot(4,999);
  assertTrue(c instanceof MappeableArrayContainer);
  assertEquals(999 - 4 + 1 - 3 + 2,c.getCardinality());
  c=c.inot(4,999);
  assertTrue(checkContent(c,content));
}

Fixed version (ground truth):
@Test public void inotTest4(){
  final short[] content={1,3,5,7,9};
  MappeableContainer c=makeContainer(content);
  c=c.inot(4,1000);
  assertTrue(c instanceof MappeableArrayContainer);
  assertEquals(999 - 4 + 1 - 3 + 2,c.getCardinality());
  c=c.inot(4,1000);
  assertTrue(checkContent(c,content));
}
Program: 90311
Project: 90311
Buggy source:
@Test public void inotTest5(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  MappeableContainer c=makeContainer(content);
  c=c.inot(4,999);
  assertTrue(c instanceof MappeableBitmapContainer);
  assertEquals(31773,c.getCardinality());
  c=c.inot(4,999);
  assertTrue(c instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c,content));
}

Fixed version (ground truth):
@Test public void inotTest5(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  MappeableContainer c=makeContainer(content);
  c=c.inot(4,1000);
  assertTrue(c instanceof MappeableBitmapContainer);
  assertEquals(31773,c.getCardinality());
  c=c.inot(4,1000);
  assertTrue(c instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c,content));
}
Program: 90312
Project: 90312
Buggy source:
@Test public void inotTest6(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  MappeableContainer c=makeContainer(content);
  c=c.inot(4,8);
  assertTrue(c instanceof MappeableBitmapContainer);
  assertEquals(32762,c.getCardinality());
  c=c.inot(4,8);
  assertTrue(c instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c,content));
}

Fixed version (ground truth):
@Test public void inotTest6(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  MappeableContainer c=makeContainer(content);
  c=c.inot(4,9);
  assertTrue(c instanceof MappeableBitmapContainer);
  assertEquals(32762,c.getCardinality());
  c=c.inot(4,9);
  assertTrue(c instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c,content));
}
Program: 90313
Project: 90313
Buggy source:
@Test public void inotTest7(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  MappeableContainer c=makeContainer(content);
  c=c.inot(5,31000);
  if (c.getCardinality() <= MappeableArrayContainer.DEFAULT_MAX_SIZE)   assertTrue(c instanceof MappeableArrayContainer);
 else   assertTrue(c instanceof MappeableBitmapContainer);
  assertEquals(1773,c.getCardinality());
  c=c.inot(5,31000);
  if (c.getCardinality() <= MappeableArrayContainer.DEFAULT_MAX_SIZE)   assertTrue(c instanceof MappeableArrayContainer);
 else   assertTrue(c instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c,content));
}

Fixed version (ground truth):
@Test public void inotTest7(){
  System.out.println("String_Node_Str");
  final short[] content=new short[32768 - 5];
  content[0]=0;
  content[1]=2;
  content[2]=4;
  content[3]=6;
  content[4]=8;
  for (int i=10; i <= 32767; ++i)   content[i - 10 + 5]=(short)i;
  MappeableContainer c=makeContainer(content);
  c=c.inot(5,31001);
  if (c.getCardinality() <= MappeableArrayContainer.DEFAULT_MAX_SIZE)   assertTrue(c instanceof MappeableArrayContainer);
 else   assertTrue(c instanceof MappeableBitmapContainer);
  assertEquals(1773,c.getCardinality());
  c=c.inot(5,31001);
  if (c.getCardinality() <= MappeableArrayContainer.DEFAULT_MAX_SIZE)   assertTrue(c instanceof MappeableArrayContainer);
 else   assertTrue(c instanceof MappeableBitmapContainer);
  assertTrue(checkContent(c,content));
}
Program: 90314
Project: 90314
Buggy source:
@Test public void inotTest8(){
  System.out.println("String_Node_Str");
  final short[] content=new short[21];
  for (int i=0; i < 18; ++i)   content[i]=(short)i;
  content[18]=21;
  content[19]=22;
  content[20]=23;
  MappeableContainer c=makeContainer(content);
  c=c.inot(5,21);
  assertTrue(c instanceof MappeableArrayContainer);
  assertEquals(10,c.getCardinality());
  c=c.inot(5,21);
  assertTrue(c instanceof MappeableArrayContainer);
  assertTrue(checkContent(c,content));
}

Fixed version (ground truth):
@Test public void inotTest8(){
  System.out.println("String_Node_Str");
  final short[] content=new short[21];
  for (int i=0; i < 18; ++i)   content[i]=(short)i;
  content[18]=21;
  content[19]=22;
  content[20]=23;
  MappeableContainer c=makeContainer(content);
  c=c.inot(5,22);
  assertTrue(c instanceof MappeableArrayContainer);
  assertEquals(10,c.getCardinality());
  c=c.inot(5,22);
  assertTrue(c instanceof MappeableArrayContainer);
  assertTrue(checkContent(c,content));
}
Program: 90315
Project: 90315
Buggy source:
@Test public void notTest3(){
  MappeableContainer c=new MappeableArrayContainer();
  for (int i=0; i < 65536; i+=2)   c=c.add((short)i);
  final MappeableContainer c1=c.not(0,65535);
  assertTrue(c1.contains((short)3) && !c1.contains((short)4));
  assertEquals(32768,c1.getCardinality());
  final MappeableContainer c2=c1.not(0,65535);
  for (int i=0; i < 65536; i+=2)   assertTrue(c2.contains((short)i) && !c2.contains((short)(i + 1)));
}

Fixed version (ground truth):
@Test public void notTest3(){
  MappeableContainer c=new MappeableArrayContainer();
  for (int i=0; i < 65536; i+=2)   c=c.add((short)i);
  final MappeableContainer c1=c.not(0,65536);
  assertTrue(c1.contains((short)3) && !c1.contains((short)4));
  assertEquals(32768,c1.getCardinality());
  final MappeableContainer c2=c1.not(0,65536);
  for (int i=0; i < 65536; i+=2)   assertTrue(c2.contains((short)i) && !c2.contains((short)(i + 1)));
}
Program: 90316
Project: 90316
Buggy source:
@Test public void notTest4(){
  System.out.println("String_Node_Str");
  final short[] content={1,3,5,7,9};
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(4,999);
  assertTrue(c1 instanceof MappeableArrayContainer);
  assertEquals(999 - 4 + 1 - 3 + 2,c1.getCardinality());
  final MappeableContainer c2=c1.not(4,999);
  assertTrue(checkContent(c2,content));
}

Fixed version (ground truth):
@Test public void notTest4(){
  System.out.println("String_Node_Str");
  final short[] content={1,3,5,7,9};
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(4,1000);
  assertTrue(c1 instanceof MappeableArrayContainer);
  assertEquals(999 - 4 + 1 - 3 + 2,c1.getCardinality());
  final MappeableContainer c2=c1.not(4,1000);
  assertTrue(checkContent(c2,content));
}
Program: 90317
Project: 90317
Buggy source:
@Test public void notTest1(){
  final short[] content={1,3,5,7,9};
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(0,65535);
  final short[] s=new short[65536 - content.length];
  int pos=0;
  for (int i=0; i < 65536; ++i)   if (Arrays.binarySearch(content,(short)i) < 0)   s[pos++]=(short)i;
  assertTrue(checkContent(c1,s));
  assertTrue(checkContent(c,content));
}

Fixed version (ground truth):
@Test public void notTest1(){
  final short[] content={1,3,5,7,9};
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(0,65536);
  final short[] s=new short[65536 - content.length];
  int pos=0;
  for (int i=0; i < 65536; ++i)   if (Arrays.binarySearch(content,(short)i) < 0)   s[pos++]=(short)i;
  assertTrue(checkContent(c1,s));
  assertTrue(checkContent(c,content));
}
Program: 90318
Project: 90318
Buggy source:
@Test public void notTest11(){
  System.out.println("String_Node_Str");
  final short[] content=new short[40];
  for (int i=244; i <= 283; ++i)   content[i - 244]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(1,58);
  assertTrue(c1 instanceof MappeableArrayContainer);
  assertEquals(40 + 58,c1.getCardinality());
  final short[] rightAns=new short[98];
  for (int i=1; i <= 58; ++i)   rightAns[i - 1]=(short)i;
  for (int i=244; i <= 283; ++i)   rightAns[i - 244 + 58]=(short)i;
  assertTrue(checkContent(c1,rightAns));
}

Fixed version (ground truth):
@Test public void notTest11(){
  System.out.println("String_Node_Str");
  final short[] content=new short[40];
  for (int i=244; i <= 283; ++i)   content[i - 244]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(1,59);
  assertTrue(c1 instanceof MappeableArrayContainer);
  assertEquals(40 + 58,c1.getCardinality());
  final short[] rightAns=new short[98];
  for (int i=1; i <= 58; ++i)   rightAns[i - 1]=(short)i;
  for (int i=244; i <= 283; ++i)   rightAns[i - 244 + 58]=(short)i;
  assertTrue(checkContent(c1,rightAns));
}
Program: 90319
Project: 90319
Buggy source:
@Test public void inotTest1(){
  final short[] content={1,3,5,7,9};
  MappeableContainer c=makeContainer(content);
  c=c.inot(0,65535);
  final short[] s=new short[65536 - content.length];
  int pos=0;
  for (int i=0; i < 65536; ++i)   if (Arrays.binarySearch(content,(short)i) < 0)   s[pos++]=(short)i;
  assertTrue(checkContent(c,s));
}

Fixed version (ground truth):
@Test public void inotTest1(){
  final short[] content={1,3,5,7,9};
  MappeableContainer c=makeContainer(content);
  c=c.inot(0,65536);
  final short[] s=new short[65536 - content.length];
  int pos=0;
  for (int i=0; i < 65536; ++i)   if (Arrays.binarySearch(content,(short)i) < 0)   s[pos++]=(short)i;
  assertTrue(checkContent(c,s));
}
Program: 90320
Project: 90320
Buggy source:
@Test public void notTest10(){
  System.out.println("String_Node_Str");
  final short[] content=new short[40];
  for (int i=244; i <= 283; ++i)   content[i - 244]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(51413,51470);
  assertTrue(c1 instanceof MappeableArrayContainer);
  assertEquals(40 + 58,c1.getCardinality());
  final short[] rightAns=new short[98];
  for (int i=244; i <= 283; ++i)   rightAns[i - 244]=(short)i;
  for (int i=51413; i <= 51470; ++i)   rightAns[i - 51413 + 40]=(short)i;
  assertTrue(checkContent(c1,rightAns));
}

Fixed version (ground truth):
@Test public void notTest10(){
  System.out.println("String_Node_Str");
  final short[] content=new short[40];
  for (int i=244; i <= 283; ++i)   content[i - 244]=(short)i;
  final MappeableContainer c=makeContainer(content);
  final MappeableContainer c1=c.not(51413,51471);
  assertTrue(c1 instanceof MappeableArrayContainer);
  assertEquals(40 + 58,c1.getCardinality());
  final short[] rightAns=new short[98];
  for (int i=244; i <= 283; ++i)   rightAns[i - 244]=(short)i;
  for (int i=51413; i <= 51470; ++i)   rightAns[i - 51413 + 40]=(short)i;
  assertTrue(checkContent(c1,rightAns));
}
Program: 90321
Project: 90321
Buggy source:
@Test public void inotTest3(){
  MappeableContainer c=new MappeableArrayContainer();
  for (int i=0; i < 65536; i+=2)   c=c.add((short)i);
  c=c.inot(0,65535);
  assertTrue(c.contains((short)3) && !c.contains((short)4));
  assertEquals(32768,c.getCardinality());
  c=c.inot(0,65535);
  for (int i=0; i < 65536; i+=2)   assertTrue(c.contains((short)i) && !c.contains((short)(i + 1)));
}

Fixed version (ground truth):
@Test public void inotTest3(){
  MappeableContainer c=new MappeableArrayContainer();
  for (int i=0; i < 65536; i+=2)   c=c.add((short)i);
  c=c.inot(0,65536);
  assertTrue(c.contains((short)3) && !c.contains((short)4));
  assertEquals(32768,c.getCardinality());
  c=c.inot(0,65536);
  for (int i=0; i < 65536; i+=2)   assertTrue(c.contains((short)i) && !c.contains((short)(i + 1)));
}
Program: 90322
Project: 90322
Buggy source:
@Test public void serializationExample() throws IOException {
  File tmpfile=File.createTempFile("String_Node_Str","String_Node_Str");
  tmpfile.deleteOnExit();
  final FileOutputStream fos=new FileOutputStream(tmpfile);
  MutableRoaringBitmap Bitmap=MutableRoaringBitmap.bitmapOf(0,2,55,64,1 << 30);
  System.out.println("String_Node_Str" + Bitmap);
  Bitmap.serialize(new DataOutputStream(fos));
  long totalcount=fos.getChannel().position();
  System.out.println("String_Node_Str" + totalcount + "String_Node_Str");
  fos.close();
  RandomAccessFile memoryMappedFile=new RandomAccessFile(tmpfile,"String_Node_Str");
  ByteBuffer bb=memoryMappedFile.getChannel().map(FileChannel.MapMode.READ_ONLY,0,totalcount);
  ImmutableRoaringBitmap mapped=new ImmutableRoaringBitmap(bb);
  System.out.println("String_Node_Str" + mapped);
  if (!mapped.equals(Bitmap))   throw new RuntimeException("String_Node_Str");
  memoryMappedFile.close();
}

Fixed version (ground truth):
@Test public void serializationExample() throws IOException {
  File tmpfile=File.createTempFile("String_Node_Str","String_Node_Str");
  tmpfile.deleteOnExit();
  final FileOutputStream fos=new FileOutputStream(tmpfile);
  MutableRoaringBitmap Bitmap=MutableRoaringBitmap.bitmapOf(0,2,55,64,1 << 30);
  System.out.println("String_Node_Str" + Bitmap);
  Bitmap.serialize(new DataOutputStream(fos));
  long totalcount=fos.getChannel().position();
  System.out.println("String_Node_Str" + totalcount + "String_Node_Str");
  fos.close();
  RandomAccessFile memoryMappedFile=new RandomAccessFile(tmpfile,"String_Node_Str");
  ByteBuffer bb=memoryMappedFile.getChannel().map(FileChannel.MapMode.READ_ONLY,0,totalcount);
  ImmutableRoaringBitmap mapped=new ImmutableRoaringBitmap(bb);
  System.out.println("String_Node_Str" + mapped);
  memoryMappedFile.close();
  if (!mapped.equals(Bitmap))   throw new RuntimeException("String_Node_Str");
}
Program: 90323
Project: 90323
Buggy source:
@Test public void flipTestBigA(){
  final int numCases=1000;
  final BitSet bs=new BitSet();
  final Random r=new Random(3333);
  int checkTime=2;
  MutableRoaringBitmap rb1=new MutableRoaringBitmap(), rb2=null;
  for (int i=0; i < numCases; ++i) {
    final int start=r.nextInt(65536 * 20);
    int end=r.nextInt(65536 * 20);
    if (r.nextDouble() < 0.1)     end=start + r.nextInt(100);
    if ((i & 1) == 0) {
      rb2=MutableRoaringBitmap.flip(rb1,start,end);
      rb1.flip(r.nextInt(65536 * 20),r.nextInt(65536 * 20));
    }
 else {
      rb1=MutableRoaringBitmap.flip(rb2,start,end);
      rb2.flip(r.nextInt(65536 * 20),r.nextInt(65536 * 20));
    }
    if (start < end)     bs.flip(start,end);
    if (r.nextDouble() < 0.2 && (i & 1) == 0) {
      final MutableRoaringBitmap mask=new MutableRoaringBitmap();
      final BitSet mask1=new BitSet();
      final int startM=r.nextInt(65536 * 20);
      final int endM=startM + 100000;
      mask.flip(startM,endM);
      mask1.flip(startM,endM);
      mask.flip(0,65536 * 20 + 100000);
      mask1.flip(0,65536 * 20 + 100000);
      rb2.and(mask);
      bs.and(mask1);
    }
    if (i > checkTime) {
      System.out.println("String_Node_Str" + i + "String_Node_Str"+ rb2.getCardinality());
      final MutableRoaringBitmap rb=(i & 1) == 0 ? rb2 : rb1;
      final boolean status=equals(bs,rb);
      Assert.assertTrue(status);
      checkTime*=1.5;
    }
  }
}

Fixed version (ground truth):
@Test public void flipTestBigA(){
  final int numCases=1000;
  final BitSet bs=new BitSet();
  final Random r=new Random(3333);
  int checkTime=2;
  MutableRoaringBitmap rb1=new MutableRoaringBitmap(), rb2=null;
  for (int i=0; i < numCases; ++i) {
    final int start=r.nextInt(65536 * 20);
    int end=r.nextInt(65536 * 20);
    if (r.nextDouble() < 0.1)     end=start + r.nextInt(100);
    if ((i & 1) == 0) {
      rb2=MutableRoaringBitmap.flip(rb1,start,end);
      int r1=r.nextInt(65536 * 20);
      int r2=r.nextInt(65536 * 20);
      rb1.flip(r1,r2);
    }
 else {
      rb1=MutableRoaringBitmap.flip(rb2,start,end);
      int r1=r.nextInt(65536 * 20);
      int r2=r.nextInt(65536 * 20);
      rb2.flip(r1,r2);
    }
    if (start < end)     bs.flip(start,end);
    if (r.nextDouble() < 0.2 && (i & 1) == 0) {
      final MutableRoaringBitmap mask=new MutableRoaringBitmap();
      final BitSet mask1=new BitSet();
      final int startM=r.nextInt(65536 * 20);
      final int endM=startM + 100000;
      mask.flip(startM,endM);
      mask1.flip(startM,endM);
      mask.flip(0,65536 * 20 + 100000);
      mask1.flip(0,65536 * 20 + 100000);
      rb2.and(mask);
      bs.and(mask1);
    }
    if (i > checkTime) {
      final MutableRoaringBitmap rb=(i & 1) == 0 ? rb2 : rb1;
      final boolean status=equals(bs,rb);
      Assert.assertTrue(status);
      checkTime*=1.5;
    }
  }
}
Program: 90324
Project: 90324
Buggy source:
@Override public Container not(final int firstOfRange,final int lastOfRange){
  if (firstOfRange > lastOfRange) {
    return clone();
  }
  int startIndex=Util.unsignedBinarySearch(content,0,cardinality,(short)firstOfRange);
  if (startIndex < 0)   startIndex=-startIndex - 1;
  int lastIndex=Util.unsignedBinarySearch(content,0,cardinality,(short)lastOfRange);
  if (lastIndex < 0)   lastIndex=-lastIndex - 2;
  final int currentValuesInRange=lastIndex - startIndex + 1;
  final int spanToBeFlipped=lastOfRange - firstOfRange + 1;
  final int newValuesInRange=spanToBeFlipped - currentValuesInRange;
  final int cardinalityChange=newValuesInRange - currentValuesInRange;
  final int newCardinality=cardinality + cardinalityChange;
  if (newCardinality >= DEFAULT_MAX_SIZE)   return toBitmapContainer().not(firstOfRange,lastOfRange);
  ArrayContainer answer=new ArrayContainer(newCardinality);
  System.arraycopy(content,0,answer.content,0,startIndex);
  int outPos=startIndex;
  int inPos=startIndex;
  int valInRange=firstOfRange;
  for (; valInRange <= lastOfRange && inPos <= lastIndex; ++valInRange) {
    if ((short)valInRange != content[inPos]) {
      answer.content[outPos++]=(short)valInRange;
    }
 else {
      ++inPos;
    }
  }
  for (; valInRange <= lastOfRange; ++valInRange) {
    answer.content[outPos++]=(short)valInRange;
  }
  for (int i=lastIndex + 1; i < cardinality; ++i)   answer.content[outPos++]=content[i];
  answer.cardinality=newCardinality;
  return answer;
}

Fixed version (ground truth):
@Override public Container not(final int firstOfRange,final int lastOfRange){
  if (firstOfRange >= lastOfRange) {
    return clone();
  }
  int startIndex=Util.unsignedBinarySearch(content,0,cardinality,(short)firstOfRange);
  if (startIndex < 0)   startIndex=-startIndex - 1;
  int lastIndex=Util.unsignedBinarySearch(content,0,cardinality,(short)(lastOfRange - 1));
  if (lastIndex < 0)   lastIndex=-lastIndex - 2;
  final int currentValuesInRange=lastIndex - startIndex + 1;
  final int spanToBeFlipped=lastOfRange - firstOfRange;
  final int newValuesInRange=spanToBeFlipped - currentValuesInRange;
  final int cardinalityChange=newValuesInRange - currentValuesInRange;
  final int newCardinality=cardinality + cardinalityChange;
  if (newCardinality >= DEFAULT_MAX_SIZE)   return toBitmapContainer().not(firstOfRange,lastOfRange);
  ArrayContainer answer=new ArrayContainer(newCardinality);
  System.arraycopy(content,0,answer.content,0,startIndex);
  int outPos=startIndex;
  int inPos=startIndex;
  int valInRange=firstOfRange;
  for (; valInRange < lastOfRange && inPos <= lastIndex; ++valInRange) {
    if ((short)valInRange != content[inPos]) {
      answer.content[outPos++]=(short)valInRange;
    }
 else {
      ++inPos;
    }
  }
  for (; valInRange < lastOfRange; ++valInRange) {
    answer.content[outPos++]=(short)valInRange;
  }
  for (int i=lastIndex + 1; i < cardinality; ++i)   answer.content[outPos++]=content[i];
  answer.cardinality=newCardinality;
  return answer;
}
Program: 90325
Project: 90325
Buggy source:
@Override public Container flip(short i){
  final int x=Util.toIntUnsigned(i);
  if (cardinality == ArrayContainer.DEFAULT_MAX_SIZE + 1) {
    if ((bitmap[x / 64] & (1l << x)) != 0) {
      --cardinality;
      bitmap[x / 64]&=~(1l << x);
      return this.toArrayContainer();
    }
  }
  cardinality+=2 * ((bitmap[x / 64] ^ (1l << x)) >>> x) - 1;
  bitmap[x / 64]^=(1l << x);
  return this;
}

Fixed version (ground truth):
@Override public Container flip(short i){
  final int x=Util.toIntUnsigned(i);
  if (cardinality == ArrayContainer.DEFAULT_MAX_SIZE + 1) {
    if ((bitmap[x / 64] & (1l << x)) != 0) {
      --cardinality;
      bitmap[x / 64]&=~(1l << x);
      return this.toArrayContainer();
    }
  }
  cardinality+=1 - 2 * ((bitmap[x / 64] & (1l << x)) >>> x);
  bitmap[x / 64]^=(1l << x);
  return this;
}
Program: 90326
Project: 90326
Buggy source:
/** 
 * Modifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd   exclusive ending of range
 */
public void flip(final int rangeStart,final int rangeEnd){
  if (rangeStart >= rangeEnd)   return;
  final int hbStart=Util.toIntUnsigned(Util.highbits(rangeStart));
  final int lbStart=Util.toIntUnsigned(Util.lowbits(rangeStart));
  final int hbLast=Util.toIntUnsigned(Util.highbits(rangeEnd - 1));
  final int lbLast=Util.toIntUnsigned(Util.lowbits(rangeEnd - 1));
  final int max=Util.toIntUnsigned(Util.maxLowBit());
  for (int hb=hbStart; hb <= hbLast; ++hb) {
    final int containerStart=(hb == hbStart) ? lbStart : 0;
    final int containerLast=(hb == hbLast) ? lbLast : max;
    final int i=highLowContainer.getIndex((short)hb);
    if (i >= 0) {
      System.out.println("String_Node_Str" + containerStart + "String_Node_Str"+ (containerLast + 1));
      final Container longway=highLowContainer.getContainerAtIndex(i).xor(Container.rangeOfOnes(containerStart,containerLast + 1));
      final Container c=highLowContainer.getContainerAtIndex(i).inot(containerStart,containerLast + 1);
      if (!c.equals(longway))       throw new RuntimeException("String_Node_Str");
      if (c.getCardinality() > 0)       highLowContainer.setContainerAtIndex(i,c);
 else       highLowContainer.removeAtIndex(i);
    }
 else {
      highLowContainer.insertNewKeyValueAt(-i - 1,(short)hb,Container.rangeOfOnes(containerStart,containerLast + 1));
    }
  }
}

Fixed version (ground truth):
/** 
 * Modifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd   exclusive ending of range
 */
public void flip(final int rangeStart,final int rangeEnd){
  if (rangeStart >= rangeEnd)   return;
  final int hbStart=Util.toIntUnsigned(Util.highbits(rangeStart));
  final int lbStart=Util.toIntUnsigned(Util.lowbits(rangeStart));
  final int hbLast=Util.toIntUnsigned(Util.highbits(rangeEnd - 1));
  final int lbLast=Util.toIntUnsigned(Util.lowbits(rangeEnd - 1));
  final int max=Util.toIntUnsigned(Util.maxLowBit());
  for (int hb=hbStart; hb <= hbLast; ++hb) {
    final int containerStart=(hb == hbStart) ? lbStart : 0;
    final int containerLast=(hb == hbLast) ? lbLast : max;
    final int i=highLowContainer.getIndex((short)hb);
    if (i >= 0) {
      final Container c=highLowContainer.getContainerAtIndex(i).inot(containerStart,containerLast + 1);
      if (c.getCardinality() > 0)       highLowContainer.setContainerAtIndex(i,c);
 else       highLowContainer.removeAtIndex(i);
    }
 else {
      highLowContainer.insertNewKeyValueAt(-i - 1,(short)hb,Container.rangeOfOnes(containerStart,containerLast + 1));
    }
  }
}
Program: 90328
Project: 90328
Buggy source:
@Test public void notTest4(){
  System.out.println("String_Node_Str");
  final short[] content={1,3,5,7,9};
  final Container c=makeContainer(content);
  final Container c1=c.not(4,999);
  assertTrue(c1 instanceof ArrayContainer);
  assertEquals(999 - 4 + 1 - 3 + 2,c1.getCardinality());
  final Container c2=c1.not(4,999);
  assertTrue(checkContent(c2,content));
}

Fixed version (ground truth):
@Test public void notTest4(){
  System.out.println("String_Node_Str");
  final short[] content={1,3,5,7,9};
  final Container c=makeContainer(content);
  final Container c1=c.not(4,1000);
  assertTrue(c1 instanceof ArrayContainer);
  assertEquals(999 - 4 + 1 - 3 + 2,c1.getCardinality());
  final Container c2=c1.not(4,1000);
  assertTrue(checkContent(c2,content));
}
Program: 90329
Project: 90329
Buggy source:
@Test public void notTest11(){
  System.out.println("String_Node_Str");
  final short[] content=new short[40];
  for (int i=244; i <= 283; ++i)   content[i - 244]=(short)i;
  final Container c=makeContainer(content);
  final Container c1=c.not(1,58);
  assertTrue(c1 instanceof ArrayContainer);
  assertEquals(40 + 58,c1.getCardinality());
  final short[] rightAns=new short[98];
  for (int i=1; i <= 58; ++i)   rightAns[i - 1]=(short)i;
  for (int i=244; i <= 283; ++i)   rightAns[i - 244 + 58]=(short)i;
  assertTrue(checkContent(c1,rightAns));
}

Fixed version (ground truth):
@Test public void notTest11(){
  System.out.println("String_Node_Str");
  final short[] content=new short[40];
  for (int i=244; i <= 283; ++i)   content[i - 244]=(short)i;
  final Container c=makeContainer(content);
  final Container c1=c.not(1,59);
  assertTrue(c1 instanceof ArrayContainer);
  assertEquals(40 + 58,c1.getCardinality());
  final short[] rightAns=new short[98];
  for (int i=1; i <= 58; ++i)   rightAns[i - 1]=(short)i;
  for (int i=244; i <= 283; ++i)   rightAns[i - 244 + 58]=(short)i;
  assertTrue(checkContent(c1,rightAns));
}
Program: 90330
Project: 90330
Buggy source:
@Test public void notTest10(){
  System.out.println("String_Node_Str");
  final short[] content=new short[40];
  for (int i=244; i <= 283; ++i)   content[i - 244]=(short)i;
  final Container c=makeContainer(content);
  final Container c1=c.not(51413,51470);
  assertTrue(c1 instanceof ArrayContainer);
  assertEquals(40 + 58,c1.getCardinality());
  final short[] rightAns=new short[98];
  for (int i=244; i <= 283; ++i)   rightAns[i - 244]=(short)i;
  for (int i=51413; i <= 51470; ++i)   rightAns[i - 51413 + 40]=(short)i;
  assertTrue(checkContent(c1,rightAns));
}

Fixed version (ground truth):
@Test public void notTest10(){
  System.out.println("String_Node_Str");
  final short[] content=new short[40];
  for (int i=244; i <= 283; ++i)   content[i - 244]=(short)i;
  final Container c=makeContainer(content);
  final Container c1=c.not(51413,51471);
  assertTrue(c1 instanceof ArrayContainer);
  assertEquals(40 + 58,c1.getCardinality());
  final short[] rightAns=new short[98];
  for (int i=244; i <= 283; ++i)   rightAns[i - 244]=(short)i;
  for (int i=51413; i <= 51470; ++i)   rightAns[i - 51413 + 40]=(short)i;
  assertTrue(checkContent(c1,rightAns));
}