nus-yam/ex-repair huggingface dataset:
Program: 773
Project: 773
Buggy source:
@Override public void generateChunk(CoreChunk chunk,Region chunkRegion){
  LiquidData waterLiquid=new LiquidData(LiquidType.WATER,LiquidData.MAX_LIQUID_DEPTH);
  DensityFacet solidityFacet=chunkRegion.getFacet(DensityFacet.class);
  SurfaceHeightFacet surfaceFacet=chunkRegion.getFacet(SurfaceHeightFacet.class);
  BiomeFacet biomeFacet=chunkRegion.getFacet(BiomeFacet.class);
  SeaLevelFacet seaLevelFacet=chunkRegion.getFacet(SeaLevelFacet.class);
  int seaLevel=seaLevelFacet.getSeaLevel();
  Vector2i pos2d=new Vector2i();
  for (  Vector3i pos : ChunkConstants.CHUNK_REGION) {
    pos2d.set(pos.x,pos.z);
    CoreBiome biome=biomeFacet.get(pos2d);
    chunk.setBiome(pos.x,pos.y,pos.z,biome);
    int posY=pos.y + chunk.getChunkWorldOffsetY();
    float density=solidityFacet.get(pos);
    if (density >= 32) {
      chunk.setBlock(pos,stone);
    }
 else     if (density >= 0) {
      int depth=TeraMath.floorToInt(surfaceFacet.get(pos2d)) - posY;
      Block block=getSurfaceBlock(depth,posY,biome);
      chunk.setBlock(pos,block);
    }
 else {
      if (posY == seaLevel && CoreBiome.SNOW == biome) {
        chunk.setBlock(pos,ice);
      }
 else       if (posY <= seaLevel) {
        chunk.setBlock(pos,water);
        chunk.setLiquid(pos,waterLiquid);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void generateChunk(CoreChunk chunk,Region chunkRegion){
  LiquidData waterLiquid=new LiquidData(LiquidType.WATER,LiquidData.MAX_LIQUID_DEPTH);
  DensityFacet solidityFacet=chunkRegion.getFacet(DensityFacet.class);
  SurfaceHeightFacet surfaceFacet=chunkRegion.getFacet(SurfaceHeightFacet.class);
  BiomeFacet biomeFacet=chunkRegion.getFacet(BiomeFacet.class);
  SeaLevelFacet seaLevelFacet=chunkRegion.getFacet(SeaLevelFacet.class);
  int seaLevel=seaLevelFacet.getSeaLevel();
  Vector2i pos2d=new Vector2i();
  for (  Vector3i pos : ChunkConstants.CHUNK_REGION) {
    pos2d.set(pos.x,pos.z);
    CoreBiome biome=biomeFacet.get(pos2d);
    chunk.setBiome(pos.x,pos.y,pos.z,biome);
    int posY=pos.y + chunk.getChunkWorldOffsetY();
    float density=solidityFacet.get(pos);
    if (density >= 32) {
      chunk.setBlock(pos,stone);
    }
 else     if (density >= 0) {
      int depth=TeraMath.floorToInt(surfaceFacet.get(pos2d)) - posY;
      Block block=getSurfaceBlock(depth,posY,biome,seaLevel);
      chunk.setBlock(pos,block);
    }
 else {
      if (posY == seaLevel && CoreBiome.SNOW == biome) {
        chunk.setBlock(pos,ice);
      }
 else       if (posY <= seaLevel) {
        chunk.setBlock(pos,water);
        chunk.setLiquid(pos,waterLiquid);
      }
    }
  }
}
Program: 775
Project: 775
Buggy source:
public BlockFamilyDefinitionFormat(AssetManager assetManager,BlockFamilyFactoryRegistry blockFamilyFactoryRegistry){
  super("String_Node_Str");
  this.assetManager=assetManager;
  gson=new GsonBuilder().registerTypeAdapterFactory(new CaseInsensitiveEnumTypeAdapterFactory()).registerTypeAdapterFactory(new AssetTypeAdapterFactory(assetManager)).registerTypeAdapter(BlockFamilyDefinitionData.class,new BlockFamilyDefinitionDataHandler(blockFamilyFactoryRegistry)).registerTypeAdapter(Vector3f.class,new Vector3fTypeAdapter()).registerTypeAdapter(Vector4f.class,new Vector4fTypeAdapter()).registerTypeAdapter(BlockFamilyFactory.class,new BlockFamilyFactoryHandler(blockFamilyFactoryRegistry)).create();
}

Fixed version (ground truth):
public BlockFamilyDefinitionFormat(AssetManager assetManager,BlockFamilyFactoryRegistry blockFamilyFactoryRegistry){
  super("String_Node_Str");
  this.assetManager=assetManager;
  gson=new GsonBuilder().registerTypeAdapterFactory(new CaseInsensitiveEnumTypeAdapterFactory()).registerTypeAdapterFactory(new AssetTypeAdapterFactory(assetManager)).registerTypeAdapter(BlockFamilyDefinitionData.class,new BlockFamilyDefinitionDataHandler()).registerTypeAdapter(Vector3f.class,new Vector3fTypeAdapter()).registerTypeAdapter(Vector4f.class,new Vector4fTypeAdapter()).registerTypeAdapter(BlockFamilyFactory.class,new BlockFamilyFactoryHandler(blockFamilyFactoryRegistry)).create();
}
Program: 776
Project: 776
Buggy source:
private BlockFamilyDefinitionData createBaseData(JsonObject jsonObject){
  JsonPrimitive basedOn=jsonObject.getAsJsonPrimitive("String_Node_Str");
  if (basedOn != null && !basedOn.getAsString().isEmpty()) {
    Optional<BlockFamilyDefinition> baseDef=assetManager.getAsset(basedOn.getAsString(),BlockFamilyDefinition.class);
    if (baseDef.isPresent()) {
      return baseDef.get().getData();
    }
 else {
      throw new JsonParseException("String_Node_Str" + basedOn.getAsString() + "String_Node_Str");
    }
  }
  BlockFamilyDefinitionData data=new BlockFamilyDefinitionData();
  data.getBaseSection().setSounds(assetManager.getAsset("String_Node_Str",BlockSounds.class).get());
  return data;
}

Fixed version (ground truth):
private BlockFamilyDefinitionData createBaseData(JsonObject jsonObject){
  JsonPrimitive basedOn=jsonObject.getAsJsonPrimitive("String_Node_Str");
  if (basedOn != null && !basedOn.getAsString().isEmpty()) {
    Optional<BlockFamilyDefinition> baseDef=assetManager.getAsset(basedOn.getAsString(),BlockFamilyDefinition.class);
    if (baseDef.isPresent()) {
      BlockFamilyDefinitionData data=baseDef.get().getData();
      if (data.getFamilyFactory() instanceof FreeformBlockFamilyFactory) {
        data.setFamilyFactory(null);
      }
      return data;
    }
 else {
      throw new JsonParseException("String_Node_Str" + basedOn.getAsString() + "String_Node_Str");
    }
  }
  BlockFamilyDefinitionData data=new BlockFamilyDefinitionData();
  data.getBaseSection().setSounds(assetManager.getAsset("String_Node_Str",BlockSounds.class).get());
  return data;
}
Program: 777
Project: 777
Buggy source:
private <T extends Component>Component deserializeOnto(Component targetComponent,EntityData.Component componentData,ComponentMetadata<T> componentMetadata,FieldSerializeCheck<Component> fieldCheck){
  Serializer serializer=typeSerializationLibrary.getSerializerFor(componentMetadata);
  DeserializationContext context=new ProtobufDeserializationContext(typeSerializationLibrary);
  Map<FieldMetadata<?,?>,PersistedData> dataMap=Maps.newHashMapWithExpectedSize(componentData.getFieldCount());
  for (  EntityData.NameValue field : componentData.getFieldList()) {
    FieldMetadata<?,?> fieldInfo=null;
    if (field.hasNameIndex()) {
      fieldInfo=componentMetadata.getField(field.getNameIndex());
    }
 else     if (field.hasName()) {
      fieldInfo=componentMetadata.getField(field.getName());
    }
    if (fieldInfo != null) {
      dataMap.put(fieldInfo,new ProtobufPersistedData(field.getValue()));
    }
 else     if (field.hasNameIndex()) {
      logger.warn("String_Node_Str",field.getName(),componentMetadata.getUri());
    }
  }
  serializer.deserializeOnto(targetComponent,dataMap,context,fieldCheck);
  return targetComponent;
}

Fixed version (ground truth):
private <T extends Component>Component deserializeOnto(Component targetComponent,EntityData.Component componentData,ComponentMetadata<T> componentMetadata,FieldSerializeCheck<Component> fieldCheck){
  Serializer serializer=typeSerializationLibrary.getSerializerFor(componentMetadata);
  DeserializationContext context=new ProtobufDeserializationContext(typeSerializationLibrary);
  Map<FieldMetadata<?,?>,PersistedData> dataMap=Maps.newHashMapWithExpectedSize(componentData.getFieldCount());
  for (  EntityData.NameValue field : componentData.getFieldList()) {
    FieldMetadata<?,?> fieldInfo=null;
    if (field.hasNameIndex()) {
      fieldInfo=componentMetadata.getField(field.getNameIndex());
    }
 else     if (field.hasName()) {
      fieldInfo=componentMetadata.getField(field.getName());
    }
    if (fieldInfo != null) {
      dataMap.put(fieldInfo,new ProtobufPersistedData(field.getValue()));
    }
 else     if (field.hasName()) {
      logger.warn("String_Node_Str",field.getName(),componentMetadata.getUri());
    }
  }
  serializer.deserializeOnto(targetComponent,dataMap,context,fieldCheck);
  return targetComponent;
}
Program: 778
Project: 778
Buggy source:
public Set<BlockUri> getAvailableBlockFamilies(){
  return assetManager.getAvailableAssets(BlockFamilyDefinition.class).stream().<Optional<BlockFamilyDefinition>>map(urn -> assetManager.getAsset(urn,BlockFamilyDefinition.class)).filter(def -> def.isPresent() && !def.get().isFreeform()).map(r -> new BlockUri(r.get().getUrn())).collect(Collectors.toSet());
}

Fixed version (ground truth):
public Set<BlockUri> getAvailableBlockFamilies(){
  return assetManager.getAvailableAssets(BlockFamilyDefinition.class).stream().<Optional<BlockFamilyDefinition>>map(urn -> assetManager.getAsset(urn,BlockFamilyDefinition.class)).filter(def -> def.isPresent() && def.get().isLoadable() && !def.get().isFreeform()).map(r -> new BlockUri(r.get().getUrn())).collect(Collectors.toSet());
}
Program: 779
Project: 779
Buggy source:
public Set<BlockUri> getFreeformBlockFamilies(){
  return assetManager.getAvailableAssets(BlockFamilyDefinition.class).stream().<Optional<BlockFamilyDefinition>>map(urn -> assetManager.getAsset(urn,BlockFamilyDefinition.class)).filter(def -> def.isPresent() && def.get().isFreeform()).map(r -> new BlockUri(r.get().getUrn())).collect(Collectors.toSet());
}

Fixed version (ground truth):
public Set<BlockUri> getFreeformBlockFamilies(){
  return assetManager.getAvailableAssets(BlockFamilyDefinition.class).stream().<Optional<BlockFamilyDefinition>>map(urn -> assetManager.getAsset(urn,BlockFamilyDefinition.class)).filter(def -> def.isPresent() && def.get().isLoadable() && def.get().isFreeform()).map(r -> new BlockUri(r.get().getUrn())).collect(Collectors.toSet());
}
Program: 780
Project: 780
Buggy source:
@Override public void onOpened(){
  super.onOpened();
  SimpleUri worldGenUri=config.getWorldGeneration().getDefaultGenerator();
  Name moduleName=worldGenUri.getModuleName();
  try {
    DependencyResolver resolver=new DependencyResolver(moduleManager.getRegistry());
    ResolutionResult result=resolver.resolve(moduleName);
    if (result.isSuccess()) {
      environment=moduleManager.loadEnvironment(result.getModules(),false);
      context.put(WorldGeneratorPluginLibrary.class,new TempWorldGeneratorPluginLibrary(environment,context));
      assetManager.setEnvironment(environment);
      worldGenerator=worldGeneratorManager.searchForWorldGenerator(worldGenUri,environment);
      worldGenerator.setWorldSeed(seed.getText());
      worldGenerator.initialize();
      previewGen=new FacetLayerPreview(environment,worldGenerator);
      configureProperties();
      triggerUpdate=true;
    }
 else {
      logger.error("String_Node_Str",worldGenUri);
    }
  }
 catch (  Exception e) {
    worldGenerator=null;
    logger.error("String_Node_Str" + worldGenUri + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void onOpened(){
  super.onOpened();
  SimpleUri worldGenUri=config.getWorldGeneration().getDefaultGenerator();
  Name moduleName=worldGenUri.getModuleName();
  try {
    DependencyResolver resolver=new DependencyResolver(moduleManager.getRegistry());
    ResolutionResult result=resolver.resolve(moduleName);
    if (result.isSuccess()) {
      environment=moduleManager.loadEnvironment(result.getModules(),false);
      context.put(WorldGeneratorPluginLibrary.class,new TempWorldGeneratorPluginLibrary(environment,context));
      assetManager.setEnvironment(environment);
      worldGenerator=worldGeneratorManager.searchForWorldGenerator(worldGenUri,environment);
      worldGenerator.setWorldSeed(seed.getText());
      previewGen=new FacetLayerPreview(environment,worldGenerator);
      configureProperties();
      triggerUpdate=true;
    }
 else {
      logger.error("String_Node_Str",worldGenUri);
    }
  }
 catch (  Exception e) {
    worldGenerator=null;
    logger.error("String_Node_Str" + worldGenUri + "String_Node_Str",e);
  }
}
Program: 781
Project: 781
Buggy source:
private void updatePreview(){
  previewImage.setVisible(false);
  final NUIManager manager=context.get(NUIManager.class);
  final WaitPopup<TextureData> popup=manager.pushScreen(WaitPopup.ASSET_URI,WaitPopup.class);
  popup.setMessage("String_Node_Str","String_Node_Str");
  ProgressListener progressListener=progress -> popup.setMessage("String_Node_Str",String.format("String_Node_Str",(int)(progress * 100f)));
  Callable<TextureData> operation=() -> {
    if (seed != null) {
      worldGenerator.setWorldSeed(seed.getText());
    }
    int zoom=TeraMath.floorToInt(zoomSlider.getValue());
    previewGen.render(texture.getData(),zoom,progressListener);
    return texture.getData();
  }
;
  popup.onSuccess(newData -> texture.reload(newData));
  popup.startOperation(operation,true);
}

Fixed version (ground truth):
private void updatePreview(){
  final NUIManager manager=context.get(NUIManager.class);
  final WaitPopup<TextureData> popup=manager.pushScreen(WaitPopup.ASSET_URI,WaitPopup.class);
  popup.setMessage("String_Node_Str","String_Node_Str");
  ProgressListener progressListener=progress -> popup.setMessage("String_Node_Str",String.format("String_Node_Str",(int)(progress * 100f)));
  Callable<TextureData> operation=() -> {
    if (seed != null) {
      worldGenerator.setWorldSeed(seed.getText());
    }
    int zoom=TeraMath.floorToInt(zoomSlider.getValue());
    previewGen.render(texture.getData(),zoom,progressListener);
    return texture.getData();
  }
;
  popup.onSuccess(newData -> texture.reload(newData));
  popup.startOperation(operation,true);
}
Program: 782
Project: 782
Buggy source:
@Override public void setSeed(long seed){
}

Fixed version (ground truth):
@Override public void setSeed(long seed){
  initialize();
}
Program: 783
Project: 783
Buggy source:
@Override public boolean switchItem(EntityRef fromInventory,EntityRef instigator,int slotFrom,EntityRef toInventory,int slotTo){
  if (!InventoryUtils.moveItem(instigator,fromInventory,slotFrom,toInventory,slotTo)) {
    return false;
  }
  MoveItemRequest request=new MoveItemRequest(instigator,fromInventory,slotFrom,toInventory,slotTo,changeId++);
  pendingMoves.put(request.getChangeId(),request);
  localPlayer.getClientEntity().send(request);
  return true;
}

Fixed version (ground truth):
@Override public boolean switchItem(EntityRef fromInventory,EntityRef instigator,int slotFrom,EntityRef toInventory,int slotTo){
  Collection<EntityRef> clientTempEntities=new HashSet<>();
  if (moveItemFillClientTempEntities(fromInventory,instigator,slotFrom,toInventory,slotTo,clientTempEntities)) {
    return false;
  }
  MoveItemRequest request=new MoveItemRequest(instigator,fromInventory,slotFrom,toInventory,slotTo,changeId++,clientTempEntities);
  pendingMoves.put(request.getChangeId(),request);
  localPlayer.getClientEntity().send(request);
  return true;
}
Program: 784
Project: 784
Buggy source:
@Override public boolean moveItem(EntityRef fromInventory,EntityRef instigator,int slotFrom,EntityRef toInventory,int slotTo,int count){
  if (!InventoryUtils.moveItemAmount(instigator,fromInventory,slotFrom,toInventory,slotTo,count)) {
    return false;
  }
  MoveItemAmountRequest request=new MoveItemAmountRequest(instigator,fromInventory,slotFrom,toInventory,slotTo,count,changeId++);
  pendingMoves.put(request.getChangeId(),request);
  localPlayer.getClientEntity().send(request);
  return true;
}

Fixed version (ground truth):
@Override public boolean moveItem(EntityRef fromInventory,EntityRef instigator,int slotFrom,EntityRef toInventory,int slotTo,int count){
  Collection<EntityRef> clientTempEntities=new HashSet<>();
  if (moveItemAmountFillClientTempEntities(fromInventory,instigator,slotFrom,toInventory,slotTo,count,clientTempEntities)) {
    return false;
  }
  MoveItemAmountRequest request=new MoveItemAmountRequest(instigator,fromInventory,slotFrom,toInventory,slotTo,count,changeId++,clientTempEntities);
  pendingMoves.put(request.getChangeId(),request);
  localPlayer.getClientEntity().send(request);
  return true;
}
Program: 785
Project: 785
Buggy source:
@ReceiveEvent(components={InventoryComponent.class}) public void inventoryChangeAcknowledge(InventoryChangeAcknowledgedRequest event,EntityRef entity){
  pendingMoves.remove(event.getChangeId());
  recalculatePredictedState();
}

Fixed version (ground truth):
@ReceiveEvent(components={InventoryComponent.class}) public void inventoryChangeAcknowledge(InventoryChangeAcknowledgedRequest event,EntityRef entity){
  AbstractMoveItemRequest removedRequest=pendingMoves.remove(event.getChangeId());
  if (removedRequest != null) {
    destroyClientTempEntities(removedRequest);
  }
  recalculatePredictedState();
}
Program: 786
Project: 786
Buggy source:
private void recalculatePredictedState(){
  for (  AbstractMoveItemRequest request : pendingMoves.values()) {
    if (request instanceof MoveItemRequest) {
      MoveItemRequest r=(MoveItemRequest)request;
      InventoryUtils.moveItem(r.getInstigator(),r.getFromInventory(),r.getFromSlot(),r.getToInventory(),r.getToSlot());
    }
 else     if (request instanceof MoveItemAmountRequest) {
      MoveItemAmountRequest r=(MoveItemAmountRequest)request;
      InventoryUtils.moveItemAmount(r.getInstigator(),r.getFromInventory(),r.getFromSlot(),r.getToInventory(),r.getToSlot(),r.getAmount());
    }
 else     if (request instanceof MoveItemToSlotsRequest) {
      MoveItemToSlotsRequest r=(MoveItemToSlotsRequest)request;
      InventoryUtils.moveItemToSlots(r.getInstigator(),r.getFromInventory(),r.getFromSlot(),r.getToInventory(),r.getToSlots());
    }
  }
}

Fixed version (ground truth):
private void recalculatePredictedState(){
  for (  AbstractMoveItemRequest request : pendingMoves.values()) {
    if (request instanceof MoveItemRequest) {
      MoveItemRequest r=(MoveItemRequest)request;
      destroyClientTempEntities(r);
      Collection<EntityRef> newClientTempEntities=new HashSet<>();
      moveItemFillClientTempEntities(request.getFromInventory(),r.getInstigator(),r.getFromSlot(),r.getToInventory(),r.getToSlot(),newClientTempEntities);
      r.setClientSideTempEntities(newClientTempEntities);
    }
 else     if (request instanceof MoveItemAmountRequest) {
      MoveItemAmountRequest r=(MoveItemAmountRequest)request;
      destroyClientTempEntities(r);
      Collection<EntityRef> newClientTempEntities=new HashSet<>();
      moveItemAmountFillClientTempEntities(r.getFromInventory(),r.getInstigator(),r.getFromSlot(),r.getToInventory(),r.getToSlot(),r.getAmount(),newClientTempEntities);
      r.setClientSideTempEntities(newClientTempEntities);
    }
 else     if (request instanceof MoveItemToSlotsRequest) {
      MoveItemToSlotsRequest r=(MoveItemToSlotsRequest)request;
      destroyClientTempEntities(r);
      Collection<EntityRef> newClientTempEntities=new HashSet<>();
      moveItemToSlotsFillClientTempEntities(r.getInstigator(),r.getFromInventory(),r.getFromSlot(),r.getToInventory(),r.getToSlots(),newClientTempEntities);
      r.setClientSideTempEntities(newClientTempEntities);
    }
  }
}
Program: 787
Project: 787
Buggy source:
@Override public boolean moveItemToSlots(EntityRef instigator,EntityRef fromInventory,int slotFrom,EntityRef toInventory,List<Integer> toSlots){
  if (!InventoryUtils.moveItemToSlots(instigator,fromInventory,slotFrom,toInventory,toSlots)) {
    return false;
  }
  MoveItemToSlotsRequest request=new MoveItemToSlotsRequest(instigator,fromInventory,slotFrom,toInventory,toSlots,changeId++);
  pendingMoves.put(request.getChangeId(),request);
  localPlayer.getClientEntity().send(request);
  return true;
}

Fixed version (ground truth):
@Override public boolean moveItemToSlots(EntityRef instigator,EntityRef fromInventory,int slotFrom,EntityRef toInventory,List<Integer> toSlots){
  Collection<EntityRef> clientTempEntities=new HashSet<>();
  if (moveItemToSlotsFillClientTempEntities(instigator,fromInventory,slotFrom,toInventory,toSlots,clientTempEntities)) {
    return false;
  }
  MoveItemToSlotsRequest request=new MoveItemToSlotsRequest(instigator,fromInventory,slotFrom,toInventory,toSlots,changeId++,clientTempEntities);
  pendingMoves.put(request.getChangeId(),request);
  localPlayer.getClientEntity().send(request);
  return true;
}
Program: 788
Project: 788
Buggy source:
public AbstractMoveItemRequest(EntityRef instigator,EntityRef fromInventory,int fromSlot,EntityRef toInventory,int changeId){
  this.instigator=instigator;
  this.fromInventory=fromInventory;
  this.fromSlot=fromSlot;
  this.toInventory=toInventory;
  this.changeId=changeId;
}

Fixed version (ground truth):
public AbstractMoveItemRequest(EntityRef instigator,EntityRef fromInventory,int fromSlot,EntityRef toInventory,int changeId,Collection<EntityRef> clientSideTempEntities){
  this.instigator=instigator;
  this.fromInventory=fromInventory;
  this.fromSlot=fromSlot;
  this.toInventory=toInventory;
  this.changeId=changeId;
  this.clientSideTempEntities=clientSideTempEntities;
}
Program: 789
Project: 789
Buggy source:
public MoveItemAmountRequest(EntityRef instigator,EntityRef fromInventory,int fromSlot,EntityRef toInventory,int toSlot,int amount,int changeId){
  super(instigator,fromInventory,fromSlot,toInventory,changeId);
  this.toSlot=toSlot;
  this.amount=amount;
}

Fixed version (ground truth):
public MoveItemAmountRequest(EntityRef instigator,EntityRef fromInventory,int fromSlot,EntityRef toInventory,int toSlot,int amount,int changeId,Collection<EntityRef> clientSideTempEntities){
  super(instigator,fromInventory,fromSlot,toInventory,changeId,clientSideTempEntities);
  this.toSlot=toSlot;
  this.amount=amount;
}
Program: 790
Project: 790
Buggy source:
public MoveItemRequest(EntityRef instigator,EntityRef fromInventory,int fromSlot,EntityRef toInventory,int toSlot,int changeId){
  super(instigator,fromInventory,fromSlot,toInventory,changeId);
  this.toSlot=toSlot;
}

Fixed version (ground truth):
public MoveItemRequest(EntityRef instigator,EntityRef fromInventory,int fromSlot,EntityRef toInventory,int toSlot,int changeId,Collection<EntityRef> clientSideTempEntities){
  super(instigator,fromInventory,fromSlot,toInventory,changeId,clientSideTempEntities);
  this.toSlot=toSlot;
}
Program: 791
Project: 791
Buggy source:
public MoveItemToSlotsRequest(EntityRef instigator,EntityRef fromInventory,int fromSlot,EntityRef toInventory,List<Integer> toSlots,int changeId){
  super(instigator,fromInventory,fromSlot,toInventory,changeId);
  this.toSlots=toSlots;
}

Fixed version (ground truth):
public MoveItemToSlotsRequest(EntityRef instigator,EntityRef fromInventory,int fromSlot,EntityRef toInventory,List<Integer> toSlots,int changeId,Collection<EntityRef> clientSideTempEntities){
  super(instigator,fromInventory,fromSlot,toInventory,changeId,clientSideTempEntities);
  this.toSlots=toSlots;
}
Program: 792
Project: 792
Buggy source:
@ReceiveEvent(components=ItemComponent.class,priority=EventPriority.PRIORITY_TRIVIAL) public void usedItem(ActivateEvent event,EntityRef item){
  ItemComponent itemComp=item.getComponent(ItemComponent.class);
  if (itemComp.consumedOnUse) {
    itemComp.stackCount--;
    if (itemComp.stackCount == 0) {
      item.destroy();
    }
 else {
      item.saveComponent(itemComp);
    }
  }
}

Fixed version (ground truth):
@ReceiveEvent(components=ItemComponent.class,priority=EventPriority.PRIORITY_TRIVIAL) public void usedItem(ActivateEvent event,EntityRef item){
  ItemComponent itemComp=item.getComponent(ItemComponent.class);
  if (itemComp.consumedOnUse) {
    int slot=InventoryUtils.getSlotWithItem(event.getInstigator(),item);
    inventoryManager.removeItem(event.getInstigator(),event.getInstigator(),slot,true,1);
  }
}
Program: 793
Project: 793
Buggy source:
private void validateRange(IntegerRange range,Integer... numbers){
  Iterator<Integer> iterator=range.createIterator();
  for (  Integer number : numbers) {
    assertTrue(iterator.hasNext());
    assertEquals(number,iterator.next());
  }
  assertFalse(iterator.hasNext());
}

Fixed version (ground truth):
private void validateRange(IntegerRange range,Integer... numbers){
  Iterator<Integer> iterator=range.iterator();
  for (  Integer number : numbers) {
    assertTrue(iterator.hasNext());
    assertEquals(number,iterator.next());
  }
  assertFalse(iterator.hasNext());
}
Program: 794
Project: 794
Buggy source:
private void validateRange(IntegerRange range,Integer... numbers){
  Iterator<Integer> iterator=range.createIterator();
  for (  Integer number : numbers) {
    assertTrue(iterator.hasNext());
    assertEquals(number,iterator.next());
  }
  assertFalse(iterator.hasNext());
}

Fixed version (ground truth):
private void validateRange(IntegerRange range,Integer... numbers){
  Iterator<Integer> iterator=range.iterator();
  for (  Integer number : numbers) {
    assertTrue(iterator.hasNext());
    assertEquals(number,iterator.next());
  }
  assertFalse(iterator.hasNext());
}
Program: 795
Project: 795
Buggy source:
@Override public Integer next(){
  if (next == null)   throw new NoSuchElementException("String_Node_Str");
  int result=next;
  if (next < rangeMax) {
    next++;
  }
 else {
    goToNextRange();
  }
  return result;
}

Fixed version (ground truth):
@Override public Integer next(){
  if (next == null) {
    throw new NoSuchElementException("String_Node_Str");
  }
  int result=next;
  if (next < rangeMax) {
    next++;
  }
 else {
    goToNextRange();
  }
  return result;
}
Program: 796
Project: 796
Buggy source:
@Override public Iterator<Integer> iterator(){
  return createIterator();
}

Fixed version (ground truth):
@Override public Iterator<Integer> iterator(){
  return new RangesIterator(ranges);
}
Program: 797
Project: 797
Buggy source:
public void addNumbers(int from,int to){
  if (from > to)   throw new IllegalArgumentException("String_Node_Str");
  Integer oldTo=ranges.get(from);
  if (oldTo == null || oldTo < to) {
    ranges.put(from,to);
  }
}

Fixed version (ground truth):
public void addNumbers(int from,int to){
  if (from > to) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Integer oldTo=ranges.get(from);
  if (oldTo == null || oldTo < to) {
    ranges.put(from,to);
  }
}
Program: 798
Project: 798
Buggy source:
@Override public String getAsString(IntegerRange item){
  StringBuilder sb=new StringBuilder();
  Integer currentRangeStart=null;
  Integer currentRangeEnd=null;
  Iterator<Integer> iterator=item.createIterator();
  while (iterator.hasNext()) {
    int nextNumber=iterator.next();
    if (currentRangeStart != null && currentRangeEnd != null && nextNumber > currentRangeEnd + 1) {
      appendRange(sb,currentRangeStart,currentRangeEnd);
      currentRangeStart=nextNumber;
    }
 else     if (currentRangeStart == null) {
      currentRangeStart=nextNumber;
    }
    currentRangeEnd=nextNumber;
  }
  if (currentRangeStart != null && currentRangeEnd != null) {
    appendRange(sb,currentRangeStart,currentRangeEnd);
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String getAsString(IntegerRange item){
  StringBuilder sb=new StringBuilder();
  Integer currentRangeStart=null;
  Integer currentRangeEnd=null;
  for (  int nextNumber : item) {
    if (currentRangeStart != null && currentRangeEnd != null && nextNumber > currentRangeEnd + 1) {
      appendRange(sb,currentRangeStart,currentRangeEnd);
      currentRangeStart=nextNumber;
    }
 else     if (currentRangeStart == null) {
      currentRangeStart=nextNumber;
    }
    currentRangeEnd=nextNumber;
  }
  if (currentRangeStart != null && currentRangeEnd != null) {
    appendRange(sb,currentRangeStart,currentRangeEnd);
  }
  return sb.toString();
}
Program: 799
Project: 799
Buggy source:
/** 
 * Once an FBO is bound, opengl commands will act on it, i.e. by drawing on it. Meanwhile shaders might output not just colors but additional per-pixel data. This method establishes on which of an FBOs attachments, subsequent opengl commands and shaders will draw on.
 * @param fbo The FBO holding the attachments to be set or unset for drawing.
 * @param color If True the color buffer is set as drawable. If false subsequent commands and shaders won't be able to draw on it.
 * @param normal If True the normal buffer is set as drawable. If false subsequent commands and shaders won't be able to draw on it.
 * @param lightBuffer If True the light buffer is set as drawable. If false subsequent commands and shaders won't be able to draw on it.
 */
public void setRenderBufferMask(FBO fbo,boolean color,boolean normal,boolean lightBuffer){
  if (fbo == null) {
    return;
  }
  int attachmentId=0;
  IntBuffer bufferIds=BufferUtils.createIntBuffer(3);
  if (fbo.colorBufferTextureId != 0) {
    if (color) {
      bufferIds.put(GL_COLOR_ATTACHMENT0_EXT + attachmentId++);
    }
  }
  if (fbo.normalsBufferTextureId != 0) {
    if (normal) {
      bufferIds.put(GL_COLOR_ATTACHMENT0_EXT + attachmentId++);
    }
  }
  if (fbo.lightBufferTextureId != 0) {
    if (lightBuffer) {
      bufferIds.put(GL_COLOR_ATTACHMENT0_EXT + attachmentId);
    }
  }
  bufferIds.flip();
  GL20.glDrawBuffers(bufferIds);
}

Fixed version (ground truth):
/** 
 * Once an FBO is bound, opengl commands will act on it, i.e. by drawing on it. Meanwhile shaders might output not just colors but additional per-pixel data. This method establishes on which of an FBOs attachments, subsequent opengl commands and shaders will draw on.
 * @param fbo The FBO holding the attachments to be set or unset for drawing.
 * @param color If True the color buffer is set as drawable. If false subsequent commands and shaders won't be able to draw on it.
 * @param normal If True the normal buffer is set as drawable. If false subsequent commands and shaders won't be able to draw on it.
 * @param lightBuffer If True the light buffer is set as drawable. If false subsequent commands and shaders won't be able to draw on it.
 */
public void setRenderBufferMask(FBO fbo,boolean color,boolean normal,boolean lightBuffer){
  if (fbo == null) {
    return;
  }
  int attachmentId=0;
  IntBuffer bufferIds=BufferUtils.createIntBuffer(3);
  if (fbo.colorBufferTextureId != 0) {
    if (color) {
      bufferIds.put(GL_COLOR_ATTACHMENT0_EXT + attachmentId);
    }
    attachmentId++;
  }
  if (fbo.normalsBufferTextureId != 0) {
    if (normal) {
      bufferIds.put(GL_COLOR_ATTACHMENT0_EXT + attachmentId);
    }
    attachmentId++;
  }
  if (fbo.lightBufferTextureId != 0) {
    if (lightBuffer) {
      bufferIds.put(GL_COLOR_ATTACHMENT0_EXT + attachmentId);
    }
  }
  bufferIds.flip();
  GL20.glDrawBuffers(bufferIds);
}
Program: 801
Project: 801
Buggy source:
/** 
 * Default setup order
 * @param modules
 */
public Environment(Name... moduleNames){
  try {
    reset(Sets.newHashSet(moduleNames));
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Default setup order
 * @param moduleNames a list of module names
 */
public Environment(Name... moduleNames){
  try {
    reset(Sets.newHashSet(moduleNames));
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}
Program: 802
Project: 802
Buggy source:
/** 
 * Filters based on the vector's y value
 * @return a predicate that returns true only if (y > height)
 */
public static Predicate<Vector3i> minHeight(final int height){
  return heightRange(height,Integer.MAX_VALUE);
}

Fixed version (ground truth):
/** 
 * Filters based on the vector's y value
 * @return a predicate that returns true only if (y &gt; height)
 */
public static Predicate<Vector3i> minHeight(final int height){
  return heightRange(height,Integer.MAX_VALUE);
}
Program: 803
Project: 803
Buggy source:
/** 
 * Filters based on the density
 * @param density the density facet that contains all tested coords.
 * @return a predicate that returns true if (density >= 0) and (density < 0) for the block at (y - 1)
 */
public static Predicate<Vector3i> density(final DensityFacet density){
  return new Predicate<Vector3i>(){
    @Override public boolean apply(    Vector3i input){
      float densBelow=density.getWorld(input.getX(),input.getY() - 1,input.getZ());
      float densThis=density.getWorld(input);
      return (densBelow >= 0 && densThis < 0);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Filters based on the density
 * @param density the density facet that contains all tested coords.
 * @return a predicate that returns true if (density &ge; 0) and (density &lt; 0) for the block at (y - 1)
 */
public static Predicate<Vector3i> density(final DensityFacet density){
  return new Predicate<Vector3i>(){
    @Override public boolean apply(    Vector3i input){
      float densBelow=density.getWorld(input.getX(),input.getY() - 1,input.getZ());
      float densThis=density.getWorld(input);
      return (densBelow >= 0 && densThis < 0);
    }
  }
;
}
Program: 804
Project: 804
Buggy source:
/** 
 * Filters based on the vector's y value
 * @return a predicate that returns true only if (y < height)
 */
public static Predicate<Vector3i> maxHeight(final int height){
  return heightRange(Integer.MIN_VALUE,height);
}

Fixed version (ground truth):
/** 
 * Filters based on the vector's y value
 * @return a predicate that returns true only if (y &lt; height)
 */
public static Predicate<Vector3i> maxHeight(final int height){
  return heightRange(Integer.MIN_VALUE,height);
}
Program: 805
Project: 805
Buggy source:
/** 
 * Filters based on the vector's y value
 * @return a predicate that returns true only if (y > minHeight) and (y < maxHeight)
 */
public static Predicate<Vector3i> heightRange(final int minHeight,final int maxHeight){
  return new Predicate<Vector3i>(){
    @Override public boolean apply(    Vector3i input){
      int y=input.getY();
      return y > minHeight && y < maxHeight;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Filters based on the vector's y value
 * @return a predicate that returns true only if (y &gt; minHeight) and (y &lt; maxHeight)
 */
public static Predicate<Vector3i> heightRange(final int minHeight,final int maxHeight){
  return new Predicate<Vector3i>(){
    @Override public boolean apply(    Vector3i input){
      int y=input.getY();
      return y > minHeight && y < maxHeight;
    }
  }
;
}
Program: 806
Project: 806
Buggy source:
/** 
 * Clears all registered population densities
 * @see SurfaceObjectProvider#register(B,T,float)
 */
protected void clearProbabilities(){
  probsTable.clear();
}

Fixed version (ground truth):
/** 
 * Clears all registered population densities
 */
protected void clearProbabilities(){
  probsTable.clear();
}
Program: 807
Project: 807
Buggy source:
/** 
 * @param x    the x coordinate
 * @param z    the z coordinate
 * @param objs a map (objType -> probability)
 * @return a random pick from the map or <code>null</code>
 */
protected T getType(int x,int z,Map<T,Float> objs){
  float random=Math.abs(typeNoiseGen.noise(x,z));
  for (  T generator : objs.keySet()) {
    Float threshold=objs.get(generator);
    if (threshold != null) {
      if (random < threshold) {
        return generator;
      }
 else {
        random-=threshold;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param x    the x coordinate
 * @param z    the z coordinate
 * @param objs a map (objType to probability)
 * @return a random pick from the map or <code>null</code>
 */
protected T getType(int x,int z,Map<T,Float> objs){
  float random=Math.abs(typeNoiseGen.noise(x,z));
  for (  T generator : objs.keySet()) {
    Float threshold=objs.get(generator);
    if (threshold != null) {
      if (random < threshold) {
        return generator;
      }
 else {
        random-=threshold;
      }
    }
  }
  return null;
}
Program: 808
Project: 808
Buggy source:
/** 
 * Reset sound state (clears buffers, reset cached info)
 * @return
 */
void reset();

Fixed version (ground truth):
/** 
 * Reset sound state (clears buffers, reset cached info)
 */
void reset();
Program: 809
Project: 809
Buggy source:
/** 
 * Begins the loading
 * @return The total number of expected steps for this LoadProcess, 0 if nothing to do
 */
void begin();

Fixed version (ground truth):
/** 
 * Begins the loading
 */
void begin();
Program: 810
Project: 810
Buggy source:
/** 
 * Can be used by modules to trigger the activation of a player owned entity like an item. The method has been made for the usage on the client. It triggers a   {@link ActivationPredicted} eventon the client and a  {@link ActivationRequest} event on the server which will lead to a {@link ActivateEvent}on the server.
 * @param usedOwnedEntity an entity owned by the player like an item.
 */
public void activateOwnedEntityAsClient(EntityRef usedOwnedEntity){
  if (!usedOwnedEntity.exists()) {
    return;
  }
  activateTargetOrOwnedEntity(usedOwnedEntity);
}

Fixed version (ground truth):
/** 
 * Can be used by modules to trigger the activation of a player owned entity like an item. The method has been made for the usage on the client. It triggers a   {@link ActivationPredicted} eventon the client and a  {@link ActivationRequest} event on the server which will leadto a  {@link org.terasology.logic.common.ActivateEvent} on the server.
 * @param usedOwnedEntity an entity owned by the player like an item.
 */
public void activateOwnedEntityAsClient(EntityRef usedOwnedEntity){
  if (!usedOwnedEntity.exists()) {
    return;
  }
  activateTargetOrOwnedEntity(usedOwnedEntity);
}
Program: 811
Project: 811
Buggy source:
/** 
 * Deserializes a prefab
 * @param prefabData
 * @param
 * @return The deserialized prefab
 */
public PrefabData deserialize(EntityData.Prefab prefabData,List<EntityData.Prefab> deltas){
  Module context=ModuleContext.getContext();
  PrefabData result=new PrefabData();
  deserializeCommonData(prefabData,result);
  for (  EntityData.Prefab delta : deltas) {
    applyCommonDataDelta(delta,result);
  }
  addInheritedComponents(result);
  applyComponentChanges(context,prefabData,result);
  for (  EntityData.Prefab delta : deltas) {
    applyComponentChanges(context,delta,result);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Deserializes a prefab
 * @param prefabData
 * @param deltas
 * @return The deserialized prefab
 */
public PrefabData deserialize(EntityData.Prefab prefabData,List<EntityData.Prefab> deltas){
  Module context=ModuleContext.getContext();
  PrefabData result=new PrefabData();
  deserializeCommonData(prefabData,result);
  for (  EntityData.Prefab delta : deltas) {
    applyCommonDataDelta(delta,result);
  }
  addInheritedComponents(result);
  applyComponentChanges(context,prefabData,result);
  for (  EntityData.Prefab delta : deltas) {
    applyComponentChanges(context,delta,result);
  }
  return result;
}
Program: 812
Project: 812
Buggy source:
/** 
 * Returns the rigid body associated with the given entity. If no such RigidBody exists, a new one is created and returned. </p> Note that you should not wait with calling this method until using the rigid body. As soon as the rigid body should exist in the physics engine, this method should be called to create the rigid body.
 * @param entity the entity to retrieve the rigid body of.
 * @return A valid RigidBody instance.
 * @throws IllegalArgumentException if there is no RigidBody in thisPhysicsEngine for the given entity and one cannot be created because the given entity does not have a LocationComponent, RigidBodyComponent and ShapeComponent.
 */
RigidBody getRigidBody(EntityRef entity);

Fixed version (ground truth):
/** 
 * Returns the rigid body associated with the given entity. If no such RigidBody exists, a new one is created and returned. <br><br> Note that you should not wait with calling this method until using the rigid body. As soon as the rigid body should exist in the physics engine, this method should be called to create the rigid body.
 * @param entity the entity to retrieve the rigid body of.
 * @return A valid RigidBody instance.
 * @throws IllegalArgumentException if there is no RigidBody in thisPhysicsEngine for the given entity and one cannot be created because the given entity does not have a LocationComponent, RigidBodyComponent and ShapeComponent.
 */
RigidBody getRigidBody(EntityRef entity);
Program: 813
Project: 813
Buggy source:
/** 
 * Returns a AssetUri which represents a Texture of that color.
 * @param color, including alpha, of the texture to represent.
 * @return an asset Uri for the texture
 */
public static AssetUri getTextureUriForWhiteNoise(int size,long seed,int min,int max){
  String name=String.format("String_Node_Str",GENERATED_NOISE_NAME_PREFIX,"String_Node_Str",size,seed,min,max);
  return new AssetUri(AssetType.TEXTURE,"String_Node_Str",name);
}

Fixed version (ground truth):
/** 
 * Returns a AssetUri which represents a Texture that contains white noise
 * @param size the size of the texture (both width and height)
 * @param seed the seed value for the noise generator
 * @param min the minimum noise value (can be lower than 0 and will be clamped then)
 * @param max the minimum noise value (can be larger than 255 and will be clamped then)
 * @return an asset Uri for the texture
 */
public static AssetUri getTextureUriForWhiteNoise(int size,long seed,int min,int max){
  String name=String.format("String_Node_Str",GENERATED_NOISE_NAME_PREFIX,"String_Node_Str",size,seed,min,max);
  return new AssetUri(AssetType.TEXTURE,"String_Node_Str",name);
}
Program: 814
Project: 814
Buggy source:
/** 
 * Returns a AssetUri which represents a Texture of that color.
 * @param color, including alpha, of the texture to represent.
 * @return an asset Uri for the texture
 */
public static AssetUri getTextureUriForColor(Color color){
  StringBuilder sb=new StringBuilder(GENERATED_COLOR_NAME_PREFIX);
  sb.append("String_Node_Str");
  appendColorName(sb,color);
  return new AssetUri(AssetType.TEXTURE,"String_Node_Str",sb.toString());
}

Fixed version (ground truth):
/** 
 * Returns a AssetUri which represents a Texture of that color.
 * @param color including alpha, of the texture to represent.
 * @return an asset Uri for the texture
 */
public static AssetUri getTextureUriForColor(Color color){
  StringBuilder sb=new StringBuilder(GENERATED_COLOR_NAME_PREFIX);
  sb.append("String_Node_Str");
  appendColorName(sb,color);
  return new AssetUri(AssetType.TEXTURE,"String_Node_Str",sb.toString());
}
Program: 815
Project: 815
Buggy source:
/** 
 * Method to convert the color string hex representation back to a color. Package-only access as it is for internal use in ColorTextureAssetResolver, but should be here for maintenance with the color-to-color-string code.
 * @param sb    StringBuilder into which to append name
 * @param color represented by hexColorName
 * @return hexColorName RRGGBBAA in lower-case hex notation
 */
private static void appendColorName(StringBuilder sb,Color color){
  int red=color.r();
  if (red < 16) {
    sb.append('0');
  }
  sb.append(Integer.toHexString(red));
  int green=color.g();
  if (green < 16) {
    sb.append('0');
  }
  sb.append(Integer.toHexString(green));
  int blue=color.b();
  if (blue < 16) {
    sb.append('0');
  }
  sb.append(Integer.toHexString(blue));
  int alpha=color.a();
  if (alpha < 16) {
    sb.append('0');
  }
  sb.append(Integer.toHexString(alpha));
}

Fixed version (ground truth):
/** 
 * Method to append the color string hex representation back to a string buffer. Package-only access as it is for internal use in ColorTextureAssetResolver, but should be here for maintenance with the color-to-color-string code.
 * @param sb    StringBuilder into which to append name
 * @param color represented by hexColorName
 */
private static void appendColorName(StringBuilder sb,Color color){
  int red=color.r();
  if (red < 16) {
    sb.append('0');
  }
  sb.append(Integer.toHexString(red));
  int green=color.g();
  if (green < 16) {
    sb.append('0');
  }
  sb.append(Integer.toHexString(green));
  int blue=color.b();
  if (blue < 16) {
    sb.append('0');
  }
  sb.append(Integer.toHexString(blue));
  int alpha=color.a();
  if (alpha < 16) {
    sb.append('0');
  }
  sb.append(Integer.toHexString(alpha));
}
Program: 816
Project: 816
Buggy source:
/** 
 * @param commandName
 * @param commands
 * @return
 */
public static Set<String> getMatches(String queryStr,Collection<String> commands,boolean includeCaseInsensitiveStartingWith){
  Set<String> matches=Sets.newHashSet();
  String query=queryStr.replaceAll("String_Node_Str","String_Node_Str");
  query=query.replaceFirst("String_Node_Str","String_Node_Str");
  String re="String_Node_Str" + query.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str";
  Pattern regex=Pattern.compile(re);
  for (  String cmd : commands) {
    if (includeCaseInsensitiveStartingWith && cmd.toLowerCase().startsWith(queryStr.toLowerCase())) {
      matches.add(cmd);
    }
    Matcher m=regex.matcher(cmd);
    if (m.find()) {
      matches.add(m.group());
    }
  }
  return matches;
}

Fixed version (ground truth):
/** 
 * @param queryStr
 * @param commands
 * @return
 */
public static Set<String> getMatches(String queryStr,Collection<String> commands,boolean includeCaseInsensitiveStartingWith){
  Set<String> matches=Sets.newHashSet();
  String query=queryStr.replaceAll("String_Node_Str","String_Node_Str");
  query=query.replaceFirst("String_Node_Str","String_Node_Str");
  String re="String_Node_Str" + query.replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str";
  Pattern regex=Pattern.compile(re);
  for (  String cmd : commands) {
    if (includeCaseInsensitiveStartingWith && cmd.toLowerCase().startsWith(queryStr.toLowerCase())) {
      matches.add(cmd);
    }
    Matcher m=regex.matcher(cmd);
    if (m.find()) {
      matches.add(m.group());
    }
  }
  return matches;
}
Program: 817
Project: 817
Buggy source:
/** 
 * Returns the ordinal indicator of an integer. <br><br> Most readable when called with class name: OrdinalIndicator.of(22) -> "nd"
 * @param number the integer
 * @return The ordinal indicator ("st", "nd", "rd" or "th").
 */
public static String of(int number){
  int x=Math.abs(number);
  x%=100;
switch (x) {
case 11:
case 12:
case 13:
    return "String_Node_Str";
}
x%=10;
switch (x) {
case 1:
  return "String_Node_Str";
case 2:
return "String_Node_Str";
case 3:
return "String_Node_Str";
default :
return "String_Node_Str";
}
}

Fixed version (ground truth):
/** 
 * Returns the ordinal indicator of an integer. <br><br> Most readable when called with class name: OrdinalIndicator.of(22) returns "nd"
 * @param number the integer
 * @return The ordinal indicator ("st", "nd", "rd" or "th").
 */
public static String of(int number){
  int x=Math.abs(number);
  x%=100;
switch (x) {
case 11:
case 12:
case 13:
    return "String_Node_Str";
}
x%=10;
switch (x) {
case 1:
  return "String_Node_Str";
case 2:
return "String_Node_Str";
case 3:
return "String_Node_Str";
default :
return "String_Node_Str";
}
}
Program: 818
Project: 818
Buggy source:
/** 
 * Returns the integer combined with it's ordinal indicator as String. <br><br> Most readable when called with class name: OrdinalIndicator.addedTo(22) -> "22nd"
 * @param x the integer
 * @return The integer with it's ordinal indicator attached.
 */
public static String addedTo(int x){
  return String.format("String_Node_Str",x,OrdinalIndicator.of(x));
}

Fixed version (ground truth):
/** 
 * Returns the integer combined with it's ordinal indicator as String. <br><br> Most readable when called with class name: OrdinalIndicator.addedTo(22) returns "22nd"
 * @param x the integer
 * @return The integer with it's ordinal indicator attached.
 */
public static String addedTo(int x){
  return String.format("String_Node_Str",x,OrdinalIndicator.of(x));
}
Program: 820
Project: 820
Buggy source:
/** 
 * Retrieves the ChunkRelevanceRegion object for the given entity
 * @param entity
 * @return The chunk relevance region, or null
 */
void updateRelevanceEntity(EntityRef entity,Vector3i distance);

Fixed version (ground truth):
/** 
 * Retrieves the ChunkRelevanceRegion object for the given entity
 * @param entity
 */
void updateRelevanceEntity(EntityRef entity,Vector3i distance);
Program: 821
Project: 821
Buggy source:
/** 
 * The values are supposed to be annotated with   {@link org.terasology.rendering.nui.properties.Property}
 * @return a map (label->object)
 */
Map<String,Component> getProperties();

Fixed version (ground truth):
/** 
 * The values are supposed to be annotated with   {@link org.terasology.rendering.nui.properties.Property}
 * @return a map (label to object)
 */
Map<String,Component> getProperties();