nus-yam/ex-repair huggingface dataset:
Program: 56222
Project: 56222
Buggy source:
@Override public MainGrid getMainGrid(byte player) throws MapLoadException {
  try {
    if (mainGrid == null) {
      loadAll();
    }
    if (mapData != null) {
      mainGrid=MainGrid.create(mapData,(byte)mapData.getPlayerCount(),player);
      if (mainGrid == null) {
        throw new MapLoadException("String_Node_Str");
      }
    }
    return mainGrid;
  }
 catch (  IOException e) {
    throw new MapLoadException(e);
  }
}

Fixed version (ground truth):
@Override public MainGrid getMainGrid(byte player) throws MapLoadException {
  try {
    if (mainGrid == null) {
      loadAll();
    }
    if (mapData != null) {
      mainGrid=new MainGrid(getMapID(),getMapName(),mapData,(byte)mapData.getPlayerCount(),player);
      if (mainGrid == null) {
        throw new MapLoadException("String_Node_Str");
      }
    }
    return mainGrid;
  }
 catch (  IOException e) {
    throw new MapLoadException(e);
  }
}
Program: 56223
Project: 56223
Buggy source:
@Override public int getMaxPlayers(){
  try {
    return getFileHeader().getMaxPlayer();
  }
 catch (  MapLoadException e) {
    return 1;
  }
}

Fixed version (ground truth):
public int getMaxPlayers(){
  try {
    return getFileHeader().getMaxPlayer();
  }
 catch (  MapLoadException e) {
    return 1;
  }
}
Program: 56224
Project: 56224
Buggy source:
public String getMapID(){
  return getUniqueID();
}

Fixed version (ground truth):
@Override public String getMapID(){
  try {
    return getFileHeader().getUniqueId();
  }
 catch (  MapLoadException e) {
    return "String_Node_Str";
  }
}
Program: 56225
Project: 56225
Buggy source:
@Override public File getFile(){
  return file;
}

Fixed version (ground truth):
public File getFile(){
  return file;
}
Program: 56226
Project: 56226
Buggy source:
@Override public String getId(){
  return mapLoader.getUniqueID();
}

Fixed version (ground truth):
@Override public String getId(){
  return mapLoader.getMapID();
}
Program: 56227
Project: 56227
Buggy source:
private void select(ShortPoint2D pos){
  if (grid.isInBounds(pos)) {
    short x=pos.x;
    short y=pos.y;
    IGuiMovable m1=grid.getMovable(x,y);
    IGuiMovable m3=grid.getMovable((short)(x + 1),(short)(y + 1));
    IGuiMovable m2=grid.getMovable((x),(short)(y + 1));
    IGuiMovable m4=grid.getMovable((short)(x + 1),(short)(y + 2));
    if (m1 != null) {
      setSelection(new SelectionSet(m1));
      System.out.println("String_Node_Str" + pos);
    }
 else     if (m2 != null) {
      setSelection(new SelectionSet(m2));
    }
 else     if (m3 != null) {
      setSelection(new SelectionSet(m3));
    }
 else     if (m4 != null) {
      setSelection(new SelectionSet(m4));
    }
 else {
      IBuilding building=getBuildingAround(pos);
      if (building != null) {
        setSelection(new SelectionSet(building));
      }
 else {
        setSelection(new SelectionSet());
      }
    }
  }
}

Fixed version (ground truth):
private void select(ShortPoint2D pos){
  if (grid.isInBounds(pos)) {
    short x=pos.x;
    short y=pos.y;
    IGuiMovable m1=grid.getMovable(x,y);
    IGuiMovable m3=grid.getMovable((short)(x + 1),(short)(y + 1));
    IGuiMovable m2=grid.getMovable((x),(short)(y + 1));
    IGuiMovable m4=grid.getMovable((short)(x + 1),(short)(y + 2));
    if (m1 != null && canSelectPlayer(m1.getPlayerId())) {
      setSelection(new SelectionSet(m1));
      System.out.println("String_Node_Str" + pos);
    }
 else     if (m2 != null && canSelectPlayer(m2.getPlayerId())) {
      setSelection(new SelectionSet(m2));
    }
 else     if (m3 != null && canSelectPlayer(m3.getPlayerId())) {
      setSelection(new SelectionSet(m3));
    }
 else     if (m4 != null && canSelectPlayer(m4.getPlayerId())) {
      setSelection(new SelectionSet(m4));
    }
 else {
      IBuilding building=getBuildingAround(pos);
      if (building != null && canSelectPlayer(building.getPlayerId())) {
        setSelection(new SelectionSet(building));
      }
 else {
        setSelection(new SelectionSet());
      }
    }
  }
}
Program: 56228
Project: 56228
Buggy source:
private void selectArea(SelectAreaAction action){
  SelectionSet selectionSet=new SelectionSet();
  for (  ShortPoint2D curr : new MapShapeFilter(action.getArea(),grid.getWidth(),grid.getHeight())) {
    IGuiMovable movable=grid.getMovable(curr.x,curr.y);
    if (movable != null && (CommonConstants.ENABLE_ALL_PLAYER_SELECTION || movable.getPlayerId() == player)) {
      selectionSet.add(movable);
    }
    IBuilding building=grid.getBuildingAt(curr.x,curr.y);
    if (building != null && (CommonConstants.ENABLE_ALL_PLAYER_SELECTION || building.getPlayerId() == player)) {
      selectionSet.add(building);
    }
  }
  setSelection(selectionSet);
}

Fixed version (ground truth):
private void selectArea(SelectAreaAction action){
  SelectionSet selectionSet=new SelectionSet();
  for (  ShortPoint2D curr : new MapShapeFilter(action.getArea(),grid.getWidth(),grid.getHeight())) {
    IGuiMovable movable=grid.getMovable(curr.x,curr.y);
    if (movable != null && canSelectPlayer(movable.getPlayerId())) {
      selectionSet.add(movable);
    }
    IBuilding building=grid.getBuildingAt(curr.x,curr.y);
    if (building != null && canSelectPlayer(building.getPlayerId())) {
      selectionSet.add(building);
    }
  }
  setSelection(selectionSet);
}
Program: 56230
Project: 56230
Buggy source:
@Override public void setReplayLogfile(OutputStream replayFileStream){
}

Fixed version (ground truth):
@Override public void setReplayLogfile(DataOutputStream replayFileStream){
}
Program: 56231
Project: 56231
Buggy source:
@Override public void close(){
  state=EPlayerState.DISCONNECTED;
  timer.cancel();
  channel.close();
}

Fixed version (ground truth):
@Override public void close(){
  state=EPlayerState.DISCONNECTED;
  timer.cancel();
  channel.close();
  clock.stopExecution();
}
Program: 56234
Project: 56234
Buggy source:
private static void loadDebugSettings(List<String> argsList){
  if (argsList.contains("String_Node_Str")) {
    CommonConstants.ENABLE_ALL_PLAYER_FOG_OF_WAR=true;
    CommonConstants.ENABLE_ALL_PLAYER_SELECTION=true;
  }
  if (argsList.contains("String_Node_Str") || argsList.contains("String_Node_Str")) {
    CommonConstants.DEFAULT_SERVER_ADDRESS="String_Node_Str";
  }
}

Fixed version (ground truth):
private static void loadDebugSettings(List<String> argsList){
  if (argsList.contains("String_Node_Str")) {
    CommonConstants.ENABLE_ALL_PLAYER_FOG_OF_WAR=true;
    CommonConstants.ENABLE_ALL_PLAYER_SELECTION=true;
    CommonConstants.ENABLE_FOG_OF_WAR_DISABLING=true;
  }
  if (argsList.contains("String_Node_Str") || argsList.contains("String_Node_Str")) {
    CommonConstants.DEFAULT_SERVER_ADDRESS="String_Node_Str";
  }
}
Program: 56235
Project: 56235
Buggy source:
/** 
 * This method activates the unflattening process. This causes a flattened position to be turned into grass after a while.
 * @param x X coordinate of the position.
 * @param y Y coordinate of the position.
 */
public void activateUnflattening(short x,short y){
  this.temporaryFlatened[x + y * width]=(byte)(40 + RandomSingleton.nextF() * 80);
  this.flattenedResetter.addPosition(x,y);
}

Fixed version (ground truth):
/** 
 * This method activates the unflattening process. This causes a flattened position to be turned into grass after a while.
 * @param x X coordinate of the position.
 * @param y Y coordinate of the position.
 */
public void activateUnflattening(short x,short y){
  ELandscapeType landscapeType=getLandscapeTypeAt(x,y);
  if (landscapeType == ELandscapeType.MOUNTAIN || landscapeType == ELandscapeType.DESERT) {
    return;
  }
  this.temporaryFlatened[x + y * width]=(byte)(40 + RandomSingleton.nextF() * 80);
  this.flattenedResetter.addPosition(x,y);
}
Program: 56236
Project: 56236
Buggy source:
@Override public final void setWorkAreaCenter(ShortPoint2D workAreaCenter){
  drawWorkAreaCircle(false);
  this.workAreaCenter=workAreaCenter;
  if (isSelected()) {
    drawWorkAreaCircle(true);
  }
}

Fixed version (ground truth):
@Override public final void setWorkAreaCenter(ShortPoint2D newWorkAreaCenter){
  int distance=super.getPos().getOnGridDistTo(newWorkAreaCenter);
  if (distance < Constants.BUILDINGS_MAX_WORKRADIUS_FACTOR * super.getBuildingType().getWorkradius()) {
    drawWorkAreaCircle(false);
    this.workAreaCenter=newWorkAreaCenter;
    if (isSelected()) {
      drawWorkAreaCircle(true);
    }
  }
}
Program: 56237
Project: 56237
Buggy source:
/** 
 * move the selected movables to the given position.
 * @param pos position to move to
 * @param list
 */
private void moveSelectedTo(ShortPoint2D pos,List<Integer> list){
  if (list.size() == 1) {
    NewMovable currMovable=NewMovable.getMovableByID(list.get(0));
    if (currMovable != null)     currMovable.moveTo(pos);
  }
 else   if (!list.isEmpty()) {
    float radius=(float)(Math.sqrt(list.size() / 3.14f)) * 2;
    MapCircle mapCircle=new MapCircle(pos,radius);
    NewMovable leader=null;
    Iterator<ShortPoint2D> circleIter=mapCircle.iterator();
    int ctr=0;
    for (    Integer currID : list) {
      NewMovable currMovable=NewMovable.getMovableByID(currID);
      if (leader == null || ctr % 30 == 0) {
        leader=currMovable;
      }
      if (currMovable != null) {
        circleIter.next();
        currMovable.moveTo(circleIter.next());
      }
      ctr++;
    }
  }
}

Fixed version (ground truth):
/** 
 * Move the selected   {@link NewMovable} to the given position.
 * @param targetPosition position to move to
 * @param movableIds A list of the id's of the movables.
 */
private void moveSelectedTo(ShortPoint2D targetPosition,List<Integer> movableIds){
  if (movableIds.size() == 1) {
    NewMovable currMovable=NewMovable.getMovableByID(movableIds.get(0));
    if (currMovable != null)     currMovable.moveTo(targetPosition);
  }
 else   if (!movableIds.isEmpty()) {
    short radius=1;
    short ringsWithoutSuccessCtr=0;
    Iterator<ShortPoint2D> posIterator=new HexBorderArea(targetPosition,radius).iterator();
    for (    Integer currMovableId : movableIds) {
      NewMovable currMovable=NewMovable.getMovableByID(currMovableId);
      ShortPoint2D currTargetPos;
      do {
        if (!posIterator.hasNext()) {
          ringsWithoutSuccessCtr++;
          if (ringsWithoutSuccessCtr > 5) {
            return;
          }
          radius++;
          posIterator=new HexBorderArea(targetPosition,radius).iterator();
        }
        currTargetPos=posIterator.next();
      }
 while (!canMoveTo(currMovable,currTargetPos));
      ringsWithoutSuccessCtr=0;
      currMovable.moveTo(currTargetPos);
    }
  }
}
Program: 56238
Project: 56238
Buggy source:
@Override public final boolean isBlocked(short x,short y){
  return flagsGrid.isBlocked(x,y);
}

Fixed version (ground truth):
@Override public boolean isBlocked(ShortPoint2D position){
  return flagsGrid.isBlocked(position.x,position.y);
}
Program: 56239
Project: 56239
Buggy source:
@Override public final short getBlockedPartition(short x,short y){
  return landscapeGrid.getBlockedPartitionAt(x,y);
}

Fixed version (ground truth):
@Override public short getBlockedPartition(ShortPoint2D position){
  return landscapeGrid.getBlockedPartitionAt(position.x,position.y);
}
Program: 56240
Project: 56240
Buggy source:
private Action getForMinimap(float relativex,float relativey,boolean selecting){
  float minimapx=(relativex - constants.MINIMAP_BOTTOMLEFT_X) / constants.MINIMAP_WIDTH;
  float minimapy=((relativey - constants.UI_CENTERY) / (1 - constants.UI_CENTERY) - constants.MINIMAP_BOTTOM_Y) / constants.MINIMAP_HEIGHT;
  ShortPoint2D clickPosition=minimap.getClickPositionIfOnMap(minimapx,minimapy);
  if (clickPosition != null) {
    if (selecting) {
      return new PointAction(EActionType.PAN_TO,clickPosition);
    }
 else {
      return new PointAction(EActionType.SELECT_POINT,clickPosition);
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private Action getForMinimap(float relativex,float relativey,boolean selecting){
  float minimapx=(relativex - constants.MINIMAP_BOTTOMLEFT_X) / constants.MINIMAP_WIDTH;
  float minimapy=((relativey - constants.UI_CENTERY) / (1 - constants.UI_CENTERY) - constants.MINIMAP_BOTTOM_Y) / constants.MINIMAP_HEIGHT;
  ShortPoint2D clickPosition=minimap.getClickPositionIfOnMap(minimapx,minimapy);
  if (clickPosition != null) {
    if (selecting) {
      return new PointAction(EActionType.PAN_TO,clickPosition);
    }
 else {
      return new PointAction(EActionType.MOVE_TO,clickPosition);
    }
  }
 else {
    return null;
  }
}
Program: 56241
Project: 56241
Buggy source:
public static MapInterfaceConnector openTestWindow(IGraphicsGrid map){
  ImageProvider.getInstance().startPreloading();
  JOGLPanel content=new JOGLPanel(new SoundPlayer(){
    @Override public void playSound(    int sound,    float lvolume,    float rvolume){
    }
    @Override public void setSoundDataRetriever(    ISoundDataRetriever soundDataRetriever){
    }
  }
);
  new NativeAreaWindow(content.getArea());
  MapInterfaceConnector connector=content.showGameMap(map,null);
  connector.addListener(new IMapInterfaceListener(){
    @Override public void action(    Action action){
      if (action.getActionType() == EActionType.SELECT_POINT) {
        PointAction selectAction=(PointAction)action;
        System.out.println("String_Node_Str" + action.getActionType() + "String_Node_Str"+ selectAction.getPosition());
      }
 else {
        System.out.println("String_Node_Str" + action.getActionType());
      }
    }
  }
);
  return connector;
}

Fixed version (ground truth):
public static MapInterfaceConnector openTestWindow(IStartedGame game){
  ImageProvider.getInstance().startPreloading();
  JSettlersScreen content=SwingManagedJSettlers.startGui(Collections.<String>emptyList());
  MapContent mapContent=new MapContent(game,new SwingSoundPlayer());
  content.setContent(mapContent);
  mapContent.getInterfaceConnector().addListener(new IMapInterfaceListener(){
    @Override public void action(    Action action){
      if (action.getActionType() == EActionType.SELECT_POINT) {
        PointAction selectAction=(PointAction)action;
        System.out.println("String_Node_Str" + action.getActionType() + "String_Node_Str"+ selectAction.getPosition());
      }
 else {
        System.out.println("String_Node_Str" + action.getActionType());
      }
    }
  }
);
  return mapContent.getInterfaceConnector();
}
Program: 56242
Project: 56242
Buggy source:
public void removePositionTo(final int x,final int y,final Partition newPartitionObject){
}

Fixed version (ground truth):
public void removePositionTo(final int x,final int y,final Partition newPartitionObject){
  if (this == newPartitionObject) {
    System.out.println("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str");
  }
  this.decrement(x,y);
  newPartitionObject.increment(x,y);
  super.removePositionTo(x,y,newPartitionObject,newPartitionObject.playerId == this.playerId);
  if (isEmpty())   super.stopManager();
}
Program: 56243
Project: 56243
Buggy source:
/** 
 * Occupies the given area for the given playerId.
 * @param playerId
 * @param filteredInfluencingArea
 * @param borders
 */
private void occupyArea(byte playerId,Iterable<ShortPoint2D> influencingArea,SRectangle borders){
  IPredicate<ShortPoint2D> predicate=new IPredicate<ShortPoint2D>(){
    @Override public boolean evaluate(    ShortPoint2D pos){
      return towers[pos.x + pos.y * width] <= 0;
    }
  }
;
  IteratorFilter<ShortPoint2D> filtered=new IteratorFilter<ShortPoint2D>(influencingArea,predicate);
  PartitionCalculatorAlgorithm partitioner=new PartitionCalculatorAlgorithm(filtered,blockingProvider,borders.xMin,borders.yMin,borders.xMax,borders.yMax);
  partitioner.calculatePartitions();
  short[] newPartitionsMap=acquirePartitionedArea(playerId,partitioner);
  checkForMergesAndDivides(playerId,partitioner,newPartitionsMap);
  changeTowerCounter(playerId,influencingArea,+1);
}

Fixed version (ground truth):
/** 
 * Occupies the given area for the given playerId.
 * @param playerId
 * @param filteredInfluencingArea
 * @param borders
 */
private void occupyArea(final byte playerId,Iterable<ShortPoint2D> influencingArea,SRectangle borders){
  IPredicate<ShortPoint2D> predicate=new IPredicate<ShortPoint2D>(){
    @Override public boolean evaluate(    ShortPoint2D pos){
      int index=pos.x + pos.y * width;
      return towers[index] <= 0 && partitionObjects[partitions[index]].playerId != playerId;
    }
  }
;
  IteratorFilter<ShortPoint2D> filtered=new IteratorFilter<ShortPoint2D>(influencingArea,predicate);
  PartitionCalculatorAlgorithm partitioner=new PartitionCalculatorAlgorithm(filtered,blockingProvider,borders.xMin,borders.yMin,borders.xMax,borders.yMax);
  partitioner.calculatePartitions();
  short[] newPartitionsMap=acquirePartitionedArea(playerId,partitioner);
  checkForMergesAndDivides(playerId,partitioner,newPartitionsMap);
  changeTowerCounter(playerId,influencingArea,+1);
}
Program: 56245
Project: 56245
Buggy source:
public MovableTestsMap(int width,int height){
  this.width=(short)width;
  this.height=(short)height;
  this.movableMap=new NewMovable[width][height];
  this.materialTypeMap=new EMaterialType[width][height];
  this.materialAmmountMap=new byte[width][height];
  aStar=new HexAStar(this,this.width,this.height);
}

Fixed version (ground truth):
public MovableTestsMap(int width,int height,Player defaultPlayer){
  this.width=(short)width;
  this.height=(short)height;
  this.defaultPlayer=defaultPlayer;
  this.movableMap=new NewMovable[width][height];
  this.materialTypeMap=new EMaterialType[width][height];
  this.materialAmmountMap=new byte[width][height];
  aStar=new HexAStar(this,this.width,this.height);
}
Program: 56246
Project: 56246
Buggy source:
/** 
 * Creates a new SWING GUI for the game.
 * @param argsList
 * @param startScreen
 * @return
 */
public static JSettlersScreen startGui(List<String> argsList,IStartScreen startScreen){
  Area area=new Area();
  JSettlersScreen content=new JSettlersScreen();
  area.add(content.getRegion());
  content.setContent(new StartScreen(startScreen,content));
  if (argsList.contains("String_Node_Str")) {
    startJogl(area);
  }
 else   if (argsList.contains("String_Node_Str")) {
    startNative(area);
  }
 else {
    try {
      startNative(area);
    }
 catch (    Throwable t) {
      startJogl(area);
    }
  }
  startRedrawTimer(content);
  return content;
}

Fixed version (ground truth):
/** 
 * Creates a new SWING GUI for the game.
 * @param argsList
 * @return
 */
public static JSettlersScreen startGui(List<String> argsList){
  Area area=new Area();
  JSettlersScreen content=new JSettlersScreen();
  area.add(content.getRegion());
  if (argsList.contains("String_Node_Str")) {
    startJogl(area);
  }
 else   if (argsList.contains("String_Node_Str")) {
    startNative(area);
  }
 else {
    try {
      startNative(area);
    }
 catch (    Throwable t) {
      startJogl(area);
    }
  }
  startRedrawTimer(content);
  return content;
}
Program: 56247
Project: 56247
Buggy source:
/** 
 * @param args args can have no entries or <br> args[0] must be "host" or "client"
 * @throws FileNotFoundException
 * @throws IOException
 * @throws ClassNotFoundException
 */
public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
  List<String> argsList=Arrays.asList(args);
  loadDebugSettings(argsList);
  ResourceManager.setProvider(new SwingResourceProvider());
  startGui(argsList,new StartScreenConnector());
  ImageProvider.getInstance().startPreloading();
}

Fixed version (ground truth):
/** 
 * @param args args can have no entries or <br> args[0] must be "host" or "client"
 * @throws FileNotFoundException
 * @throws IOException
 * @throws ClassNotFoundException
 */
public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
  List<String> argsList=Arrays.asList(args);
  loadDebugSettings(argsList);
  ResourceManager.setProvider(new SwingResourceProvider());
  JSettlersScreen content=startGui(argsList);
  generateContent(new StartScreenConnector(),content);
  ImageProvider.getInstance().startPreloading();
}
Program: 56248
Project: 56248
Buggy source:
@Override public void stop(){
  listener=null;
  items=null;
}

Fixed version (ground truth):
@Override public void stop(){
  listener=null;
  items=Collections.emptyList();
}
Program: 56249
Project: 56249
Buggy source:
public ChangingList(List<? extends T> items){
  this.items=items;
}

Fixed version (ground truth):
public ChangingList(List<? extends T> items){
  setList(items);
}
Program: 56250
Project: 56250
Buggy source:
public void setList(List<T> items){
  this.items=items;
  informListener();
}

Fixed version (ground truth):
public void setList(List<? extends T> items){
  if (items == null) {
    throw new NullPointerException();
  }
  this.items=items;
  informListener();
}
Program: 56251
Project: 56251
Buggy source:
private IPacketReceiver<MatchStartPacket> generateMatchStartedListener(){
  return new IPacketReceiver<MatchStartPacket>(){
    @Override public void receivePacket(    MatchStartPacket packet){
      updatePlayersList(packet.getMatchInfo().getPlayers());
      MapLoader mapLoader=MapList.getDefaultList().getMapById(packet.getMatchInfo().getMapInfo().getId());
      long randomSeed=packet.getRandomSeed();
      byte myPlayerNumber=getMyPlayerNumber();
      JSettlersGame game=new JSettlersGame(mapLoader,randomSeed,myPlayerNumber);
      multiplayerListener.gameIsStarting(game.start());
    }
  }
;
}

Fixed version (ground truth):
private IPacketReceiver<MatchStartPacket> generateMatchStartedListener(){
  return new IPacketReceiver<MatchStartPacket>(){
    @Override public void receivePacket(    MatchStartPacket packet){
      updatePlayersList(packet.getMatchInfo().getPlayers());
      MapLoader mapLoader=MapList.getDefaultList().getMapById(packet.getMatchInfo().getMapInfo().getId());
      long randomSeed=packet.getRandomSeed();
      byte myPlayerNumber=getMyPlayerNumber();
      JSettlersGame game=new JSettlersGame(mapLoader,randomSeed,networkClient,myPlayerNumber);
      multiplayerListener.gameIsStarting(game.start());
    }
  }
;
}
Program: 56252
Project: 56252
Buggy source:
public StartScreen(IStartScreen connector,IContentSetable contentSetable){
  this.connector=connector;
  this.contentSetable=contentSetable;
  addButtons();
  content=new UIPanel();
  addChild(content,.55f,.05f,.95f,.95f);
}

Fixed version (ground truth):
public StartScreen(IStartScreen connector,IContentSetable contentSetable){
  this.connector=connector;
  this.contentSetable=contentSetable;
  setBackground(BACKGROUND);
  addButtons();
  content=new UIPanel();
  addChild(content,.55f,.05f,.95f,.95f);
}
Program: 56253
Project: 56253
Buggy source:
public JoinPhaseScreen(IJoinPhaseMultiplayerGameConnector connector,IContentSetable contentSetable){
  this.connector=connector;
  this.contentSetable=contentSetable;
  connector.setMultiplayerListener(this);
  addStartButton();
  addPlayerList();
}

Fixed version (ground truth):
public JoinPhaseScreen(IJoinPhaseMultiplayerGameConnector connector,IContentSetable contentSetable){
  this.connector=connector;
  this.contentSetable=contentSetable;
  setBackground(StartScreen.BACKGROUND);
  connector.setMultiplayerListener(this);
  addStartButton();
  addPlayerList();
}
Program: 56254
Project: 56254
Buggy source:
private void addPlayerList(){
  multiplayerList=new UIList<IMultiplayerPlayer>(connector.getPlayers().getItems(),new ListItemGenerator<IMultiplayerPlayer>(){
    @Override public UIListItem getItem(    IMultiplayerPlayer item){
      return new GenericListItem(item.getName(),item.toString());
    }
  }
,.1f);
}

Fixed version (ground truth):
private void addPlayerList(){
  multiplayerList=new UIList<IMultiplayerPlayer>(connector.getPlayers().getItems(),new ListItemGenerator<IMultiplayerPlayer>(){
    @Override public UIListItem getItem(    IMultiplayerPlayer item){
      return new GenericListItem(item.getName(),item.toString());
    }
  }
,.1f);
  this.addChild(multiplayerList,.1f,.15f,.1f,.85f);
}
Program: 56255
Project: 56255
Buggy source:
@Override public void gameAborted(){
}

Fixed version (ground truth):
@Override public void gameAborted(){
  throw new UnsupportedOperationException();
}
Program: 56256
Project: 56256
Buggy source:
public ProgressPanel(){
  setBackground(new OriginalImageLink(EImageLinkType.GUI,2,29,0));
}

Fixed version (ground truth):
public ProgressPanel(){
  setBackground(StartScreen.BACKGROUND);
}
Program: 56257
Project: 56257
Buggy source:
@Override protected void receivePacket(int key,TimeSyncPacket packet) throws IOException {
  int expectedRemoteTime=packet.getTime() + rttSupplier.getRoundTripTime().getRtt() / 2;
  int localTime=clock.getTime();
  int deltaTime=localTime - expectedRemoteTime;
  if (deltaTime > Client.TIME_SYNC_TOLERATED_DIFFERENCE) {
    clock.stopClockFor((int)(deltaTime * Client.TIME_SYNC_APPROACH_FACTOR));
  }
}

Fixed version (ground truth):
@Override protected void receivePacket(int key,TimeSyncPacket packet) throws IOException {
  int expectedRemoteTime=packet.getTime() + rttSupplier.getRoundTripTime().getRtt() / 2;
  int localTime=clock.getTime();
  int deltaTime=localTime - expectedRemoteTime;
  if (deltaTime > Client.TIME_SYNC_TOLERATED_DIFFERENCE) {
    clock.pauseClockFor((int)(deltaTime * Client.TIME_SYNC_APPROACH_FACTOR));
  }
}
Program: 56258
Project: 56258
Buggy source:
/** 
 * Gets the round trip time of this   {@link Channel}.
 * @return Returns the current {@link RoundTripTime}.
 */
public RoundTripTime getRoundTripTime(){
  return currRtt;
}

Fixed version (ground truth):
/** 
 * Gets the round trip time of this   {@link Channel}.
 * @return Returns the current {@link RoundTripTime}.
 */
@Override public RoundTripTime getRoundTripTime(){
  return currRtt;
}
Program: 56259
Project: 56259
Buggy source:
public NetworkTimer(boolean noLockstepWaiting){
  this();
  if (noLockstepWaiting) {
    maxAllowedLockstep=Integer.MAX_VALUE;
  }
}

Fixed version (ground truth):
public NetworkTimer(boolean disableLockstepWaiting){
  this();
  if (disableLockstepWaiting) {
    maxAllowedLockstep=Integer.MAX_VALUE;
  }
}
Program: 56260
Project: 56260
Buggy source:
/** 
 * Sets the multiplayer listener that listens to game state changes. If the game has already started,  {@link IMultiplayerListener#gameStarted(IStartingGame)} is calledimmediately by this method.
 * @param l�stener
 */
public void setMultiplayerListener(IMultiplayerListener l){
}

Fixed version (ground truth):
/** 
 * Sets the multiplayer listener that listens to game state changes. If the game has already started,  {@link IMultiplayerListener#gameStarted(IStartingGame)} is calledimmediately by this method.
 * @param listener
 */
public void setMultiplayerListener(IMultiplayerListener listener);
Program: 56261
Project: 56261
Buggy source:
@Override protected void constructionFinishedEvent(){
  IRequestStackListener listener=new IRequestStackListener(){
    @Override public void materialDelivered(    RequestStack stack){
      getGrid().requestSoilderable(Barrack.this);
    }
  }
;
  for (  RequestStack curr : super.getStacks()) {
    curr.setListener(listener);
  }
}

Fixed version (ground truth):
@Override protected void constructionFinishedEvent(){
  for (  RequestStack curr : super.getStacks()) {
    curr.setListener(this);
  }
}
Program: 56262
Project: 56262
Buggy source:
public MainGrid load(InputStream inStream) throws MapLoadException {
  try {
    final ObjectInputStream ois=new ObjectInputStream(inStream);
    LoadRunnable runnable=new LoadRunnable(ois);
    Thread t=new Thread(null,runnable,"String_Node_Str",LOAD_STACK_SIZE);
    t.start();
    t.join();
    return runnable.grid;
  }
 catch (  Throwable t) {
    throw new MapLoadException(t);
  }
}

Fixed version (ground truth):
public MainGrid load(InputStream inStream) throws MapLoadException {
  try {
    final ObjectInputStream ois=new ObjectInputStream(inStream);
    LoadRunnable runnable=new LoadRunnable(ois);
    Thread t=new Thread(null,runnable,"String_Node_Str",LOAD_STACK_SIZE);
    t.start();
    t.join();
    if (runnable.grid != null) {
      return runnable.grid;
    }
 else {
      throw new MapLoadException("String_Node_Str",runnable.exception);
    }
  }
 catch (  Throwable t) {
    throw new MapLoadException(t);
  }
}
Program: 56263
Project: 56263
Buggy source:
/** 
 * Saves the grid to the given output file.
 * @param grid The grid to use.
 * @param out The output file/stream for the game.
 * @throws IOException
 */
public void save(MainGrid grid,OutputStream out) throws IOException {
  final ObjectOutputStream oos=new ObjectOutputStream(out);
  Thread t=new Thread(null,new GameSaveTask(grid,oos),"String_Node_Str",SAVE_STACK_SIZE);
  t.start();
  try {
    t.join();
  }
 catch (  InterruptedException e) {
    throw new IOException(e);
  }
  oos.flush();
  oos.close();
}

Fixed version (ground truth):
/** 
 * Saves the grid to the given output file.
 * @param grid The grid to use.
 * @param out The output file/stream for the game.
 * @throws IOException
 */
public void save(MainGrid grid,OutputStream out) throws IOException {
  final ObjectOutputStream oos=new ObjectOutputStream(out);
  GameSaveTask runnable=new GameSaveTask(grid,oos);
  Thread t=new Thread(null,runnable,"String_Node_Str",SAVE_STACK_SIZE);
  t.start();
  try {
    t.join();
  }
 catch (  InterruptedException e) {
    throw new IOException(e);
  }
  if (runnable.exception != null) {
    throw new IOException("String_Node_Str",runnable.exception);
  }
  oos.flush();
  oos.close();
}
Program: 56264
Project: 56264
Buggy source:
@Override public void run(){
  try {
    NetworkTimer.get().setGameTime(ois.readInt());
    grid=(MainGrid)ois.readObject();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    NetworkTimer.get().setGameTime(ois.readInt());
    grid=(MainGrid)ois.readObject();
  }
 catch (  Throwable t) {
    t.printStackTrace();
    this.exception=t;
  }
}
Program: 56265
Project: 56265
Buggy source:
private boolean isFlatened(){
  if (shouldBeFlatened()) {
    for (    RelativePoint currPos : type.getBlockedTiles()) {
      if (grid.getHeightAt(currPos.calculatePoint(this.pos)) != heightAvg) {
        return false;
      }
    }
    return true;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
private boolean isFlatened(){
  if (shouldBeFlatened()) {
    return grid.isAreaFlattenedAtHeight(pos,getFlattenTiles(),heightAvg);
  }
 else {
    return true;
  }
}
Program: 56266
Project: 56266
Buggy source:
@Override public void changeHeightTowards(short x,short y,byte targetHeight){
  landscapeGrid.flattenAndChangeHeightTowards(x,y,targetHeight);
}

Fixed version (ground truth):
@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);
}
Program: 56267
Project: 56267
Buggy source:
private final boolean isCornPlantable(int x,int y){
  ELandscapeType landscapeType=landscapeGrid.getLandscapeTypeAt(x,y);
  return (landscapeType.isGrass() || landscapeType == ELandscapeType.EARTH) && !flagsGrid.isProtected(x,y) && !hasProtectedNeighbor(x,y)&& !objectsGrid.hasMapObjectType(x,y,EMapObjectType.CORN_GROWING)&& !objectsGrid.hasMapObjectType(x,y,EMapObjectType.CORN_ADULT)&& !objectsGrid.hasNeighborObjectType(x,y,EMapObjectType.CORN_ADULT)&& !objectsGrid.hasNeighborObjectType(x,y,EMapObjectType.CORN_GROWING);
}

Fixed version (ground truth):
private final boolean isCornPlantable(int x,int y){
  ELandscapeType landscapeType=landscapeGrid.getLandscapeTypeAt(x,y);
  return (landscapeType == ELandscapeType.GRASS || landscapeType == ELandscapeType.EARTH) && !flagsGrid.isProtected(x,y) && !hasProtectedNeighbor(x,y)&& !objectsGrid.hasMapObjectType(x,y,EMapObjectType.CORN_GROWING)&& !objectsGrid.hasMapObjectType(x,y,EMapObjectType.CORN_ADULT)&& !objectsGrid.hasNeighborObjectType(x,y,EMapObjectType.CORN_ADULT)&& !objectsGrid.hasNeighborObjectType(x,y,EMapObjectType.CORN_GROWING)&& areAllNeighborsOneOf(x,y,2,ELandscapeType.GRASS,ELandscapeType.EARTH);
}
Program: 56268
Project: 56268
Buggy source:
private ShortPoint2D getDiggablePosition(){
  RelativePoint[] blockedTiles=requester.getBuildingType().getProtectedTiles();
  ShortPoint2D buildingPos=requester.getPos();
  int offset=RandomSingleton.getInt(0,blockedTiles.length - 1);
  for (int i=0; i < blockedTiles.length; i++) {
    ShortPoint2D pos=blockedTiles[(i + offset) % blockedTiles.length].calculatePoint(buildingPos);
    if (needsToBeWorkedOn(pos) && !super.getStrategyGrid().isMarked(pos)) {
      return pos;
    }
  }
  return null;
}

Fixed version (ground truth):
private ShortPoint2D getDiggablePosition(){
  RelativePoint[] blockedTiles=requester.getBuildingType().getProtectedTiles();
  ShortPoint2D buildingPos=requester.getPos();
  int offset=RandomSingleton.getInt(0,blockedTiles.length - 1);
  for (int i=0; i < blockedTiles.length; i++) {
    ShortPoint2D pos=blockedTiles[(i + offset) % blockedTiles.length].calculatePoint(buildingPos);
    if (!super.getStrategyGrid().isMarked(pos) && needsToBeWorkedOn(pos)) {
      return pos;
    }
  }
  return null;
}
Program: 56269
Project: 56269
Buggy source:
@Override public void changeHeightTowards(short x,short y,byte targetHeight){
  byte currHeight=landscapeGrid.getHeightAt(x,y);
  landscapeGrid.setHeightAt(x,y,(byte)(currHeight + Math.signum(targetHeight - currHeight)));
  landscapeGrid.setLandscapeTypeAt(x,y,ELandscapeType.FLATTENED);
}

Fixed version (ground truth):
@Override public void changeHeightTowards(short x,short y,byte targetHeight){
  landscapeGrid.flattenAndChangeHeightTowards(x,y,targetHeight);
}
Program: 56270
Project: 56270
Buggy source:
@Override public final void removeBuildingAt(ShortPoint2D pos){
  IBuilding building=(IBuilding)objectsGrid.getMapObjectAt(pos.x,pos.y,EMapObjectType.BUILDING);
  mapObjectsManager.removeMapObjectType(pos.x,pos.y,EMapObjectType.BUILDING);
  FreeMapArea area=new FreeMapArea(pos,building.getBuildingType().getProtectedTiles());
  objectsGrid.setBuildingArea(area,null);
  for (  ShortPoint2D curr : area) {
    short x=curr.x;
    short y=curr.y;
    if (isInBounds(x,y)) {
      flagsGrid.setBlockedAndProtected(x,y,false);
    }
  }
}

Fixed version (ground truth):
@Override public final void removeBuildingAt(ShortPoint2D pos){
  IBuilding building=(IBuilding)objectsGrid.getMapObjectAt(pos.x,pos.y,EMapObjectType.BUILDING);
  mapObjectsManager.removeMapObjectType(pos.x,pos.y,EMapObjectType.BUILDING);
  FreeMapArea area=new FreeMapArea(pos,building.getBuildingType().getProtectedTiles());
  objectsGrid.setBuildingArea(area,null);
  for (  ShortPoint2D curr : area) {
    short x=curr.x;
    short y=curr.y;
    if (isInBounds(x,y)) {
      flagsGrid.setBlockedAndProtected(x,y,false);
      landscapeGrid.activateUnflattening(x,y);
    }
  }
}
Program: 56271
Project: 56271
Buggy source:
@Override public boolean countFlattenedDown(short x,short y){
  int i=x + y * width;
  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){
  final int index=x + y * width;
  byte flattenedValue=temporaryFlatened[index];
  if (flattenedValue == Byte.MAX_VALUE) {
    return true;
  }
  flattenedValue--;
  temporaryFlatened[index]=flattenedValue;
  if (flattenedValue <= -30) {
    temporaryFlatened[index]=0;
    setLandscapeTypeAt(x,y,ELandscapeType.GRASS);
    return true;
  }
 else {
    return false;
  }
}
Program: 56272
Project: 56272
Buggy source:
@Override protected void onPause(){
  super.onPause();
  goView.onPause();
  soundPlayer.setPaused(true);
  if (!goView.canPreserveContext()) {
    ImageProvider.getInstance().invalidateAll();
  }
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  goView.onPause();
  soundPlayer.setPaused(true);
  goView.setContextDestroyedListener(new IContextDestroyedListener(){
    @Override public void glContextDestroyed(){
      ImageProvider.getInstance().invalidateAll();
    }
  }
);
}
Program: 56273
Project: 56273
Buggy source:
@Override public IMovable getMovableAt(int x,int y){
  if (x > MOVABLE_BORDER && getLandscapeTypeAt(x,y) == ELandscapeType.GRASS && getRand(x,y) > 1 - MOVABLE_PROBABILITY) {
    return movable;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public IMovable getMovableAt(int x,int y){
  if (x > MOVABLE_BORDER && getLandscapeTypeAt(x,y) == ELandscapeType.GRASS && getRand(x,y) > 1 - MOVABLE_PROBABILITY) {
    return new BgMovable(new ShortPoint2D(x,y));
  }
 else {
    return null;
  }
}
Program: 56274
Project: 56274
Buggy source:
@Override public EMaterialType getMaterial(){
  return null;
}

Fixed version (ground truth):
@Override public EMaterialType getMaterial(){
  return EMaterialType.NO_MATERIAL;
}
Program: 56275
Project: 56275
Buggy source:
@Override public ShortPoint2D getPos(){
  return null;
}

Fixed version (ground truth):
@Override public ShortPoint2D getPos(){
  return point;
}
Program: 56276
Project: 56276
Buggy source:
@Override public final ShortPoint2D getConstructablePosition(ShortPoint2D pos,EBuildingType type,boolean useNeighbors){
  Player player=partitionsGrid.getPlayerAt(pos.x,pos.y);
  if (constructionMarksGrid.canConstructAt(pos.x,pos.y,type,player)) {
    return pos;
  }
 else   if (useNeighbors) {
    for (    ShortPoint2D neighbour : new MapNeighboursArea(pos)) {
      if (constructionMarksGrid.canConstructAt(neighbour.x,neighbour.y,type,player)) {
        return neighbour;
      }
    }
    return null;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public final ShortPoint2D getConstructablePosition(ShortPoint2D pos,EBuildingType type,boolean useNeighbors){
  Player player=partitionsGrid.getPlayerAt(pos.x,pos.y);
  if (player != null) {
    if (constructionMarksGrid.canConstructAt(pos.x,pos.y,type,player)) {
      return pos;
    }
 else     if (useNeighbors) {
      for (      ShortPoint2D neighbour : new MapNeighboursArea(pos)) {
        if (constructionMarksGrid.canConstructAt(neighbour.x,neighbour.y,type,player)) {
          return neighbour;
        }
      }
      return null;
    }
  }
  return null;
}
Program: 56277
Project: 56277
Buggy source:
public Player getPlayerAt(int x,int y){
  return players[partitionObjects[partitions[x + y * width]].playerId];
}

Fixed version (ground truth):
public Player getPlayerAt(int x,int y){
  short playerId=partitionObjects[partitions[x + y * width]].playerId;
  if (playerId >= 0) {
    return players[playerId];
  }
 else {
    return null;
  }
}
Program: 56278
Project: 56278
Buggy source:
public AndroidTextDrawer(EFontSize size,AndroidContext context){
  this.size=size;
  this.context=context;
}

Fixed version (ground truth):
private AndroidTextDrawer(EFontSize size,AndroidContext context){
  this.size=size;
  this.context=context;
}
Program: 56279
Project: 56279
Buggy source:
private void tryEnableContextPreservation(){
  try {
    Method m=GLSurfaceView.class.getMethod("String_Node_Str",Boolean.TYPE);
    m.invoke(this,true);
  }
 catch (  Throwable t) {
    Log.w("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
private void tryEnableContextPreservation(){
  try {
    Method m=GLSurfaceView.class.getMethod("String_Node_Str",Boolean.TYPE);
    m.invoke(this,true);
  }
 catch (  Throwable t) {
    Log.d("String_Node_Str","String_Node_Str");
  }
}
Program: 56280
Project: 56280
Buggy source:
public GOSurfaceView(Context context,Area area){
  super(context);
  this.area=area;
  setRenderer(new Renderer(context));
  setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
  tryEnableContextPreservation();
  area.addRedrawListener(this);
}

Fixed version (ground truth):
public GOSurfaceView(Context context,Area area){
  super(context);
  this.area=area;
  setEGLContextFactory(new Factory());
  setRenderer(new Renderer(context));
  setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
  tryEnableContextPreservation();
  area.addRedrawListener(this);
}
Program: 56281
Project: 56281
Buggy source:
public void setScreen(MapRectangle mapArea){
  this.mapArea=mapArea;
  this.notifyAll();
}

Fixed version (ground truth):
public synchronized void setScreen(MapRectangle mapArea){
  this.mapArea=mapArea;
  this.notifyAll();
}
Program: 56282
Project: 56282
Buggy source:
public void setBuildingType(EBuildingType type){
  this.buildingType=type;
  this.notifyAll();
}

Fixed version (ground truth):
public synchronized void setBuildingType(EBuildingType type){
  this.buildingType=type;
  this.notifyAll();
}
Program: 56283
Project: 56283
Buggy source:
private final void initPathfinders(){
  pathfinderGrid=new PathfinderGrid();
  aStar=new BucketQueueAStar(pathfinderGrid,width,height);
  dijkstra=new DijkstraAlgorithm(pathfinderGrid,aStar,width,height);
  inAreaFinder=new InAreaFinder(pathfinderGrid,width,height);
}

Fixed version (ground truth):
private final void initPathfinders(){
  pathfinderGrid=new PathfinderGrid();
  aStar=new HexAStar(pathfinderGrid,width,height);
  dijkstra=new DijkstraAlgorithm(pathfinderGrid,aStar,width,height);
  inAreaFinder=new InAreaFinder(pathfinderGrid,width,height);
}
Program: 56284
Project: 56284
Buggy source:
@Override public final boolean setBuilding(ShortPoint2D position,Building newBuilding){
  if (MainGrid.this.isInBounds(position.x,position.y)) {
    FreeMapArea area=new FreeMapArea(position,newBuilding.getBuildingType().getBlockedTiles());
    if (canConstructAt(area)) {
      setProtectedState(area,true);
      mapObjectsManager.addBuildingTo(position,newBuilding);
      objectsGrid.setBuildingArea(area,newBuilding);
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public final boolean setBuilding(ShortPoint2D position,Building newBuilding){
  if (MainGrid.this.isInBounds(position.x,position.y)) {
    FreeMapArea protectedArea=new FreeMapArea(position,newBuilding.getBuildingType().getProtectedTiles());
    if (canConstructAt(protectedArea)) {
      setProtectedState(protectedArea,true);
      mapObjectsManager.addBuildingTo(position,newBuilding);
      objectsGrid.setBuildingArea(new FreeMapArea(position,newBuilding.getBuildingType().getBlockedTiles()),newBuilding);
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return false;
  }
}
Program: 56285
Project: 56285
Buggy source:
@Override public final int getDebugColorAt(int x,int y){
  int value=partitionsGrid.getRealPartitionIdAt(x,y);
  return Color.getABGR((value % 3) * 0.33f,((value / 3) % 3) * 0.33f,((value / 9) % 3) * 0.33f,1);
}

Fixed version (ground truth):
@Override public final int getDebugColorAt(int x,int y){
  return flagsGrid.isMarked(x,y) ? Color.ORANGE.getARGB() : (objectsGrid.getMapObjectAt(x,y,EMapObjectType.INFORMABLE_MAP_OBJECT) != null ? Color.GREEN.getARGB() : (objectsGrid.getMapObjectAt(x,y,EMapObjectType.ATTACKABLE_TOWER) != null ? Color.RED.getARGB() : (flagsGrid.isBlocked(x,y) ? Color.BLACK.getARGB() : (flagsGrid.isProtected(x,y) ? Color.BLUE.getARGB() : 0))));
}
Program: 56286
Project: 56286
Buggy source:
public void setBuildingArea(FreeMapArea area,Building buildingValue){
  for (  ShortPoint2D curr : area) {
    buildingsGrid[curr.x + curr.y * width]=buildingValue;
  }
}

Fixed version (ground truth):
public void setBuildingArea(FreeMapArea area,Building building){
  for (  ShortPoint2D curr : area) {
    buildingsGrid[curr.x + curr.y * width]=building;
  }
}
Program: 56287
Project: 56287
Buggy source:
@Test public void testPushAndPop(){
  assertEquals(0,list.size());
  for (int i=0; i < TEST_NUMBERS; i++) {
    list.pushFront(i);
    assertEquals(i + 1,list.size());
  }
  for (int i=TEST_NUMBERS - 1; i >= 0; i--) {
    assertEquals(i + 1,list.size());
    assertEquals(i,list.popFront());
  }
  assertEquals(0,list.size());
}

Fixed version (ground truth):
@Test public void testPushAndPop(){
  assertEquals(0,list.size());
  for (int i=0; i < TEST_NUMBERS; i++) {
    list.pushFront(i);
    assertEquals(i + 1,list.size());
  }
  for (int i=TEST_NUMBERS - 1; i >= 0; i--) {
    assertEquals(i + 1,list.size());
    assertEquals(i,list.popFront().value);
  }
  assertEquals(0,list.size());
}
Program: 56288
Project: 56288
Buggy source:
private void assertListsEqual(DoubleLinkedIntList copy){
  assertEquals(list.size(),copy.size());
  while (!list.isEmpty()) {
    assertEquals(list.popFront(),copy.popFront());
  }
}

Fixed version (ground truth):
private void assertListsEqual(DoubleLinkedIntList copy){
  assertEquals(list.size(),copy.size());
  while (!list.isEmpty()) {
    assertEquals(list.popFront().value,copy.popFront().value);
  }
}
Program: 56289
Project: 56289
Buggy source:
@Test public void testRemoveByHandle(){
  DoubleLinkedIntListItem handles[]=new DoubleLinkedIntListItem[TEST_NUMBERS];
  for (int i=0; i < TEST_NUMBERS; i++) {
    handles[i]=list.pushFront(i);
  }
  list.remove(handles[4]);
  list.remove(handles[7]);
  assertEquals(TEST_NUMBERS - 2,list.size());
  for (int i=TEST_NUMBERS - 1; i >= 0; i--) {
    if (i == 4 || i == 7) {
      continue;
    }
    assertEquals(i,list.popFront());
  }
  assertEquals(0,list.size());
}

Fixed version (ground truth):
@Test public void testRemoveByHandle(){
  DoubleLinkedIntListItem handles[]=new DoubleLinkedIntListItem[TEST_NUMBERS];
  for (int i=0; i < TEST_NUMBERS; i++) {
    handles[i]=list.pushFront(i);
  }
  list.remove(handles[4]);
  list.remove(handles[7]);
  assertEquals(TEST_NUMBERS - 2,list.size());
  for (int i=TEST_NUMBERS - 1; i >= 0; i--) {
    if (i == 4 || i == 7) {
      continue;
    }
    assertEquals(i,list.popFront().value);
  }
  assertEquals(0,list.size());
}
Program: 56290
Project: 56290
Buggy source:
private final void initStartNode(short sx,short sy,short tx,short ty){
  int flatIdx=getFlatIdx(sx,sy);
  open.insert(flatIdx);
  openList.set(flatIdx);
  depthParentHeap[getDepthIdx(flatIdx)]=0;
  depthParentHeap[getParentIdx(flatIdx)]=-1;
  costsAndHeuristics[getCostsIdx(flatIdx)]=0;
  costsAndHeuristics[getHeuristicIdx(flatIdx)]=getHeuristicCost(sx,sy,tx,ty);
}

Fixed version (ground truth):
private final void initStartNode(short sx,short sy,short tx,short ty){
  int flatIdx=getFlatIdx(sx,sy);
  depthParentHeap[getDepthIdx(flatIdx)]=0;
  depthParentHeap[getParentIdx(flatIdx)]=-1;
  costsAndHeuristics[getCostsIdx(flatIdx)]=0;
  costsAndHeuristics[getHeuristicIdx(flatIdx)]=getHeuristicCost(sx,sy,tx,ty);
  open.insert(flatIdx);
  openList.set(flatIdx);
}
Program: 56291
Project: 56291
Buggy source:
public DoubleLinkedIntListItem pushFront(int value){
  DoubleLinkedIntListItem newItem=new DoubleLinkedIntListItem(value);
  newItem.next=head.next;
  newItem.prev=head;
  newItem.next.prev=newItem;
  head.next=newItem;
  size++;
  return newItem;
}

Fixed version (ground truth):
public void pushFront(DoubleLinkedIntListItem newItem){
  newItem.next=head.next;
  newItem.prev=head;
  newItem.next.prev=newItem;
  head.next=newItem;
  size++;
}
Program: 56292
Project: 56292
Buggy source:
public int popFront(){
  final DoubleLinkedIntListItem item=head.next;
  item.next.prev=head;
  head.next=item.next;
  size--;
  return item.value;
}

Fixed version (ground truth):
public DoubleLinkedIntListItem popFront(){
  final DoubleLinkedIntListItem item=head.next;
  item.next.prev=head;
  head.next=item.next;
  item.next=null;
  item.prev=null;
  size--;
  return item;
}
Program: 56293
Project: 56293
Buggy source:
public MinBucketQueue(IRankSupplier rankSupplier,int maxNumberOfIds){
  this.rankSupplier=rankSupplier;
  this.buckets=new DoubleLinkedIntList[NUMBER_OF_BUCKETS];
  for (int i=0; i < NUMBER_OF_BUCKETS; i++) {
    this.buckets[i]=new DoubleLinkedIntList();
  }
  this.handles=new DoubleLinkedIntListItem[maxNumberOfIds];
}

Fixed version (ground truth):
public MinBucketQueue(IRankSupplier rankSupplier,int maxNumberOfIds){
  this.rankSupplier=rankSupplier;
  this.buckets=new DoubleLinkedIntList[NUMBER_OF_BUCKETS];
  for (int i=0; i < NUMBER_OF_BUCKETS; i++) {
    this.buckets[i]=new DoubleLinkedIntList();
  }
  this.handles=new DoubleLinkedIntListItem[maxNumberOfIds];
  for (int i=0; i < maxNumberOfIds; i++) {
    handles[i]=new DoubleLinkedIntListItem(i);
  }
}