nus-yam/ex-repair huggingface dataset:
Program: 56536
Project: 56536
Buggy source:
public boolean isProtected(short x,short y){
  return this.protectedGrid.get(x * width + y);
}

Fixed version (ground truth):
public boolean isProtected(short x,short y){
  return this.protectedGrid.get(getIdx(x,y));
}
Program: 56537
Project: 56537
Buggy source:
public void setMarked(short x,short y,boolean marked){
  this.markedGrid.set(x * width + y,marked);
}

Fixed version (ground truth):
public void setMarked(short x,short y,boolean marked){
  this.markedGrid.set(getIdx(x,y),marked);
}
Program: 56538
Project: 56538
Buggy source:
public void setProtected(short x,short y,boolean setProtected){
  this.protectedGrid.set(x * width + y,setProtected);
}

Fixed version (ground truth):
public void setProtected(short x,short y,boolean setProtected){
  this.protectedGrid.set(getIdx(x,y),setProtected);
}
Program: 56539
Project: 56539
Buggy source:
public boolean isBlocked(short x,short y){
  return blockedGrid.get(x * width + y);
}

Fixed version (ground truth):
public boolean isBlocked(short x,short y){
  return blockedGrid.get(getIdx(x,y));
}
Program: 56540
Project: 56540
Buggy source:
/** 
 * sets this position blocked and protected.
 * @param x x coordinate
 * @param y y coordinate
 * @param blocked the position will be set to blocked and protected if blocked == true<br> otherwise it will be set to unblocked and unprotected.
 */
public void setBlockedAndProtected(short x,short y,boolean blocked){
  this.blockedGrid.set(x * width + y,blocked);
  this.setProtected(x,y,blocked);
}

Fixed version (ground truth):
/** 
 * sets this position blocked and protected.
 * @param x x coordinate
 * @param y y coordinate
 * @param blocked the position will be set to blocked and protected if blocked == true<br> otherwise it will be set to unblocked and unprotected.
 */
public void setBlockedAndProtected(short x,short y,boolean blocked){
  final int idx=getIdx(x,y);
  this.blockedGrid.set(idx,blocked);
  this.protectedGrid.set(idx,blocked);
}
Program: 56541
Project: 56541
Buggy source:
public boolean isMarked(short x,short y){
  return this.markedGrid.get(x * width + y);
}

Fixed version (ground truth):
public boolean isMarked(short x,short y){
  return this.markedGrid.get(getIdx(x,y));
}
Program: 56542
Project: 56542
Buggy source:
public final byte getHeightAt(short x,short y){
  return heightGrid[x][y];
}

Fixed version (ground truth):
public final byte getHeightAt(short x,short y){
  return heightGrid[getIdx(x,y)];
}
Program: 56543
Project: 56543
Buggy source:
public final void setLandscapeTypeAt(short x,short y,ELandscapeType landscapeType){
  if (landscapeType == ELandscapeType.FLATTENED && this.landscapeGrid[x][y] != ELandscapeType.FLATTENED) {
    flattenedResetter.addPosition(x,y);
  }
  this.landscapeGrid[x][y]=landscapeType;
  backgroundListener.backgroundChangedAt(x,y);
}

Fixed version (ground truth):
public final void setLandscapeTypeAt(short x,short y,ELandscapeType landscapeType){
  if (landscapeType == ELandscapeType.FLATTENED && this.landscapeGrid[getIdx(x,y)] != ELandscapeType.FLATTENED) {
    flattenedResetter.addPosition(x,y);
  }
  this.landscapeGrid[getIdx(x,y)]=landscapeType;
  backgroundListener.backgroundChangedAt(x,y);
}
Program: 56544
Project: 56544
Buggy source:
public float getResourceAmountAround(short x,short y,EResourceType type){
  int minx=Math.max(x - 1,0);
  int maxx=Math.max(x + 1,width - 1);
  int miny=Math.max(y - 1,0);
  int maxy=Math.max(y + 1,resourceAmount[0].length - 1);
  int found=0;
  for (int currentx=minx; currentx <= maxx; currentx++) {
    for (int currenty=miny; currenty <= maxy; currenty++) {
      if (resourceType[currentx][currenty] == type) {
        found+=resourceAmount[currentx][currenty];
      }
    }
  }
  return (float)found / Byte.MAX_VALUE / 9;
}

Fixed version (ground truth):
public float getResourceAmountAround(short x,short y,EResourceType type){
  int minx=Math.max(x - 1,0);
  int maxx=Math.max(x + 1,width - 1);
  int miny=Math.max(y - 1,0);
  int maxy=Math.max(y + 1,height - 1);
  int found=0;
  for (int currentx=minx; currentx <= maxx; currentx++) {
    for (int currenty=miny; currenty <= maxy; currenty++) {
      if (resourceType[getIdx(currentx,currenty)] == type) {
        found+=resourceAmount[getIdx(x,y)];
      }
    }
  }
  return (float)found / Byte.MAX_VALUE / 9;
}
Program: 56545
Project: 56545
Buggy source:
public LandscapeGrid(short width,short height){
  this.width=width;
  this.heightGrid=new byte[width][height];
  this.landscapeGrid=new ELandscapeType[width][height];
  this.resourceAmount=new byte[width][height];
  this.resourceType=new EResourceType[width][height];
  this.temporaryFlatened=new byte[width * height];
  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 ELandscapeType[width * height];
  this.resourceAmount=new byte[width * height];
  this.resourceType=new EResourceType[width * height];
  this.temporaryFlatened=new byte[width * height];
  flattenedResetter=new FlattenedResetter(this);
  setBackgroundListener(null);
}
Program: 56546
Project: 56546
Buggy source:
public final void pickResourceAt(short x,short y){
  resourceAmount[x][y]--;
}

Fixed version (ground truth):
public final void pickResourceAt(short x,short y){
  resourceAmount[getIdx(x,y)]--;
}
Program: 56547
Project: 56547
Buggy source:
/** 
 * gets the resource amount at the given position
 * @param x
 * @param y
 * @return The amount of resources, where 0 is no resources and {@link Byte.MAX_VALUE} means full resources.
 */
public final byte getResourceAmountAt(short x,short y){
  return resourceAmount[x][y];
}

Fixed version (ground truth):
/** 
 * gets the resource amount at the given position
 * @param x
 * @param y
 * @return The amount of resources, where 0 is no resources and {@link Byte.MAX_VALUE} means full resources.
 */
public final byte getResourceAmountAt(short x,short y){
  return resourceAmount[getIdx(x,y)];
}
Program: 56548
Project: 56548
Buggy source:
@Override public boolean countFlattenedDown(short x,short y){
  int i=getFlatIndex(x,y);
  temporaryFlatened[i]--;
  if (temporaryFlatened[i] <= -30) {
    temporaryFlatened[i]=0;
    setLandscapeTypeAt(x,y,ELandscapeType.GRASS);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean countFlattenedDown(short x,short y){
  int i=getIdx(x,y);
  temporaryFlatened[i]--;
  if (temporaryFlatened[i] <= -30) {
    temporaryFlatened[i]=0;
    setLandscapeTypeAt(x,y,ELandscapeType.GRASS);
    return true;
  }
 else {
    return false;
  }
}
Program: 56549
Project: 56549
Buggy source:
@Override public final void walkOn(int x,int y){
  int i=getFlatIndex(x,y);
  if (temporaryFlatened[i] < 100) {
    temporaryFlatened[i]+=3;
    if (temporaryFlatened[i] > 20) {
      flaten(x,y);
    }
  }
}

Fixed version (ground truth):
@Override public final void walkOn(int x,int y){
  int i=getIdx(x,y);
  if (temporaryFlatened[i] < 100) {
    temporaryFlatened[i]+=3;
    if (temporaryFlatened[i] > 20) {
      flaten(x,y);
    }
  }
}
Program: 56550
Project: 56550
Buggy source:
public final void setResourceAt(short x,short y,EResourceType resourceType,byte amount){
  this.resourceType[x][y]=resourceType;
  this.resourceAmount[x][y]=amount;
}

Fixed version (ground truth):
public final void setResourceAt(short x,short y,EResourceType resourceType,byte amount){
  this.resourceType[getIdx(x,y)]=resourceType;
  this.resourceAmount[getIdx(x,y)]=amount;
}
Program: 56551
Project: 56551
Buggy source:
public final void setHeightAt(short x,short y,byte height){
  this.heightGrid[x][y]=height;
  backgroundListener.backgroundChangedAt(x,y);
}

Fixed version (ground truth):
public final void setHeightAt(short x,short y,byte height){
  this.heightGrid[getIdx(x,y)]=height;
  backgroundListener.backgroundChangedAt(x,y);
}
Program: 56552
Project: 56552
Buggy source:
public final boolean hasResourceAt(short x,short y,EResourceType resourceType){
  return getResourceTypeAt(x,y) == resourceType && resourceAmount[x][y] > 0;
}

Fixed version (ground truth):
public final boolean hasResourceAt(short x,short y,EResourceType resourceType){
  return getResourceTypeAt(x,y) == resourceType && resourceAmount[getIdx(x,y)] > 0;
}
Program: 56553
Project: 56553
Buggy source:
public final void changeHeightAt(short x,short y,byte delta){
  this.heightGrid[x][y]+=delta;
  backgroundListener.backgroundChangedAt(x,y);
}

Fixed version (ground truth):
public final void changeHeightAt(short x,short y,byte delta){
  this.heightGrid[getIdx(x,y)]+=delta;
  backgroundListener.backgroundChangedAt(x,y);
}
Program: 56554
Project: 56554
Buggy source:
public final EResourceType getResourceTypeAt(short x,short y){
  return resourceType[x][y];
}

Fixed version (ground truth):
public final EResourceType getResourceTypeAt(short x,short y){
  return resourceType[getIdx(x,y)];
}
Program: 56555
Project: 56555
Buggy source:
public final ELandscapeType getLandscapeTypeAt(short x,short y){
  return landscapeGrid[x][y];
}

Fixed version (ground truth):
public final ELandscapeType getLandscapeTypeAt(short x,short y){
  return landscapeGrid[getIdx(x,y)];
}
Program: 56556
Project: 56556
Buggy source:
@Override public final Color getDebugColorAt(int x,int y){
  return debugColors[x][y];
}

Fixed version (ground truth):
@Override public final Color getDebugColorAt(int x,int y){
  return isLandscapeBlocking((short)x,(short)y) ? new Color(0,0,0,1) : (flagsGrid.isProtected((short)x,(short)y) ? new Color(0,0,1,1) : (flagsGrid.isMarked((short)x,(short)y) ? new Color(0,1,0,1) : null));
}
Program: 56557
Project: 56557
Buggy source:
private final void takeOverBlockedLand(LinkedList<ISPosition2D> blockedBorder,short startPartition){
  for (  ISPosition2D curr : blockedBorder) {
    short y=curr.getY();
    for (short x=curr.getX(); ; x++) {
      if (grid.isInBounds(x,y) && grid.isBlocked(x,y)) {
        grid.setPartitionAndPlayerAt(x,y,startPartition);
      }
 else {
        break;
      }
    }
  }
}

Fixed version (ground truth):
private final void takeOverBlockedLand(LinkedList<ISPosition2D> blockedBorder,short startPartition){
  for (  ISPosition2D curr : blockedBorder) {
    short y=curr.getY();
    for (short x=curr.getX(); ; x++) {
      if (grid.isInBounds(x,y) && grid.isBlocked(x,y)) {
        grid.setPartitionAndPlayerAt(x,y,startPartition);
      }
 else {
        break;
      }
    }
    for (short x=(short)(curr.getX() - 1); ; x--) {
      if (grid.isInBounds(x,y) && grid.isBlocked(x,y)) {
        grid.setPartitionAndPlayerAt(x,y,startPartition);
      }
 else {
        break;
      }
    }
  }
}
Program: 56558
Project: 56558
Buggy source:
private final void checkLandmarks(ISPosition2D startPos,short startPartition,EDirection startDirection){
  EDirection blockedDir=startDirection;
  ISPosition2D blocked=blockedDir.getNextHexPoint(startPos);
  ISPosition2D currBase=startPos;
  LinkedList<ISPosition2D> blockedBorder=new LinkedList<ISPosition2D>();
  blockedBorder.add(blocked);
  for (byte i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection neighborDir=blockedDir.getNeighbor(-1);
    ISPosition2D neighborPos=neighborDir.getNextHexPoint(currBase);
    if (!grid.isInBounds(neighborPos.getX(),neighborPos.getY())) {
      takeOverBlockedLand(blockedBorder,startPartition);
      break;
    }
 else     if (grid.isBlocked(neighborPos.getX(),neighborPos.getY())) {
      blocked=neighborPos;
      blockedDir=neighborDir;
      blockedBorder.add(blocked);
      i=0;
    }
 else     if (grid.getPartitionAt(neighborPos.getX(),neighborPos.getY()) == startPartition) {
      currBase=neighborPos;
      blockedDir=EDirection.getDirection(currBase,blocked);
      i=0;
      if (neighborPos.equals(startPos)) {
        takeOverBlockedLand(blockedBorder,startPartition);
        break;
      }
    }
 else {
      break;
    }
  }
}

Fixed version (ground truth):
private final void checkLandmarks(ISPosition2D startPos,short startPartition,EDirection startDirection){
  EDirection blockedDir=startDirection;
  ISPosition2D blocked=blockedDir.getNextHexPoint(startPos);
  ISPosition2D currBase=startPos;
  LinkedList<ISPosition2D> blockedBorder=new LinkedList<ISPosition2D>();
  blockedBorder.add(blocked);
  int length;
  for (byte i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    length=blockedBorder.size();
    EDirection neighborDir=blockedDir.getNeighbor(-1);
    ISPosition2D neighborPos=neighborDir.getNextHexPoint(currBase);
    if (!grid.isInBounds(neighborPos.getX(),neighborPos.getY())) {
      takeOverBlockedLand(blockedBorder,startPartition);
      break;
    }
 else     if (grid.isBlocked(neighborPos.getX(),neighborPos.getY())) {
      blocked=neighborPos;
      if (blocked.equals(blockedBorder.getFirst())) {
        takeOverBlockedLand(blockedBorder,startPartition);
        break;
      }
 else {
        blockedDir=neighborDir;
        blockedBorder.add(blocked);
        i=0;
      }
    }
 else     if (grid.getPartitionAt(neighborPos.getX(),neighborPos.getY()) == startPartition) {
      currBase=neighborPos;
      blockedDir=EDirection.getDirection(currBase,blocked);
      i=0;
      if (neighborPos.equals(startPos)) {
        takeOverBlockedLand(blockedBorder,startPartition);
        break;
      }
    }
 else {
      break;
    }
  }
}
Program: 56559
Project: 56559
Buggy source:
/** 
 * Gets a list of matches. <p> The list should be immutable to prevent problems with concurrent modification exceptions.
 * @return The list.
 */
public List<IMatch> getMatches();

Fixed version (ground truth):
/** 
 * Gets an array of matches. <br> NOTE: elements of the array might be null!!
 * @return the array of matches
 */
public IMatch[] getMatches();
Program: 56560
Project: 56560
Buggy source:
@Override public void drawAt(GLDrawContext gl){
  if (listIsOld) {
    ArrayList<DisplayableMatch> displaymatches=new ArrayList<DisplayableMatch>();
    for (    IMatch m : networkConnector.getMatches()) {
      displaymatches.add(new DisplayableMatch(m));
    }
    list=new UIList<DisplayableMatch>(displaymatches,.1f);
    this.addChild(list,0,.15f,1,1);
    listIsOld=false;
  }
  super.drawAt(gl);
}

Fixed version (ground truth):
@Override public void drawAt(GLDrawContext gl){
  if (listIsOld) {
    ArrayList<DisplayableMatch> displaymatches=new ArrayList<DisplayableMatch>();
    for (    IMatch m : networkConnector.getMatches()) {
      if (m != null)       displaymatches.add(new DisplayableMatch(m));
    }
    list=new UIList<DisplayableMatch>(displaymatches,.1f);
    this.addChild(list,0,.15f,1,1);
    listIsOld=false;
  }
  super.drawAt(gl);
}
Program: 56561
Project: 56561
Buggy source:
private void reloadPlayerList(){
  if (!playerListValid) {
    playerListValid=true;
    listContainer.removeAll();
    ArrayList<PlayerItem> players=new ArrayList<PlayerItem>();
    for (    INetworkPlayer player : networkScreen.getPlayerList()) {
      players.add(new PlayerItem(player));
    }
    UIList<PlayerItem> list=new UIList<PlayerItem>(players,.2f);
    listContainer.addChild(list,0,0,1,1);
  }
}

Fixed version (ground truth):
private void reloadPlayerList(){
  if (!playerListValid) {
    playerListValid=true;
    listContainer.removeAll();
    ArrayList<PlayerItem> players=new ArrayList<PlayerItem>();
    if (networkScreen.getPlayers() != null) {
      for (      INetworkPlayer player : networkScreen.getPlayers()) {
        players.add(new PlayerItem(player));
      }
    }
    UIList<PlayerItem> list=new UIList<PlayerItem>(players,.2f);
    listContainer.addChild(list,0,0,1,1);
  }
}
Program: 56562
Project: 56562
Buggy source:
@Override public INetworkConnector getNetworkConnector(){
  if (networkConnector == null) {
    networkConnector=new NetworkConnector();
  }
  return networkConnector;
}

Fixed version (ground truth):
@Override public INetworkConnector getNetworkConnector(){
  if (networkConnector == null) {
    networkConnector=new NetworkMatchRetriever();
  }
  return networkConnector;
}
Program: 56563
Project: 56563
Buggy source:
@Override public boolean isReady(){
  return false;
}

Fixed version (ground truth):
@Override public boolean isReady(){
  return matchPlayer.isReady();
}
Program: 56564
Project: 56564
Buggy source:
@Override public String getPlayerName(){
  return name;
}

Fixed version (ground truth):
@Override public String getPlayerName(){
  return matchPlayer.getName();
}
Program: 56565
Project: 56565
Buggy source:
public NetworkScreenAdapter(ClientThread clientThread,MatchDescription description){
  this.clientThread=clientThread;
  this.description=description;
}

Fixed version (ground truth):
public NetworkScreenAdapter(ClientThread clientThread,MatchDescription description){
  this.clientThread=clientThread;
  this.description=description;
  clientThread.setListener(new ScreenAdapterClientThreadListener());
}
Program: 56566
Project: 56566
Buggy source:
public NetworkPlayer(int i){
  name="String_Node_Str" + i;
}

Fixed version (ground truth):
public NetworkPlayer(MatchPlayer matchPlayer){
  this.matchPlayer=matchPlayer;
}
Program: 56567
Project: 56567
Buggy source:
private final void takeOverBlockedLand(LinkedList<ISPosition2D> blockedBorder,short startPartition){
  for (  ISPosition2D curr : blockedBorder) {
    short y=curr.getY();
    for (short x=curr.getX(); ; x++) {
      if (grid.isBlocked(x,y)) {
        grid.setPartitionAndPlayerAt(x,y,startPartition);
      }
 else {
        break;
      }
    }
  }
}

Fixed version (ground truth):
private final void takeOverBlockedLand(LinkedList<ISPosition2D> blockedBorder,short startPartition){
  for (  ISPosition2D curr : blockedBorder) {
    short y=curr.getY();
    for (short x=curr.getX(); ; x++) {
      if (grid.isInBounds(x,y) && grid.isBlocked(x,y)) {
        grid.setPartitionAndPlayerAt(x,y,startPartition);
      }
 else {
        break;
      }
    }
  }
}
Program: 56568
Project: 56568
Buggy source:
@Override public long getItemId(int arg0){
  return playerList.get(arg0).hashCode();
}

Fixed version (ground truth):
@Override public long getItemId(int idx){
  return getItem(idx).hashCode();
}
Program: 56569
Project: 56569
Buggy source:
public PlayerList(Context context,INetworkScreenAdapter networkScreen){
  this.context=context;
  this.networkScreen=networkScreen;
  playerList=networkScreen.getPlayerList();
}

Fixed version (ground truth):
public PlayerList(Context context,INetworkScreenAdapter networkScreen){
  this.context=context;
  this.networkScreen=networkScreen;
  playerList=networkScreen.getPlayers();
}
Program: 56570
Project: 56570
Buggy source:
@Override public Object getItem(int arg0){
  return playerList.get(arg0);
}

Fixed version (ground truth):
@Override public INetworkPlayer getItem(int idx){
  return playerList[idx];
}
Program: 56571
Project: 56571
Buggy source:
@Override public int getCount(){
  return playerList.size();
}

Fixed version (ground truth):
@Override public int getCount(){
  if (playerList != null) {
    return playerList.length;
  }
 else {
    return 0;
  }
}
Program: 56572
Project: 56572
Buggy source:
@Override public View getView(int arg0,View arg1,ViewGroup arg2){
  TextView view=new TextView(context);
  view.setText(playerList.get(arg0).getPlayerName());
  return view;
}

Fixed version (ground truth):
@Override public View getView(int idx,View arg1,ViewGroup arg2){
  TextView view=new TextView(context);
  view.setText(getItem(idx).getPlayerName());
  return view;
}
Program: 56573
Project: 56573
Buggy source:
public void changed(){
  playerList=networkScreen.getPlayerList();
  notifyDataSetChanged();
}

Fixed version (ground truth):
public void changed(){
  playerList=networkScreen.getPlayers();
  notifyDataSetChanged();
}
Program: 56574
Project: 56574
Buggy source:
public LandmarksCorrectingThread(ILandmarksThreadMap map){
  super("String_Node_Str");
  this.map=map;
  this.setDaemon(true);
  this.start();
}

Fixed version (ground truth):
public LandmarksCorrectingThread(ILandmarksThreadGrid map){
  super("String_Node_Str");
  this.grid=map;
  this.setDaemon(true);
  this.start();
}
Program: 56575
Project: 56575
Buggy source:
private final LinkedList<EDirection> getBlockedDirection(ISPosition2D position){
  LinkedList<EDirection> blockedDirections=new LinkedList<EDirection>();
  for (  EDirection currDir : EDirection.values()) {
    short currX=currDir.getNextTileX(position.getX());
    short currY=currDir.getNextTileY(position.getY());
    if (map.isInBounds(currX,currY) && map.isBlocked(currX,currY)) {
      blockedDirections.add(currDir);
    }
  }
  return blockedDirections;
}

Fixed version (ground truth):
private final LinkedList<EDirection> getBlockedDirection(ISPosition2D position){
  LinkedList<EDirection> blockedDirections=new LinkedList<EDirection>();
  for (  EDirection currDir : EDirection.values()) {
    short currX=currDir.getNextTileX(position.getX());
    short currY=currDir.getNextTileY(position.getY());
    if (grid.isInBounds(currX,currY) && grid.isBlocked(currX,currY)) {
      blockedDirections.add(currDir);
    }
  }
  return blockedDirections;
}
Program: 56576
Project: 56576
Buggy source:
private final void takeOverBlockedLand(LinkedList<ISPosition2D> blockedBorder,short startPartition){
  for (  ISPosition2D curr : blockedBorder) {
    short y=curr.getY();
    for (short x=curr.getX(); ; x++) {
      if (map.isBlocked(x,y)) {
        map.setPartitionAndPlayerAt(x,y,startPartition);
      }
 else {
        break;
      }
    }
  }
}

Fixed version (ground truth):
private final void takeOverBlockedLand(LinkedList<ISPosition2D> blockedBorder,short startPartition){
  for (  ISPosition2D curr : blockedBorder) {
    short y=curr.getY();
    for (short x=curr.getX(); ; x++) {
      if (grid.isBlocked(x,y)) {
        grid.setPartitionAndPlayerAt(x,y,startPartition);
      }
 else {
        break;
      }
    }
  }
}
Program: 56577
Project: 56577
Buggy source:
private final void checkLandmarks(ISPosition2D startPos,short startPartition,EDirection startDirection){
  EDirection blockedDir=startDirection;
  ISPosition2D blocked=blockedDir.getNextHexPoint(startPos);
  ISPosition2D currBase=startPos;
  LinkedList<ISPosition2D> blockedBorder=new LinkedList<ISPosition2D>();
  blockedBorder.add(blocked);
  for (byte i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection neighborDir=blockedDir.getNeighbor(-1);
    ISPosition2D neighborPos=neighborDir.getNextHexPoint(currBase);
    if (!map.isInBounds(neighborPos.getX(),neighborPos.getY())) {
      takeOverBlockedLand(blockedBorder,startPartition);
      break;
    }
 else     if (map.isBlocked(neighborPos.getX(),neighborPos.getY())) {
      blocked=neighborPos;
      blockedDir=neighborDir;
      blockedBorder.add(blocked);
      i=0;
    }
 else     if (map.getPartitionAt(neighborPos.getX(),neighborPos.getY()) == startPartition) {
      currBase=neighborPos;
      blockedDir=EDirection.getDirection(currBase,blocked);
      i=0;
      if (neighborPos.equals(startPos)) {
        takeOverBlockedLand(blockedBorder,startPartition);
        break;
      }
    }
 else {
      break;
    }
  }
}

Fixed version (ground truth):
private final void checkLandmarks(ISPosition2D startPos,short startPartition,EDirection startDirection){
  EDirection blockedDir=startDirection;
  ISPosition2D blocked=blockedDir.getNextHexPoint(startPos);
  ISPosition2D currBase=startPos;
  LinkedList<ISPosition2D> blockedBorder=new LinkedList<ISPosition2D>();
  blockedBorder.add(blocked);
  for (byte i=0; i < EDirection.NUMBER_OF_DIRECTIONS; i++) {
    EDirection neighborDir=blockedDir.getNeighbor(-1);
    ISPosition2D neighborPos=neighborDir.getNextHexPoint(currBase);
    if (!grid.isInBounds(neighborPos.getX(),neighborPos.getY())) {
      takeOverBlockedLand(blockedBorder,startPartition);
      break;
    }
 else     if (grid.isBlocked(neighborPos.getX(),neighborPos.getY())) {
      blocked=neighborPos;
      blockedDir=neighborDir;
      blockedBorder.add(blocked);
      i=0;
    }
 else     if (grid.getPartitionAt(neighborPos.getX(),neighborPos.getY()) == startPartition) {
      currBase=neighborPos;
      blockedDir=EDirection.getDirection(currBase,blocked);
      i=0;
      if (neighborPos.equals(startPos)) {
        takeOverBlockedLand(blockedBorder,startPartition);
        break;
      }
    }
 else {
      break;
    }
  }
}
Program: 56578
Project: 56578
Buggy source:
@Override public void run(){
  try {
    while (!stopped) {
      waitTime(300);
      if (stopped) {
        break;
      }
      MapRectangle screen=map.getScreenArea();
      if (screen == null) {
        continue;
      }
      int line=(int)(Math.random() * screen.getLines());
      int x=screen.getLineStartX(line) + (int)(Math.random() * screen.getLineLength());
      int y=screen.getLineY(line);
      if (hasTree(x,y)) {
        if (Math.random() < .5) {
          sound.playSound(INDEX_BIRDS1,VOLUME,VOLUME);
        }
 else {
          sound.playSound(INDEX_BIRDS2,VOLUME,VOLUME);
        }
        waitTime(800);
      }
 else       if (hasWater(x,y)) {
        sound.playSound(INDEX_WATER,VOLUME,VOLUME);
        waitTime(200);
      }
 else       if (hasDesert(x,y)) {
        sound.playSound(INDEX_DESERT,VOLUME,VOLUME);
        waitTime(500);
      }
    }
  }
 catch (  Throwable e) {
    System.out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    while (!stopped) {
      waitTime(300);
      if (stopped) {
        break;
      }
      MapRectangle screen=map.getScreenArea();
      if (screen == null) {
        continue;
      }
      int line=(int)(Math.random() * screen.getLines());
      int x=screen.getLineStartX(line) + (int)(Math.random() * screen.getLineLength());
      int y=screen.getLineY(line);
      if (hasTree(x,y)) {
        if (Math.random() < .5) {
          sound.playSound(INDEX_BIRDS1,VOLUME,VOLUME);
        }
 else {
          sound.playSound(INDEX_BIRDS2,VOLUME,VOLUME);
        }
        waitTime(800);
      }
 else       if (hasWater(x,y)) {
        sound.playSound(INDEX_WATER,VOLUME,VOLUME);
        waitTime(200);
      }
 else       if (hasDesert(x,y)) {
        sound.playSound(INDEX_DESERT,VOLUME,VOLUME);
        waitTime(500);
      }
    }
  }
 catch (  Throwable e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
  }
}
Program: 56579
Project: 56579
Buggy source:
private boolean checkGotoJob(){
  if (gotoJob != null) {
    calculatePathTo(gotoJob.getPosition());
    gotoJob=null;
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
private boolean checkGotoJob(){
  if (gotoJob != null) {
    executingGotoJobAction();
    calculatePathTo(gotoJob.getPosition());
    gotoJob=null;
    return true;
  }
 else {
    return false;
  }
}
Program: 56580
Project: 56580
Buggy source:
@Override protected void killedEvent(){
  if (requester != null) {
    requester.requestFailed();
  }
}

Fixed version (ground truth):
@Override protected void killedEvent(){
  if (requester != null) {
    requester.requestFailed();
  }
  if (super.getMaterial() != EMaterialType.NO_MATERIAL) {
    super.getGrid().pushMaterial(super.getPos(),super.getMaterial(),true);
    super.setMaterial(EMaterialType.NO_MATERIAL);
  }
}
Program: 56581
Project: 56581
Buggy source:
protected AbstractSoldierStrategy(IMovableGrid grid,Movable movable,EMovableType type){
  super(grid,movable);
  this.type=type;
  this.behavior=SoldierBehavior.getDefaultSoldierBehavior(this);
}

Fixed version (ground truth):
protected AbstractSoldierStrategy(IMovableGrid grid,Movable movable,EMovableType type){
  super(grid,movable);
  this.type=type;
  this.behavior=SoldierBehavior.getDefaultSoldierBehavior(this);
  super.setAction(EAction.NO_ACTION,-1);
}
Program: 56582
Project: 56582
Buggy source:
WatchingBehavior(ISoldierBehaviorable soldier){
  super(soldier);
  initActions();
}

Fixed version (ground truth):
WatchingBehavior(ISoldierBehaviorable soldier){
  super(soldier);
  super.setAction(EAction.NO_ACTION,-1);
}
Program: 56583
Project: 56583
Buggy source:
@Override public void run(){
  NetworkManager manager=new NetworkManager();
  ProgressConnector progress=content.showProgress();
  RandomSingleton.load(randomSheed);
  Timer100Milli.start();
  NetworkTimer.get().setPausing(true);
  progress.setProgressState(EProgressState.LOADING_MAP);
  ImageProvider.getInstance().startPreloading();
  MainGrid grid;
  UIState uiState;
  try {
    grid=mapcreator.getMainGrid();
    uiState=mapcreator.getUISettings(0);
  }
 catch (  MapLoadException e1) {
    e1.printStackTrace();
    listener.gameEnded();
    return;
  }
  NetworkTimer.get().setPausing(false);
  progress.setProgressState(EProgressState.LOADING_IMAGES);
  final MapInterfaceConnector connector=content.showGameMap(grid.getGraphicsGrid(),null);
  new GuiInterface(connector,manager,grid.getGuiInputGrid(),(byte)0);
  connector.addListener(this);
  connector.loadUIState(uiState);
  manager.startGameTimer();
  gameConnector=connector;
synchronized (stopMutex) {
    while (!stopped) {
      try {
        stopMutex.wait();
      }
 catch (      InterruptedException e) {
      }
    }
  }
  listener.gameEnded();
}

Fixed version (ground truth):
@Override public void run(){
  NetworkManager manager=new NetworkManager();
  ProgressConnector progress=content.showProgress();
  RandomSingleton.load(randomSheed);
  NetworkTimer.get().setPausing(true);
  Timer100Milli.start();
  progress.setProgressState(EProgressState.LOADING_MAP);
  ImageProvider.getInstance().startPreloading();
  MainGrid grid;
  UIState uiState;
  try {
    grid=mapcreator.getMainGrid();
    uiState=mapcreator.getUISettings(0);
  }
 catch (  MapLoadException e1) {
    e1.printStackTrace();
    listener.gameEnded();
    return;
  }
  NetworkTimer.get().setPausing(false);
  progress.setProgressState(EProgressState.LOADING_IMAGES);
  final MapInterfaceConnector connector=content.showGameMap(grid.getGraphicsGrid(),null);
  new GuiInterface(connector,manager,grid.getGuiInputGrid(),(byte)0);
  connector.addListener(this);
  connector.loadUIState(uiState);
  manager.startGameTimer();
  gameConnector=connector;
synchronized (stopMutex) {
    while (!stopped) {
      try {
        stopMutex.wait();
      }
 catch (      InterruptedException e) {
      }
    }
  }
  listener.gameEnded();
}
Program: 56584
Project: 56584
Buggy source:
@Override public final void hit(float strength){
  if (health > 0) {
    health-=strength * 0.1f;
    if (health <= 0) {
      this.kill();
    }
 else {
      strategy.gotHitEvent();
    }
  }
}

Fixed version (ground truth):
@Override public final void hit(float strength){
  if (health >= 0) {
    health-=strength * 0.1f;
    if (health <= 0) {
      this.kill();
      health=-1;
    }
 else {
      strategy.gotHitEvent();
    }
  }
}
Program: 56585
Project: 56585
Buggy source:
@Override public void action(Action action){
  System.out.println("String_Node_Str" + action.getActionType());
  if (action.getActionType() == EActionType.SELECT_AREA) {
  }
 else   if (action instanceof DrawLineAction) {
    if (tool != null) {
      DrawLineAction lineAction=(DrawLineAction)action;
      ShapeType shape=getActiveShape();
      tool.apply(data,shape,lineAction.getStart(),lineAction.getEnd(),lineAction.getUidy());
      dataTester.retest();
    }
  }
 else   if (action instanceof StartDrawingAction) {
    if (tool != null) {
      StartDrawingAction lineAction=(StartDrawingAction)action;
      ShapeType shape=getActiveShape();
      tool.start(data,shape,lineAction.getPos());
      dataTester.retest();
    }
  }
 else   if (action instanceof EndDrawingAction) {
    endUseStep();
    dataTester.retest();
  }
 else   if (action instanceof AbortDrawingAction) {
    MapDataDelta delta=data.getUndoDelta();
    data.apply(delta);
    data.resetUndoDelta();
    dataTester.retest();
  }
}

Fixed version (ground truth):
@Override public void action(Action action){
  System.out.println("String_Node_Str" + action.getActionType());
  if (action.getActionType() == EActionType.SELECT_AREA) {
  }
 else   if (action instanceof DrawLineAction) {
    if (tool != null) {
      DrawLineAction lineAction=(DrawLineAction)action;
      ShapeType shape=getActiveShape();
      tool.apply(data,shape,lineAction.getStart(),lineAction.getEnd(),lineAction.getUidy());
      dataTester.retest();
    }
  }
 else   if (action instanceof StartDrawingAction) {
    if (tool != null) {
      StartDrawingAction lineAction=(StartDrawingAction)action;
      ShapeType shape=getActiveShape();
      tool.start(data,shape,lineAction.getPos());
      dataTester.retest();
    }
  }
 else   if (action instanceof EndDrawingAction) {
    endUseStep();
    dataTester.retest();
  }
 else   if (action instanceof AbortDrawingAction) {
    MapDataDelta delta=data.getUndoDelta();
    data.apply(delta);
    data.resetUndoDelta();
    dataTester.retest();
  }
 else   if (action instanceof SelectAction) {
    if (tool != null) {
      SelectAction lineAction=(SelectAction)action;
      ShapeType shape=getActiveShape();
      tool.start(data,shape,lineAction.getPosition());
      tool.apply(data,shape,lineAction.getPosition(),lineAction.getPosition(),0);
      endUseStep();
      dataTester.retest();
    }
  }
}
Program: 56586
Project: 56586
Buggy source:
@Override public boolean containsPoint(UIPoint position){
  return true;
}

Fixed version (ground truth):
@Override public boolean containsPoint(UIPoint position){
  return false;
}
Program: 56587
Project: 56587
Buggy source:
protected final boolean isLandscapeBlocking(short x,short y){
  ELandscapeType landscape=landscapeGrid.getLandscapeTypeAt(x,y);
  return landscape.isWater() || landscape == ELandscapeType.MOOR || landscape == ELandscapeType.SNOW;
}

Fixed version (ground truth):
protected final boolean isLandscapeBlocking(short x,short y){
  ELandscapeType landscape=landscapeGrid.getLandscapeTypeAt(x,y);
  return landscape.isWater() || landscape == ELandscapeType.MOOR || landscape == ELandscapeType.MOORINNER || landscape == ELandscapeType.SNOW;
}
Program: 56588
Project: 56588
Buggy source:
@SuppressWarnings("String_Node_Str") public SlotQueue(T[] slottypes,int[] slotpriority){
  int slotCount=slotpriority.length;
  if (slotCount != slottypes.length) {
    throw new IllegalArgumentException();
  }
  this.slotTypes=slottypes;
  this.slotPriority=slotpriority;
  this.slots=(ElementHolder<E>[])new ElementHolder[slotCount];
  this.tails=(ElementHolder<E>[])new ElementHolder[slotCount];
  this.count=new int[slotCount];
  this.slotOrder=new int[slotCount];
  for (int i=0; i < slotCount; i++) {
    slotOrder[i]=i;
  }
  reorderSlots();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public SlotQueue(T[] slottypes,int[] slotpriority){
  int slotCount=slotpriority.length;
  if (slotCount != slottypes.length) {
    throw new IllegalArgumentException();
  }
  this.slotTypes=slottypes;
  this.slotPriority=slotpriority;
  this.slots=new ElementHolder[slotCount];
  this.tails=new ElementHolder[slotCount];
  this.count=new int[slotCount];
  this.slotOrder=new int[slotCount];
  for (int i=0; i < slotCount; i++) {
    slotOrder[i]=i;
  }
  reorderSlots();
}
Program: 56589
Project: 56589
Buggy source:
@Override public final void run(){
  while (true) {
    ISPosition2D startPos=null;
    while (startPos == null) {
      try {
        startPos=queue.take();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
    checkLandmarks(startPos);
  }
}

Fixed version (ground truth):
@Override public final void run(){
  try {
    Thread.sleep(1000);
  }
 catch (  InterruptedException e) {
  }
  while (true) {
    try {
      Thread.sleep(1);
    }
 catch (    InterruptedException e) {
    }
    ISPosition2D startPos=null;
    while (startPos == null) {
      try {
        startPos=queue.take();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
    checkLandmarks(startPos);
  }
}
Program: 56590
Project: 56590
Buggy source:
@Override public float getRank(){
  return heuristic + cost;
}

Fixed version (ground truth):
@Override public final float getRank(){
  return heuristic + cost;
}
Program: 56591
Project: 56591
Buggy source:
private void drawOccupyers(MapDrawContext context,IOccupyed building){
  for (  IBuildingOccupyer occupyer : building.getOccupyers()) {
    OccupyerPlace place=occupyer.getPlace();
    GLDrawContext gl=context.getGl();
    gl.glPushMatrix();
    gl.glTranslatef(place.getOffsetX(),place.getOffsetY(),0);
    if (place.getType() == ESoldierType.INFANTARY) {
      ImageLink image=place.looksRight() ? INSIDE_BUILDING_RIGHT : INSIDE_BUILDING_LEFT;
      Color color=context.getPlayerColor(occupyer.getMovable().getPlayer());
      imageProvider.getImage(image).draw(gl,color);
    }
 else {
      movableDrawer.draw(context,occupyer.getMovable());
    }
    gl.glPopMatrix();
  }
}

Fixed version (ground truth):
private void drawOccupyers(MapDrawContext context,IOccupyed building){
  try {
    for (    IBuildingOccupyer occupyer : building.getOccupyers()) {
      OccupyerPlace place=occupyer.getPlace();
      GLDrawContext gl=context.getGl();
      gl.glPushMatrix();
      gl.glTranslatef(place.getOffsetX(),place.getOffsetY(),0);
      if (place.getType() == ESoldierType.INFANTARY) {
        ImageLink image=place.looksRight() ? INSIDE_BUILDING_RIGHT : INSIDE_BUILDING_LEFT;
        Color color=context.getPlayerColor(occupyer.getMovable().getPlayer());
        imageProvider.getImage(image).draw(gl,color);
      }
 else {
        movableDrawer.draw(context,occupyer.getMovable());
      }
      gl.glPopMatrix();
    }
  }
 catch (  ConcurrentModificationException e) {
  }
}
Program: 56592
Project: 56592
Buggy source:
@Override public final Color getDebugColorAt(int x,int y){
  short value=(short)(partitionsGrid.getPartitionAt((short)x,(short)y) + 1);
  return new Color((value % 3) * 0.33f,((value / 3) % 3) * 0.33f,((value / 9) % 3) * 0.33f,1);
}

Fixed version (ground truth):
@Override public final Color getDebugColorAt(int x,int y){
  return flagsGrid.isBlocked((short)x,(short)y) ? new Color(0,0,0,1) : (flagsGrid.isProtected((short)x,(short)y) ? new Color(0,0,1,1) : (flagsGrid.isMarked((short)x,(short)y) ? new Color(0,1,0,1) : null));
}
Program: 56593
Project: 56593
Buggy source:
public BuildingWorkerStrategy(IMovableGrid grid,Movable movable,EMovableType movableType){
  super(grid,movable);
  this.movableType=movableType;
  grid.addJobless(this);
}

Fixed version (ground truth):
public BuildingWorkerStrategy(IMovableGrid grid,Movable movable,EMovableType movableType){
  super(grid,movable);
  this.movableType=movableType;
  makeJobless();
}
Program: 56594
Project: 56594
Buggy source:
@Override public void setWorkerJob(IWorkerRequestBuilding building){
  if (building.isNotDestroyed()) {
    this.building=building;
    this.currentJob=building.getBuildingType().getStartJob();
    this.done=false;
    this.building.occupyBuilding(this);
  }
 else {
    super.getGrid().addJobless(this);
  }
}

Fixed version (ground truth):
@Override public void setWorkerJob(IWorkerRequestBuilding building){
  if (building.isNotDestroyed()) {
    this.building=building;
    this.currentJob=building.getBuildingType().getStartJob();
    this.done=false;
    this.building.occupyBuilding(this);
    recordedJobless=false;
  }
 else {
    super.getGrid().addJobless(this);
  }
}
Program: 56595
Project: 56595
Buggy source:
@Override protected void pathRequestFailed(){
  super.setAction(EAction.NO_ACTION,-1);
  path=null;
  if (currentJob != null)   jobFailed();
}

Fixed version (ground truth):
@Override protected void pathRequestFailed(){
  super.setAction(EAction.NO_ACTION,-1);
  this.path=null;
  if (currentJob != null)   jobFailed();
}
Program: 56596
Project: 56596
Buggy source:
private void checkForDroppingMaterial(){
  EMaterialType material;
  material=super.getMaterial();
  if (material != null && material != EMaterialType.NO_MATERIAL) {
    super.setAction(EAction.DROP,Constants.MOVABLE_TAKE_DROP_DURATION);
    super.setMaterial(EMaterialType.NO_MATERIAL);
    super.getGrid().pushMaterial(super.getPos(),material,true);
  }
  super.getGrid().addJobless(this);
}

Fixed version (ground truth):
private void checkForDroppingMaterial(){
  EMaterialType material;
  material=super.getMaterial();
  if (material != null && material != EMaterialType.NO_MATERIAL) {
    super.setAction(EAction.DROP,Constants.MOVABLE_TAKE_DROP_DURATION);
    super.setMaterial(EMaterialType.NO_MATERIAL);
    super.getGrid().pushMaterial(super.getPos(),material,true);
  }
  makeJobless();
}
Program: 56597
Project: 56597
Buggy source:
@Override public void buildingDestroyed(){
  this.currentJob=null;
  if (super.isFollowingPath()) {
    super.getGrid().setMarked(super.getTargetPos(),false);
    super.abortPath();
  }
  this.done=false;
  super.setVisible(true);
}

Fixed version (ground truth):
@Override public void buildingDestroyed(){
  this.currentJob=null;
  this.building=null;
  this.path=null;
  if (super.isFollowingPath()) {
    super.getGrid().setMarked(super.getTargetPos(),false);
    super.abortPath();
  }
  this.done=false;
  super.setVisible(true);
}
Program: 56598
Project: 56598
Buggy source:
/** 
 * this method removes the enforcement in the given area
 * @param occupied
 * @param pos
 */
void freeOccupiedArea(MapShapeFilter occupied,ISPosition2D pos);

Fixed version (ground truth):
/** 
 * this method removes the enforcement in the given area
 * @param occupied
 * @param pos
 */
void freeOccupiedArea(MapCircle occupied,ISPosition2D pos);
Program: 56599
Project: 56599
Buggy source:
void occupyArea(MapShapeFilter toBeOccupied,ISPosition2D occupiersPosition,byte player);

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

Fixed version (ground truth):
@Override protected final void killedEvent(){
  setSelected(false);
  if (occupiedArea) {
    MapCircle occupied=getOccupyablePositions();
    super.getGrid().freeOccupiedArea(occupied,super.getPos());
    int idx=0;
    for (    TowerOccupyer curr : occupiers) {
      curr.soldier.leaveOccupyableBuilding(super.getBuildingArea().get(idx));
      idx++;
    }
    occupiers.clear();
  }
  allOccupyingBuildings.remove(this);
}
Program: 56601
Project: 56601
Buggy source:
public final MapShapeFilter getOccupyablePositions(){
  return new MapShapeFilter(new MapCircle(super.getPos(),CommonConstants.TOWERRADIUS),super.getGrid().getWidth(),super.getGrid().getHeight());
}

Fixed version (ground truth):
public final MapCircle getOccupyablePositions(){
  return new MapCircle(super.getPos(),CommonConstants.TOWERRADIUS);
}
Program: 56602
Project: 56602
Buggy source:
private final void occupyArea(){
  if (!occupiedArea) {
    MapShapeFilter occupying=getOccupyablePositions();
    super.getGrid().occupyArea(occupying,super.getPos(),super.getPlayer());
    occupiedArea=true;
  }
}

Fixed version (ground truth):
private final void occupyArea(){
  if (!occupiedArea) {
    MapCircle occupying=getOccupyablePositions();
    super.getGrid().occupyArea(occupying,super.getPos(),super.getPlayer());
    occupiedArea=true;
  }
}
Program: 56604
Project: 56604
Buggy source:
@Override public final void occupyArea(MapShapeFilter toBeOccupied,ISPosition2D occupiersPosition,byte player){
  List<ISPosition2D> occupiedPositions=partitionsGrid.occupyArea(toBeOccupied,occupiersPosition,player);
  bordersThread.checkPositions(occupiedPositions);
  landmarksCorrectionThread.addLandmarkedPositions(occupiedPositions);
}

Fixed version (ground truth):
@Override public final void occupyArea(MapCircle toBeOccupied,ISPosition2D occupiersPosition,byte player){
  List<ISPosition2D> occupiedPositions=partitionsGrid.occupyArea(toBeOccupied,occupiersPosition,player);
  bordersThread.checkPositions(occupiedPositions);
  landmarksCorrectionThread.addLandmarkedPositions(occupiedPositions);
}
Program: 56605
Project: 56605
Buggy source:
private MainGrid(IMapData mapGrid){
  this((short)mapGrid.getWidth(),(short)mapGrid.getHeight());
  for (short y=0; y < height; y++) {
    for (short x=0; x < width; x++) {
      ELandscapeType landscape=mapGrid.getLandscape(x,y);
      landscapeGrid.setLandscapeTypeAt(x,y,landscape);
      landscapeGrid.setHeightAt(x,y,mapGrid.getLandscapeHeight(x,y));
      if (landscape == ELandscapeType.MOUNTAIN) {
        landscapeGrid.setResourceAt(x,y,EResourceType.values()[RandomSingleton.getInt(0,2)],(byte)RandomSingleton.getInt(-100,127));
      }
 else       if (landscape.isWater()) {
        landscapeGrid.setResourceAt(x,y,EResourceType.FISH,(byte)RandomSingleton.getInt(-100,127));
      }
    }
  }
  for (short y=0; y < height; y++) {
    for (short x=0; x < width; x++) {
      MapObject object=mapGrid.getMapObject(x,y);
      if (object != null && !(object instanceof MovableObject)) {
        addMapObject(x,y,object);
      }
      if ((x + y / 2) % 4 == 0 && y % 4 == 0 && isInsideWater(x,y)) {
        mapObjectsManager.addWaves(x,y);
        if (landscapeGrid.getResourceAmountAt(x,y) > 50) {
          mapObjectsManager.addFish(x,y);
        }
      }
    }
  }
  for (short y=0; y < height; y++) {
    for (short x=0; x < width; x++) {
      MapObject object=mapGrid.getMapObject(x,y);
      if (object != null && object instanceof MovableObject) {
        addMapObject(x,y,object);
      }
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
private MainGrid(IMapData mapGrid){
  this((short)mapGrid.getWidth(),(short)mapGrid.getHeight());
  for (short y=0; y < height; y++) {
    for (short x=0; x < width; x++) {
      ELandscapeType landscape=mapGrid.getLandscape(x,y);
      landscapeGrid.setLandscapeTypeAt(x,y,landscape);
      landscapeGrid.setHeightAt(x,y,mapGrid.getLandscapeHeight(x,y));
      if (landscape == ELandscapeType.MOUNTAIN) {
        landscapeGrid.setResourceAt(x,y,EResourceType.values()[RandomSingleton.getInt(0,2)],(byte)RandomSingleton.getInt(-100,127));
      }
 else       if (landscape.isWater()) {
        landscapeGrid.setResourceAt(x,y,EResourceType.FISH,(byte)RandomSingleton.getInt(-100,127));
      }
    }
  }
  for (short y=0; y < height; y++) {
    for (short x=0; x < width; x++) {
      MapObject object=mapGrid.getMapObject(x,y);
      if (object != null && (object instanceof BuildingObject) && isTower(((BuildingObject)object).getType())) {
        addMapObject(x,y,object);
      }
      if ((x + y / 2) % 4 == 0 && y % 4 == 0 && isInsideWater(x,y)) {
        mapObjectsManager.addWaves(x,y);
        if (landscapeGrid.getResourceAmountAt(x,y) > 50) {
          mapObjectsManager.addFish(x,y);
        }
      }
    }
  }
  for (short y=0; y < height; y++) {
    for (short x=0; x < width; x++) {
      MapObject object=mapGrid.getMapObject(x,y);
      if (object != null && !((object instanceof BuildingObject) && isTower(((BuildingObject)object).getType()))) {
        addMapObject(x,y,object);
      }
    }
  }
  System.out.println("String_Node_Str");
}
Program: 56606
Project: 56606
Buggy source:
@Override public final Color getDebugColorAt(int x,int y){
  short value=(short)(partitionsGrid.getTowerCounterAt((short)x,(short)y) + 1);
  return new Color((value % 3) * 0.33f,((value / 3) % 3) * 0.33f,((value / 9) % 3) * 0.33f,1);
}

Fixed version (ground truth):
@Override public final Color getDebugColorAt(int x,int y){
  short value=(short)(partitionsGrid.getPartitionAt((short)x,(short)y) + 1);
  return new Color((value % 3) * 0.33f,((value / 3) % 3) * 0.33f,((value / 9) % 3) * 0.33f,1);
}