nus-yam/ex-repair huggingface dataset:
Program: 55785
Project: 55785
Buggy source:
void becomeWorker(IWorkerRequester requester,WorkerCreationRequest request,ShortPoint2D offer);

Fixed version (ground truth):
boolean becomeWorker(IWorkerRequester requester,WorkerCreationRequest request,ShortPoint2D offer);
Program: 55786
Project: 55786
Buggy source:
boolean isProbablyPushable(Movable pushingMovable){
switch (state) {
case DOING_NOTHING:
    return true;
case PATHING:
  return pushingMovable.path != null && pushingMovable.path.hasNextStep();
default :
return false;
}
}

Fixed version (ground truth):
boolean isProbablyPushable(Movable pushingMovable){
switch (state) {
case DOING_NOTHING:
    return true;
case PATHING:
  return path != null && pushingMovable.path != null && pushingMovable.path.hasNextStep();
default :
return false;
}
}
Program: 55787
Project: 55787
Buggy source:
@Override public void becomeSoldier(IBarrack barrack){
  this.barrack=barrack;
  this.state=EBearerState.INIT_BECOME_SOLDIER_JOB;
}

Fixed version (ground truth):
@Override public boolean becomeSoldier(IBarrack barrack){
  if (state == EBearerState.JOBLESS) {
    this.barrack=barrack;
    this.state=EBearerState.INIT_BECOME_SOLDIER_JOB;
    return true;
  }
 else {
    return false;
  }
}
Program: 55788
Project: 55788
Buggy source:
@Override public void becomeWorker(IWorkerRequester requester,WorkerCreationRequest workerCreationRequest,ShortPoint2D offer){
  this.workerRequester=requester;
  this.workerCreationRequest=workerCreationRequest;
  this.offer=offer;
  this.state=EBearerState.INIT_CONVERT_WITH_TOOL_JOB;
  this.materialType=workerCreationRequest.requestedMovableType().getTool();
}

Fixed version (ground truth):
@Override public boolean becomeWorker(IWorkerRequester requester,WorkerCreationRequest workerCreationRequest,ShortPoint2D offer){
  if (state == EBearerState.JOBLESS) {
    this.workerRequester=requester;
    this.workerCreationRequest=workerCreationRequest;
    this.offer=offer;
    this.state=EBearerState.INIT_CONVERT_WITH_TOOL_JOB;
    this.materialType=workerCreationRequest.requestedMovableType().getTool();
    return true;
  }
 else {
    return false;
  }
}
Program: 55789
Project: 55789
Buggy source:
private static void createReplayOfRemainingTasks(MapLoader newSavegame,ReplayStartInformation replayStartInformation,String newReplayFile,IGameClock gameClock) throws IOException {
  System.out.println("String_Node_Str" + newReplayFile + "String_Node_Str");
  ReplayStartInformation replayInfo=new ReplayStartInformation(0,newSavegame.getMapName(),newSavegame.getMapId(),replayStartInformation.getPlayerId(),replayStartInformation.getPlayerSettings());
  DataOutputStream dos=new DataOutputStream(ResourceManager.writeConfigurationFile(newReplayFile));
  replayInfo.serialize(dos);
  gameClock.saveRemainingTasks(dos);
  dos.close();
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
private static void createReplayOfRemainingTasks(MapLoader newSavegame,ReplayStartInformation replayStartInformation,String newReplayFile,IGameClock gameClock) throws IOException {
  System.out.println("String_Node_Str" + newReplayFile + "String_Node_Str");
  ReplayStartInformation replayInfo=new ReplayStartInformation(0,newSavegame.getMapName(),newSavegame.getMapId(),replayStartInformation.getPlayerId(),replayStartInformation.getPlayerSettings());
  DataOutputStream dos=new DataOutputStream(ResourceManager.writeUserFile(newReplayFile));
  replayInfo.serialize(dos);
  gameClock.saveRemainingTasks(dos);
  dos.close();
  System.out.println("String_Node_Str");
}
Program: 55790
Project: 55790
Buggy source:
boolean isProbablyPushable(Movable pushingMovable){
switch (state) {
case DOING_NOTHING:
    return true;
case PATHING:
  return pushingMovable.path != null && pushingMovable.path.hasNextStep();
default :
return false;
}
}

Fixed version (ground truth):
boolean isProbablyPushable(Movable pushingMovable){
switch (state) {
case DOING_NOTHING:
    return true;
case PATHING:
  return path != null && pushingMovable.path != null && pushingMovable.path.hasNextStep();
default :
return false;
}
}
Program: 55791
Project: 55791
Buggy source:
public ELandscapeType[] getGroundtypes(){
  return groundtypes.toArray(new ELandscapeType[groundtypes.size()]);
}

Fixed version (ground truth):
public List<ELandscapeType> getGroundtypes(){
  return groundtypes;
}
Program: 55792
Project: 55792
Buggy source:
/** 
 * Checks if the given position is valid to build a building of given player that can stand on the given   {@link ELandscapeType}s. Bounds checks will be done by this method.
 * @param x x coordinate of the target position
 * @param y y coordinate of the target position
 * @param landscapeTypes allowed landscape types
 * @param partitionId player
 * @return true if a building can be positioned at the given position<br>false otherwise.
 */
public abstract boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,short partitionId);

Fixed version (ground truth):
/** 
 * Checks if the given position is valid to build a building of given player that can stand on the given   {@link ELandscapeType}s. Bounds checks will be done by this method.
 * @param x x coordinate of the target position
 * @param y y coordinate of the target position
 * @param landscapeTypes allowed landscape types
 * @param partitionId player
 * @return true if a building can be positioned at the given position<br>false otherwise.
 */
public abstract boolean canUsePositionForConstruction(int x,int y,Set<ELandscapeType> landscapeTypes,short partitionId);
Program: 55793
Project: 55793
Buggy source:
@Override public void run(){
  while (!canceled) {
    try {
synchronized (this) {
        while (buildingType == null) {
          this.wait();
        }
      }
      while (buildingType != null && !canceled) {
        if (!pausingSupplier.isPausing()) {
          StopWatch watch=new MilliStopWatch();
          watch.restart();
          EBuildingType buildingType=this.buildingType;
          if (buildingType != null && mapArea != null) {
            algorithm.calculateConstructMarks(mapArea,buildingType.getBuildingAreaBitSet(),buildingType.getGroundtypes(),buildingType.getBlockedTiles(),buildingType.isMine());
          }
          watch.stop("String_Node_Str");
        }
synchronized (this) {
          wait(AlgorithmConstants.CONSTRUCT_MARKS_MAX_REFRESH_TIME);
        }
      }
      algorithm.removeConstructionMarks();
    }
 catch (    InterruptedException e) {
    }
catch (    Throwable t) {
      t.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!canceled) {
    try {
synchronized (this) {
        while (buildingType == null) {
          this.wait();
        }
      }
      while (buildingType != null && !canceled) {
        if (!pausingSupplier.isPausing()) {
          StopWatch watch=new MilliStopWatch();
          watch.restart();
          EBuildingType buildingType=this.buildingType;
          if (buildingType != null && mapArea != null) {
            algorithm.calculateConstructMarks(mapArea,buildingType.getBuildingAreaBitSet(),buildingType.getGroundTypes(),buildingType.getBuildingArea(),!buildingType.needsFlattenedGround());
          }
          watch.stop("String_Node_Str");
        }
synchronized (this) {
          wait(AlgorithmConstants.CONSTRUCT_MARKS_MAX_REFRESH_TIME);
        }
      }
      algorithm.removeConstructionMarks();
    }
 catch (    InterruptedException e) {
    }
catch (    Throwable t) {
      t.printStackTrace();
    }
  }
}
Program: 55795
Project: 55795
Buggy source:
@Override public boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,short partitionId){
  return isInBounds(x,y) && !flagsGrid.isProtected(x,y) && partitionsGrid.getPartitionIdAt(x,y) == partitionId && isAllowedLandscape(x,y,landscapeTypes);
}

Fixed version (ground truth):
@Override public boolean canUsePositionForConstruction(int x,int y,Set<ELandscapeType> allowedBuildingTypes,short partitionId){
  return isInBounds(x,y) && !flagsGrid.isProtected(x,y) && partitionsGrid.getPartitionIdAt(x,y) == partitionId && allowedBuildingTypes.contains(landscapeGrid.getLandscapeTypeAt(x,y));
}
Program: 55796
Project: 55796
Buggy source:
private final void writeObject(ObjectOutputStream oos) throws IOException {
  oos.defaultWriteObject();
  SerializationUtils.writeSparseArray(oos,buildingsGrid);
  int length=objectsGrid.length;
  oos.writeInt(length);
  for (int idx=0; idx < length; idx++) {
    AbstractHexMapObject currObject=objectsGrid[idx];
    if (currObject != null) {
      oos.writeInt(idx);
      while (currObject != null) {
        if (currObject.getObjectType() != EMapObjectType.WORKAREA_MARK) {
          oos.writeObject(currObject);
        }
        currObject=currObject.getNextObject();
      }
      oos.writeObject(null);
    }
  }
  oos.writeInt(-1);
}

Fixed version (ground truth):
private final void writeObject(ObjectOutputStream oos) throws IOException {
  oos.defaultWriteObject();
  SerializationUtils.writeSparseArray(oos,buildingsGrid);
  int length=objectsGrid.length;
  oos.writeInt(length);
  for (int idx=0; idx < length; idx++) {
    AbstractHexMapObject currObject=objectsGrid[idx];
    if (currObject != null) {
      oos.writeInt(idx);
      while (currObject != null) {
        if (currObject.getObjectType().persistent) {
          oos.writeObject(currObject);
        }
        currObject=currObject.getNextObject();
      }
      oos.writeObject(null);
    }
  }
  oos.writeInt(-1);
}
Program: 55797
Project: 55797
Buggy source:
@Override public boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,short partitionId){
  return isInBounds(x,y) && !blockedSet.get(x + y * width);
}

Fixed version (ground truth):
@Override public boolean canUsePositionForConstruction(int x,int y,Set<ELandscapeType> landscapeTypes,short partitionId){
  return isInBounds(x,y) && !blockedSet.get(x + y * width);
}
Program: 55798
Project: 55798
Buggy source:
@Test public void veryHardShouldConquerHard() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_VERY_HARD,EPlayerType.AI_HARD,82 * MINUTES);
}

Fixed version (ground truth):
@Test public void veryHardShouldConquerHard() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_VERY_HARD,EPlayerType.AI_HARD,95 * MINUTES);
}
Program: 55799
Project: 55799
Buggy source:
@Test public void easyShouldConquerVeryEasy() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_EASY,EPlayerType.AI_VERY_EASY,70 * MINUTES);
}

Fixed version (ground truth):
@Test public void easyShouldConquerVeryEasy() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_EASY,EPlayerType.AI_VERY_EASY,80 * MINUTES);
}
Program: 55800
Project: 55800
Buggy source:
public ELandscapeType[] getAllowedLandscapes();

Fixed version (ground truth):
Set<ELandscapeType> getAllowedLandscapes();
Program: 55801
Project: 55801
Buggy source:
public ELandscapeType[] getGroundtypes(){
  return groundtypes.toArray(new ELandscapeType[groundtypes.size()]);
}

Fixed version (ground truth):
public List<ELandscapeType> getGroundtypes(){
  return groundtypes;
}
Program: 55802
Project: 55802
Buggy source:
/** 
 * Checks if the given position is valid to build a building of given player that can stand on the given   {@link ELandscapeType}s. Bounds checks will be done by this method.
 * @param x x coordinate of the target position
 * @param y y coordinate of the target position
 * @param landscapeTypes allowed landscape types
 * @param partitionId player
 * @return true if a building can be positioned at the given position<br>false otherwise.
 */
public abstract boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,short partitionId);

Fixed version (ground truth):
/** 
 * Checks if the given position is valid to build a building of given player that can stand on the given   {@link ELandscapeType}s. Bounds checks will be done by this method.
 * @param x x coordinate of the target position
 * @param y y coordinate of the target position
 * @param landscapeTypes allowed landscape types
 * @param partitionId player
 * @return true if a building can be positioned at the given position<br>false otherwise.
 */
public abstract boolean canUsePositionForConstruction(int x,int y,Set<ELandscapeType> landscapeTypes,short partitionId);
Program: 55803
Project: 55803
Buggy source:
@Override public void run(){
  while (!canceled) {
    try {
synchronized (this) {
        while (buildingType == null) {
          this.wait();
        }
      }
      while (buildingType != null && !canceled) {
        if (!pausingSupplier.isPausing()) {
          StopWatch watch=new MilliStopWatch();
          watch.restart();
          EBuildingType buildingType=this.buildingType;
          if (buildingType != null && mapArea != null) {
            algorithm.calculateConstructMarks(mapArea,buildingType.getBuildingAreaBitSet(),buildingType.getGroundtypes(),buildingType.getBlockedTiles(),buildingType.isMine());
          }
          watch.stop("String_Node_Str");
        }
synchronized (this) {
          wait(AlgorithmConstants.CONSTRUCT_MARKS_MAX_REFRESH_TIME);
        }
      }
      algorithm.removeConstructionMarks();
    }
 catch (    InterruptedException e) {
    }
catch (    Throwable t) {
      t.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!canceled) {
    try {
synchronized (this) {
        while (buildingType == null) {
          this.wait();
        }
      }
      while (buildingType != null && !canceled) {
        if (!pausingSupplier.isPausing()) {
          StopWatch watch=new MilliStopWatch();
          watch.restart();
          EBuildingType buildingType=this.buildingType;
          if (buildingType != null && mapArea != null) {
            algorithm.calculateConstructMarks(mapArea,buildingType.getBuildingAreaBitSet(),buildingType.getGroundTypes(),buildingType.getBuildingArea(),!buildingType.needsFlattenedGround());
          }
          watch.stop("String_Node_Str");
        }
synchronized (this) {
          wait(AlgorithmConstants.CONSTRUCT_MARKS_MAX_REFRESH_TIME);
        }
      }
      algorithm.removeConstructionMarks();
    }
 catch (    InterruptedException e) {
    }
catch (    Throwable t) {
      t.printStackTrace();
    }
  }
}
Program: 55805
Project: 55805
Buggy source:
@Override public boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,short partitionId){
  return isInBounds(x,y) && !flagsGrid.isProtected(x,y) && partitionsGrid.getPartitionIdAt(x,y) == partitionId && isAllowedLandscape(x,y,landscapeTypes);
}

Fixed version (ground truth):
@Override public boolean canUsePositionForConstruction(int x,int y,Set<ELandscapeType> allowedBuildingTypes,short partitionId){
  return isInBounds(x,y) && !flagsGrid.isProtected(x,y) && partitionsGrid.getPartitionIdAt(x,y) == partitionId && allowedBuildingTypes.contains(landscapeGrid.getLandscapeTypeAt(x,y));
}
Program: 55806
Project: 55806
Buggy source:
private final void writeObject(ObjectOutputStream oos) throws IOException {
  oos.defaultWriteObject();
  SerializationUtils.writeSparseArray(oos,buildingsGrid);
  int length=objectsGrid.length;
  oos.writeInt(length);
  for (int idx=0; idx < length; idx++) {
    AbstractHexMapObject currObject=objectsGrid[idx];
    if (currObject != null) {
      oos.writeInt(idx);
      while (currObject != null) {
        if (currObject.getObjectType() != EMapObjectType.WORKAREA_MARK) {
          oos.writeObject(currObject);
        }
        currObject=currObject.getNextObject();
      }
      oos.writeObject(null);
    }
  }
  oos.writeInt(-1);
}

Fixed version (ground truth):
private final void writeObject(ObjectOutputStream oos) throws IOException {
  oos.defaultWriteObject();
  SerializationUtils.writeSparseArray(oos,buildingsGrid);
  int length=objectsGrid.length;
  oos.writeInt(length);
  for (int idx=0; idx < length; idx++) {
    AbstractHexMapObject currObject=objectsGrid[idx];
    if (currObject != null) {
      oos.writeInt(idx);
      while (currObject != null) {
        if (currObject.getObjectType().persistent) {
          oos.writeObject(currObject);
        }
        currObject=currObject.getNextObject();
      }
      oos.writeObject(null);
    }
  }
  oos.writeInt(-1);
}
Program: 55807
Project: 55807
Buggy source:
@Override public boolean canUsePositionForConstruction(int x,int y,ELandscapeType[] landscapeTypes,short partitionId){
  return isInBounds(x,y) && !blockedSet.get(x + y * width);
}

Fixed version (ground truth):
@Override public boolean canUsePositionForConstruction(int x,int y,Set<ELandscapeType> landscapeTypes,short partitionId){
  return isInBounds(x,y) && !blockedSet.get(x + y * width);
}
Program: 55808
Project: 55808
Buggy source:
@Test public void veryHardShouldConquerHard() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_VERY_HARD,EPlayerType.AI_HARD,82 * MINUTES);
}

Fixed version (ground truth):
@Test public void veryHardShouldConquerHard() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_VERY_HARD,EPlayerType.AI_HARD,95 * MINUTES);
}
Program: 55809
Project: 55809
Buggy source:
@Test public void easyShouldConquerVeryEasy() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_EASY,EPlayerType.AI_VERY_EASY,70 * MINUTES);
}

Fixed version (ground truth):
@Test public void easyShouldConquerVeryEasy() throws MapLoadException {
  holdBattleBetween(EPlayerType.AI_EASY,EPlayerType.AI_VERY_EASY,80 * MINUTES);
}
Program: 55810
Project: 55810
Buggy source:
public ELandscapeType[] getAllowedLandscapes();

Fixed version (ground truth):
Set<ELandscapeType> getAllowedLandscapes();
Program: 55811
Project: 55811
Buggy source:
/** 
 * Gives the id of the player of this object.
 * @return -1 if this component has no player (for example a non occupied tile)<br>otherwise: the id of the player of the component.
 */
public byte getPlayerId();

Fixed version (ground truth):
/** 
 * Gives the id of the player of this object.
 * @return -1 if this component has no player (for example a non occupied tile)<br>otherwise: the id of the player of the component.
 */
byte getPlayerId();
Program: 55812
Project: 55812
Buggy source:
/** 
 * Sets the content of the main panel.
 * @param content The content to change to.
 */
public void setContent(AbstractContentProvider content){
  activeContent.contentHiding(actionFireable,content);
  ESecondaryTabType tabs=content.getTabs();
  showSecondaryTabs(tabs);
  if (tabs != null) {
switch (tabs) {
case BUILD:
      setButtonsActive(buildButtons,content);
    break;
case GOODS:
  setButtonsActive(goodsButtons,content);
break;
case SETTLERS:
setButtonsActive(settlerButtons,content);
break;
case NONE:
default :
break;
}
}
contentContainer.removeAll();
contentContainer.addChild(content.getPanel(),0,0,1,1);
activeContent=content;
sendMapPositionChange();
activeContent.contentShowing(actionFireable);
}

Fixed version (ground truth):
/** 
 * Sets the content of the main panel.
 * @param content The content to change to.
 */
public synchronized void setContent(AbstractContentProvider content){
  activeContent.contentHiding(actionFireable,content);
  ESecondaryTabType tabs=content.getTabs();
  showSecondaryTabs(tabs);
  if (tabs != null) {
switch (tabs) {
case BUILD:
      setButtonsActive(buildButtons,content);
    break;
case GOODS:
  setButtonsActive(goodsButtons,content);
break;
case SETTLERS:
setButtonsActive(settlerButtons,content);
break;
case NONE:
default :
break;
}
}
contentContainer.removeAll();
contentContainer.addChild(content.getPanel(),0,0,1,1);
activeContent=content;
sendMapPositionChange();
activeContent.contentShowing(actionFireable);
}
Program: 55814
Project: 55814
Buggy source:
@Override public void refreshSelection(){
  connector.setSelection(null);
  connector.setSelection(currentSelection);
}

Fixed version (ground truth):
@Override public void refreshSelection(){
  if (!currentSelection.isEmpty()) {
    SelectionSet newSelection=new SelectionSet();
    for (    ISelectable selected : currentSelection) {
      if (selected.isSelected() && canSelectPlayer(selected.getPlayerId())) {
        newSelection.add(selected);
      }
    }
    if (currentSelection.getSize() != newSelection.getSize() || currentSelection.getSelectionType() != newSelection.getSelectionType()) {
      setSelection(newSelection);
    }
  }
}
Program: 55815
Project: 55815
Buggy source:
public GuiInterface(IMapInterfaceConnector connector,IGameClock clock,ITaskScheduler taskScheduler,IGuiInputGrid grid,IGameStoppable gameStoppable,byte player,boolean multiplayer){
  this.connector=connector;
  this.clock=clock;
  this.taskScheduler=taskScheduler;
  this.grid=grid;
  this.gameStoppable=gameStoppable;
  this.playerId=player;
  this.multiplayer=multiplayer;
  this.constructionMarksCalculator=new ConstructionMarksThread(grid.getConstructionMarksGrid(),clock,player);
  grid.getPlayer(player).setMessenger(connector);
  clock.setTaskExecutor(new GuiTaskExecutor(grid,this,playerId));
  connector.addListener(this);
}

Fixed version (ground truth):
public GuiInterface(IMapInterfaceConnector connector,IGameClock clock,ITaskScheduler taskScheduler,IGuiInputGrid grid,IGameStoppable gameStoppable,byte player,boolean multiplayer){
  this.connector=connector;
  this.clock=clock;
  this.taskScheduler=taskScheduler;
  this.grid=grid;
  this.gameStoppable=gameStoppable;
  this.playerId=player;
  this.multiplayer=multiplayer;
  this.constructionMarksCalculator=new ConstructionMarksThread(grid.getConstructionMarksGrid(),clock,player);
  this.refreshSelectionTimer=new Timer("String_Node_Str");
  this.refreshSelectionTimer.schedule(new TimerTask(){
    @Override public void run(){
      refreshSelection();
    }
  }
,1000,1000);
  grid.getPlayer(player).setMessenger(connector);
  clock.setTaskExecutor(new GuiTaskExecutor(grid,this,playerId));
  connector.addListener(this);
}
Program: 55816
Project: 55816
Buggy source:
/** 
 * Sets the selection.
 * @param selection The selected items. Not null!
 */
private void setSelection(SelectionSet selection){
  currentSelection.clear();
  selection.setSelected(true);
  this.connector.setSelection(selection);
  this.currentSelection=selection;
}

Fixed version (ground truth):
/** 
 * Sets the selection.
 * @param selection The selected items. Not null!
 */
private void setSelection(SelectionSet selection){
  currentSelection.setSelected(false);
  selection.setSelected(true);
  connector.setSelection(selection);
  currentSelection=selection;
}
Program: 55817
Project: 55817
Buggy source:
/** 
 * Shuts down used threads.
 */
public void stop(){
  constructionMarksCalculator.cancel();
  connector.removeListener(this);
}

Fixed version (ground truth):
/** 
 * Shuts down used threads.
 */
public void stop(){
  constructionMarksCalculator.cancel();
  connector.removeListener(this);
  refreshSelectionTimer.cancel();
}
Program: 55818
Project: 55818
Buggy source:
private void selectPointType(PointAction action){
  final ShortPoint2D actionPosition=action.getPosition();
  final IGuiMovable selectedMovable=getSelectableMovable(actionPosition.x,actionPosition.y);
  if (selectedMovable == null) {
    setSelection(new SelectionSet());
    return;
  }
  EMovableType selectedType=selectedMovable.getMovableType();
  Set<EMovableType> selectableTypes;
  if (selectedType.isSwordsman()) {
    selectableTypes=EMovableType.swordsmen;
  }
 else   if (selectedType.isPikeman()) {
    selectableTypes=EMovableType.pikemen;
  }
 else   if (selectedType.isBowman()) {
    selectableTypes=EMovableType.bowmen;
  }
 else {
    selectableTypes=EnumSet.of(selectedType);
  }
  final List<ISelectable> selected=new LinkedList<>();
  for (  final ShortPoint2D pos : new MapCircle(actionPosition,SELECT_BY_TYPE_RADIUS)) {
    final IGuiMovable movable=grid.getMovable(pos.x,pos.y);
    if (movable != null && selectableTypes.contains(movable.getMovableType()) && canSelectPlayer(movable.getPlayerId())) {
      selected.add(movable);
    }
  }
  setSelection(new SelectionSet(selected));
}

Fixed version (ground truth):
private void selectPointType(PointAction action){
  final ShortPoint2D actionPosition=action.getPosition();
  final IGuiMovable selectedMovable=getSelectableMovable(actionPosition.x,actionPosition.y);
  if (selectedMovable == null) {
    setSelection(new SelectionSet());
    return;
  }
  EMovableType selectedType=selectedMovable.getMovableType();
  byte selectedPlayerId=selectedMovable.getPlayerId();
  Set<EMovableType> selectableTypes;
  if (selectedType.isSwordsman()) {
    selectableTypes=EMovableType.swordsmen;
  }
 else   if (selectedType.isPikeman()) {
    selectableTypes=EMovableType.pikemen;
  }
 else   if (selectedType.isBowman()) {
    selectableTypes=EMovableType.bowmen;
  }
 else {
    selectableTypes=EnumSet.of(selectedType);
  }
  final List<ISelectable> selected=new LinkedList<>();
  for (  final ShortPoint2D pos : new MapCircle(actionPosition,SELECT_BY_TYPE_RADIUS)) {
    final IGuiMovable movable=grid.getMovable(pos.x,pos.y);
    if (movable != null && selectableTypes.contains(movable.getMovableType()) && selectedPlayerId == movable.getPlayerId()) {
      selected.add(movable);
    }
  }
  setSelection(new SelectionSet(selected));
}
Program: 55819
Project: 55819
Buggy source:
/** 
 * This methods decides if the given   {@link ISelectable} can be added to this selection set or not.
 * @param selectable
 */
public synchronized void add(ISelectable selectable){
  ESelectionType selectionType=selectable.getSelectionType();
  if (selectionType.priority < this.selectionType.priority) {
    return;
  }
 else   if (selectionType.priority > this.selectionType.priority) {
    clear();
    this.selectionType=selectionType;
  }
  if (selectionType.maxSelected > set.size()) {
    set.add(selectable);
  }
}

Fixed version (ground truth):
/** 
 * This methods decides if the given   {@link ISelectable} can be added to this selection set or not.
 * @param selectable
 */
public synchronized void add(ISelectable selectable){
  ESelectionType selectionType=selectable.getSelectionType();
  if (selectionType.priority < this.selectionType.priority) {
    return;
  }
 else   if (selectionType.priority > this.selectionType.priority) {
    setSelected(false);
    this.set.clear();
    this.selectionType=selectionType;
  }
  if (selectionType.maxSelected > set.size()) {
    set.add(selectable);
  }
}
Program: 55820
Project: 55820
Buggy source:
@Override public void kill(){
  if (this.state == EBuildingState.DESTROYED) {
    return;
  }
  System.out.println("String_Node_Str");
  if (grid != null) {
    grid.removeBuildingAt(pos);
    grid.getMapObjectsManager().addSelfDeletingMapObject(pos,EMapObjectType.BUILDING_DECONSTRUCTION_SMOKE,BUILDING_DESTRUCTION_SMOKE_DURATION,player);
    placeAdditionalMapObjects(grid,pos,false);
    showFlag(false);
    placeReusableMaterials();
    killedEvent();
  }
  releaseRequestStacks();
  allBuildings.remove(this);
  this.state=EBuildingState.DESTROYED;
}

Fixed version (ground truth):
@Override public void kill(){
  if (this.state == EBuildingState.DESTROYED) {
    return;
  }
  System.out.println("String_Node_Str");
  if (grid != null) {
    grid.removeBuildingAt(pos);
    grid.getMapObjectsManager().addSelfDeletingMapObject(pos,EMapObjectType.BUILDING_DECONSTRUCTION_SMOKE,BUILDING_DESTRUCTION_SMOKE_DURATION,player);
    placeAdditionalMapObjects(grid,pos,false);
    showFlag(false);
    placeReusableMaterials();
    killedEvent();
  }
  releaseRequestStacks();
  allBuildings.remove(this);
  this.state=EBuildingState.DESTROYED;
  this.selected=false;
}
Program: 55821
Project: 55821
Buggy source:
/** 
 * kills this movable.
 */
@Override public final void kill(){
  if (state == EMovableState.DEAD) {
    return;
  }
  grid.leavePosition(this.position,this);
  this.health=-200;
  this.strategy.strategyKilledEvent(path != null ? path.getTargetPos() : null);
  this.state=EMovableState.DEAD;
  movablesByID.remove(this.getID());
  allMovables.remove(this);
  grid.addSelfDeletingMapObject(position,EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,player);
}

Fixed version (ground truth):
/** 
 * kills this movable.
 */
@Override public final void kill(){
  if (state == EMovableState.DEAD) {
    return;
  }
  grid.leavePosition(this.position,this);
  this.health=-200;
  this.strategy.strategyKilledEvent(path != null ? path.getTargetPos() : null);
  this.state=EMovableState.DEAD;
  this.selected=false;
  movablesByID.remove(this.getID());
  allMovables.remove(this);
  grid.addSelfDeletingMapObject(position,EMapObjectType.GHOST,Constants.GHOST_PLAY_DURATION,player);
}
Program: 55822
Project: 55822
Buggy source:
private void dropCurrentMaterial(){
  EMaterialType material=movable.getMaterial();
  if (material.isDroppable()) {
    super.getGrid().dropMaterial(movable.getPos(),material,true,false);
    super.setMaterial(EMaterialType.NO_MATERIAL);
  }
}

Fixed version (ground truth):
private void dropCurrentMaterial(){
  EMaterialType material=movable.getMaterial();
  if (material.isDroppable()) {
    super.getGrid().dropMaterial(movable.getPos(),material,true,false);
  }
  super.setMaterial(EMaterialType.NO_MATERIAL);
}
Program: 55823
Project: 55823
Buggy source:
@Override protected boolean checkPathStepPreconditions(ShortPoint2D pathTarget,int step){
  return building != null;
}

Fixed version (ground truth):
@Override protected boolean checkPathStepPreconditions(ShortPoint2D pathTarget,int step){
  return isJobless() || building != null;
}
Program: 55824
Project: 55824
Buggy source:
@Override public void buildingDestroyed(){
  super.setVisible(true);
  reportAsJobless();
  dropCurrentMaterial();
  clearMark();
}

Fixed version (ground truth):
@Override public void buildingDestroyed(){
  super.setVisible(true);
  super.abortPath();
  reportAsJobless();
  dropCurrentMaterial();
  clearMark();
}
Program: 55825
Project: 55825
Buggy source:
public LinkedList<Tuple<Short,ShortPoint2D>> getPartitionsList(){
  LinkedList<Tuple<Short,ShortPoint2D>> resultList=new LinkedList<Tuple<Short,ShortPoint2D>>();
  resultList.addAll(partitionsList);
  if (resultList.size() >= 2 && resultList.getFirst().e1.equals(resultList.getLast().e1)) {
    resultList.removeFirst();
  }
  return resultList;
}

Fixed version (ground truth):
public LinkedList<Tuple<Short,ShortPoint2D>> getPartitionsList(){
  LinkedList<Tuple<Short,ShortPoint2D>> resultList=new LinkedList<Tuple<Short,ShortPoint2D>>();
  resultList.addAll(partitionsList);
  if (resultList.size() >= 2 && resultList.getFirst().e1.equals(resultList.getLast().e1) && lastPartititon != -1) {
    resultList.removeFirst();
  }
  return resultList;
}
Program: 55826
Project: 55826
Buggy source:
private void handleJobFailed(boolean reportAsJobless){
switch (state) {
case INIT_CARRY_JOB:
case GOING_TO_OFFER:
    reoffer();
case TAKING:
  if (workerCreationRequest != null) {
    workerRequester.workerCreationRequestFailed(workerCreationRequest);
  }
case GOING_TO_REQUEST:
if (request != null) {
  request.deliveryAborted();
}
break;
case INIT_BECOME_SOLDIER_JOB:
case GOING_TO_BARRACK:
barrack.bearerRequestFailed();
break;
case DROPPING:
break;
case INIT_CONVERT_WITH_TOOL_JOB:
reoffer();
case INIT_CONVERT_JOB:
workerRequester.workerCreationRequestFailed(workerCreationRequest);
break;
case DEAD_OBJECT:
break;
case JOBLESS:
break;
default :
break;
}
EMaterialType carriedMaterial=super.setMaterial(EMaterialType.NO_MATERIAL);
if (carriedMaterial != EMaterialType.NO_MATERIAL) {
super.getGrid().dropMaterial(movable.getPos(),materialType,true,false);
}
offer=null;
request=null;
materialType=null;
workerCreationRequest=null;
workerRequester=null;
state=EBearerState.JOBLESS;
if (reportAsJobless) {
reportJobless();
}
}

Fixed version (ground truth):
private void handleJobFailed(boolean reportAsJobless){
switch (state) {
case INIT_CARRY_JOB:
case GOING_TO_OFFER:
    reoffer();
case TAKING:
  if (workerCreationRequest != null) {
    workerRequester.workerCreationRequestFailed(workerCreationRequest);
  }
case GOING_TO_REQUEST:
if (request != null) {
  request.deliveryAborted();
}
break;
case DROPPING:
if (request != null) {
boolean offerMaterial=droppingMaterial();
super.setMaterial(EMaterialType.NO_MATERIAL);
super.getGrid().dropMaterial(super.getPos(),materialType,offerMaterial,false);
}
break;
case INIT_BECOME_SOLDIER_JOB:
case GOING_TO_BARRACK:
barrack.bearerRequestFailed();
break;
case INIT_CONVERT_WITH_TOOL_JOB:
reoffer();
case INIT_CONVERT_JOB:
workerRequester.workerCreationRequestFailed(workerCreationRequest);
break;
case DEAD_OBJECT:
break;
case JOBLESS:
break;
default :
break;
}
EMaterialType carriedMaterial=super.setMaterial(EMaterialType.NO_MATERIAL);
if (carriedMaterial != EMaterialType.NO_MATERIAL) {
super.getGrid().dropMaterial(movable.getPos(),materialType,true,false);
}
offer=null;
request=null;
materialType=null;
workerCreationRequest=null;
workerRequester=null;
state=EBearerState.JOBLESS;
if (reportAsJobless) {
reportJobless();
}
}
Program: 55827
Project: 55827
Buggy source:
@Override public boolean droppingMaterial(){
  if (request != null) {
    if (request.isActive() && request.getPos().equals(movable.getPos())) {
      request.deliveryFulfilled();
      return false;
    }
 else {
      request.deliveryAborted();
      request=null;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean droppingMaterial(){
  if (request != null) {
    if (request.isActive() && request.getPos().equals(movable.getPos())) {
      request.deliveryFulfilled();
      request=null;
      return false;
    }
 else {
      request.deliveryAborted();
      request=null;
    }
  }
  return true;
}
Program: 55828
Project: 55828
Buggy source:
private void handleJobFailed(boolean reportAsJobless){
switch (state) {
case INIT_CARRY_JOB:
case GOING_TO_OFFER:
    reoffer();
case TAKING:
  if (workerCreationRequest != null) {
    workerRequester.workerCreationRequestFailed(workerCreationRequest);
  }
case GOING_TO_REQUEST:
if (request != null) {
  request.deliveryAborted();
}
break;
case INIT_BECOME_SOLDIER_JOB:
case GOING_TO_BARRACK:
barrack.bearerRequestFailed();
break;
case DROPPING:
break;
case INIT_CONVERT_WITH_TOOL_JOB:
reoffer();
case INIT_CONVERT_JOB:
workerRequester.workerCreationRequestFailed(workerCreationRequest);
break;
case DEAD_OBJECT:
break;
case JOBLESS:
break;
default :
break;
}
EMaterialType carriedMaterial=super.setMaterial(EMaterialType.NO_MATERIAL);
if (carriedMaterial != EMaterialType.NO_MATERIAL) {
super.getGrid().dropMaterial(movable.getPos(),materialType,true,false);
}
offer=null;
request=null;
materialType=null;
workerCreationRequest=null;
workerRequester=null;
state=EBearerState.JOBLESS;
if (reportAsJobless) {
reportJobless();
}
}

Fixed version (ground truth):
private void handleJobFailed(boolean reportAsJobless){
switch (state) {
case INIT_CARRY_JOB:
case GOING_TO_OFFER:
    reoffer();
case TAKING:
  if (workerCreationRequest != null) {
    workerRequester.workerCreationRequestFailed(workerCreationRequest);
  }
case GOING_TO_REQUEST:
if (request != null) {
  request.deliveryAborted();
}
break;
case DROPPING:
if (request != null) {
boolean offerMaterial=droppingMaterial();
super.setMaterial(EMaterialType.NO_MATERIAL);
super.getGrid().dropMaterial(super.getPos(),materialType,offerMaterial,false);
}
break;
case INIT_BECOME_SOLDIER_JOB:
case GOING_TO_BARRACK:
barrack.bearerRequestFailed();
break;
case INIT_CONVERT_WITH_TOOL_JOB:
reoffer();
case INIT_CONVERT_JOB:
workerRequester.workerCreationRequestFailed(workerCreationRequest);
break;
case DEAD_OBJECT:
break;
case JOBLESS:
break;
default :
break;
}
EMaterialType carriedMaterial=super.setMaterial(EMaterialType.NO_MATERIAL);
if (carriedMaterial != EMaterialType.NO_MATERIAL) {
super.getGrid().dropMaterial(movable.getPos(),materialType,true,false);
}
offer=null;
request=null;
materialType=null;
workerCreationRequest=null;
workerRequester=null;
state=EBearerState.JOBLESS;
if (reportAsJobless) {
reportJobless();
}
}
Program: 55829
Project: 55829
Buggy source:
@Override public boolean droppingMaterial(){
  if (request != null) {
    if (request.isActive() && request.getPos().equals(movable.getPos())) {
      request.deliveryFulfilled();
      return false;
    }
 else {
      request.deliveryAborted();
      request=null;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean droppingMaterial(){
  if (request != null) {
    if (request.isActive() && request.getPos().equals(movable.getPos())) {
      request.deliveryFulfilled();
      request=null;
      return false;
    }
 else {
      request.deliveryAborted();
      request=null;
    }
  }
  return true;
}
Program: 55830
Project: 55830
Buggy source:
private void selectPointType(PointAction action){
  final ShortPoint2D actionPosition=action.getPosition();
  final IGuiMovable centerSelectable=getSelectableMovable(actionPosition.x,actionPosition.y);
  if (centerSelectable == null) {
    setSelection(new SelectionSet());
    return;
  }
  final List<ISelectable> selected=new LinkedList<ISelectable>();
  selected.add(centerSelectable);
  for (  final ShortPoint2D pos : new MapCircle(actionPosition,SELECT_BY_TYPE_RADIUS)) {
    final IGuiMovable movable=grid.getMovable(pos.x,pos.y);
    if (movable != null && movable.getMovableType() == centerSelectable.getMovableType() && canSelectPlayer(movable.getPlayerId())) {
      selected.add(movable);
    }
  }
  setSelection(new SelectionSet(selected));
}

Fixed version (ground truth):
private void selectPointType(PointAction action){
  final ShortPoint2D actionPosition=action.getPosition();
  final IGuiMovable centerSelectable=getSelectableMovable(actionPosition.x,actionPosition.y);
  if (centerSelectable == null) {
    setSelection(new SelectionSet());
    return;
  }
  final List<ISelectable> selected=new LinkedList<ISelectable>();
  for (  final ShortPoint2D pos : new MapCircle(actionPosition,SELECT_BY_TYPE_RADIUS)) {
    final IGuiMovable movable=grid.getMovable(pos.x,pos.y);
    if (movable != null && movable.getMovableType() == centerSelectable.getMovableType() && canSelectPlayer(movable.getPlayerId())) {
      selected.add(movable);
    }
  }
  setSelection(new SelectionSet(selected));
}
Program: 55831
Project: 55831
Buggy source:
private void goToDiggablePosition(){
  super.getGrid().setMarked(movable.getPos(),false);
  ShortPoint2D diggablePos=getDiggablePosition();
  if (diggablePos != null) {
    if (super.goToPos(diggablePos)) {
      state=EDiggerState.GOING_TO_POS;
      super.getGrid().setMarked(diggablePos,true);
    }
 else {
      reportJobless();
    }
  }
 else {
    reportJobless();
  }
}

Fixed version (ground truth):
private void goToDiggablePosition(){
  super.getGrid().setMarked(movable.getPos(),false);
  ShortPoint2D diggablePos=getDiggablePosition();
  if (diggablePos != null) {
    if (super.goToPos(diggablePos)) {
      state=EDiggerState.GOING_TO_POS;
      super.getGrid().setMarked(diggablePos,true);
    }
 else {
      reportJobless();
    }
  }
 else   if (allPositionsFlattened()) {
    reportJobless();
  }
}
Program: 55832
Project: 55832
Buggy source:
public void releaseSoldier(ESoldierType soldierType){
  Iterator<SoldierRequest> searchedSoldiersIterator=searchedSoldiers.iterator();
  while (searchedSoldiersIterator.hasNext()) {
    if (searchedSoldiersIterator.next().soldierType == soldierType) {
      searchedSoldiersIterator.remove();
    }
  }
  for (  Entry<IBuildingOccupyableMovable,SoldierRequest> commingSoldierEntry : commingSoldiers.entrySet()) {
    if (commingSoldierEntry.getValue().soldierType == soldierType) {
      commingSoldierEntry.getKey().leaveOccupyableBuilding(super.getDoor());
      emptyPlaces.add(commingSoldierEntry.getValue().place);
      commingSoldiers.remove(commingSoldierEntry.getKey());
      return;
    }
  }
  for (  TowerOccupier occupier : sortedOccupiers) {
    if (occupier.soldier.getMovableType().getSoldierType() == soldierType && !toBeReleasedOccupiers.contains(occupier)) {
      toBeReleasedOccupiers.add(occupier);
      return;
    }
  }
}

Fixed version (ground truth):
public void releaseSoldier(ESoldierType soldierType){
  Iterator<SoldierRequest> searchedSoldiersIterator=searchedSoldiers.iterator();
  while (searchedSoldiersIterator.hasNext()) {
    SoldierRequest soldierRequest=searchedSoldiersIterator.next();
    if (soldierRequest.soldierType == soldierType) {
      searchedSoldiersIterator.remove();
      emptyPlaces.add(soldierRequest.place);
    }
  }
  for (  Entry<IBuildingOccupyableMovable,SoldierRequest> commingSoldierEntry : commingSoldiers.entrySet()) {
    if (commingSoldierEntry.getValue().isOfTypeOrClass(soldierType)) {
      commingSoldierEntry.getKey().leaveOccupyableBuilding(super.getDoor());
      emptyPlaces.add(commingSoldierEntry.getValue().place);
      commingSoldiers.remove(commingSoldierEntry.getKey());
      return;
    }
  }
  for (  TowerOccupier occupier : sortedOccupiers) {
    if (occupier.soldier.getMovableType().getSoldierType() == soldierType && !toBeReleasedOccupiers.contains(occupier)) {
      toBeReleasedOccupiers.add(occupier);
      return;
    }
  }
}
Program: 55834
Project: 55834
Buggy source:
private void drawStones(int x,int y,IMapObject object,float color){
  Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(OBJECTS_FILE,STONE);
  int stones=(int)(seq.length() - object.getStateProgress() - 1);
  draw(seq.getImageSafe(stones),x,y,color);
}

Fixed version (ground truth):
private void drawStones(int x,int y,int availableStones,float color){
  Sequence<? extends Image> seq=this.imageProvider.getSettlerSequence(OBJECTS_FILE,STONE);
  int stones=seq.length() - availableStones - 1;
  draw(seq.getImageSafe(stones),x,y,color);
}
Program: 55836
Project: 55836
Buggy source:
@Override public void changeHeightTowards(short x,short y,byte targetHeight){
  landscapeGrid.flattenAndChangeHeightTowards(x,y,targetHeight);
  objectsGrid.removeMapObjectType(x,y,EMapObjectType.CORN_ADULT);
  objectsGrid.removeMapObjectType(x,y,EMapObjectType.CORN_DEAD);
  objectsGrid.removeMapObjectType(x,y,EMapObjectType.CORN_GROWING);
}

Fixed version (ground truth):
@Override public void changeHeightTowards(short x,short y,byte targetHeight){
  landscapeGrid.flattenAndChangeHeightTowards(x,y,targetHeight);
  objectsGrid.removeMapObjectTypes(x,y,EMapObjectType.TO_BE_REMOVED_WHEN_FLATTENED);
}
Program: 55837
Project: 55837
Buggy source:
private void cutStone(ShortPoint2D pos){
  short x=(short)(pos.x - 1);
  short y=(short)(pos.y + 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,null);
      removeMapObjectType(x,y,EMapObjectType.STONE);
    }
  }
}

Fixed version (ground truth):
private void cutStone(ShortPoint2D pos){
  short x=(short)(pos.x - 1);
  short y=(short)(pos.y + 1);
  AbstractHexMapObject stone=grid.getMapObject(x,y,EMapObjectType.STONE);
  if (stone != null) {
    stone.cutOff();
    if (!stone.canBeCut()) {
      addSelfDeletingMapObject(new ShortPoint2D(x,y),EMapObjectType.CUT_OFF_STONE,Stone.DECOMPOSE_DELAY,null);
      removeMapObjectType(x,y,EMapObjectType.STONE);
    }
  }
}
Program: 55838
Project: 55838
Buggy source:
public void addStone(ShortPoint2D pos,int capacity){
  addMapObject(pos,new Stone(capacity));
}

Fixed version (ground truth):
public void addStone(ShortPoint2D pos,int capacity){
  if (capacity > 0) {
    addMapObject(pos,new Stone(capacity));
  }
 else {
    addSelfDeletingMapObject(pos,EMapObjectType.CUT_OFF_STONE,Stone.DECOMPOSE_DELAY,null);
  }
}
Program: 55839
Project: 55839
Buggy source:
@Override public boolean tryToTakeMaterial(){
  if (state != EBuildingState.BRICKLAYERS_REQUESTED) {
    return false;
  }
  remainingMaterialActions--;
  constructionProgress+=1f / (Constants.BRICKLAYER_ACTIONS_PER_MATERIAL * getBuildingType().getNumberOfConstructionMaterials());
  if (remainingMaterialActions > 0) {
    return true;
  }
 else {
    IRequestStack stack=getStackWithMaterial();
    if (priority != EPriority.STOPPED && stack != null) {
      stack.pop();
      remainingMaterialActions=Constants.BRICKLAYER_ACTIONS_PER_MATERIAL;
      return true;
    }
 else {
      if (areAllStacksFullfilled()) {
        finishConstruction();
      }
 else {
        state=EBuildingState.WAITING_FOR_MATERIAL;
        RescheduleTimer.add(this,WAITING_FOR_MATERIAL_PERIOD);
      }
      return false;
    }
  }
}

Fixed version (ground truth):
@Override public boolean tryToTakeMaterial(){
  if (state != EBuildingState.BRICKLAYERS_REQUESTED) {
    return false;
  }
  remainingMaterialActions--;
  constructionProgress+=1f / (Constants.BRICKLAYER_ACTIONS_PER_MATERIAL * getBuildingType().getNumberOfConstructionMaterials());
  if (remainingMaterialActions > 0) {
    return true;
  }
 else {
    IRequestStack stack=getStackWithMaterial();
    if (stack != null) {
      stack.pop();
      remainingMaterialActions=Constants.BRICKLAYER_ACTIONS_PER_MATERIAL;
      return true;
    }
 else {
      if (areAllStacksFullfilled()) {
        finishConstruction();
      }
 else {
        state=EBuildingState.WAITING_FOR_MATERIAL;
        RescheduleTimer.add(this,WAITING_FOR_MATERIAL_PERIOD);
      }
      return false;
    }
  }
}
Program: 55840
Project: 55840
Buggy source:
public void setPriority(EPriority newPriority){
  this.priority=newPriority;
  if (stacks != null) {
    for (    IRequestStack curr : stacks) {
      curr.setPriority(newPriority);
    }
  }
}

Fixed version (ground truth):
public void setPriority(EPriority newPriority){
  this.priority=newPriority;
  if (stacks != null) {
    for (    IRequestStack curr : stacks) {
      curr.setPriority(newPriority);
    }
  }
  if (newPriority == EPriority.STOPPED) {
switch (state) {
case IN_FLATTERNING:
      state=EBuildingState.CREATED;
    break;
case BRICKLAYERS_REQUESTED:
  state=EBuildingState.WAITING_FOR_MATERIAL;
RescheduleTimer.add(this,WAITING_FOR_MATERIAL_PERIOD);
break;
}
}
}
Program: 55841
Project: 55841
Buggy source:
private void initConstruction(){
  stacks=createConstructionStacks();
  placeAdditionalMapObjects(grid,pos,true);
  this.state=EBuildingState.IN_FLATTERNING;
  RescheduleTimer.add(this,IS_FLATTENED_RECHECK_PERIOD);
  requestDiggers();
}

Fixed version (ground truth):
private void initConstruction(){
  stacks=createConstructionStacks();
  placeAdditionalMapObjects(grid,pos,true);
  this.state=EBuildingState.CREATED;
  RescheduleTimer.add(this,IS_UNSTOPPED_RECHECK_PERIOD);
}
Program: 55842
Project: 55842
Buggy source:
private void tryToBuild(){
  if (constructionSite.tryToTakeMaterial()) {
    super.playAction(EMovableAction.ACTION1,BRICKLAYER_ACTION_DURATION);
  }
 else {
    jobFinished();
  }
}

Fixed version (ground truth):
private void tryToBuild(){
  if (constructionSite.isBricklayerRequestActive() && constructionSite.tryToTakeMaterial()) {
    super.playAction(EMovableAction.ACTION1,BRICKLAYER_ACTION_DURATION);
  }
 else {
    jobFinished();
  }
}
Program: 55843
Project: 55843
Buggy source:
private final boolean isValidPosition(IPathCalculatable requester,int x,int y,short blockedAtStartPartition){
  return isInBounds(x,y) && (blockedAtStartPartition >= 0 && map.getBlockedPartition(x,y) == blockedAtStartPartition || !isBlocked(requester,x,y));
}

Fixed version (ground truth):
private final boolean isValidPosition(IPathCalculatable requester,int fromX,int fromY,int toX,int toY,short blockedAtStartPartition){
  return isInBounds(toX,toY) && (!isBlocked(requester,toX,toY) || (blockedAtStartPartition >= 0 && map.getBlockedPartition(toX,toY) == blockedAtStartPartition && isBlocked(requester,fromX,fromY)));
}
Program: 55845
Project: 55845
Buggy source:
@Override public void debug(){
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
@Override public void debug(){
  System.out.println("String_Node_Str" + pos);
}