nus-yam/ex-repair huggingface dataset:
Program: 55733
Project: 55733
Buggy source:
@Override public ShortPoint2D findBestConstructionPosition(AiStatistics aiStatistics,AbstractConstructionMarkableMap constructionMap,byte playerId){
  List<ScoredConstructionPosition> scoredConstructionPositions=new ArrayList<ScoredConstructionPosition>();
  int fishDistance=Integer.MAX_VALUE;
  for (  ShortPoint2D point : aiStatistics.getLandForPlayer(playerId)) {
    if (constructionMap.canConstructAt(point.x,point.y,buildingType,playerId) && !aiStatistics.blocksWorkingAreaOfOtherBuilding(point,playerId,buildingType)) {
      ShortPoint2D fishPosition=aiStatistics.getNearestResourcePointForPlayer(point,FISH,playerId,fishDistance);
      if (fishPosition != null) {
        fishDistance=point.getOnGridDistTo(fishPosition);
        scoredConstructionPositions.add(new ScoredConstructionPosition(point,fishDistance));
      }
    }
  }
  return ScoredConstructionPosition.detectPositionWithLowestScore(scoredConstructionPositions);
}

Fixed version (ground truth):
@Override public ShortPoint2D findBestConstructionPosition(AiStatistics aiStatistics,AbstractConstructionMarkableMap constructionMap,byte playerId){
  List<ScoredConstructionPosition> scoredConstructionPositions=new ArrayList<ScoredConstructionPosition>();
  int fishDistance=buildingType.getWorkRadius();
  for (  ShortPoint2D point : aiStatistics.getLandForPlayer(playerId)) {
    if (constructionMap.canConstructAt(point.x,point.y,buildingType,playerId) && !aiStatistics.blocksWorkingAreaOfOtherBuilding(point,playerId,buildingType)) {
      ShortPoint2D fishPosition=aiStatistics.getNearestResourcePointForPlayer(point,FISH,playerId,fishDistance);
      if (fishPosition != null) {
        fishDistance=point.getOnGridDistTo(fishPosition);
        scoredConstructionPositions.add(new ScoredConstructionPosition(point,fishDistance));
      }
    }
  }
  return ScoredConstructionPosition.detectPositionWithLowestScore(scoredConstructionPositions);
}
Program: 55734
Project: 55734
Buggy source:
@Override public ShortPoint2D findBestConstructionPosition(AiStatistics aiStatistics,AbstractConstructionMarkableMap constructionMap,byte playerId){
  AiPositions rivers=aiStatistics.getRiversForPlayer(playerId);
  if (rivers.size() == 0) {
    return null;
  }
  List<ScoredConstructionPosition> scoredConstructionPositions=new ArrayList<ScoredConstructionPosition>();
  for (  ShortPoint2D point : aiStatistics.getLandForPlayer(playerId)) {
    if (constructionMap.canConstructAt(point.x,point.y,buildingType,playerId) && !aiStatistics.blocksWorkingAreaOfOtherBuilding(point,playerId,buildingType)) {
      ShortPoint2D nearestRiverPosition=rivers.getNearestPoint(point);
      int riverDistance=point.getOnGridDistTo(nearestRiverPosition);
      scoredConstructionPositions.add(new ScoredConstructionPosition(point,riverDistance));
    }
  }
  return ScoredConstructionPosition.detectPositionWithLowestScore(scoredConstructionPositions);
}

Fixed version (ground truth):
@Override public ShortPoint2D findBestConstructionPosition(AiStatistics aiStatistics,AbstractConstructionMarkableMap constructionMap,byte playerId){
  AiPositions rivers=aiStatistics.getRiversForPlayer(playerId);
  if (rivers.size() == 0) {
    return null;
  }
  List<ScoredConstructionPosition> scoredConstructionPositions=new ArrayList<ScoredConstructionPosition>();
  for (  ShortPoint2D point : aiStatistics.getLandForPlayer(playerId)) {
    if (constructionMap.canConstructAt(point.x,point.y,buildingType,playerId) && !aiStatistics.blocksWorkingAreaOfOtherBuilding(point,playerId,buildingType)) {
      ShortPoint2D nearestRiverPosition=rivers.getNearestPoint(point,buildingType.getWorkRadius(),null);
      if (nearestRiverPosition != null) {
        int riverDistance=point.getOnGridDistTo(nearestRiverPosition);
        scoredConstructionPositions.add(new ScoredConstructionPosition(point,riverDistance));
      }
    }
  }
  return ScoredConstructionPosition.detectPositionWithLowestScore(scoredConstructionPositions);
}
Program: 55735
Project: 55735
Buggy source:
private ShortPoint2D getNearestPointInDefaultPartitionOutOfSortedMap(ShortPoint2D point,AiPositions sortedPoints,final byte playerId,int currentNearestPointDistance){
  return sortedPoints.getNearestPoint(point,currentNearestPointDistance,new AiPositionFilter(){
    @Override public boolean contains(    int x,    int y){
      return partitionsGrid.getPartitionAt(x,y).getPlayerId() == playerId;
    }
  }
);
}

Fixed version (ground truth):
private ShortPoint2D getNearestPointInDefaultPartitionOutOfSortedMap(ShortPoint2D point,AiPositions sortedPoints,final byte playerId,int searchDistance){
  return sortedPoints.getNearestPoint(point,searchDistance,new AiPositionFilter(){
    @Override public boolean contains(    int x,    int y){
      return partitionsGrid.getPartitionAt(x,y).getPlayerId() == playerId;
    }
  }
);
}
Program: 55736
Project: 55736
Buggy source:
public ShortPoint2D getNearestRiverPointInDefaultPartitionFor(ShortPoint2D referencePoint,int currentNearestPointDistance){
  return getNearestPointInDefaultPartitionOutOfSortedMap(referencePoint,sortedRiversInDefaultPartition,(byte)-1,currentNearestPointDistance);
}

Fixed version (ground truth):
public ShortPoint2D getNearestRiverPointInDefaultPartitionFor(ShortPoint2D referencePoint,int searchDistance){
  return getNearestPointInDefaultPartitionOutOfSortedMap(referencePoint,sortedRiversInDefaultPartition,(byte)-1,searchDistance);
}
Program: 55737
Project: 55737
Buggy source:
public ShortPoint2D getNearestCuttableObjectPointInDefaultPartitionFor(ShortPoint2D point,EMapObjectType cuttableObject,int currentNearestPointDistance){
  return getNearestCuttableObjectPointForPlayer(point,cuttableObject,currentNearestPointDistance,(byte)-1);
}

Fixed version (ground truth):
public ShortPoint2D getNearestCuttableObjectPointInDefaultPartitionFor(ShortPoint2D point,EMapObjectType cuttableObject,int searchDistance){
  return getNearestCuttableObjectPointForPlayer(point,cuttableObject,searchDistance,(byte)-1);
}
Program: 55738
Project: 55738
Buggy source:
public ShortPoint2D getNearestCuttableObjectPointForPlayer(ShortPoint2D point,EMapObjectType cuttableObject,int currentNearestPointDistance,byte playerId){
  AiPositions sortedResourcePoints=sortedCuttableObjectsInDefaultPartition.get(cuttableObject);
  if (sortedResourcePoints == null) {
    return null;
  }
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourcePoints,playerId,currentNearestPointDistance);
}

Fixed version (ground truth):
public ShortPoint2D getNearestCuttableObjectPointForPlayer(ShortPoint2D point,EMapObjectType cuttableObject,int searchDistance,byte playerId){
  AiPositions sortedResourcePoints=sortedCuttableObjectsInDefaultPartition.get(cuttableObject);
  if (sortedResourcePoints == null) {
    return null;
  }
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourcePoints,playerId,searchDistance);
}
Program: 55739
Project: 55739
Buggy source:
public ShortPoint2D getNearestResourcePointForPlayer(ShortPoint2D point,EResourceType resourceType,byte playerId,int currentNearestPointDistance){
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourceTypes[resourceType.ordinal],playerId,currentNearestPointDistance);
}

Fixed version (ground truth):
public ShortPoint2D getNearestResourcePointForPlayer(ShortPoint2D point,EResourceType resourceType,byte playerId,int searchDistance){
  return getNearestPointInDefaultPartitionOutOfSortedMap(point,sortedResourceTypes[resourceType.ordinal],playerId,searchDistance);
}
Program: 55741
Project: 55741
Buggy source:
/** 
 * @param weaponSmithFactor influences the power of the AI. Use 1 for full power. Use < 1 for weaker AIs. The factor is used to determine the maximum amount of weapon smiths build on the map and shifts the point of time when the weapon smiths are build.
 * @param buildingIndustryFactor influences the amount of lumberjacks, sawmills, foresters and stone cutters to slow down the AI.
 */
public BuildingListEconomyMinister(AiStatistics aiStatistics,Player player,float weaponSmithFactor,float buildingIndustryFactor){
  this.aiStatistics=aiStatistics;
  this.buildingIndustryFactor=buildingIndustryFactor;
  this.playerId=player.playerId;
  this.weaponSmithFactor=weaponSmithFactor;
  this.buildingsToBuild=new ArrayList<>();
  this.isHighGoodsGame=isHighGoodsGame();
  this.isMiddleGoodsGame=isMiddleGoodsGame();
}

Fixed version (ground truth):
/** 
 * @param weaponSmithFactor influences the power of the AI. Use 1 for full power. Use < 1 for weaker AIs. The factor is used to determine the maximum amount of weapon smiths build on the map and shifts the point of time when the weapon smiths are build.
 * @param buildingIndustryFactor influences the power of the AI. Use 1 for full power. Use < 1 for weaker AIs. The factor is used to determine the maximum amount of building industry buildings. If the AI e.g. builds less lumberjacks it is slower.
 * @param limitByWeakestEnemy when set limits the AI in all amounts of buildings by the average building count of all alive enemies.
 */
public BuildingListEconomyMinister(AiStatistics aiStatistics,Player player,float weaponSmithFactor,float buildingIndustryFactor,boolean limitByWeakestEnemy){
  this.aiStatistics=aiStatistics;
  this.buildingIndustryFactor=buildingIndustryFactor;
  this.limitByWeakestEnemy=limitByWeakestEnemy;
  this.playerId=player.playerId;
  this.weaponSmithFactor=weaponSmithFactor;
  this.buildingsToBuild=new ArrayList<>();
  this.isHighGoodsGame=isHighGoodsGame();
  this.isMiddleGoodsGame=isMiddleGoodsGame();
}
Program: 55742
Project: 55742
Buggy source:
protected void addIfPossible(EBuildingType buildingType){
  float factor=1F;
  if (BUILDING_INDUSTRY.contains(buildingType)) {
    factor=buildingIndustryFactor;
  }
  if (currentCountOf(buildingType) < Math.ceil(mapBuildingCounts[buildingType.ordinal] * factor)) {
    buildingsToBuild.add(buildingType);
  }
}

Fixed version (ground truth):
protected void addIfPossible(EBuildingType buildingType){
  float factor=1F;
  if (BUILDING_INDUSTRY.contains(buildingType)) {
    factor=buildingIndustryFactor;
  }
  double currentCount=currentCountOf(buildingType);
  if (currentCount < Math.ceil(mapBuildingCounts[buildingType.ordinal] * factor) && currentCount < maximumAllowedCount(buildingType)) {
    buildingsToBuild.add(buildingType);
  }
}
Program: 55743
Project: 55743
Buggy source:
private EconomyMinister determineMinister(EPlayerType type,ECivilisation civilisation,AiStatistics aiStatistics,Player player){
switch (type) {
case AI_VERY_EASY:
    return new AdaptableEconomyMinister(aiStatistics,player);
case AI_EASY:
  return new BuildingListEconomyMinister(aiStatistics,player,1F / 4F,1F / 2F);
case AI_HARD:
return new BuildingListEconomyMinister(aiStatistics,player,1F / 2F,3F / 4F);
default :
return new BuildingListEconomyMinister(aiStatistics,player,1F,1F);
}
}

Fixed version (ground truth):
private EconomyMinister determineMinister(EPlayerType type,ECivilisation civilisation,AiStatistics aiStatistics,Player player){
switch (type) {
case AI_VERY_EASY:
    return new BuildingListEconomyMinister(aiStatistics,player,1F / 8F,1F / 4F,true);
case AI_EASY:
  return new BuildingListEconomyMinister(aiStatistics,player,1F / 4F,1F / 2F,false);
case AI_HARD:
return new BuildingListEconomyMinister(aiStatistics,player,1F / 2F,3F / 4F,false);
default :
return new BuildingListEconomyMinister(aiStatistics,player,1F,1F,false);
}
}
Program: 55744
Project: 55744
Buggy source:
@Test public void easyShouldConquerVeryEasy() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_EASY,EPlayerType.AI_VERY_EASY,125 * MINUTES);
}

Fixed version (ground truth):
@Test public void easyShouldConquerVeryEasy() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_EASY,EPlayerType.AI_VERY_EASY,100 * MINUTES);
}
Program: 55745
Project: 55745
Buggy source:
public BuildingDefinition(EBuildingType type){
  this.type=type;
  for (  RelativePoint pos : type.getBlockedTiles()) {
    blocked.add(pos);
  }
  for (  RelativePoint pos : type.getProtectedTiles()) {
    if (!blocked.contains(pos)) {
      justProtected.add(pos);
    }
  }
  buildmarks.addAll(Arrays.asList(type.getBuildmarks()));
  bricklayers.addAll(Arrays.asList(type.getBricklayers()));
  door=type.getDoorTile();
  flag=type.getFlag();
  constructionStacks.addAll(Arrays.asList(type.getConstructionStacks()));
  requestStacks.addAll(Arrays.asList(type.getRequestStacks()));
  offerStacks.addAll(Arrays.asList(type.getOfferStacks()));
}

Fixed version (ground truth):
public BuildingDefinition(EBuildingType type){
  this.type=type;
  for (  RelativePoint pos : type.getBlockedTiles()) {
    blocked.add(pos);
  }
  for (  RelativePoint pos : type.getProtectedTiles()) {
    if (!blocked.contains(pos)) {
      justProtected.add(pos);
    }
  }
  buildmarks.addAll(Arrays.asList(type.getBuildMarks()));
  bricklayers.addAll(Arrays.asList(type.getBricklayers()));
  door=type.getDoorTile();
  flag=type.getFlag();
  constructionStacks.addAll(Arrays.asList(type.getConstructionStacks()));
  requestStacks.addAll(Arrays.asList(type.getRequestStacks()));
  offerStacks.addAll(Arrays.asList(type.getOfferStacks()));
}
Program: 55746
Project: 55746
Buggy source:
@Override public void towerDefended(IBuildingOccupyableMovable soldier){
  inFight=false;
  if (attackableTowerObject.currDefender == null) {
    System.err.println("String_Node_Str");
  }
 else {
    addOccupier(new TowerOccupier(attackableTowerObject.currDefender.place,soldier));
    attackableTowerObject.currDefender=null;
  }
  doorHealth=0.1f;
}

Fixed version (ground truth):
@Override public void towerDefended(IBuildingOccupyableMovable soldier){
  inFight=false;
  if (attackableTowerObject.currDefender == null) {
    System.err.println("String_Node_Str");
  }
 else {
    TowerOccupier towerOccupier=new TowerOccupier(attackableTowerObject.currDefender.place,soldier);
    addOccupier(towerOccupier);
    attackableTowerObject.currDefender=null;
    addInformableMapObject(towerOccupier,true);
  }
  doorHealth=0.1f;
}
Program: 55747
Project: 55747
Buggy source:
@Override public OutputStream getOutputStream(MapFileHeader header) throws IOException {
  String name=header.getName().toLowerCase().replaceAll("String_Node_Str","String_Node_Str");
  if (name.isEmpty()) {
    name="String_Node_Str";
  }
  Date date=header.getCreationDate();
  if (date != null) {
    SimpleDateFormat format=new SimpleDateFormat("String_Node_Str");
    name+=format.format(date);
  }
  String mapFileExtension=MapList.getMapExtension();
  String actualName=name;
  File file=new File(directory,actualName + mapFileExtension);
  int i=1;
  while (file.exists()) {
    actualName=name + "String_Node_Str" + i;
    file=new File(directory,actualName + mapFileExtension);
    i++;
  }
  if (!directory.exists()) {
    directory.mkdirs();
  }
  if (!directory.isDirectory()) {
    throw new IOException("String_Node_Str");
  }
  try {
    OutputStream outputStream=new BufferedOutputStream(new FileOutputStream(file));
    if (CommonConstants.USE_SAVEGAME_COMPRESSION) {
      System.out.println("String_Node_Str");
      ZipOutputStream zipOutputStream=new ZipOutputStream(outputStream);
      ZipEntry zipEntry=new ZipEntry(actualName + MapLoader.MAP_EXTENSION);
      zipOutputStream.putNextEntry(zipEntry);
      return zipOutputStream;
    }
 else {
      System.out.println("String_Node_Str");
      return outputStream;
    }
  }
 catch (  FileNotFoundException e) {
    throw new IOException(e);
  }
}

Fixed version (ground truth):
@Override public OutputStream getOutputStream(MapFileHeader header) throws IOException {
  String name=header.getName().toLowerCase().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
  if (name.isEmpty()) {
    name="String_Node_Str";
  }
  Date date=header.getCreationDate();
  if (date != null) {
    SimpleDateFormat format=new SimpleDateFormat("String_Node_Str");
    name+=format.format(date);
  }
  String mapFileExtension=MapList.getMapExtension();
  String actualName=name;
  File file=new File(directory,actualName + mapFileExtension);
  int i=1;
  while (file.exists()) {
    actualName=name + "String_Node_Str" + i;
    file=new File(directory,actualName + mapFileExtension);
    i++;
  }
  if (!directory.exists()) {
    directory.mkdirs();
  }
  if (!directory.isDirectory()) {
    throw new IOException("String_Node_Str");
  }
  try {
    OutputStream outputStream=new BufferedOutputStream(new FileOutputStream(file));
    if (CommonConstants.USE_SAVEGAME_COMPRESSION) {
      System.out.println("String_Node_Str");
      ZipOutputStream zipOutputStream=new ZipOutputStream(outputStream);
      ZipEntry zipEntry=new ZipEntry(actualName + MapLoader.MAP_EXTENSION);
      zipOutputStream.putNextEntry(zipEntry);
      return zipOutputStream;
    }
 else {
      System.out.println("String_Node_Str");
      return outputStream;
    }
  }
 catch (  FileNotFoundException e) {
    throw new IOException(e);
  }
}
Program: 55748
Project: 55748
Buggy source:
/** 
 * Set the maximum player count
 * @param maxPlayer Min: 1, Max: CommonConstants.MAX_PLAYERS
 */
public void setMaxPlayers(short maxPlayer){
  if (maxPlayer <= 0 || maxPlayer > CommonConstants.MAX_PLAYERS) {
    throw new IllegalArgumentException("String_Node_Str" + CommonConstants.MAX_PLAYERS);
  }
  ShortPoint2D[] newPlayerStarts=new ShortPoint2D[maxPlayer];
  for (int i=0; i < maxPlayer; i++) {
    newPlayerStarts[i]=i < playercount ? playerStarts[i] : new ShortPoint2D(width / 2,height / 2);
  }
  this.playercount=maxPlayer;
  this.playerStarts=newPlayerStarts;
}

Fixed version (ground truth):
/** 
 * Set the maximum player count
 * @param maxPlayer Min: 1, Max: CommonConstants.MAX_PLAYERS
 */
public void setMaxPlayers(short maxPlayer){
  if (maxPlayer <= 0 || maxPlayer > CommonConstants.MAX_PLAYERS) {
    throw new IllegalArgumentException("String_Node_Str" + CommonConstants.MAX_PLAYERS);
  }
  ShortPoint2D[] newPlayerStarts=new ShortPoint2D[maxPlayer];
  for (int i=0; i < maxPlayer; i++) {
    newPlayerStarts[i]=i < playerCount ? playerStarts[i] : new ShortPoint2D(width / 2,height / 2);
  }
  this.playerCount=maxPlayer;
  this.playerStarts=newPlayerStarts;
}
Program: 55749
Project: 55749
Buggy source:
@Override public int getPlayerCount(){
  return playercount;
}

Fixed version (ground truth):
@Override public int getPlayerCount(){
  return playerCount;
}
Program: 55750
Project: 55750
Buggy source:
public void deleteObject(int x,int y){
  ObjectContainer obj=objects[x][y];
  if (obj instanceof ProtectContainer) {
    return;
  }
 else   if (obj != null) {
    undoDelta.addObject(x,y,obj);
    objects[x][y]=null;
    ShortPoint2D start=new ShortPoint2D(x,y);
    RelativePoint[] area=obj.getProtectedArea();
    for (    RelativePoint point : area) {
      ShortPoint2D pos=point.calculatePoint(start);
      if (contains(pos.x,pos.y)) {
        undoDelta.addObject(pos.x,pos.y,objects[pos.x][pos.y]);
        objects[pos.x][pos.y]=null;
      }
    }
  }
}

Fixed version (ground truth):
public void deleteObject(int x,int y){
  ObjectContainer obj=objects[x][y];
  if (obj instanceof ProtectContainer) {
  }
 else   if (obj != null) {
    undoDelta.addObject(x,y,obj);
    objects[x][y]=null;
    ShortPoint2D start=new ShortPoint2D(x,y);
    RelativePoint[] area=obj.getProtectedArea();
    for (    RelativePoint point : area) {
      ShortPoint2D pos=point.calculatePoint(start);
      if (contains(pos.x,pos.y)) {
        undoDelta.addObject(pos.x,pos.y,objects[pos.x][pos.y]);
        objects[pos.x][pos.y]=null;
      }
    }
  }
}
Program: 55751
Project: 55751
Buggy source:
@Override public void setDimension(int width,int height,int playercount){
  data=new MapData(width,height,playercount,ELandscapeType.GRASS);
}

Fixed version (ground truth):
@Override public void setDimension(int width,int height,int playerCount){
  data=new MapData(width,height,playerCount,ELandscapeType.GRASS);
}
Program: 55753
Project: 55753
Buggy source:
public static final void checkLandmark(IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D startPos){
  final short startX=startPos.x;
  final short startY=startPos.y;
  if (grid.isBlocked(startX,startY))   return;
  short startPartition=grid.getPartitionAt(startPos.x,startPos.y);
  for (  EDirection currDir : EDirection.VALUES) {
    ShortPoint2D currPos=currDir.getNextHexPoint(startX,startY);
    if (grid.isBlocked(currPos.x,currPos.y)) {
      if (needsRelabel(grid,containingProvider,currPos,startPartition)) {
        relabel(grid,containingProvider,currPos,startPartition);
      }
    }
  }
}

Fixed version (ground truth):
public static final void checkLandmark(IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D startPos){
  final short startX=startPos.x;
  final short startY=startPos.y;
  if (grid.isBlocked(startX,startY)) {
    return;
  }
  short startPartition=grid.getPartitionAt(startPos.x,startPos.y);
  for (  EDirection currDir : EDirection.VALUES) {
    ShortPoint2D currPos=currDir.getNextHexPoint(startX,startY);
    if (grid.isBlocked(currPos.x,currPos.y)) {
      if (needsRelabel(grid,containingProvider,currPos,startPartition)) {
        relabel(grid,containingProvider,currPos,startPartition);
      }
    }
  }
}
Program: 55754
Project: 55754
Buggy source:
/** 
 * Checks if the blocked partition given by the coordinates blockedX and blockedY is surrounded by the given partition.
 * @param containingProvider2
 * @param grid2
 * @param blockedX
 * @param blockedY
 * @param partition
 * @param blockedStartPos
 * @return
 */
private static boolean needsRelabel(final IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D blockedStartPos,final short partition){
  return BorderTraversingAlgorithm.traverseBorder(containingProvider,blockedStartPos,new ITraversingVisitor(){
    @Override public boolean visit(    int x,    int y){
      return grid.getPartitionAt((short)x,(short)y) == partition;
    }
  }
,true);
}

Fixed version (ground truth):
/** 
 * Checks if the blocked partition given by the coordinates blockedX and blockedY is surrounded by the given partition.
 * @param grid
 * @param containingProvider
 * @param blockedStartPos
 * @return
 */
private static boolean needsRelabel(final IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D blockedStartPos,final short partition){
  return BorderTraversingAlgorithm.traverseBorder(containingProvider,blockedStartPos,new IBorderVisitor(){
    @Override public boolean visit(    int insideX,    int insideY,    int outsideX,    int outsideY){
      return grid.getPartitionAt((short)outsideX,(short)outsideY) == partition;
    }
  }
,true);
}
Program: 55755
Project: 55755
Buggy source:
@Override public boolean visit(int x,int y){
  return grid.getPartitionAt((short)x,(short)y) == partition;
}

Fixed version (ground truth):
@Override public boolean visit(int insideX,int insideY,int outsideX,int outsideY){
  return grid.getPartitionAt((short)outsideX,(short)outsideY) == partition;
}
Program: 55756
Project: 55756
Buggy source:
private static void relabel(final IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D blockedStartPos,final short newPartition){
  ITraversingVisitor visitor=new ITraversingVisitor(){
    @Override public boolean visit(    int x,    int y){
      grid.setPartitionAt(x,y,newPartition);
      return true;
    }
  }
;
  AreaTraversingAlgorithm.traverseArea(containingProvider,visitor,blockedStartPos,grid.getWidth(),grid.getHeight());
}

Fixed version (ground truth):
private static void relabel(final IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D blockedStartPos,final short newPartition){
  IAreaVisitor visitor=new IAreaVisitor(){
    @Override public boolean visit(    int x,    int y){
      grid.setPartitionAt(x,y,newPartition);
      return true;
    }
  }
;
  AreaTraversingAlgorithm.traverseArea(containingProvider,visitor,blockedStartPos,grid.getWidth(),grid.getHeight());
}
Program: 55760
Project: 55760
Buggy source:
@Override protected Path findWayAroundObstacle(ShortPoint2D position,Path path){
  if (state == ESoldierState.SEARCH_FOR_ENEMIES) {
    EDirection direction=EDirection.getDirection(position,path.getNextPos());
    AbstractMovableGrid grid=super.getGrid();
    EDirection leftDir=direction.getNeighbor(-1);
    ShortPoint2D leftPos=leftDir.getNextHexPoint(position);
    EDirection rightDir=direction.getNeighbor(1);
    ShortPoint2D rightPos=rightDir.getNextHexPoint(position);
    if (grid.isFreePosition(leftPos)) {
      return new Path(leftPos);
    }
 else     if (grid.isFreePosition(rightPos)) {
      return new Path(rightPos);
    }
 else {
      EDirection twoLeftDir=direction.getNeighbor(-2);
      ShortPoint2D twoLeftPos=twoLeftDir.getNextHexPoint(position);
      EDirection twoRightDir=direction.getNeighbor(2);
      ShortPoint2D twoRightPos=twoRightDir.getNextHexPoint(position);
      if (grid.isFreePosition(twoLeftPos)) {
        return new Path(twoLeftPos);
      }
 else       if (grid.isFreePosition(twoRightPos)) {
        return new Path(twoRightPos);
      }
 else {
        return path;
      }
    }
  }
 else {
    return super.findWayAroundObstacle(position,path);
  }
}

Fixed version (ground truth):
@Override protected Path findWayAroundObstacle(ShortPoint2D position,Path path){
  if (state == ESoldierState.SEARCH_FOR_ENEMIES) {
    EDirection direction=EDirection.getDirection(position,path.getNextPos());
    EDirection rightDir=direction.getNeighbor(-1);
    ShortPoint2D rightPos=rightDir.getNextHexPoint(position);
    EDirection leftDir=direction.getNeighbor(1);
    ShortPoint2D leftPos=leftDir.getNextHexPoint(position);
    ShortPoint2D freePosition=getRandomFreePosition(rightPos,leftPos);
    if (freePosition != null) {
      return new Path(freePosition);
    }
 else {
      EDirection twoRightDir=direction.getNeighbor(-2);
      ShortPoint2D twoRightPos=twoRightDir.getNextHexPoint(position);
      EDirection twoLeftDir=direction.getNeighbor(2);
      ShortPoint2D twoLeftPos=twoLeftDir.getNextHexPoint(position);
      freePosition=getRandomFreePosition(twoRightPos,twoLeftPos);
      if (freePosition != null) {
        return new Path(freePosition);
      }
 else {
        return path;
      }
    }
  }
 else {
    return super.findWayAroundObstacle(position,path);
  }
}
Program: 55761
Project: 55761
Buggy source:
@Override public void receiveHit(float strength,ShortPoint2D attackerPos,byte attackingPlayer){
  Movable attacker=grid.getMovable(attackerPos);
  if (attacker != null && attacker.getPlayer() == getPlayer()) {
    return;
  }
  if (doorHealth > 0) {
    doorHealth-=strength / Constants.DOOR_HIT_RESISTENCY_FACTOR;
    if (doorHealth <= 0) {
      doorHealth=0;
      inFight=true;
      OccupyingBuilding.this.grid.getMapObjectsManager().addSelfDeletingMapObject(getPos(),EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,getPlayer());
      pullNewDefender(attackerPos);
    }
  }
 else   if (currDefender != null) {
    IAttackableMovable movable=currDefender.getSoldier().getMovable();
    movable.receiveHit(strength,attackerPos,attackingPlayer);
    if (movable.getHealth() <= 0) {
      emptyPlaces.add(currDefender.place);
      requestSoldier(currDefender.place.getSoldierClass());
      pullNewDefender(attackerPos);
    }
  }
  OccupyingBuilding.this.getPlayer().showMessage(SimpleMessage.attacked(attackingPlayer,attackerPos));
}

Fixed version (ground truth):
@Override public void receiveHit(float strength,ShortPoint2D attackerPos,byte attackingPlayer){
  if (!OccupyingBuilding.this.isNotDestroyed()) {
    return;
  }
  Movable attacker=grid.getMovable(attackerPos);
  if (attacker != null && attacker.getPlayer() == getPlayer()) {
    return;
  }
  if (doorHealth > 0) {
    doorHealth-=strength / Constants.DOOR_HIT_RESISTENCY_FACTOR;
    if (doorHealth <= 0) {
      doorHealth=0;
      inFight=true;
      OccupyingBuilding.this.grid.getMapObjectsManager().addSelfDeletingMapObject(getPos(),EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,getPlayer());
      pullNewDefender(attackerPos);
    }
  }
 else   if (currDefender != null) {
    IAttackableMovable movable=currDefender.getSoldier().getMovable();
    movable.receiveHit(strength,attackerPos,attackingPlayer);
    if (movable.getHealth() <= 0) {
      emptyPlaces.add(currDefender.place);
      requestSoldier(currDefender.place.getSoldierClass());
      pullNewDefender(attackerPos);
    }
  }
  OccupyingBuilding.this.getPlayer().showMessage(SimpleMessage.attacked(attackingPlayer,attackerPos));
}
Program: 55762
Project: 55762
Buggy source:
@Override public void materialDelivered(RequestStack stack){
  super.grid.requestSoldierable(Barrack.this);
}

Fixed version (ground truth):
@Override public void materialDelivered(RequestStack stack){
  super.grid.requestSoldierable(this);
}
Program: 55764
Project: 55764
Buggy source:
@Override public boolean contains(int x,int y){
  return partitionObjects[partitions[x + y * width]].partitionId == partition;
}

Fixed version (ground truth):
@Override public boolean contains(int x,int y){
  return partitionObjects[partitions[x + y * width]].partitionId == partitionId;
}
Program: 55765
Project: 55765
Buggy source:
/** 
 * NOTE: The call to this method is different if the given positions are swapped!
 * @param debugColorSetable
 * @param partitionObjects
 * @param partitions
 * @param width
 * @param startPosition
 * @param checkPosition
 * @param partition
 * @return
 */
private static boolean posNotOnBorder(final Partition[] partitionObjects,final short[] partitions,final short width,final ShortPoint2D startPosition,final ShortPoint2D checkPosition,final short partition,MutableInt partitionSize){
  final short checkPositionX=checkPosition.x;
  final short checkPositionY=checkPosition.y;
  boolean pos2NotOnBorder=BorderTraversingAlgorithm.traverseBorder(new IContainingProvider(){
    @Override public boolean contains(    int x,    int y){
      return partitionObjects[partitions[x + y * width]].partitionId == partition;
    }
  }
,startPosition,new IBorderVisitor(){
    @Override public boolean visit(    int insideX,    int insideY,    int outsideX,    int outsideY){
      return checkPositionX != insideX || checkPositionY != insideY;
    }
  }
,false,partitionSize);
  return pos2NotOnBorder;
}

Fixed version (ground truth):
/** 
 * NOTE: The call to this method is different if the given positions are swapped!
 * @param debugColorSetable
 * @param partitionObjects
 * @param partitions
 * @param width
 * @param insideStartPosition
 * @param checkPosition
 * @param partitionSize
 * @param partition
 * @return
 */
private static boolean posNotOnBorder(final Partition[] partitionObjects,final short[] partitions,final short width,final ShortPoint2D insideStartPosition,final ShortPoint2D outsideStartPosition,final ShortPoint2D checkPosition,final short partitionId,MutableInt partitionSize){
  final short checkPositionX=checkPosition.x;
  final short checkPositionY=checkPosition.y;
  boolean pos2NotOnBorder=BorderTraversingAlgorithm.traverseBorder(new IContainingProvider(){
    @Override public boolean contains(    int x,    int y){
      return partitionObjects[partitions[x + y * width]].partitionId == partitionId;
    }
  }
,insideStartPosition,outsideStartPosition,new IBorderVisitor(){
    @Override public boolean visit(    int insideX,    int insideY,    int outsideX,    int outsideY){
      return checkPositionX != insideX || checkPositionY != insideY;
    }
  }
,false,partitionSize);
  return pos2NotOnBorder;
}
Program: 55766
Project: 55766
Buggy source:
/** 
 * Tests if the given positions (that need to lie on the border of the given partition) are connected by the given partition.
 * @param debugColorSetable
 * @param partitionObjects
 * @param partitions
 * @param width
 * @param pos1 The first position.
 * @param pos2 The second position.
 * @param partition The partition of both positions.
 * @return true if both positions are connected by the given partition.<br>false if the positions are not connected.
 */
public static boolean isPartitionDivided(Partition[] partitionObjects,short[] partitions,short width,ShortPoint2D pos1,MutableInt partition1Size,ShortPoint2D pos2,MutableInt partition2Size,short partition){
  return posNotOnBorder(partitionObjects,partitions,width,pos1,pos2,partition,partition1Size) && posNotOnBorder(partitionObjects,partitions,width,pos2,pos1,partition,partition2Size);
}

Fixed version (ground truth):
/** 
 * Tests if the given positions (that need to lie on the border of the given partition) are connected by the given partition.
 * @param debugColorSetable
 * @param partitionObjects
 * @param partitions
 * @param width
 * @param partition1
 * @param partition1Size
 * @param partition2
 * @param partition2Size
 * @return true if both positions are connected by the given partition.<br>false if the positions are not connected.
 */
public static boolean isPartitionDivided(Partition[] partitionObjects,short[] partitions,short width,BorderPartitionInfo partition1,MutableInt partition1Size,BorderPartitionInfo partition2,MutableInt partition2Size){
}
Program: 55767
Project: 55767
Buggy source:
public static final void checkLandmark(IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D startPos){
  final short startX=startPos.x;
  final short startY=startPos.y;
  if (grid.isBlocked(startX,startY))   return;
  short startPartition=grid.getPartitionAt(startPos.x,startPos.y);
  for (  EDirection currDir : EDirection.VALUES) {
    ShortPoint2D currPos=currDir.getNextHexPoint(startX,startY);
    if (grid.isBlocked(currPos.x,currPos.y)) {
      if (needsRelabel(grid,containingProvider,currPos,startPartition)) {
        relabel(grid,containingProvider,currPos,startPartition);
      }
    }
  }
}

Fixed version (ground truth):
public static final void checkLandmark(IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D startPos){
  final short startX=startPos.x;
  final short startY=startPos.y;
  if (grid.isBlocked(startX,startY)) {
    return;
  }
  short startPartition=grid.getPartitionAt(startPos.x,startPos.y);
  for (  EDirection currDir : EDirection.VALUES) {
    ShortPoint2D currPos=currDir.getNextHexPoint(startX,startY);
    if (grid.isBlocked(currPos.x,currPos.y)) {
      if (needsRelabel(grid,containingProvider,currPos,startPartition)) {
        relabel(grid,containingProvider,currPos,startPartition);
      }
    }
  }
}
Program: 55768
Project: 55768
Buggy source:
/** 
 * Checks if the blocked partition given by the coordinates blockedX and blockedY is surrounded by the given partition.
 * @param containingProvider2
 * @param grid2
 * @param blockedX
 * @param blockedY
 * @param partition
 * @param blockedStartPos
 * @return
 */
private static boolean needsRelabel(final IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D blockedStartPos,final short partition){
  return BorderTraversingAlgorithm.traverseBorder(containingProvider,blockedStartPos,new ITraversingVisitor(){
    @Override public boolean visit(    int x,    int y){
      return grid.getPartitionAt((short)x,(short)y) == partition;
    }
  }
,true);
}

Fixed version (ground truth):
/** 
 * Checks if the blocked partition given by the coordinates blockedX and blockedY is surrounded by the given partition.
 * @param grid
 * @param containingProvider
 * @param blockedStartPos
 * @return
 */
private static boolean needsRelabel(final IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D blockedStartPos,final short partition){
  return BorderTraversingAlgorithm.traverseBorder(containingProvider,blockedStartPos,new IBorderVisitor(){
    @Override public boolean visit(    int insideX,    int insideY,    int outsideX,    int outsideY){
      return grid.getPartitionAt((short)outsideX,(short)outsideY) == partition;
    }
  }
,true);
}
Program: 55769
Project: 55769
Buggy source:
@Override public boolean visit(int x,int y){
  return grid.getPartitionAt((short)x,(short)y) == partition;
}

Fixed version (ground truth):
@Override public boolean visit(int insideX,int insideY,int outsideX,int outsideY){
  return grid.getPartitionAt((short)outsideX,(short)outsideY) == partition;
}
Program: 55770
Project: 55770
Buggy source:
private static void relabel(final IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D blockedStartPos,final short newPartition){
  ITraversingVisitor visitor=new ITraversingVisitor(){
    @Override public boolean visit(    int x,    int y){
      grid.setPartitionAt(x,y,newPartition);
      return true;
    }
  }
;
  AreaTraversingAlgorithm.traverseArea(containingProvider,visitor,blockedStartPos,grid.getWidth(),grid.getHeight());
}

Fixed version (ground truth):
private static void relabel(final IEnclosedBlockedAreaFinderGrid grid,IContainingProvider containingProvider,ShortPoint2D blockedStartPos,final short newPartition){
  IAreaVisitor visitor=new IAreaVisitor(){
    @Override public boolean visit(    int x,    int y){
      grid.setPartitionAt(x,y,newPartition);
      return true;
    }
  }
;
  AreaTraversingAlgorithm.traverseArea(containingProvider,visitor,blockedStartPos,grid.getWidth(),grid.getHeight());
}
Program: 55773
Project: 55773
Buggy source:
@Override public void enterPosition(ShortPoint2D position,Movable movable,boolean informFullArea){
  movableGrid.movableEntered(position,movable);
  if (movable.isAttackable()) {
    movableGrid.informMovables(movable,position.x,position.y,informFullArea);
    objectsGrid.informObjectsAboutAttackble(position,movable,informFullArea,!movable.getMovableType().isBowman());
  }
}

Fixed version (ground truth):
@Override public void enterPosition(ShortPoint2D position,Movable movable,boolean informFullArea){
  movableGrid.movableEntered(position,movable);
  notifyAttackers(position,movable,informFullArea);
}
Program: 55774
Project: 55774
Buggy source:
private void setStrategy(MovableStrategy newStrategy){
  this.strategy.strategyKilledEvent(path != null ? path.getTargetPos() : null);
  this.strategy=newStrategy;
  this.movableAction=EMovableAction.NO_ACTION;
  setState(EMovableState.DOING_NOTHING);
}

Fixed version (ground truth):
private void setStrategy(MovableStrategy newStrategy){
  this.strategy.strategyKilledEvent(path != null ? path.getTargetPos() : null);
  this.strategy=newStrategy;
  this.movableAction=EMovableAction.NO_ACTION;
  setState(EMovableState.DOING_NOTHING);
  grid.notifyAttackers(position,this,true);
}
Program: 55775
Project: 55775
Buggy source:
/** 
 * Lets the given movable enter the given position.
 * @param position Position to be entered.
 * @param movable Movable that enters the position.
 * @param informFullArea If true, the full soldier update area is informed if the given movable is attackable.<br> If false, only a circle is informed if the given movable is attackable.
 */
public abstract void enterPosition(ShortPoint2D position,Movable movable,boolean informFullArea);

Fixed version (ground truth):
/** 
 * Lets the given movable enter the given position.
 * @param position       Position to be entered.
 * @param movable        Movable that enters the position.
 * @param informFullArea If true, the full soldier update area is informed if the given movable is attackable.<br>If false, only a circle is informed if the given movable is attackable.
 */
public abstract void enterPosition(ShortPoint2D position,Movable movable,boolean informFullArea);
Program: 55776
Project: 55776
Buggy source:
/** 
 * Adds a map object to the grid that deletes itself after the given duration.
 * @param position The position to add the map object.
 * @param mapObjectType The  {@link EMapObjectType} of the map object that will be added.
 * @param duration The time (in seconds) the map object will stay on the grid.
 * @param player The  {@link Player} of the map object.
 */
public abstract void addSelfDeletingMapObject(ShortPoint2D position,EMapObjectType mapObjectType,float duration,Player player);

Fixed version (ground truth):
/** 
 * Adds a map object to the grid that deletes itself after the given duration.
 * @param position      The position to add the map object.
 * @param mapObjectType The {@link EMapObjectType} of the map object that will be added.
 * @param duration      The time (in seconds) the map object will stay on the grid.
 * @param player        The {@link Player} of the map object.
 */
public abstract void addSelfDeletingMapObject(ShortPoint2D position,EMapObjectType mapObjectType,float duration,Player player);
Program: 55777
Project: 55777
Buggy source:
@Test public void veryHardShouldConquerHard() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_VERY_HARD,EPlayerType.AI_HARD,100 * MINUTES);
}

Fixed version (ground truth):
@Test public void veryHardShouldConquerHard() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_VERY_HARD,EPlayerType.AI_HARD,120 * MINUTES);
}
Program: 55778
Project: 55778
Buggy source:
@Override public void receiveHit(float strength,ShortPoint2D attackerPos,byte attackingPlayer){
  Movable attacker=grid.getMovable(attackerPos);
  if (attacker != null && attacker.getPlayer() == getPlayer()) {
    return;
  }
  if (doorHealth > 0) {
    doorHealth-=strength / Constants.DOOR_HIT_RESISTENCY_FACTOR;
    if (doorHealth <= 0) {
      doorHealth=0;
      inFight=true;
      OccupyingBuilding.this.grid.getMapObjectsManager().addSelfDeletingMapObject(getPos(),EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,getPlayer());
      pullNewDefender(attackerPos);
    }
  }
 else   if (currDefender != null) {
    IAttackableMovable movable=currDefender.getSoldier().getMovable();
    movable.receiveHit(strength,attackerPos,attackingPlayer);
    if (movable.getHealth() <= 0) {
      emptyPlaces.add(currDefender.place);
      requestSoldier(currDefender.place.getSoldierClass());
      pullNewDefender(attackerPos);
    }
  }
  OccupyingBuilding.this.getPlayer().showMessage(SimpleMessage.attacked(attackingPlayer,attackerPos));
}

Fixed version (ground truth):
@Override public void receiveHit(float strength,ShortPoint2D attackerPos,byte attackingPlayer){
  if (!OccupyingBuilding.this.isNotDestroyed()) {
    return;
  }
  Movable attacker=grid.getMovable(attackerPos);
  if (attacker != null && attacker.getPlayer() == getPlayer()) {
    return;
  }
  if (doorHealth > 0) {
    doorHealth-=strength / Constants.DOOR_HIT_RESISTENCY_FACTOR;
    if (doorHealth <= 0) {
      doorHealth=0;
      inFight=true;
      OccupyingBuilding.this.grid.getMapObjectsManager().addSelfDeletingMapObject(getPos(),EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,getPlayer());
      pullNewDefender(attackerPos);
    }
  }
 else   if (currDefender != null) {
    IAttackableMovable movable=currDefender.getSoldier().getMovable();
    movable.receiveHit(strength,attackerPos,attackingPlayer);
    if (movable.getHealth() <= 0) {
      emptyPlaces.add(currDefender.place);
      requestSoldier(currDefender.place.getSoldierClass());
      pullNewDefender(attackerPos);
    }
  }
  OccupyingBuilding.this.getPlayer().showMessage(SimpleMessage.attacked(attackingPlayer,attackerPos));
}
Program: 55779
Project: 55779
Buggy source:
@Override public void materialDelivered(RequestStack stack){
  super.grid.requestSoilderable(Barrack.this);
}

Fixed version (ground truth):
@Override public void materialDelivered(RequestStack stack){
  super.grid.requestSoldierable(Barrack.this);
}
Program: 55780
Project: 55780
Buggy source:
@Override public void bearerRequestFailed(){
  super.grid.requestSoilderable(this);
}

Fixed version (ground truth):
@Override public void bearerRequestFailed(){
  super.grid.requestSoldierable(this);
}
Program: 55781
Project: 55781
Buggy source:
private void handleSoldierCreationRequest(){
  SoilderCreationRequest soilderRequest=soilderCreationRequests.poll();
  if (soilderRequest != null) {
    IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(soilderRequest.getPos());
    if (manageableBearer != null) {
      manageableBearer.becomeSoldier(soilderRequest.getBarrack());
    }
 else {
      soilderCreationRequests.addLast(soilderRequest);
    }
  }
}

Fixed version (ground truth):
private void handleSoldierCreationRequest(){
  SoldierCreationRequest soilderRequest=soldierCreationRequests.poll();
  if (soilderRequest != null) {
    IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(soilderRequest.getPos());
    if (manageableBearer == null || !manageableBearer.becomeSoldier(soilderRequest.getBarrack())) {
      soldierCreationRequests.addLast(soilderRequest);
    }
  }
}
Program: 55782
Project: 55782
Buggy source:
private boolean tryToCreateWorker(WorkerCreationRequest workerCreationRequest){
  EMovableType movableType=workerCreationRequest.requestedMovableType();
  EMaterialType tool=movableType.getTool();
  if (tool != EMaterialType.NO_MATERIAL) {
    MaterialOffer offer=this.materialOffers.removeOfferCloseTo(tool,workerCreationRequest.getPos());
    if (offer != null) {
      IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(offer.getPos());
      if (manageableBearer != null) {
        manageableBearer.becomeWorker(this,workerCreationRequest,offer.getPos());
        return true;
      }
 else {
        materialOffers.addOffer(offer.getPos(),tool);
        return false;
      }
    }
 else {
      workerCreationRequest.setToolProductionRequired(true);
      return false;
    }
  }
 else {
    IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(workerCreationRequest.getPos());
    if (manageableBearer != null) {
      manageableBearer.becomeWorker(this,workerCreationRequest);
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
private boolean tryToCreateWorker(WorkerCreationRequest workerCreationRequest){
  EMovableType movableType=workerCreationRequest.requestedMovableType();
  EMaterialType tool=movableType.getTool();
  if (tool != EMaterialType.NO_MATERIAL) {
    MaterialOffer offer=this.materialOffers.removeOfferCloseTo(tool,workerCreationRequest.getPos());
    if (offer != null) {
      IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(offer.getPos());
      if (manageableBearer != null) {
        return manageableBearer.becomeWorker(this,workerCreationRequest,offer.getPos());
      }
 else {
        materialOffers.addOffer(offer.getPos(),tool);
        return false;
      }
    }
 else {
      workerCreationRequest.setToolProductionRequired(true);
      return false;
    }
  }
 else {
    IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(workerCreationRequest.getPos());
    if (manageableBearer != null) {
      return manageableBearer.becomeWorker(this,workerCreationRequest);
    }
 else {
      return false;
    }
  }
}
Program: 55783
Project: 55783
Buggy source:
public final void mergeInto(PartitionManager newManager){
  newManager.bricklayerRequests.addAll(this.bricklayerRequests);
  newManager.diggerRequests.addAll(this.diggerRequests);
  newManager.joblessBearer.addAll(this.joblessBearer);
  newManager.joblessBricklayers.addAll(this.joblessBricklayers);
  newManager.joblessDiggers.addAll(this.joblessDiggers);
  newManager.joblessWorkers.addAll(this.joblessWorkers);
  newManager.materialOffers.addAll(this.materialOffers);
  this.materialsManager.mergeInto(newManager.materialsManager);
  newManager.soilderCreationRequests.addAll(this.soilderCreationRequests);
  newManager.workerCreationRequests.addAll(this.workerCreationRequests);
  newManager.workerRequests.addAll(this.workerRequests);
}

Fixed version (ground truth):
public final void mergeInto(PartitionManager newManager){
  newManager.bricklayerRequests.addAll(this.bricklayerRequests);
  newManager.diggerRequests.addAll(this.diggerRequests);
  newManager.joblessBearer.addAll(this.joblessBearer);
  newManager.joblessBricklayers.addAll(this.joblessBricklayers);
  newManager.joblessDiggers.addAll(this.joblessDiggers);
  newManager.joblessWorkers.addAll(this.joblessWorkers);
  newManager.materialOffers.addAll(this.materialOffers);
  this.materialsManager.mergeInto(newManager.materialsManager);
  newManager.soldierCreationRequests.addAll(this.soldierCreationRequests);
  newManager.workerCreationRequests.addAll(this.workerCreationRequests);
  newManager.workerRequests.addAll(this.workerRequests);
}
Program: 55784
Project: 55784
Buggy source:
void becomeSoldier(IBarrack barrack);

Fixed version (ground truth):
boolean becomeSoldier(IBarrack barrack);