nus-yam/ex-repair huggingface dataset:
Program: 56410
Project: 56410
Buggy source:
private IAttackable getEnemyInSearchArea(byte movablePlayer,HexGridArea area,boolean isBowman){
  for (  ShortPoint2D curr : area) {
    short x=curr.getX();
    short y=curr.getY();
    if (0 <= x && x < width && 0 <= y && y < height) {
      IAttackable currAttackable=movableGrid.getMovableAt(x,y);
      if (currAttackable == null && !isBowman) {
        currAttackable=(IAttackable)objectsGrid.getMapObjectAt(x,y,EMapObjectType.ATTACKABLE_TOWER);
      }
      if (currAttackable != null && MovableGrid.isEnemy(movablePlayer,currAttackable)) {
        return currAttackable;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private IAttackable getEnemyInSearchArea(byte searchingPlayer,HexGridArea area,boolean isBowman){
  for (  ShortPoint2D curr : area) {
    short x=curr.getX();
    short y=curr.getY();
    if (0 <= x && x < width && 0 <= y && y < height) {
      IAttackable currAttackable=movableGrid.getMovableAt(x,y);
      if (currAttackable == null && !isBowman) {
        currAttackable=(IAttackable)objectsGrid.getMapObjectAt(x,y,EMapObjectType.ATTACKABLE_TOWER);
      }
      if (currAttackable != null && MovableGrid.isEnemy(searchingPlayer,currAttackable)) {
        return currAttackable;
      }
    }
  }
  return null;
}
Program: 56411
Project: 56411
Buggy source:
@Override protected boolean isEnemyAttackable(IAttackable enemy){
  ShortPoint2D pos=super.getPos();
  ShortPoint2D enemyPos=enemy.getPos();
  final int dx=Math.abs(pos.getX() - enemyPos.getX());
  final int dy=Math.abs(pos.getY() - enemyPos.getY());
  final int squareDist=dx * dx + dy * dy;
  return squareDist <= SQUARE_BOWMAN_ATTACK_RADIUS;
}

Fixed version (ground truth):
@Override protected boolean isEnemyAttackable(IAttackable enemy,boolean isInTower){
  ShortPoint2D pos=super.getPos();
  ShortPoint2D enemyPos=enemy.getPos();
  final int dx=Math.abs(pos.getX() - enemyPos.getX());
  final int dy=Math.abs(pos.getY() - enemyPos.getY());
  final int squareDist=dx * dx + dy * dy;
  if (isInTower) {
    return squareDist <= SQUARE_BOWMAN_IN_TOWER_ATTACK_RADIUS;
  }
 else {
    return squareDist <= SQUARE_BOWMAN_ATTACK_RADIUS;
  }
}
Program: 56412
Project: 56412
Buggy source:
@Override protected boolean isEnemyAttackable(IAttackable enemy){
  return EDirection.getDirection(super.getPos(),enemy.getPos()) != null;
}

Fixed version (ground truth):
@Override protected boolean isEnemyAttackable(IAttackable enemy,boolean isInTower){
  return EDirection.getDirection(super.getPos(),enemy.getPos()) != null;
}
Program: 56413
Project: 56413
Buggy source:
@Override public void informAboutAttackable(IAttackable other){
  if (isInTower) {
    if (getSoldierType() == ESoldierType.BOWMAN) {
      state=ESoldierState.SEARCH_FOR_ENEMIES;
    }
  }
 else   if (state == ESoldierState.AGGRESSIVE) {
    state=ESoldierState.SEARCH_FOR_ENEMIES;
  }
}

Fixed version (ground truth):
@Override public void informAboutAttackable(IAttackable other){
  if (state == ESoldierState.AGGRESSIVE && (!isInTower || getSoldierType() == ESoldierType.BOWMAN)) {
    state=ESoldierState.SEARCH_FOR_ENEMIES;
  }
}
Program: 56414
Project: 56414
Buggy source:
@Override protected void action(){
switch (state) {
case AGGRESSIVE:
    break;
case HITTING:
  hitEnemy(enemy);
if (enemy.getHealth() <= 0) {
  enemy=null;
  state=ESoldierState.SEARCH_FOR_ENEMIES;
  break;
}
case SEARCH_FOR_ENEMIES:
IAttackable oldEnemy=enemy;
enemy=super.getStrategyGrid().getEnemyInSearchArea(getAttackPosition(),super.getMovable(),getSearchDistance(isInTower));
if (oldEnemy != null && oldEnemy != enemy) {
inSaveGotoMode=false;
}
if (enemy == null) {
if (defending) {
building.towerDefended(this);
defending=false;
}
changeStateTo(ESoldierState.AGGRESSIVE);
break;
}
if (isEnemyAttackable(enemy)) {
super.lookInDirection(EDirection.getApproxDirection(super.getPos(),enemy.getPos()));
startAttackAnimation(enemy);
state=ESoldierState.HITTING;
}
 else if (!isInTower) {
state=ESoldierState.SEARCH_FOR_ENEMIES;
goToEnemy(enemy);
}
break;
case INIT_GOTO_TOWER:
super.goToPos(building.getDoor());
state=ESoldierState.GOING_TO_TOWER;
break;
case GOING_TO_TOWER:
if (building.isNotDestroyed() && building.getPlayer() == super.getPlayer()) {
OccupyerPlace place=building.addSoldier(this);
super.setPosition(place.getPosition().calculatePoint(building.getDoor()));
super.enableNothingToDoAction(false);
super.setVisible(false);
if (isBowman()) {
this.inTowerAttackPosition=building.getTowerBowmanSearchPosition(place);
}
state=ESoldierState.AGGRESSIVE;
isInTower=true;
}
 else {
state=ESoldierState.SEARCH_FOR_ENEMIES;
}
break;
}
}

Fixed version (ground truth):
@Override protected void action(){
switch (state) {
case AGGRESSIVE:
    break;
case HITTING:
  hitEnemy(enemy);
if (enemy.getHealth() <= 0) {
  enemy=null;
  state=ESoldierState.SEARCH_FOR_ENEMIES;
  break;
}
case SEARCH_FOR_ENEMIES:
IAttackable oldEnemy=enemy;
enemy=super.getStrategyGrid().getEnemyInSearchArea(getAttackPosition(),super.getMovable(),getSearchDistance(isInTower));
if (oldEnemy != null && oldEnemy != enemy) {
inSaveGotoMode=false;
}
if (enemy == null) {
if (defending) {
building.towerDefended(this);
defending=false;
}
changeStateTo(ESoldierState.AGGRESSIVE);
break;
}
if (isEnemyAttackable(enemy,isInTower)) {
super.lookInDirection(EDirection.getApproxDirection(super.getPos(),enemy.getPos()));
startAttackAnimation(enemy);
state=ESoldierState.HITTING;
}
 else if (!isInTower) {
state=ESoldierState.SEARCH_FOR_ENEMIES;
goToEnemy(enemy);
}
break;
case INIT_GOTO_TOWER:
super.goToPos(building.getDoor());
state=ESoldierState.GOING_TO_TOWER;
break;
case GOING_TO_TOWER:
if (building.isNotDestroyed() && building.getPlayer() == super.getPlayer()) {
OccupyerPlace place=building.addSoldier(this);
super.setPosition(place.getPosition().calculatePoint(building.getDoor()));
super.enableNothingToDoAction(false);
super.setVisible(false);
if (isBowman()) {
this.inTowerAttackPosition=building.getTowerBowmanSearchPosition(place);
}
state=ESoldierState.AGGRESSIVE;
isInTower=true;
}
 else {
state=ESoldierState.SEARCH_FOR_ENEMIES;
}
break;
}
}
Program: 56415
Project: 56415
Buggy source:
protected abstract boolean isEnemyAttackable(IAttackable enemy);

Fixed version (ground truth):
protected abstract boolean isEnemyAttackable(IAttackable enemy,boolean isInTower);
Program: 56417
Project: 56417
Buggy source:
void leaveOccupyableBuilding();

Fixed version (ground truth):
void leaveOccupyableBuilding(ShortPoint2D newPosition);
Program: 56418
Project: 56418
Buggy source:
@Override protected final void killedEvent(){
  setSelected(false);
  if (occupiedArea) {
    MapCircle occupied=getOccupyablePositions();
    super.getGrid().freeOccupiedArea(occupied,super.getPos());
    for (    TowerOccupyer curr : occupiers) {
      curr.soldier.leaveOccupyableBuilding();
    }
    occupiers.clear();
  }
  allOccupyingBuildings.remove(this);
  ShortPoint2D defenderPos=getDefenderPos();
  super.getGrid().getMapObjectsManager().removeMapObjectType(defenderPos.getX(),defenderPos.getY(),EMapObjectType.ATTACKABLE_TOWER);
}

Fixed version (ground truth):
@Override protected final void killedEvent(){
  setSelected(false);
  if (occupiedArea) {
    MapCircle occupied=getOccupyablePositions();
    super.getGrid().freeOccupiedArea(occupied,super.getPos());
    int idx=0;
    FreeMapArea buildingArea=super.getBuildingArea();
    for (    TowerOccupyer curr : occupiers) {
      curr.soldier.leaveOccupyableBuilding(buildingArea.get(idx));
      idx++;
    }
    occupiers.clear();
  }
  allOccupyingBuildings.remove(this);
  ShortPoint2D defenderPos=getDefenderPos();
  super.getGrid().getMapObjectsManager().removeMapObjectType(defenderPos.getX(),defenderPos.getY(),EMapObjectType.ATTACKABLE_TOWER);
}
Program: 56419
Project: 56419
Buggy source:
@Override public void leaveOccupyableBuilding(){
  super.enableNothingToDoAction(true);
  super.setVisible(true);
  state=ESoldierState.AGGRESSIVE;
}

Fixed version (ground truth):
@Override public void leaveOccupyableBuilding(ShortPoint2D newPosition){
  super.setPosition(newPosition);
  super.enableNothingToDoAction(true);
  super.setVisible(true);
  state=ESoldierState.ENEMY_FOUND;
}
Program: 56420
Project: 56420
Buggy source:
@Override protected void startAttackAnimation(IAttackable enemy){
  super.playAction(EAction.ACTION1,BOWMAN_ATTACK_DURATION);
  super.getStrategyGrid().addArrowObject(enemy.getPos(),super.getPos(),super.getPlayer(),0.1f);
}

Fixed version (ground truth):
@Override protected void startAttackAnimation(IAttackable enemy){
  super.playAction(EAction.ACTION1,BOWMAN_ATTACK_DURATION);
  super.getStrategyGrid().addArrowObject(enemy.getPos(),super.getPos(),super.getPlayer(),0.08f);
}
Program: 56421
Project: 56421
Buggy source:
@Override protected boolean checkPathStepPreconditions(ShortPoint2D pathTarget,int step){
  boolean result=!((state == ESoldierState.ENEMY_FOUND || state == ESoldierState.HITTING) && step >= 2);
  if (!result && oldPathTarget == null) {
    oldPathTarget=pathTarget;
  }
  return result;
}

Fixed version (ground truth):
@Override protected boolean checkPathStepPreconditions(ShortPoint2D pathTarget,int step){
  boolean result=!((state == ESoldierState.SEARCH_FOR_ENEMIES || state == ESoldierState.HITTING) && step >= 2);
  if (!result && oldPathTarget == null) {
    oldPathTarget=pathTarget;
  }
  if (state == ESoldierState.GOING_TO_TOWER && (!building.isNotDestroyed() || building.getPlayer() != super.getPlayer())) {
    result=false;
  }
  return result;
}
Program: 56422
Project: 56422
Buggy source:
@Override public void leaveOccupyableBuilding(ShortPoint2D newPosition){
  super.setPosition(newPosition);
  super.enableNothingToDoAction(true);
  super.setVisible(true);
  state=ESoldierState.ENEMY_FOUND;
}

Fixed version (ground truth):
@Override public void leaveOccupyableBuilding(ShortPoint2D newPosition){
  super.setPosition(newPosition);
  super.enableNothingToDoAction(true);
  super.setVisible(true);
  isInTower=false;
  state=ESoldierState.SEARCH_FOR_ENEMIES;
}
Program: 56423
Project: 56423
Buggy source:
@Override public void setDefendingAt(ShortPoint2D pos){
  super.setPosition(pos);
  state=ESoldierState.ENEMY_FOUND;
}

Fixed version (ground truth):
@Override public void setDefendingAt(ShortPoint2D pos){
  super.setPosition(pos);
  state=ESoldierState.SEARCH_FOR_ENEMIES;
}
Program: 56424
Project: 56424
Buggy source:
@Override public void informAboutAttackable(IAttackable other){
  if (state == ESoldierState.AGGRESSIVE && !isInTower) {
    state=ESoldierState.ENEMY_FOUND;
  }
}

Fixed version (ground truth):
@Override public void informAboutAttackable(IAttackable other){
  if (state == ESoldierState.AGGRESSIVE && !isInTower) {
    state=ESoldierState.SEARCH_FOR_ENEMIES;
  }
}
Program: 56425
Project: 56425
Buggy source:
@Override protected Path findWayAroundObstacle(EDirection direction,ShortPoint2D position,Path path){
  if (state == ESoldierState.ENEMY_FOUND) {
    IStrategyGrid grid=super.getStrategyGrid();
    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(direction,position,path);
  }
}

Fixed version (ground truth):
@Override protected Path findWayAroundObstacle(EDirection direction,ShortPoint2D position,Path path){
  if (state == ESoldierState.SEARCH_FOR_ENEMIES) {
    IStrategyGrid grid=super.getStrategyGrid();
    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(direction,position,path);
  }
}
Program: 56426
Project: 56426
Buggy source:
@Override protected void action(){
switch (state) {
case AGGRESSIVE:
    break;
case HITTING:
  hitEnemy(enemy);
if (enemy.getHealth() <= 0) {
  enemy=null;
  state=ESoldierState.ENEMY_FOUND;
  break;
}
case ENEMY_FOUND:
IAttackable oldEnemy=enemy;
enemy=super.getStrategyGrid().getEnemyInSearchArea(super.getMovable());
if (oldEnemy != null && oldEnemy != enemy) {
inSaveGotoMode=false;
}
if (enemy == null) {
if (isInTower) {
building.towerDefended(this);
}
changeStateTo(ESoldierState.AGGRESSIVE);
break;
}
if (isEnemyAttackable(enemy)) {
super.lookInDirection(EDirection.getApproxDirection(super.getPos(),enemy.getPos()));
startAttackAnimation(enemy);
state=ESoldierState.HITTING;
}
 else if (!isInTower) {
state=ESoldierState.ENEMY_FOUND;
goToEnemy(enemy);
}
break;
case INIT_GOTO_TOWER:
super.goToPos(building.getDoor());
state=ESoldierState.GOING_TO_TOWER;
break;
case GOING_TO_TOWER:
ShortPoint2D pos=building.addSoldier(this);
super.setPosition(pos);
super.enableNothingToDoAction(false);
super.setVisible(false);
state=ESoldierState.AGGRESSIVE;
isInTower=true;
break;
}
}

Fixed version (ground truth):
@Override protected void action(){
switch (state) {
case AGGRESSIVE:
    break;
case HITTING:
  hitEnemy(enemy);
if (enemy.getHealth() <= 0) {
  enemy=null;
  state=ESoldierState.SEARCH_FOR_ENEMIES;
  break;
}
case SEARCH_FOR_ENEMIES:
IAttackable oldEnemy=enemy;
enemy=super.getStrategyGrid().getEnemyInSearchArea(super.getMovable());
if (oldEnemy != null && oldEnemy != enemy) {
inSaveGotoMode=false;
}
if (enemy == null) {
if (isInTower) {
building.towerDefended(this);
}
changeStateTo(ESoldierState.AGGRESSIVE);
break;
}
if (isEnemyAttackable(enemy)) {
super.lookInDirection(EDirection.getApproxDirection(super.getPos(),enemy.getPos()));
startAttackAnimation(enemy);
state=ESoldierState.HITTING;
}
 else if (!isInTower) {
state=ESoldierState.SEARCH_FOR_ENEMIES;
goToEnemy(enemy);
}
break;
case INIT_GOTO_TOWER:
super.goToPos(building.getDoor());
state=ESoldierState.GOING_TO_TOWER;
break;
case GOING_TO_TOWER:
if (building.isNotDestroyed() && building.getPlayer() == super.getPlayer()) {
ShortPoint2D pos=building.addSoldier(this);
super.setPosition(pos);
super.enableNothingToDoAction(false);
super.setVisible(false);
state=ESoldierState.AGGRESSIVE;
isInTower=true;
}
 else {
state=ESoldierState.SEARCH_FOR_ENEMIES;
}
break;
}
}
Program: 56427
Project: 56427
Buggy source:
@Override public IAttackable getEnemyInSearchArea(IAttackable movable){
  IAttackable enemy=movableGrid.getEnemyInSearchArea(movable);
  IAttackable tower=null;
  if (tower == null || movable.getMovableType().getTool() == EMaterialType.BOW) {
    return enemy;
  }
 else   if (enemy == null) {
    return tower;
  }
 else {
    int enemyDist=movable.getPos().getOnGridDistTo(enemy.getPos());
    int towerDist=movable.getPos().getOnGridDistTo(tower.getPos());
    if (enemyDist < towerDist) {
      return enemy;
    }
 else {
      return tower;
    }
  }
}

Fixed version (ground truth):
private IAttackable getEnemyInSearchArea(NewMovable movable,HexGridArea area,boolean isBowman){
  byte movablePlayer=movable.getPlayer();
  for (  ShortPoint2D curr : area) {
    short x=curr.getX();
    short y=curr.getY();
    if (0 <= x && x < width && 0 <= y && y < height) {
      IAttackable currAttackable=movableGrid.getMovableAt(x,y);
      if (currAttackable == null && !isBowman) {
        currAttackable=(IAttackable)objectsGrid.getMapObjectAt(x,y,EMapObjectType.ATTACKABLE_TOWER);
      }
      if (currAttackable != null && MovableGrid.isEnemy(movablePlayer,currAttackable)) {
        return currAttackable;
      }
    }
  }
  return null;
}
Program: 56428
Project: 56428
Buggy source:
@Override public void enterPosition(ShortPoint2D position,NewMovable movable,boolean informFullArea){
  movableGrid.movableEntered(position,movable,informFullArea);
}

Fixed version (ground truth):
@Override public void enterPosition(ShortPoint2D position,NewMovable movable,boolean informFullArea){
  movableGrid.movableEntered(position,movable,informFullArea);
  if (movable.isAttackable()) {
    objectsGrid.informTowersAboutAttackble(position,movable,informFullArea,!EMovableType.isBowman(movable.getMovableType()));
  }
}
Program: 56429
Project: 56429
Buggy source:
@Override public void hitWithArrowAt(ArrowObject arrow){
  short x=arrow.getTargetX();
  short y=arrow.getTargetY();
  NewMovable movable=movableGrid.getMovableAt(x,y);
  if (movable != null) {
    movable.hit(arrow.getHitStrength());
    mapObjectsManager.removeMapObject(x,y,arrow);
  }
}

Fixed version (ground truth):
@Override public void hitWithArrowAt(ArrowObject arrow){
  short x=arrow.getTargetX();
  short y=arrow.getTargetY();
  NewMovable movable=movableGrid.getMovableAt(x,y);
  if (movable != null) {
    movable.receiveHit(arrow.getHitStrength());
    mapObjectsManager.removeMapObject(x,y,arrow);
  }
}
Program: 56430
Project: 56430
Buggy source:
@Override public final int getDebugColorAt(int x,int y){
  return landscapeGrid.getDebugColor(x,y);
}

Fixed version (ground truth):
@Override public final int getDebugColorAt(int x,int y){
  return flagsGrid.isMarked((short)x,(short)y) ? Color.GREEN.getARGB() : (objectsGrid.getMapObjectAt((short)x,(short)y,EMapObjectType.ATTACKABLE_TOWER) != null ? Color.RED.getARGB() : (flagsGrid.isBlocked((short)x,(short)y) ? Color.BLACK.getARGB() : (flagsGrid.isProtected((short)x,(short)y) ? Color.BLUE.getARGB() : 0)));
}
Program: 56431
Project: 56431
Buggy source:
private final boolean isEnemy(byte movablePlayer,IAttackable currMovable){
  return currMovable != null && currMovable.getPlayer() != movablePlayer && currMovable.isAttackable();
}

Fixed version (ground truth):
/** 
 * @param player The player id of the first player.
 * @param otherAttackable The other attackable. (Must not be null!)
 * @return
 */
public static boolean isEnemy(byte player,IAttackable otherAttackable){
  return otherAttackable.getPlayer() != player && otherAttackable.isAttackable();
}
Program: 56432
Project: 56432
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 final void movableEntered(ShortPoint2D position,NewMovable movable,boolean informFullArea){
  short x=position.getX();
  short y=position.getY();
  int idx=getIdx(x,y);
  if (idx < 0) {
    System.out.println("String_Node_Str");
  }
  this.movableGrid[idx]=movable;
  if (movable != null && movable.getMovableType() == EMovableType.BEARER) {
    ground.walkOn(x,y);
  }
  if (movable.isAttackable()) {
    IMapArea area;
    if (informFullArea) {
      area=new HexGridArea(x,y,(short)1,Constants.SOLDIER_SEARCH_RADIUS);
    }
 else {
      area=new HexBorderArea(x,y,(short)(Constants.SOLDIER_SEARCH_RADIUS - 1));
    }
    boolean foundOne=false;
    byte movablePlayer=movable.getPlayer();
    for (    ShortPoint2D curr : area) {
      short currX=curr.getX();
      short currY=curr.getY();
      if (0 <= currX && currX < width && 0 <= currY && currY < height) {
        NewMovable currMovable=getMovableAt(currX,currY);
        if (isEnemy(movablePlayer,currMovable)) {
          currMovable.informAboutAttackable(movable);
          if (!foundOne) {
            movable.informAboutAttackable(currMovable);
            foundOne=true;
          }
        }
      }
    }
  }
}

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 final void movableEntered(ShortPoint2D position,NewMovable movable,boolean informFullArea){
  short x=position.getX();
  short y=position.getY();
  int idx=getIdx(x,y);
  if (idx < 0) {
    System.out.println("String_Node_Str");
  }
  this.movableGrid[idx]=movable;
  if (movable != null && movable.getMovableType() == EMovableType.BEARER) {
    ground.walkOn(x,y);
  }
  if (movable.isAttackable()) {
    IMapArea area;
    if (informFullArea) {
      area=new HexGridArea(x,y,(short)1,Constants.SOLDIER_SEARCH_RADIUS);
    }
 else {
      area=new HexBorderArea(x,y,(short)(Constants.SOLDIER_SEARCH_RADIUS - 1));
    }
    boolean foundOne=false;
    byte movablePlayer=movable.getPlayer();
    for (    ShortPoint2D curr : area) {
      short currX=curr.getX();
      short currY=curr.getY();
      if (0 <= currX && currX < width && 0 <= currY && currY < height) {
        NewMovable currMovable=getMovableAt(currX,currY);
        if (currMovable != null && isEnemy(movablePlayer,currMovable)) {
          currMovable.informAboutAttackable(movable);
          if (!foundOne) {
            movable.informAboutAttackable(currMovable);
            foundOne=true;
          }
        }
      }
    }
  }
}
Program: 56433
Project: 56433
Buggy source:
public NewMovable(INewMovableGrid grid,EMovableType movableType,ShortPoint2D position,byte player){
  this.grid=grid;
  this.position=position;
  this.player=player;
  this.strategy=NewMovableStrategy.getStrategy(this,movableType);
  this.movableType=movableType == EMovableType.TEST_MOVABLE ? EMovableType.SWORDSMAN_L1 : movableType;
  this.direction=EDirection.values[RandomSingleton.getInt(0,5)];
  MovableTimer.add(this);
  this.id=nextID++;
  movablesByID.put(this.id,this);
  allMovables.offer(this);
  grid.enterPosition(position,this,true);
}

Fixed version (ground truth):
public NewMovable(INewMovableGrid grid,EMovableType movableType,ShortPoint2D position,byte player){
  this.grid=grid;
  this.position=position;
  this.player=player;
  this.strategy=NewMovableStrategy.getStrategy(this,movableType);
  this.movableType=movableType;
  this.direction=EDirection.values[RandomSingleton.getInt(0,5)];
  MovableTimer.add(this);
  this.id=nextID++;
  movablesByID.put(this.id,this);
  allMovables.offer(this);
  grid.enterPosition(position,this,true);
}
Program: 56434
Project: 56434
Buggy source:
/** 
 * This method may only be called if this movable shall be informed about a movable that's in it's search radius.
 * @param other The other movable.
 */
public final void informAboutAttackable(NewMovable other){
  strategy.informAboutAttackable(other);
}

Fixed version (ground truth):
/** 
 * This method may only be called if this movable shall be informed about a movable that's in it's search radius.
 * @param other The other movable.
 */
@Override public final void informAboutAttackable(IAttackable other){
  strategy.informAboutAttackable(other);
}
Program: 56435
Project: 56435
Buggy source:
/** 
 * Searches for an enemy around the position of the given movable in it's search radius.
 * @param movable The movable searching an enemy.
 * @return The closest enemy or null if none exists in the search radius.
 */
IAttackable getEnemyInSearchArea(IAttackable movable);

Fixed version (ground truth):
/** 
 * Searches for an enemy around the position of the given movable in it's search radius.
 * @param movable The movable searching an enemy.
 * @return The closest enemy or null if none exists in the search radius.
 */
IAttackable getEnemyInSearchArea(NewMovable movable);
Program: 56436
Project: 56436
Buggy source:
@Override protected void hitEnemy(IAttackable enemy){
  enemy.hit(0.1f);
}

Fixed version (ground truth):
@Override protected void hitEnemy(IAttackable enemy){
  enemy.receiveHit(0.1f);
}
Program: 56438
Project: 56438
Buggy source:
@Override public NewMovable getEnemyInSearchArea(IAttackable movable){
  return null;
}

Fixed version (ground truth):
@Override public NewMovable getEnemyInSearchArea(NewMovable movable){
  return null;
}
Program: 56439
Project: 56439
Buggy source:
@Override public void hitWithArrowAt(short x,short y,float hitStrength){
  NewMovable movable=movableGrid.getMovableAt(x,y);
  if (movable != null) {
    movable.hit(hitStrength);
  }
}

Fixed version (ground truth):
@Override public void hitWithArrowAt(ArrowObject arrow){
  short x=arrow.getTargetX();
  short y=arrow.getTargetY();
  NewMovable movable=movableGrid.getMovableAt(x,y);
  if (movable != null) {
    movable.hit(arrow.getHitStrength());
    mapObjectsManager.removeMapObject(x,y,arrow);
  }
}
Program: 56440
Project: 56440
Buggy source:
/** 
 * Adds an arrow object to the map flying from
 * @param attackedPos Attacked position.
 * @param shooterPos Position of the shooter.
 * @param hitStrength Strength of the hit.
 */
public void addArrowObject(ShortPoint2D attackedPos,ShortPoint2D shooterPos,float hitStrength){
  ArrowObject arrow=new ArrowObject(grid,attackedPos,shooterPos,hitStrength);
  addMapObject(attackedPos,arrow);
  timingQueue.offer(new TimeEvent(arrow,arrow.getEndTime(),false));
  timingQueue.offer(new TimeEvent(arrow,arrow.getEndTime() + ArrowObject.DECOMPOSE_DELAY,true));
}

Fixed version (ground truth):
/** 
 * Adds an arrow object to the map flying from
 * @param attackedPos Attacked position.
 * @param shooterPos Position of the shooter.
 * @param hitStrength Strength of the hit.
 */
public void addArrowObject(ShortPoint2D attackedPos,ShortPoint2D shooterPos,float hitStrength){
  ArrowObject arrow=new ArrowObject(grid,attackedPos,shooterPos,hitStrength);
  addMapObject(attackedPos,arrow);
  timingQueue.offer(new TimeEvent(arrow,arrow.getEndTime(),false));
  timingQueue.offer(new TimeEvent(arrow,arrow.getEndTime() + ArrowObject.MIN_DECOMPOSE_DELAY * (1 + RandomSingleton.nextF()),true));
}
Program: 56441
Project: 56441
Buggy source:
@Override protected void startAttackAnimation(IAttackable enemy){
  super.playAction(EAction.ACTION1,BOWMAN_ATTACK_DURATION);
  super.getStrategyGrid().addArrowObject(enemy.getPos(),super.getPos(),0.7f);
}

Fixed version (ground truth):
@Override protected void startAttackAnimation(IAttackable enemy){
  super.playAction(EAction.ACTION1,BOWMAN_ATTACK_DURATION);
  super.getStrategyGrid().addArrowObject(enemy.getPos(),super.getPos(),0.1f);
}
Program: 56442
Project: 56442
Buggy source:
@Override protected void changeState(){
  grid.hitWithArrowAt(super.getX(),super.getY(),hitStrength);
}

Fixed version (ground truth):
@Override protected void changeState(){
  grid.hitWithArrowAt(this);
}
Program: 56443
Project: 56443
Buggy source:
/** 
 * If a movable is currently standing on the given position, it will be hit with the given hitStrength.
 * @param x X coordinate of the position.
 * @param y Y coordinate of the position.
 * @param hitStrength Strength of the hit.
 */
void hitWithArrowAt(short x,short y,float hitStrength);

Fixed version (ground truth):
/** 
 * If a movable is currently standing on the given position, it will be hit with the given arrow.
 * @param the arrow hitting the position.
 */
void hitWithArrowAt(ArrowObject arrowObject);
Program: 56444
Project: 56444
Buggy source:
/** 
 * Draws a player border at a given position.
 * @param player The player.
 */
public void drawPlayerBorderObject(int x,int y,byte player){
  int color=context.getPlayerColor(player).getABGR();
  draw(imageProvider.getSettlerSequence(FILE_BORDERPOST,65).getImageSafe(0),x,y,color);
}

Fixed version (ground truth):
/** 
 * Draws a player border at a given position.
 * @param player The player.
 */
public void drawPlayerBorderObject(int x,int y,byte player){
  byte fogstatus=context.getVisibleStatus(x,y);
  if (fogstatus == 0) {
    return;
  }
  float base=getColor(fogstatus);
  Color color=context.getPlayerColor(player);
  draw(imageProvider.getSettlerSequence(FILE_BORDERPOST,65).getImageSafe(0),x,y,color,base);
}
Program: 56445
Project: 56445
Buggy source:
@Override public void onDrawFrame(GL10 gl){
  GLES10.glClearColor(0,0,0,1);
  GLES10.glClear(GL10.GL_DEPTH_BUFFER_BIT | GL10.GL_COLOR_BUFFER_BIT);
  area.drawArea(drawcontext);
}

Fixed version (ground truth):
@Override public void onDrawFrame(GL10 gl){
  GLES10.glClearColor(0,0,0,1);
  GLES10.glClear(GL10.GL_DEPTH_BUFFER_BIT | GL10.GL_COLOR_BUFFER_BIT);
  GLES10.glScalef(1,1,.5f);
  area.drawArea(drawcontext);
}
Program: 56446
Project: 56446
Buggy source:
void leaveOccupyableBuilding(ShortPoint2D pos);

Fixed version (ground truth):
void leaveOccupyableBuilding();
Program: 56447
Project: 56447
Buggy source:
void setSoldier(IBuildingOccupyableMovable soldier);

Fixed version (ground truth):
ShortPoint2D setSoldier(IBuildingOccupyableMovable soldier);
Program: 56448
Project: 56448
Buggy source:
@Override protected final void killedEvent(){
  setSelected(false);
  if (occupiedArea) {
    MapCircle occupied=getOccupyablePositions();
    super.getGrid().freeOccupiedArea(occupied,super.getPos());
    int idx=0;
    for (    TowerOccupyer curr : occupiers) {
      curr.soldier.leaveOccupyableBuilding(super.getBuildingArea().get(idx));
      idx++;
    }
    occupiers.clear();
  }
  allOccupyingBuildings.remove(this);
}

Fixed version (ground truth):
@Override protected final void killedEvent(){
  setSelected(false);
  if (occupiedArea) {
    MapCircle occupied=getOccupyablePositions();
    super.getGrid().freeOccupiedArea(occupied,super.getPos());
    for (    TowerOccupyer curr : occupiers) {
      curr.soldier.leaveOccupyableBuilding();
    }
    occupiers.clear();
  }
  allOccupyingBuildings.remove(this);
}
Program: 56449
Project: 56449
Buggy source:
@Override public final void setSoldier(IBuildingOccupyableMovable soldier){
  for (  OccupyerPlace curr : emptyPlaces) {
    if (curr.getType() == soldier.getSoldierType()) {
      emptyPlaces.remove(curr);
      occupiers.add(new TowerOccupyer(curr,soldier));
      break;
    }
  }
  occupyArea();
  soldier.setSelected(super.isSelected());
}

Fixed version (ground truth):
@Override public final ShortPoint2D setSoldier(IBuildingOccupyableMovable soldier){
  OccupyerPlace freePosition=findFreePositionFor(soldier.getSoldierType());
  emptyPlaces.remove(freePosition);
  occupiers.add(new TowerOccupyer(freePosition,soldier));
  occupyArea();
  soldier.setSelected(super.isSelected());
  return freePosition.getPosition().calculatePoint(super.getPos());
}
Program: 56450
Project: 56450
Buggy source:
@Override protected final void constructionFinishedEvent(){
  for (  RelativePoint curr : super.getBuildingType().getAttackers()) {
    super.getGrid().getMapObjectsManager().addSimpleMapObject(curr.calculatePoint(super.getPos()),EMapObjectType.ATTACKABLE_TOWER,false,super.getPlayer());
  }
}

Fixed version (ground truth):
@Override protected final void constructionFinishedEvent(){
  super.getGrid().getMapObjectsManager().addAttackableTowerObject(super.getDoor(),this);
}
Program: 56451
Project: 56451
Buggy source:
@Override public NewMovable getEnemyInSearchArea(IAttackable movable){
  return movableGrid.getEnemyInSearchArea(movable);
}

Fixed version (ground truth):
@Override public IAttackable getEnemyInSearchArea(IAttackable movable){
  IAttackable enemy=movableGrid.getEnemyInSearchArea(movable);
  IAttackable tower=null;
  if (enemy == null) {
    return tower;
  }
 else   if (tower == null) {
    return enemy;
  }
 else {
    int enemyDist=movable.getPos().getOnGridDistTo(enemy.getPos());
    int towerDist=movable.getPos().getOnGridDistTo(tower.getPos());
    if (enemyDist < towerDist) {
      return enemy;
    }
 else {
      return tower;
    }
  }
}
Program: 56452
Project: 56452
Buggy source:
@Override public final int getDebugColorAt(int x,int y){
  short value=(short)(partitionsGrid.getPartitionAt((short)x,(short)y) + 1);
  return Color.getARGB((value % 3) * 0.33f,((value / 3) % 3) * 0.33f,((value / 9) % 3) * 0.33f,1);
}

Fixed version (ground truth):
@Override public final int getDebugColorAt(int x,int y){
  return flagsGrid.isMarked((short)x,(short)y) ? Color.GREEN.getARGB() : (objectsGrid.getMapObjectAt((short)x,(short)y,EMapObjectType.ATTACKABLE_TOWER) != null ? Color.RED.getARGB() : (flagsGrid.isBlocked((short)x,(short)y) ? Color.BLACK.getARGB() : (flagsGrid.isProtected((short)x,(short)y) ? Color.BLUE.getARGB() : 0)));
}
Program: 56453
Project: 56453
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 final void movableEntered(ShortPoint2D position,NewMovable movable,boolean informFullArea){
  short x=position.getX();
  short y=position.getY();
  int idx=getIdx(x,y);
  if (idx < 0) {
    System.out.println("String_Node_Str");
  }
  this.movableGrid[idx]=movable;
  if (movable != null && movable.getMovableType() == EMovableType.BEARER) {
    ground.walkOn(x,y);
  }
  if (movable.isAttackable()) {
    IMapArea area;
    if (informFullArea) {
      area=new HexGridArea(x,y,(short)1,Constants.SOLDIER_SEARCH_RADIUS);
    }
 else {
      area=new HexBorderArea(x,y,(short)(Constants.SOLDIER_SEARCH_RADIUS - 1));
    }
    boolean foundOne=false;
    byte movablePlayer=movable.getPlayer();
    for (    ShortPoint2D curr : area) {
      short currX=curr.getX();
      short currY=curr.getY();
      if (0 <= currX && currX < width && 0 <= currY && currY < height) {
        NewMovable currMovable=getMovableAt(currX,currY);
        if (currMovable != null && currMovable.getPlayer() != movablePlayer) {
          currMovable.informAboutAttackable(movable);
          if (!foundOne) {
            movable.informAboutAttackable(currMovable);
            foundOne=true;
          }
        }
      }
    }
  }
}

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 final void movableEntered(ShortPoint2D position,NewMovable movable,boolean informFullArea){
  short x=position.getX();
  short y=position.getY();
  int idx=getIdx(x,y);
  if (idx < 0) {
    System.out.println("String_Node_Str");
  }
  this.movableGrid[idx]=movable;
  if (movable != null && movable.getMovableType() == EMovableType.BEARER) {
    ground.walkOn(x,y);
  }
  if (movable.isAttackable()) {
    IMapArea area;
    if (informFullArea) {
      area=new HexGridArea(x,y,(short)1,Constants.SOLDIER_SEARCH_RADIUS);
    }
 else {
      area=new HexBorderArea(x,y,(short)(Constants.SOLDIER_SEARCH_RADIUS - 1));
    }
    boolean foundOne=false;
    byte movablePlayer=movable.getPlayer();
    for (    ShortPoint2D curr : area) {
      short currX=curr.getX();
      short currY=curr.getY();
      if (0 <= currX && currX < width && 0 <= currY && currY < height) {
        NewMovable currMovable=getMovableAt(currX,currY);
        if (isEnemy(movablePlayer,currMovable)) {
          currMovable.informAboutAttackable(movable);
          if (!foundOne) {
            movable.informAboutAttackable(currMovable);
            foundOne=true;
          }
        }
      }
    }
  }
}
Program: 56454
Project: 56454
Buggy source:
public NewMovable getEnemyInSearchArea(IAttackable movable){
  ShortPoint2D pos=movable.getPos();
  HexGridArea area=new HexGridArea(pos.getX(),pos.getY(),(short)1,Constants.SOLDIER_SEARCH_RADIUS);
  byte movablePlayer=movable.getPlayer();
  for (  ShortPoint2D curr : area) {
    short x=curr.getX();
    short y=curr.getY();
    if (0 <= x && x < width && 0 <= y && y < height) {
      NewMovable currMovable=getMovableAt(x,y);
      if (currMovable != null && currMovable.getPlayer() != movablePlayer) {
        return currMovable;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public IAttackable getEnemyInSearchArea(IAttackable movable){
  ShortPoint2D pos=movable.getPos();
  HexGridArea area=new HexGridArea(pos.getX(),pos.getY(),(short)1,Constants.SOLDIER_SEARCH_RADIUS);
  byte movablePlayer=movable.getPlayer();
  for (  ShortPoint2D curr : area) {
    short x=curr.getX();
    short y=curr.getY();
    if (0 <= x && x < width && 0 <= y && y < height) {
      IAttackable currMovable=getMovableAt(x,y);
      if (isEnemy(movablePlayer,currMovable)) {
        return currMovable;
      }
    }
  }
  return null;
}
Program: 56455
Project: 56455
Buggy source:
public ObjectsGrid(short width,short height){
  this.width=width;
  this.objectsGrid=new AbstractHexMapObject[width * height];
}

Fixed version (ground truth):
public ObjectsGrid(short width,short height){
  this.width=width;
  this.height=height;
  this.objectsGrid=new AbstractHexMapObject[width * height];
}
Program: 56456
Project: 56456
Buggy source:
@Override public void leaveOccupyableBuilding(ShortPoint2D pos){
  super.enableNothingToDoAction(true);
  super.setPosition(pos);
  super.setVisible(true);
  state=ESoldierState.AGGRESSIVE;
}

Fixed version (ground truth):
@Override public void leaveOccupyableBuilding(){
  super.enableNothingToDoAction(true);
  super.setVisible(true);
  state=ESoldierState.AGGRESSIVE;
}
Program: 56457
Project: 56457
Buggy source:
@Override protected void action(){
switch (state) {
case AGGRESSIVE:
    break;
case HITTING:
  hitEnemy(enemy);
if (enemy.getHealth() <= 0) {
  enemy=null;
  state=ESoldierState.ENEMY_FOUND;
  break;
}
case ENEMY_FOUND:
enemy=super.getStrategyGrid().getEnemyInSearchArea(super.getMovable());
if (enemy == null) {
changeStateTo(ESoldierState.AGGRESSIVE);
break;
}
if (isEnemyAttackable(enemy)) {
super.lookInDirection(EDirection.getApproxDirection(super.getPos(),enemy.getPos()));
startAttackAnimation(enemy);
state=ESoldierState.HITTING;
}
 else {
super.goToPos(enemy.getPos());
}
break;
case INIT_GOTO_TOWER:
super.goToPos(building.getDoor());
state=ESoldierState.GOING_TO_TOWER;
break;
case GOING_TO_TOWER:
super.enableNothingToDoAction(false);
super.setVisible(false);
building.setSoldier(this);
state=ESoldierState.IN_TOWER;
break;
case IN_TOWER:
break;
}
}

Fixed version (ground truth):
@Override protected void action(){
switch (state) {
case AGGRESSIVE:
    break;
case HITTING:
  hitEnemy(enemy);
if (enemy.getHealth() <= 0) {
  enemy=null;
  state=ESoldierState.ENEMY_FOUND;
  break;
}
case ENEMY_FOUND:
enemy=super.getStrategyGrid().getEnemyInSearchArea(super.getMovable());
if (enemy == null) {
changeStateTo(ESoldierState.AGGRESSIVE);
break;
}
if (isEnemyAttackable(enemy)) {
super.lookInDirection(EDirection.getApproxDirection(super.getPos(),enemy.getPos()));
startAttackAnimation(enemy);
state=ESoldierState.HITTING;
}
 else {
super.goToPos(enemy.getPos());
}
break;
case INIT_GOTO_TOWER:
super.goToPos(building.getDoor());
state=ESoldierState.GOING_TO_TOWER;
break;
case GOING_TO_TOWER:
ShortPoint2D pos=building.setSoldier(this);
super.setPosition(pos);
super.enableNothingToDoAction(false);
super.setVisible(false);
state=ESoldierState.IN_TOWER;
break;
case IN_TOWER:
break;
}
}
Program: 56458
Project: 56458
Buggy source:
public final boolean isAttackable(){
  return movableType.isMoveToAble();
}

Fixed version (ground truth):
@Override public final boolean isAttackable(){
  return movableType.isMoveToAble();
}
Program: 56459
Project: 56459
Buggy source:
@Override public void setOccupyableBuilding(IOccupyableBuilding building){
  this.building=building;
  this.state=ESoldierState.INIT_GOTO_TOWER;
}

Fixed version (ground truth):
@Override public void setOccupyableBuilding(IOccupyableBuilding building){
  this.building=building;
  this.state=ESoldierState.INIT_GOTO_TOWER;
  super.abortPath();
}
Program: 56460
Project: 56460
Buggy source:
private void finishConstruction(){
  constructionProgress=1;
  this.state=STATE_CONSTRUCTED;
  stacks=createWorkStacks();
  constructionFinishedEvent();
}

Fixed version (ground truth):
private void finishConstruction(){
  constructionProgress=1;
  this.state=STATE_CONSTRUCTED;
  if (getFlagType() == EMapObjectType.FLAG_DOOR) {
    createWorkStacks();
  }
  constructionFinishedEvent();
}
Program: 56461
Project: 56461
Buggy source:
private List<RequestStack> createWorkStacks(){
  RelativeStack[] requestStacks=type.getRequestStacks();
  List<RequestStack> result=new LinkedList<RequestStack>();
  for (int i=0; i < requestStacks.length; i++) {
    RelativeStack currStack=requestStacks[i];
    if (currStack.requiredForBuild() == 0) {
      result.add(new RequestStack(grid.getRequestStackGrid(),currStack.calculatePoint(this.pos),currStack.getType()));
    }
  }
  return result;
}

Fixed version (ground truth):
protected void createWorkStacks(){
  RelativeStack[] requestStacks=type.getRequestStacks();
  List<RequestStack> result=new LinkedList<RequestStack>();
  for (int i=0; i < requestStacks.length; i++) {
    RelativeStack currStack=requestStacks[i];
    if (currStack.requiredForBuild() == 0) {
      result.add(new RequestStack(grid.getRequestStackGrid(),currStack.calculatePoint(this.pos),currStack.getType()));
    }
  }
  this.stacks=result;
}
Program: 56462
Project: 56462
Buggy source:
private void requestDiggers(){
  if (shouldBeFlatened()) {
    RelativePoint[] blocked=getBuildingType().getBlockedTiles();
    int heightSum=0;
    for (    RelativePoint curr : blocked) {
      ShortPoint2D currPos=curr.calculatePoint(this.pos);
      heightSum+=this.grid.getHeightAt(currPos);
    }
    this.heightAvg=(byte)(heightSum / blocked.length);
    byte numberOfDiggers=(byte)Math.ceil(((float)blocked.length) / Constants.TILES_PER_DIGGER);
    grid.requestDiggers(this,numberOfDiggers);
  }
}

Fixed version (ground truth):
private void requestDiggers(){
  if (shouldBeFlatened()) {
    RelativePoint[] protectedTiles=getBuildingType().getProtectedTiles();
    int heightSum=0;
    for (    RelativePoint curr : protectedTiles) {
      ShortPoint2D currPos=curr.calculatePoint(this.pos);
      heightSum+=this.grid.getHeightAt(currPos);
    }
    this.heightAvg=(byte)(heightSum / protectedTiles.length);
    byte numberOfDiggers=(byte)Math.ceil(((float)protectedTiles.length) / Constants.TILES_PER_DIGGER);
    grid.requestDiggers(this,numberOfDiggers);
  }
}
Program: 56463
Project: 56463
Buggy source:
private void releaseRequestStacks(){
  for (  RequestStack curr : stacks) {
    curr.releaseRequests();
  }
  stacks=new LinkedList<RequestStack>();
}

Fixed version (ground truth):
protected void releaseRequestStacks(){
  for (  RequestStack curr : stacks) {
    curr.releaseRequests();
  }
  stacks=new LinkedList<RequestStack>();
}
Program: 56464
Project: 56464
Buggy source:
@Override protected final void constructionFinishedEvent(){
  super.getGrid().requestBuildingWorker(super.getBuildingType().getWorkerType(),this);
}

Fixed version (ground truth):
@Override protected final void constructionFinishedEvent(){
  requestWorker();
}
Program: 56465
Project: 56465
Buggy source:
@Override public final void occupyBuilding(IManageableWorker worker){
  if (super.isNotDestroyed()) {
    this.worker=worker;
    super.placeFlag(true);
  }
}

Fixed version (ground truth):
@Override public final void occupyBuilding(IManageableWorker worker){
  if (super.isNotDestroyed()) {
    this.worker=worker;
    super.placeFlag(true);
    super.createWorkStacks();
  }
}
Program: 56466
Project: 56466
Buggy source:
private void dropCurrMaterial(){
  if (super.getMaterial() != EMaterialType.NO_MATERIAL) {
    super.getStrategyGrid().dropMaterial(super.getPos(),super.getMaterial(),true);
    super.setMaterial(EMaterialType.NO_MATERIAL);
  }
}

Fixed version (ground truth):
private void dropCurrMaterial(){
  EMaterialType material=super.getMaterial();
  if (material.isDroppable()) {
    super.getStrategyGrid().dropMaterial(super.getPos(),material,true);
    super.setMaterial(EMaterialType.NO_MATERIAL);
  }
}
Program: 56467
Project: 56467
Buggy source:
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  dropCurrMaterial();
  if (isJobless()) {
    super.getStrategyGrid().removeJobless(this);
  }
}

Fixed version (ground truth):
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  dropCurrMaterial();
  if (building != null) {
    building.leaveBuilding(this);
  }
  if (isJobless()) {
    super.getStrategyGrid().removeJobless(this);
  }
}
Program: 56468
Project: 56468
Buggy source:
public void stopWatchdog(){
  if (executingTimerTask != null) {
    executingTimerTask.cancel();
  }
}

Fixed version (ground truth):
public void stopWatchdog(){
  if (watchdogTimerTask != null) {
    watchdogTimerTask.cancel();
  }
}
Program: 56469
Project: 56469
Buggy source:
public void setBlockingListener(ActionThreadBlockingListener listener){
  this.listener=listener;
}

Fixed version (ground truth):
/** 
 * Sets the listener to be notified on blocking state changes.
 * @param listener
 */
public void setBlockingListener(ActionThreadBlockingListener listener){
synchronized (blockingListenerMutex) {
    this.blockingListener=listener;
  }
}
Program: 56470
Project: 56470
Buggy source:
@Override public void fireAction(Action action){
  toFire.offer(action);
  fireStartTime.add(System.currentTimeMillis());
}

Fixed version (ground truth):
/** 
 * Schedules an action to be fired.
 */
@Override public void fireAction(Action action){
  toFire.offer(new FireringAction(action,System.currentTimeMillis()));
}
Program: 56471
Project: 56471
Buggy source:
protected void startWatchdog(long startTime){
  long destTime=startTime + ACTION_FIRERER_TIMEOUT;
  long timeUntilFreezeState=System.currentTimeMillis() - destTime;
  if (timeUntilFreezeState <= 0) {
    sendIsBlocking(true);
  }
 else {
    executingTimerTask=new TimerTask(){
      @Override public void run(){
        sendIsBlocking(true);
      }
    }
;
    watchdogTimer.schedule(executingTimerTask,timeUntilFreezeState);
  }
}

Fixed version (ground truth):
protected void startWatchdog(long startTime){
  long destTime=startTime + ACTION_FIRERER_TIMEOUT;
  long timeUntilFreezeState=System.currentTimeMillis() - destTime;
  if (timeUntilFreezeState <= 0) {
    sendIsBlocking(true);
  }
 else {
    watchdogTimerTask=new TimerTask(){
      @Override public void run(){
        sendIsBlocking(true);
      }
    }
;
    watchdogTimer.schedule(watchdogTimerTask,timeUntilFreezeState);
  }
}
Program: 56472
Project: 56472
Buggy source:
private void sendIsBlocking(boolean blocking){
  if (isBlockingSent != blocking && listener != null) {
    listener.actionThreadSlow(blocking);
  }
  isBlockingSent=blocking;
}

Fixed version (ground truth):
private void sendIsBlocking(boolean blocking){
synchronized (blockingListenerMutex) {
    if (isBlockingSent != blocking && blockingListener != null) {
      blockingListener.actionThreadSlow(blocking);
    }
    isBlockingSent=blocking;
  }
}
Program: 56473
Project: 56473
Buggy source:
public ActionFirerer(ActionFireable fireTo){
  this.fireTo=fireTo;
  this.thread=new ActionFirererThread();
  this.thread.setDaemon(true);
  this.thread.start();
}

Fixed version (ground truth):
/** 
 * Creates a new action firerer and starts it.
 * @param fireTo The object we should fire to.
 */
public ActionFirerer(ActionFireable fireTo){
  this.fireTo=fireTo;
  this.thread=new ActionFirererThread();
  this.thread.setDaemon(true);
  this.thread.start();
}