nus-yam/ex-repair huggingface dataset:
Program: 56474
Project: 56474
Buggy source:
/** 
 * Tests if this movable can receive moveTo requests and if so, directs it to go to the given position.
 * @param targetPosition
 */
public final void moveTo(ShortPoint2D targetPosition){
  if (movableType.isMoveToAble() && state != ENewMovableState.SLEEPING) {
    this.moveToRequest=targetPosition;
  }
}

Fixed version (ground truth):
/** 
 * Tests if this movable can receive moveTo requests and if so, directs it to go to the given position.
 * @param targetPosition
 */
public final void moveTo(ShortPoint2D targetPosition){
  if (movableType.isMoveToAble() && state != ENewMovableState.SLEEPING && strategy.isMoveToAble()) {
    this.moveToRequest=targetPosition;
  }
}
Program: 56475
Project: 56475
Buggy source:
/** 
 * @param duration in seconds<br> NOTE: duration MAY NEVER BE 0.0f
 */
protected final void setDuration(float duration){
  this.duration=(int)(duration * 1000);
  this.startTime=NetworkTimer.getGameTime();
}

Fixed version (ground truth):
/** 
 * @param duration in seconds<br> NOTE: duration MAY NEVER BE LESS OR EQUAL TO 0.0f
 */
protected final void setDuration(float duration){
}
Program: 56476
Project: 56476
Buggy source:
@Override protected float getGrowthDuration(){
  return 0;
}

Fixed version (ground truth):
@Override protected float getGrowthDuration(){
  return 0.01f;
}
Program: 56477
Project: 56477
Buggy source:
@Override protected void action(){
switch (state) {
case AGGRESSIVE:
    break;
case HITTING:
  hitEnemy(enemy);
case ENEMY_FOUND:
enemy=super.getStrategyGrid().getEnemyInSearchArea(super.getMovable());
if (enemy == null) {
state=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) {
state=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;
}
}
Program: 56478
Project: 56478
Buggy source:
@Override public boolean hasNoMovableAt(short x,short y){
  return movableGrid.getMovableAt(x,y) == null;
}

Fixed version (ground truth):
@Override public boolean hasNoMovableAt(short x,short y){
  return movableGrid.hasNoMovableAt(x,y);
}
Program: 56479
Project: 56479
Buggy source:
@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)));
}

Fixed version (ground truth):
@Override public final int getDebugColorAt(int x,int y){
  return Color.BLACK.getARGB();
}
Program: 56480
Project: 56480
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();
  this.movableGrid[getIdx(x,y)]=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) {
      NewMovable currMovable=getMovableAt(curr.getX(),curr.getY());
      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 (currMovable != null && currMovable.getPlayer() != movablePlayer) {
          currMovable.informAboutAttackable(movable);
          if (!foundOne) {
            movable.informAboutAttackable(currMovable);
            foundOne=true;
          }
        }
      }
    }
  }
}
Program: 56481
Project: 56481
Buggy source:
public MovableGrid(short width,short height,IWalkableGround ground){
  this.width=width;
  this.ground=ground;
  this.movableGrid=new NewMovable[width * height];
}

Fixed version (ground truth):
public MovableGrid(short width,short height,IWalkableGround ground){
  this.width=width;
  this.height=height;
  this.ground=ground;
  this.movableGrid=new NewMovable[width * height];
}
Program: 56482
Project: 56482
Buggy source:
private void flockToDecentralize(){
  short x=position.getX(), y=position.getY();
  HexGridArea area=new HexGridArea(x,y,(short)1,NOTHING_TO_DO_MAX_RADIUS);
  float dx=0, dy=0;
  HexGridAreaIterator iter=area.iterator();
  while (iter.hasNext()) {
    short currX=iter.getNextX();
    short currY=iter.getNextY();
    int factor;
    if (!grid.isInBounds(currX,currY) || grid.isBlocked(currX,currY)) {
      factor=iter.getCurrRadius() == 1 ? 6 : 2;
    }
 else     if (grid.getMovableAt(currX,currY) != null) {
      factor=NOTHING_TO_DO_MAX_RADIUS - iter.getCurrRadius() + 1;
    }
 else {
      continue;
    }
    dx+=(short)(x - currX) * factor;
    dy+=(short)(y - currY) * factor;
  }
  dx+=direction.gridDeltaX;
  dy+=direction.gridDeltaY;
  if (Math.abs(dx) + Math.abs(dy) >= 4f) {
    this.goInDirection(EDirection.getApproxDirection(0,0,(int)dx,(int)dy));
    doingNothingProbablity=Math.min(doingNothingProbablity + 0.02f,0.1f);
  }
 else {
    doingNothingProbablity=Math.max(doingNothingProbablity - 0.02f,0.06f);
  }
}

Fixed version (ground truth):
private void flockToDecentralize(){
  short x=position.getX(), y=position.getY();
  HexGridArea area=new HexGridArea(x,y,(short)1,NOTHING_TO_DO_MAX_RADIUS);
  int dx=0, dy=0;
  HexGridAreaIterator iter=area.iterator();
  while (iter.hasNext()) {
    short currX=iter.getNextX();
    short currY=iter.getNextY();
    int factor;
    if (!grid.isInBounds(currX,currY) || grid.isBlocked(currX,currY)) {
      factor=iter.getCurrRadius() == 1 ? 6 : 2;
    }
 else     if (!grid.hasNoMovableAt(currX,currY)) {
      factor=NOTHING_TO_DO_MAX_RADIUS - iter.getCurrRadius() + 1;
    }
 else {
      continue;
    }
    dx+=(x - currX) * factor;
    dy+=(y - currY) * factor;
  }
  dx+=direction.gridDeltaX;
  dy+=direction.gridDeltaY;
  if (Math.abs(dx) + Math.abs(dy) >= 4f) {
    this.goInDirection(EDirection.getApproxDirection(0,0,dx,dy));
    doingNothingProbablity=Math.min(doingNothingProbablity + 0.02f,0.1f);
  }
 else {
    doingNothingProbablity=Math.max(doingNothingProbablity - 0.02f,0.06f);
  }
}
Program: 56483
Project: 56483
Buggy source:
@Override public void timerEvent(){
switch (state) {
case SLEEPING:
    return;
case DOING_NOTHING:
  if (visible && enableNothingToDo) {
    doingNothingAction();
  }
break;
case GOING_SINGLE_STEP:
case PLAYING_ACTION:
progressCurrentAction();
break;
case PATHING:
pathingAction();
break;
}
if (moveToRequest != null) {
switch (state) {
case PATHING:
if (progress < 1) {
break;
}
setState(ENewMovableState.DOING_NOTHING);
case DOING_NOTHING:
ShortPoint2D oldTargetPos;
if (path != null) {
oldTargetPos=path.getTargetPos();
}
 else {
oldTargetPos=null;
}
goToPos(moveToRequest);
moveToRequest=null;
if (path != null) {
this.strategy.moveToPathSet(oldTargetPos,path.getTargetPos());
}
break;
}
}
if (state == ENewMovableState.DOING_NOTHING) {
strategy.action();
}
}

Fixed version (ground truth):
@Override public void timerEvent(){
  if (health <= 0) {
    return;
  }
switch (state) {
case SLEEPING:
    return;
case DOING_NOTHING:
  if (visible && enableNothingToDo) {
    doingNothingAction();
  }
break;
case GOING_SINGLE_STEP:
case PLAYING_ACTION:
progressCurrentAction();
break;
case PATHING:
pathingAction();
break;
}
if (moveToRequest != null) {
switch (state) {
case PATHING:
if (progress < 1) {
break;
}
setState(ENewMovableState.DOING_NOTHING);
case DOING_NOTHING:
ShortPoint2D oldTargetPos;
if (path != null) {
oldTargetPos=path.getTargetPos();
}
 else {
oldTargetPos=null;
}
goToPos(moveToRequest);
moveToRequest=null;
if (path != null) {
this.strategy.moveToPathSet(oldTargetPos,path.getTargetPos());
}
break;
}
}
if (state == ENewMovableState.DOING_NOTHING) {
strategy.action();
}
}
Program: 56484
Project: 56484
Buggy source:
private void followPath(Path path){
  this.path=path;
  setState(ENewMovableState.PATHING);
  this.movableAction=EAction.NO_ACTION;
  progress=1;
}

Fixed version (ground truth):
private void followPath(Path path){
  this.path=path;
  setState(ENewMovableState.PATHING);
  this.movableAction=EAction.NO_ACTION;
  progress=1;
  pathingAction();
}
Program: 56485
Project: 56485
Buggy source:
/** 
 * Forces the movable to go a step in the given direction (if it is not blocked).
 * @param direction direction to go
 */
final void forceGoInDirection(EDirection direction){
  ShortPoint2D targetPos=direction.getNextHexPoint(position);
  this.direction=direction;
  this.followPath(new Path(targetPos));
  this.goSinglePathStep();
  setState(ENewMovableState.PATHING);
}

Fixed version (ground truth):
/** 
 * Forces the movable to go a step in the given direction (if it is not blocked).
 * @param direction direction to go
 */
final void forceGoInDirection(EDirection direction){
  ShortPoint2D targetPos=direction.getNextHexPoint(position);
  this.direction=direction;
  this.followPath(new Path(targetPos));
  setState(ENewMovableState.PATHING);
}
Program: 56486
Project: 56486
Buggy source:
private <T extends Image>void drawSequences(GLDrawContext gl2,int width,int height,SequenceList<T> sequences){
  gl2.glTranslatef(offsetX,offsetY,0);
  int y=0;
  int seqIndex=0;
  TextDrawer drawer=JOGLTextDrawer.getTextDrawer(EFontSize.NORMAL,null);
  for (int i=0; i < sequences.size(); i++) {
    Sequence<T> seq=sequences.get(i);
    int maxheight;
    maxheight=drawSequence(gl2,width,height,y,seq);
    gl2.color(0,0,0,1);
    drawer.drawString(20,y + 20,seqIndex + "String_Node_Str");
    seqIndex++;
    y-=maxheight + 40;
  }
}

Fixed version (ground truth):
private <T extends Image>void drawSequences(GLDrawContext gl2,int width,int height,SequenceList<T> sequences){
  gl2.glTranslatef(offsetX,offsetY,0);
  int y=0;
  int seqIndex=0;
  TextDrawer drawer=gl2.getTextDrawer(EFontSize.NORMAL);
  for (int i=0; i < sequences.size(); i++) {
    Sequence<T> seq=sequences.get(i);
    int maxheight;
    maxheight=drawSequence(gl2,width,height,y,seq);
    gl2.color(0,0,0,1);
    drawer.drawString(20,y + 20,seqIndex + "String_Node_Str");
    seqIndex++;
    y-=maxheight + 40;
  }
}
Program: 56487
Project: 56487
Buggy source:
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
  ois.defaultReadObject();
}

Fixed version (ground truth):
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
  ois.defaultReadObject();
  enabled=true;
}
Program: 56488
Project: 56488
Buggy source:
public 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);
  newManager.materialRequests.addAll(this.materialRequests);
  newManager.soilderCreationRequests.addAll(this.soilderCreationRequests);
  newManager.workerCreationRequests.addAll(this.workerCreationRequests);
  newManager.workerRequests.addAll(this.workerRequests);
  newManager.toolProductionRequests.addAll(toolProductionRequests);
  newManager.weaponProductionRequests.addAll(weaponProductionRequests);
}

Fixed version (ground truth):
public 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);
  newManager.materialRequests.addAll(this.materialRequests);
  newManager.soilderCreationRequests.addAll(this.soilderCreationRequests);
  newManager.workerCreationRequests.addAll(this.workerCreationRequests);
  newManager.workerRequests.addAll(this.workerRequests);
  newManager.toolProductionRequests.addAll(toolProductionRequests);
  newManager.weaponProductionRequests.addAll(weaponProductionRequests);
  newManager.toolRequestingWorkerRequests.merge(this.toolRequestingWorkerRequests);
}
Program: 56490
Project: 56490
Buggy source:
private void popToolRequestAction(){
  if (poppedMaterial != null) {
    System.err.println("String_Node_Str");
  }
  ShortPoint2D pos=building.getDoor();
  poppedMaterial=super.getStrategyGrid().popToolProductionRequest(pos);
  if (poppedMaterial != null) {
    jobFinished();
  }
 else {
    jobFailed();
  }
}

Fixed version (ground truth):
private void popToolRequestAction(){
  ShortPoint2D pos=building.getDoor();
  poppedMaterial=super.getStrategyGrid().popToolProductionRequest(pos);
  if (poppedMaterial != null) {
    jobFinished();
  }
 else {
    jobFailed();
  }
}
Program: 56492
Project: 56492
Buggy source:
@Override public final void occupyBuilding(IManageableWorker worker){
  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);
  }
}
Program: 56493
Project: 56493
Buggy source:
private void handleWorkerCreationRequest(){
  WorkerCreationRequest workerRequest=workerCreationRequests.poll();
  if (workerRequest != null) {
    EMaterialType tool=workerRequest.movableType.getTool();
    if (tool != EMaterialType.NO_MATERIAL) {
      this.materialTypeAcceptor.materialType=tool;
      Offer offer=this.materialOffers.getObjectNextTo(workerRequest.position,this.materialTypeAcceptor);
      if (offer != null) {
        IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(workerRequest.position);
        if (manageableBearer != null) {
          manageableBearer.becomeWorker(this,workerRequest.movableType,offer.position);
          reduceOfferAmount(offer);
        }
 else {
          workerCreationRequests.addLast(workerRequest);
        }
      }
 else {
        if (!workerRequest.produceToolRequested) {
          requestToolProduction(tool,workerRequest.position);
          workerRequest.produceToolRequested=true;
        }
        workerCreationRequests.addLast(workerRequest);
      }
    }
 else {
      IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(workerRequest.position);
      if (manageableBearer != null) {
        manageableBearer.becomeWorker(this,workerRequest.movableType);
      }
 else {
        workerCreationRequests.addLast(workerRequest);
      }
    }
  }
}

Fixed version (ground truth):
private void handleWorkerCreationRequest(){
  WorkerCreationRequest workerRequest=workerCreationRequests.poll();
  if (workerRequest != null && workerRequest.movableType == EMovableType.SMITH) {
    System.err.println("String_Node_Str");
  }
  if (workerRequest != null) {
    EMaterialType tool=workerRequest.movableType.getTool();
    if (tool != EMaterialType.NO_MATERIAL) {
      this.materialTypeAcceptor.materialType=tool;
      Offer offer=this.materialOffers.getObjectNextTo(workerRequest.position,this.materialTypeAcceptor);
      if (offer != null) {
        IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(workerRequest.position);
        if (manageableBearer != null) {
          manageableBearer.becomeWorker(this,workerRequest.movableType,offer.position);
          reduceOfferAmount(offer);
        }
 else {
          workerCreationRequests.addLast(workerRequest);
        }
      }
 else {
        if (!workerRequest.produceToolRequested) {
          requestToolProduction(tool,workerRequest.position);
          workerRequest.produceToolRequested=true;
        }
        workerCreationRequests.addLast(workerRequest);
      }
    }
 else {
      IManageableBearer manageableBearer=joblessBearer.removeObjectNextTo(workerRequest.position);
      if (manageableBearer != null) {
        manageableBearer.becomeWorker(this,workerRequest.movableType);
      }
 else {
        workerCreationRequests.addLast(workerRequest);
      }
    }
  }
}
Program: 56494
Project: 56494
Buggy source:
@Override public void setWorkerJob(IWorkerRequestBuilding building){
  this.building=building;
  building.occupyBuilding(this);
  this.currentJob=building.getBuildingType().getStartJob();
  super.enableNothingToDoAction(false);
  this.done=false;
}

Fixed version (ground truth):
@Override public void setWorkerJob(IWorkerRequestBuilding building){
  this.building=building;
  this.currentJob=building.getBuildingType().getStartJob();
  super.enableNothingToDoAction(false);
  this.done=false;
  building.occupyBuilding(this);
}
Program: 56495
Project: 56495
Buggy source:
private void popToolRequestAction(){
  ShortPoint2D pos=building.getDoor();
  poppedMaterial=super.getStrategyGrid().popToolProductionRequest(pos);
  if (poppedMaterial != null) {
    jobFinished();
  }
 else {
    jobFailed();
  }
}

Fixed version (ground truth):
private void popToolRequestAction(){
  if (poppedMaterial != null) {
    System.err.println("String_Node_Str");
  }
  ShortPoint2D pos=building.getDoor();
  poppedMaterial=super.getStrategyGrid().popToolProductionRequest(pos);
  if (poppedMaterial != null) {
    jobFinished();
  }
 else {
    jobFailed();
  }
}
Program: 56497
Project: 56497
Buggy source:
public void addImage(int texture,float x1,float y1,float x2,float y2,float u1,float v1,float u2,float v2,int activeColor){
  setZ(getZ() + .0001f);
  getBuffer(texture).addImage(x1,y1,x2,y2,u1,v1,u2,v2,activeColor);
}

Fixed version (ground truth):
public void addImage(int texture,float x1,float y1,float x2,float y2,float u1,float v1,float u2,float v2,int activeColor){
  setZ(getZ() + .00001f);
  getBuffer(texture).addImage(x1,y1,x2,y2,u1,v1,u2,v2,activeColor);
}
Program: 56498
Project: 56498
Buggy source:
public void leavePosition(){
  int offset=RandomSingleton.getInt(0,EDirection.NUMBER_OF_DIRECTIONS - 1);
  for (int i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection currDir=EDirection.values[(i + offset) % EDirection.NUMBER_OF_DIRECTIONS];
    if (goInDirection(currDir)) {
      break;
    }
 else {
      NewMovable movableAtPos=grid.getMovableAt(currDir.getNextTileX(position.getX()),currDir.getNextTileY(position.getY()));
      if (movableAtPos != null) {
        movableAtPos.push(this);
      }
    }
  }
}

Fixed version (ground truth):
public void leavePosition(){
  if (!enableNothingToDo) {
    return;
  }
  int offset=RandomSingleton.getInt(0,EDirection.NUMBER_OF_DIRECTIONS - 1);
  for (int i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection currDir=EDirection.values[(i + offset) % EDirection.NUMBER_OF_DIRECTIONS];
    if (goInDirection(currDir)) {
      break;
    }
 else {
      NewMovable movableAtPos=grid.getMovableAt(currDir.getNextTileX(position.getX()),currDir.getNextTileY(position.getY()));
      if (movableAtPos != null) {
        movableAtPos.push(this);
      }
    }
  }
}
Program: 56499
Project: 56499
Buggy source:
/** 
 * Forces the movable to go a step in the given direction (if it is not blocked).
 * @param direction direction to go
 */
final void forceGoInDirection(EDirection direction){
  ShortPoint2D targetPos=direction.getNextHexPoint(position);
  this.direction=direction;
  this.followPath(new Path(targetPos));
  this.goSinglePathStep();
}

Fixed version (ground truth):
/** 
 * Forces the movable to go a step in the given direction (if it is not blocked).
 * @param direction direction to go
 */
final void forceGoInDirection(EDirection direction){
  ShortPoint2D targetPos=direction.getNextHexPoint(position);
  this.direction=direction;
  this.followPath(new Path(targetPos));
  this.goSinglePathStep();
  setState(ENewMovableState.PATHING);
}
Program: 56500
Project: 56500
Buggy source:
/** 
 * Sets the state to the given one and resets the movable to a clean start of this state.
 * @param newState
 */
private void setState(ENewMovableState newState){
  this.state=newState;
}

Fixed version (ground truth):
/** 
 * Sets the state to the given one and resets the movable to a clean start of this state.
 * @param newState
 */
private void setState(ENewMovableState newState){
  this.formerState=this.state;
  this.state=newState;
}
Program: 56501
Project: 56501
Buggy source:
public final boolean pushMaterial(ShortPoint2D position,EMaterialType materialType){
  return getPartitionObject(position.getX(),position.getY()).pushMaterial(position,materialType);
}

Fixed version (ground truth):
public final boolean pushMaterial(ShortPoint2D position,EMaterialType materialType){
  return getPartitionObject(position.getX(),position.getY()).addOffer(position,materialType);
}
Program: 56502
Project: 56502
Buggy source:
public IManageableBearer removeJobless(ShortPoint2D position){
  return joblessBearer.removeObjectAt(position);
}

Fixed version (ground truth):
public void removeJobless(IManageableWorker worker){
  joblessWorkers.remove(worker);
}
Program: 56503
Project: 56503
Buggy source:
private void reportAsJobless(){
  super.getStrategyGrid().addJoblessBearer(this);
}

Fixed version (ground truth):
private void reportAsJobless(){
  super.getStrategyGrid().addJobless(this);
}
Program: 56504
Project: 56504
Buggy source:
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  handleJobFailed(false);
  state=EBearerState.DEAD_OBJECT;
}

Fixed version (ground truth):
@Override protected void strategyKilledEvent(ShortPoint2D pathTarget){
  if (state == EBearerState.JOBLESS) {
    super.getStrategyGrid().removeJobless(this);
  }
 else {
    handleJobFailed(false);
  }
  state=EBearerState.DEAD_OBJECT;
}
Program: 56505
Project: 56505
Buggy source:
/** 
 * creates a new area conaainer
 * @param area The area to display
 */
public AreaContainer(Area area){
  this.area=area;
  this.setLayout(new BorderLayout());
  GLProfile profile=GLProfile.getDefault();
  GLCapabilities cap=new GLCapabilities(profile);
  cap.setStencilBits(1);
  canvas=new GLCanvas(cap);
  new GOSwingEventConverter(canvas,this);
  canvas.addGLEventListener(new GLEventListener(){
    @Override public void reshape(    GLAutoDrawable gl,    int x,    int y,    int width,    int height){
      resizeArea(gl.getGL().getGL2(),x,y,width,height);
    }
    @Override public void init(    GLAutoDrawable arg0){
      arg0.getGL().setSwapInterval(0);
    }
    @Override public void dispose(    GLAutoDrawable arg0){
    }
    @Override public void display(    GLAutoDrawable glDrawable){
      draw(glDrawable.getGL().getGL2());
    }
  }
);
  this.add(canvas);
  area.addRedrawListener(this);
}

Fixed version (ground truth):
/** 
 * creates a new area conaainer
 * @param area The area to display
 */
public AreaContainer(Area area,boolean forceLightweight){
  this.area=area;
  this.setLayout(new BorderLayout());
  GLProfile profile=GLProfile.getDefault();
  GLCapabilities cap=new GLCapabilities(profile);
  cap.setStencilBits(1);
  GLEventListener glEventListener=new GLEventListener(){
    @Override public void reshape(    GLAutoDrawable gl,    int x,    int y,    int width,    int height){
      resizeArea(gl.getGL().getGL2(),x,y,width,height);
    }
    @Override public void init(    GLAutoDrawable arg0){
      arg0.getGL().setSwapInterval(0);
    }
    @Override public void dispose(    GLAutoDrawable arg0){
    }
    @Override public void display(    GLAutoDrawable glDrawable){
      draw(glDrawable.getGL().getGL2());
    }
  }
;
  if (forceLightweight) {
    GLJPanel panel=new GLJPanel(cap);
    panel.addGLEventListener(glEventListener);
    canvas=panel;
  }
 else {
    GLCanvas glCanvas=new GLCanvas(cap);
    glCanvas.addGLEventListener(glEventListener);
    canvas=glCanvas;
  }
  new GOSwingEventConverter(canvas,this);
  area.addRedrawListener(this);
  this.add(canvas);
}
Program: 56506
Project: 56506
Buggy source:
/** 
 * Draws the content area on the OpenGl object.
 * @param gl2 Where to draw on.
 */
protected void draw(GL2 gl2){
  gl2.glClear(GL2.GL_COLOR_BUFFER_BIT);
  gl2.glLoadIdentity();
  if (context == null) {
    context=new JOGLDrawContext(gl2);
  }
  context.startFrame();
  area.drawArea(context);
}

Fixed version (ground truth):
/** 
 * Draws the content area on the OpenGl object.
 * @param gl2 Where to draw on.
 */
protected void draw(GL2 gl2){
  gl2.glClear(GL2.GL_COLOR_BUFFER_BIT);
  gl2.glLoadIdentity();
  if (context == null || context.getGl2() != gl2) {
    context=new JOGLDrawContext(gl2);
  }
  context.startFrame();
  area.drawArea(context);
}
Program: 56507
Project: 56507
Buggy source:
@Override public TextDrawer getTextDrawer(EFontSize size){
  return JOGLTextDrawer.getTextDrawer(size,this);
}

Fixed version (ground truth):
/** 
 * Gets a text drawer for the given text size.
 * @param size The size for the drawer.
 * @return An instance of a drawer for that size.
 */
@Override public TextDrawer getTextDrawer(EFontSize size){
  if (textDrawers[size.ordinal()] == null) {
    textDrawers[size.ordinal()]=new JOGLTextDrawer(size,this);
  }
  return textDrawers[size.ordinal()];
}
Program: 56508
Project: 56508
Buggy source:
/** 
 * Creates a new text drawer.
 * @param size The size of the text.
 * @param drawContext 
 */
private JOGLTextDrawer(EFontSize size,JOGLDrawContext drawContext){
  this.drawContext=drawContext;
  Font font=new Font(FONTNAME,Font.TRUETYPE_FONT,size.getSize());
  this.renderer=new TextRenderer(font,true,true,null,true);
}

Fixed version (ground truth):
/** 
 * Creates a new text drawer.
 * @param size The size of the text.
 * @param drawContext 
 */
public JOGLTextDrawer(EFontSize size,JOGLDrawContext drawContext){
  this.drawContext=drawContext;
  Font font=new Font(FONTNAME,Font.TRUETYPE_FONT,size.getSize());
  this.renderer=new TextRenderer(font,true,true,null,true);
}
Program: 56509
Project: 56509
Buggy source:
/** 
 * @param inX
 * @param inY
 * @param oldPartition
 * @param newPartition
 * @param justRelabel if true, only the partition will be changed.<br> if false, the partition will be changed and for every changed position the contents of that position in the old manager will be moved to the new manager.
 */
private final void relabelPartition(short inX,short inY,short oldPartition,short newPartition,boolean justRelabel){
  final short MAX_LENGTH=1000;
  final short[] pointsBuffer=new short[MAX_LENGTH];
  pointsBuffer[0]=inX;
  pointsBuffer[1]=inY;
  short length=2;
  while (length > 0) {
    short y=pointsBuffer[--length];
    short x=pointsBuffer[--length];
    if (partitions[getIdx(x,y)] != oldPartition) {
      continue;
    }
    if (justRelabel) {
      this.partitions[getIdx(x,y)]=newPartition;
    }
 else {
      setPartition(x,y,newPartition);
    }
    boolean currIsBlocked=grid.isBlocked(x,y);
    for (byte i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
      short currX=(short)(x + neighborX[i]);
      short currY=(short)(y + neighborY[i]);
      if (isInBounds(currX,currY) && partitions[getIdx(currX,currY)] == oldPartition && (!currIsBlocked || grid.isBlocked(currX,currY))) {
        if (length < MAX_LENGTH) {
          pointsBuffer[length++]=currX;
          pointsBuffer[length++]=currY;
        }
 else {
          relabelPartition(currX,currY,oldPartition,newPartition,justRelabel);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param inX
 * @param inY
 * @param oldPartition
 * @param newPartition
 * @param justRelabel if true, only the partition will be changed.<br> if false, the partition will be changed and for every changed position the contents of that position in the old manager will be moved to the new manager.
 */
private final void relabelPartition(short inX,short inY,short oldPartition,short newPartition,boolean justRelabel){
  final short MAX_LENGTH=10000;
  final short[] pointsBuffer=new short[MAX_LENGTH];
  pointsBuffer[0]=inX;
  pointsBuffer[1]=inY;
  short length=2;
  while (length > 0) {
    short y=pointsBuffer[--length];
    short x=pointsBuffer[--length];
    if (partitions[getIdx(x,y)] != oldPartition) {
      continue;
    }
    if (justRelabel) {
      this.partitions[getIdx(x,y)]=newPartition;
    }
 else {
      setPartition(x,y,newPartition);
    }
    boolean currIsBlocked=grid.isBlocked(x,y);
    for (byte i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
      short currX=(short)(x + neighborX[i]);
      short currY=(short)(y + neighborY[i]);
      if (isInBounds(currX,currY) && partitions[getIdx(currX,currY)] == oldPartition && (!currIsBlocked || grid.isBlocked(currX,currY))) {
        if (length < MAX_LENGTH) {
          pointsBuffer[length++]=currX;
          pointsBuffer[length++]=currY;
        }
 else {
          relabelPartition(currX,currY,oldPartition,newPartition,justRelabel);
        }
      }
    }
  }
}
Program: 56510
Project: 56510
Buggy source:
private void progressCurrentAction(){
  progress+=progressIncrease;
  if (progress >= 1.01) {
    setState(ENewMovableState.DOING_NOTHING);
    this.movableAction=EAction.NO_ACTION;
  }
}

Fixed version (ground truth):
private void progressCurrentAction(){
  progress+=progressIncrease;
  if (progress >= 1) {
    setState(ENewMovableState.DOING_NOTHING);
    this.movableAction=EAction.NO_ACTION;
  }
}
Program: 56511
Project: 56511
Buggy source:
/** 
 * Forces the movable to go a step in the given direction (if it is not blocked).
 * @param direction direction to go
 * @return true if the step can and will immediately be executed. <br>false if the target position is blocked for this movable.
 */
final boolean forceGoInDirection(EDirection direction){
  ShortPoint2D targetPos=direction.getNextHexPoint(position);
  if (grid.isValidPosition(this,targetPos)) {
    this.followPath(new Path(targetPos));
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Forces the movable to go a step in the given direction (if it is not blocked).
 * @param direction direction to go
 */
final void forceGoInDirection(EDirection direction){
  ShortPoint2D targetPos=direction.getNextHexPoint(position);
  this.direction=direction;
  this.followPath(new Path(targetPos));
  this.goSinglePathStep();
}
Program: 56512
Project: 56512
Buggy source:
/** 
 * Forces the movable to go a step in the given direction (if it is not blocked).
 * @param direction direction to go
 * @return true if the step can and will immediately be executed. <br>false if the target position is blocked for this movable.
 */
protected final boolean forceGoInDirection(EDirection direction){
  return movable.forceGoInDirection(direction);
}

Fixed version (ground truth):
/** 
 * Forces the movable to go a step in the given direction (if it is not blocked).
 * @param direction direction to go
 */
protected final void forceGoInDirection(EDirection direction){
  movable.forceGoInDirection(direction);
}
Program: 56515
Project: 56515
Buggy source:
private void dropAction(EMaterialType materialType){
  if (!done) {
    super.playAction(EAction.DROP,Constants.MOVABLE_TAKE_DROP_DURATION);
    done=true;
  }
 else {
    super.getStrategyGrid().dropMaterial(super.getPos(),materialType,true);
    jobFinished();
  }
}

Fixed version (ground truth):
private void dropAction(EMaterialType materialType){
  if (!done) {
    super.playAction(EAction.DROP,Constants.MOVABLE_TAKE_DROP_DURATION);
    if (materialType == EMaterialType.NO_MATERIAL) {
      jobFinished();
    }
 else {
      done=true;
    }
  }
 else {
    super.getStrategyGrid().dropMaterial(super.getPos(),materialType,true);
    jobFinished();
  }
}
Program: 56517
Project: 56517
Buggy source:
private void cutStone(ShortPoint2D pos){
  short x=(short)(pos.getX() - 1);
  short y=(short)(pos.getY() + 1);
  AbstractHexMapObject stone=grid.getMapObject(x,y,EMapObjectType.STONE);
  stone.cutOff();
  if (!stone.canBeCut()) {
    addSelfDeletingMapObject(pos,EMapObjectType.CUT_OFF_STONE,Stone.DECOMPOSE_DELAY,(byte)-1);
    removeMapObjectType(x,y,EMapObjectType.STONE);
  }
}

Fixed version (ground truth):
private void cutStone(ShortPoint2D pos){
  short x=(short)(pos.getX() - 1);
  short y=(short)(pos.getY() + 1);
  AbstractHexMapObject stone=grid.getMapObject(x,y,EMapObjectType.STONE);
  if (stone != null) {
    stone.cutOff();
    if (!stone.canBeCut()) {
      addSelfDeletingMapObject(pos,EMapObjectType.CUT_OFF_STONE,Stone.DECOMPOSE_DELAY,(byte)-1);
      removeMapObjectType(x,y,EMapObjectType.STONE);
    }
  }
}
Program: 56518
Project: 56518
Buggy source:
private boolean cutCorn(ShortPoint2D pos){
  short x=pos.getX();
  short y=pos.getY();
  if (grid.isInBounds(x,y)) {
    AbstractObjectsManagerObject corn=(AbstractObjectsManagerObject)grid.getMapObject(x,y,EMapObjectType.CORN_ADULT);
    if (corn.cutOff()) {
      timingQueue.offer(new TimeEvent(corn,Corn.REMOVE_DURATION,true));
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean cutCorn(ShortPoint2D pos){
  short x=pos.getX();
  short y=pos.getY();
  if (grid.isInBounds(x,y)) {
    AbstractObjectsManagerObject corn=(AbstractObjectsManagerObject)grid.getMapObject(x,y,EMapObjectType.CORN_ADULT);
    if (corn != null && corn.cutOff()) {
      timingQueue.offer(new TimeEvent(corn,Corn.REMOVE_DURATION,true));
      return true;
    }
  }
  return false;
}
Program: 56519
Project: 56519
Buggy source:
private boolean cutTree(ShortPoint2D pos){
  short x=(short)(pos.getX() - 1);
  short y=(short)(pos.getY() - 1);
  if (grid.isInBounds(x,y)) {
    AbstractObjectsManagerObject tree=(AbstractObjectsManagerObject)grid.getMapObject(x,y,EMapObjectType.TREE_ADULT);
    if (tree.cutOff()) {
      timingQueue.offer(new TimeEvent(tree,Tree.DECOMPOSE_DURATION,true));
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean cutTree(ShortPoint2D pos){
  short x=(short)(pos.getX() - 1);
  short y=(short)(pos.getY() - 1);
  if (grid.isInBounds(x,y)) {
    AbstractObjectsManagerObject tree=(AbstractObjectsManagerObject)grid.getMapObject(x,y,EMapObjectType.TREE_ADULT);
    if (tree != null && tree.cutOff()) {
      timingQueue.offer(new TimeEvent(tree,Tree.DECOMPOSE_DURATION,true));
      return true;
    }
  }
  return false;
}
Program: 56521
Project: 56521
Buggy source:
@Override public void buildingDestroyed(){
  super.setVisible(true);
  reportAsJobless();
  if (super.getMaterial() != EMaterialType.NO_MATERIAL) {
    super.getStrategyGrid().dropMaterial(super.getPos(),super.getMaterial(),true);
    super.setMaterial(EMaterialType.NO_MATERIAL);
  }
}

Fixed version (ground truth):
@Override public void buildingDestroyed(){
  super.setVisible(true);
  reportAsJobless();
  dropCurrMaterial();
}
Program: 56522
Project: 56522
Buggy source:
/** 
 * To be called after the parition of (x,y) changed.
 * @param x
 * @param y
 */
public void reTest(short x,short y){
  if (!map.isBlocked(x,y)) {
    short destPartition=map.getPartitionAt(x,y);
    for (    EDirection dir : EDirection.valuesCached()) {
      short nx=dir.getNextTileX(x);
      short ny=dir.getNextTileY(y);
      if (map.isInBounds(nx,ny) && map.isBlocked(nx,ny)) {
        System.out.println("String_Node_Str" + nx + "String_Node_Str"+ ny);
        startRelabel(nx,ny,destPartition,dir.getInverseDirection());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * To be called after the parition of (x,y) changed.
 * @param x
 * @param y
 */
public void reTest(short x,short y){
  if (!map.isBlocked(x,y)) {
    short destPartition=map.getPartitionAt(x,y);
    for (    EDirection dir : EDirection.values) {
      short nx=dir.getNextTileX(x);
      short ny=dir.getNextTileY(y);
      if (map.isInBounds(nx,ny) && map.isBlocked(nx,ny)) {
        System.out.println("String_Node_Str" + nx + "String_Node_Str"+ ny);
        startRelabel(nx,ny,destPartition,dir.getInverseDirection());
      }
    }
  }
}
Program: 56524
Project: 56524
Buggy source:
/** 
 * move the selected movables to the given position.
 * @param pos position to move to
 * @param list
 */
private void moveSelectedTo(ISPosition2D pos,List<Integer> list){
  if (list.size() == 1) {
    Movable currMovable=Movable.getMovableByID(list.get(0));
    currMovable.setGotoJob(new GotoJob(pos));
  }
 else {
    float radius=(float)(Math.sqrt(list.size() / 3.14f)) * 2;
    MapCircle mapCircle=new MapCircle(pos,radius);
    Iterator<ISPosition2D> circleIter=mapCircle.iterator();
    for (    Integer currID : list) {
      Movable currMovable=Movable.getMovableByID(currID);
      if (currMovable != null) {
        GotoJob job=new GotoJob(circleIter.next());
        circleIter.next();
        currMovable.setGotoJob(job);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * move the selected movables to the given position.
 * @param pos position to move to
 * @param list
 */
private void moveSelectedTo(ISPosition2D pos,List<Integer> list){
  if (list.size() == 1) {
    Movable currMovable=Movable.getMovableByID(list.get(0));
    if (currMovable != null)     currMovable.setGotoJob(new GotoJob(pos));
  }
 else {
    float radius=(float)(Math.sqrt(list.size() / 3.14f)) * 2;
    MapCircle mapCircle=new MapCircle(pos,radius);
    Iterator<ISPosition2D> circleIter=mapCircle.iterator();
    for (    Integer currID : list) {
      Movable currMovable=Movable.getMovableByID(currID);
      if (currMovable != null) {
        GotoJob job=new GotoJob(circleIter.next());
        circleIter.next();
        currMovable.setGotoJob(job);
      }
    }
  }
}
Program: 56525
Project: 56525
Buggy source:
private void killSelectedMovables(List<Integer> selectedMovables){
  for (  Integer currID : selectedMovables) {
    Movable.getMovableByID(currID).kill();
  }
}

Fixed version (ground truth):
private void killSelectedMovables(List<Integer> selectedMovables){
  for (  Integer currID : selectedMovables) {
    Movable curr=Movable.getMovableByID(currID);
    if (curr != null)     curr.kill();
  }
}
Program: 56526
Project: 56526
Buggy source:
@Override protected void executeAction(){
  for (  ITimerable s : timerables) {
    s.timerEvent();
  }
}

Fixed version (ground truth):
@Override protected void executeAction(){
  for (  ITimerable s : timerables) {
    try {
      s.timerEvent();
    }
 catch (    Throwable t) {
      System.out.println("String_Node_Str");
      t.printStackTrace();
      s.kill();
    }
  }
}
Program: 56527
Project: 56527
Buggy source:
public final int getDebugColor(int x,int y){
  return debugColor[getIdx(x,y)];
}

Fixed version (ground truth):
public final int getDebugColor(int x,int y){
  if (CommonConstants.ENABLE_DEBUG_COLORS) {
    return debugColors[getIdx(x,y)];
  }
 else {
    return 0;
  }
}
Program: 56528
Project: 56528
Buggy source:
public final void resetDebugColors(){
  for (int i=0; i < debugColor.length; i++) {
    debugColor[i]=-1;
  }
}

Fixed version (ground truth):
public final void resetDebugColors(){
  if (CommonConstants.ENABLE_DEBUG_COLORS) {
    for (int i=0; i < debugColors.length; i++) {
      debugColors[i]=0;
    }
  }
}
Program: 56529
Project: 56529
Buggy source:
public LandscapeGrid(short width,short height){
  this.width=width;
  this.height=height;
  this.heightGrid=new byte[width * height];
  this.landscapeGrid=new byte[width * height];
  this.resourceAmount=new byte[width * height];
  this.resourceType=new byte[width * height];
  this.temporaryFlatened=new byte[width * height];
  this.debugColor=new int[width * height];
  resetDebugColors();
  this.flattenedResetter=new FlattenedResetter(this);
  setBackgroundListener(null);
}

Fixed version (ground truth):
public LandscapeGrid(short width,short height){
  this.width=width;
  this.height=height;
  this.heightGrid=new byte[width * height];
  this.landscapeGrid=new byte[width * height];
  this.resourceAmount=new byte[width * height];
  this.resourceType=new byte[width * height];
  this.temporaryFlatened=new byte[width * height];
  initDebugColors();
  this.flattenedResetter=new FlattenedResetter(this);
  setBackgroundListener(null);
}
Program: 56530
Project: 56530
Buggy source:
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
  ois.defaultReadObject();
  setBackgroundListener(null);
  resetDebugColors();
}

Fixed version (ground truth):
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
  ois.defaultReadObject();
  setBackgroundListener(null);
  initDebugColors();
}
Program: 56531
Project: 56531
Buggy source:
public final void setDebugColor(short x,short y,int rgba){
  debugColor[getIdx(x,y)]=rgba;
}

Fixed version (ground truth):
public final void setDebugColor(short x,short y,int argb){
  if (CommonConstants.ENABLE_DEBUG_COLORS) {
    debugColors[getIdx(x,y)]=argb;
  }
}
Program: 56532
Project: 56532
Buggy source:
private boolean drawTile(int x,int y){
  IMapObject object=map.getMapObjectsAt(x,y);
  if (object != null) {
    this.objectDrawer.drawMapObject(this.context,this.map,x,y,object);
  }
  IMovable movable=map.getMovableAt(x,y);
  if (movable != null) {
    if (movable.getAction() == EAction.WALKING) {
      int originx=x - movable.getDirection().getGridDeltaX();
      int originy=y - movable.getDirection().getGridDeltaY();
      this.context.beginBetweenTileContext(originx,originy,x,y,movable.getMoveProgress());
      this.movableDrawer.draw(this.context,movable);
      this.context.endTileContext();
    }
 else {
      this.context.beginTileContext(x,y);
      this.movableDrawer.draw(this.context,movable);
      this.context.endTileContext();
    }
  }
  if (map.isBorder(x,y)) {
    this.context.beginTileContext(x,y);
    byte player=map.getPlayerAt(x,y);
    objectDrawer.drawPlayerBorderObject(context,player);
    this.context.endTileContext();
  }
  return ENABLE_DEBUG && map.getDebugColorAt(x,y) >= 0;
}

Fixed version (ground truth):
private boolean drawTile(int x,int y){
  IMapObject object=map.getMapObjectsAt(x,y);
  if (object != null) {
    this.objectDrawer.drawMapObject(this.context,this.map,x,y,object);
  }
  IMovable movable=map.getMovableAt(x,y);
  if (movable != null) {
    if (movable.getAction() == EAction.WALKING) {
      int originx=x - movable.getDirection().getGridDeltaX();
      int originy=y - movable.getDirection().getGridDeltaY();
      this.context.beginBetweenTileContext(originx,originy,x,y,movable.getMoveProgress());
      this.movableDrawer.draw(this.context,movable);
      this.context.endTileContext();
    }
 else {
      this.context.beginTileContext(x,y);
      this.movableDrawer.draw(this.context,movable);
      this.context.endTileContext();
    }
  }
  if (map.isBorder(x,y)) {
    this.context.beginTileContext(x,y);
    byte player=map.getPlayerAt(x,y);
    objectDrawer.drawPlayerBorderObject(context,player);
    this.context.endTileContext();
  }
  return ENABLE_DEBUG && map.getDebugColorAt(x,y) != 0;
}
Program: 56533
Project: 56533
Buggy source:
private void drawDebugColors(){
  IMapArea tiles=new MapShapeFilter(context.getScreenArea(),map.getWidth(),map.getHeight());
  GLDrawContext gl=this.context.getGl();
  float[] shape=new float[]{0,4,.5f,0,0,-3,2,.5f,0,0,-3,-2,.5f,0,0,0,-4,.5f,0,0,0,-4,.5f,0,0,3,-2,.5f,0,0,3,2,.5f,0,0,0,4,.5f,0,0};
  for (  ISPosition2D pos : tiles) {
    short x=pos.getX();
    short y=pos.getY();
    int argb=map.getDebugColorAt(x,y);
    if (argb >= 0) {
      this.context.beginTileContext(x,y);
      gl.color(((argb >> 16) & 0xff) / 255f,((argb >> 8) & 0xff) / 255f,((argb >> 0) & 0xff) / 255f,((argb >> 24) & 0xff) / 255f);
      gl.drawQuadWithTexture(0,shape);
      context.endTileContext();
    }
  }
}

Fixed version (ground truth):
private void drawDebugColors(){
  IMapArea tiles=new MapShapeFilter(context.getScreenArea(),map.getWidth(),map.getHeight());
  GLDrawContext gl=this.context.getGl();
  float[] shape=new float[]{0,4,.5f,0,0,-3,2,.5f,0,0,-3,-2,.5f,0,0,0,-4,.5f,0,0,0,-4,.5f,0,0,3,-2,.5f,0,0,3,2,.5f,0,0,0,4,.5f,0,0};
  for (  ISPosition2D pos : tiles) {
    short x=pos.getX();
    short y=pos.getY();
    int argb=map.getDebugColorAt(x,y);
    if (argb != 0) {
      this.context.beginTileContext(x,y);
      gl.color(((argb >> 16) & 0xff) / 255f,((argb >> 8) & 0xff) / 255f,((argb >> 0) & 0xff) / 255f,((argb >> 24) & 0xff) / 255f);
      gl.drawQuadWithTexture(0,shape);
      context.endTileContext();
    }
  }
}
Program: 56534
Project: 56534
Buggy source:
NewFoWThread(){
  super("String_Node_Str");
  this.buffer=new byte[width][height];
  super.setDaemon(true);
}

Fixed version (ground truth):
NewFoWThread(){
  super("String_Node_Str");
  this.buffer=new byte[width][height];
  super.setDaemon(true);
  drawer=new CircleDrawer();
}
Program: 56535
Project: 56535
Buggy source:
private final void applyViewDistances(ConcurrentLinkedQueue<? extends IViewDistancable> objects){
  for (  IViewDistancable curr : objects) {
    if (isPlayerOK(curr)) {
      short distance=curr.getViewDistance();
      if (distance > 0) {
        ISPosition2D pos=curr.getPos();
        drawer.drawCircleToBuffer(pos.getX(),pos.getY(),distance);
      }
    }
  }
}

Fixed version (ground truth):
private final void applyViewDistances(ConcurrentLinkedQueue<? extends IViewDistancable> objects){
  for (  IViewDistancable curr : objects) {
    if (isPlayerOK(curr)) {
      short distance=curr.getViewDistance();
      if (distance > 0) {
        ISPosition2D pos=curr.getPos();
        if (pos != null)         drawer.drawCircleToBuffer(pos.getX(),pos.getY(),distance);
      }
    }
  }
}