nus-yam/ex-repair huggingface dataset:
Program: 173731
Project: 173731
Buggy source:
private boolean travelEdge(int startVertex,int endVertex,boolean previousGreedy){
  if (edgeUsed[startVertex][endVertex]) {
    log.debug("String_Node_Str" + startVertex + "String_Node_Str"+ endVertex+ "String_Node_Str");
    return false;
  }
 else   if (previousGreedy || edgeGreedy[startVertex][endVertex]) {
    log.debug("String_Node_Str" + startVertex + "String_Node_Str"+ endVertex);
    edgeUsed[startVertex][endVertex]=true;
    edgeUsed[endVertex][startVertex]=true;
    countEdges++;
    log.debug("String_Node_Str" + countEdges);
    return true;
  }
 else {
    log.debug("String_Node_Str" + startVertex + "String_Node_Str"+ endVertex+ "String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
private boolean travelEdge(int startVertex,int endVertex,boolean previousGreedy){
  if (edgeUsed[startVertex][endVertex]) {
    log.debug("String_Node_Str" + startVertex + "String_Node_Str"+ endVertex+ "String_Node_Str");
    return false;
  }
 else   if (previousGreedy || edgeGreedy[startVertex][endVertex]) {
    log.debug("String_Node_Str" + startVertex + "String_Node_Str"+ endVertex);
    edgeUsed[startVertex][endVertex]=true;
    edgeUsed[endVertex][startVertex]=true;
    countEdges++;
    nbEdges++;
    log.debug("String_Node_Str" + countEdges);
    return true;
  }
 else {
    log.debug("String_Node_Str" + startVertex + "String_Node_Str"+ endVertex+ "String_Node_Str");
    return false;
  }
}
Program: 173732
Project: 173732
Buggy source:
private void notifyRevenueAdapter(final int revenue,final boolean finalResult){
  revenueAdapter.notifyRevenueListener(revenue,finalResult);
}

Fixed version (ground truth):
private void notifyRevenueAdapter(final int revenue,final boolean finalResult){
  String modifier;
  if (finalResult)   modifier="String_Node_Str";
 else   modifier="String_Node_Str";
  StringBuffer statistics=new StringBuffer();
  statistics.append(nbEvaluations + "String_Node_Str");
  if (useRevenuePrediction)   statistics.append("String_Node_Str" + nbPredictions + "String_Node_Str");
  statistics.append("String_Node_Str" + nbEdges + "String_Node_Str");
  log.info("String_Node_Str" + modifier + "String_Node_Str"+ revenue+ "String_Node_Str"+ statistics.toString());
  revenueAdapter.notifyRevenueListener(revenue,finalResult);
}
Program: 173733
Project: 173733
Buggy source:
private boolean predictRevenues(int trainId){
  int totalValue=0;
  for (int j=0; j <= finalTrain; j++) {
    int trainValue;
    if (j < trainId) {
      trainValue=trainCurrentValue[j];
    }
 else     if (j > trainId) {
      trainValue=maxTrainRevenues[j];
    }
 else {
      if (trainTownsCostNothing[trainId]) {
        trainValue=0;
      }
 else       if (trainTowns[trainId] == 0) {
        trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j];
      }
 else {
        int townDiff=trainMaxTowns[trainId] - trainTowns[trainId];
        if (townDiff > 0) {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j] + maxTownRevenues[trainMaxTowns[j] - trainTowns[j]] * trainMultiplyTowns[j];
        }
 else         if (townDiff == 0) {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j];
        }
 else {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j] + townDiff] * trainMultiplyCities[j];
        }
      }
    }
    log.debug("String_Node_Str" + j + "String_Node_Str"+ trainValue);
    totalValue+=Math.min(trainValue,maxTrainRevenues[trainId]);
  }
  boolean terminate=(totalValue < currentBestValue);
  if (terminate)   log.debug("String_Node_Str" + totalValue);
  return terminate;
}

Fixed version (ground truth):
private boolean predictRevenues(int trainId){
  int totalValue=0;
  for (int j=0; j <= finalTrain; j++) {
    int trainValue;
    if (j < trainId) {
      trainValue=trainCurrentValue[j];
    }
 else     if (j > trainId) {
      trainValue=maxTrainRevenues[j];
    }
 else {
      if (trainTownsCostNothing[j]) {
        trainValue=0;
      }
 else       if (trainTowns[j] == 0) {
        trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j];
      }
 else {
        int townDiff=trainMaxTowns[j] - trainTowns[j];
        if (townDiff > 0) {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j] + maxTownRevenues[trainMaxTowns[j] - trainTowns[j]] * trainMultiplyTowns[j];
        }
 else         if (townDiff == 0) {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j];
        }
 else {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j] + townDiff] * trainMultiplyCities[j];
        }
      }
      trainValue=Math.min(trainValue,maxTrainRevenues[j]);
    }
    log.debug("String_Node_Str" + j + "String_Node_Str"+ trainValue);
    totalValue+=trainValue;
  }
  nbPredictions++;
  boolean terminate=(totalValue <= currentBestValue);
  if (terminate)   log.debug("String_Node_Str" + totalValue);
  return terminate;
}
Program: 173734
Project: 173734
Buggy source:
private void runTrain(int trainId){
  log.debug("String_Node_Str" + trainId);
  trainStackPos[trainId]=0;
  trainBottomPos[trainId]=0;
  for (int i=0; i < startVertexes.length; i++) {
    int vertexId=startVertexes[i];
    log.debug("String_Node_Str" + i + "String_Node_Str"+ trainId);
    boolean trainTerminated;
    if (encounterVertex(trainId,startVertexes[i],true)) {
      trainTerminated=trainTerminated(trainId) || (predictRevenues(trainId));
    }
 else {
      trainTerminated=false;
    }
    boolean evaluateResult=true;
    if (!trainTerminated) {
      for (int j=0; j < maxNeighbors; j++) {
        int neighborId=vertexNeighbors[vertexId][j];
        log.debug("String_Node_Str" + j + "String_Node_Str"+ neighborId);
        if (neighborId == -1)         break;
        if (travelEdge(vertexId,neighborId,true)) {
          evaluateResult=false;
          trainStartEdge[trainId]=j;
          nextVertex(trainId,neighborId,vertexId);
        }
      }
    }
    finalizeVertex(trainId,startVertexes[i],evaluateResult);
    encounterVertex(trainId,startVertexes[i],false);
    log.debug("String_Node_Str" + vertexId + "String_Node_Str"+ trainId);
  }
  log.debug("String_Node_Str" + trainId);
}

Fixed version (ground truth):
private void runTrain(int trainId){
  log.debug("String_Node_Str" + trainId);
  trainStackPos[trainId]=0;
  trainBottomPos[trainId]=0;
  for (int i=0; i < startVertexes.length; i++) {
    int vertexId=startVertexes[i];
    log.debug("String_Node_Str" + i + "String_Node_Str"+ trainId);
    boolean trainTerminated=false;
    if (encounterVertex(trainId,vertexId,true)) {
      if (useRevenuePrediction && predictRevenues(trainId)) {
        encounterVertex(trainId,vertexId,false);
        log.debug("String_Node_Str" + vertexId + "String_Node_Str"+ trainId);
        continue;
      }
 else {
        trainTerminated=trainTerminated(trainId);
      }
    }
    boolean evaluateResult=true;
    if (!trainTerminated) {
      for (int j=0; j < maxNeighbors; j++) {
        int neighborId=vertexNeighbors[vertexId][j];
        log.debug("String_Node_Str" + j + "String_Node_Str"+ neighborId);
        if (neighborId == -1)         break;
        if (travelEdge(vertexId,neighborId,true)) {
          evaluateResult=false;
          trainStartEdge[trainId]=j;
          nextVertex(trainId,neighborId,vertexId);
        }
      }
    }
    finalizeVertex(trainId,vertexId,evaluateResult);
    encounterVertex(trainId,vertexId,false);
    log.debug("String_Node_Str" + vertexId + "String_Node_Str"+ trainId);
  }
  log.debug("String_Node_Str" + trainId);
}
Program: 173735
Project: 173735
Buggy source:
public RevenueCalculator(RevenueAdapter revenueAdapter,int nbVertexes,int maxNeighbors,int nbTrains){
  this.revenueAdapter=revenueAdapter;
  this.nbVertexes=nbVertexes;
  this.maxNeighbors=maxNeighbors;
  this.nbTrains=nbTrains;
  log.debug("String_Node_Str" + nbVertexes + "String_Node_Str"+ maxNeighbors+ "String_Node_Str"+ nbTrains);
  vertexValue=new int[nbVertexes];
  vertexCity=new boolean[nbVertexes];
  vertexTown=new boolean[nbVertexes];
  vertexNeighbors=new int[nbVertexes][maxNeighbors];
  edgeGreedy=new boolean[nbVertexes][nbVertexes];
  edgeDistance=new int[nbVertexes][nbVertexes];
  edgeUsed=new boolean[nbVertexes][nbVertexes];
  trainCities=new int[nbTrains];
  trainTowns=new int[nbTrains];
  trainTownsCostNothing=new boolean[nbTrains];
  trainMultiplyCities=new int[nbTrains];
  trainMultiplyTowns=new int[nbTrains];
  trainCurrentValue=new int[nbTrains];
  trainMaxCities=new int[nbTrains];
  trainMaxTowns=new int[nbTrains];
  trainVisited=new boolean[nbTrains][nbVertexes];
  trainVertexStack=new int[nbTrains][nbVertexes];
  trainStackPos=new int[nbTrains];
  trainBottomPos=new int[nbTrains];
  trainStartEdge=new int[nbTrains];
  currentBestRun=new int[nbTrains][nbVertexes];
}

Fixed version (ground truth):
public RevenueCalculator(RevenueAdapter revenueAdapter,int nbVertexes,int maxNeighbors,int nbTrains){
  this.revenueAdapter=revenueAdapter;
  this.nbVertexes=nbVertexes;
  this.maxNeighbors=maxNeighbors;
  this.nbTrains=nbTrains;
  log.debug("String_Node_Str" + nbVertexes + "String_Node_Str"+ maxNeighbors+ "String_Node_Str"+ nbTrains);
  vertexValue=new int[nbVertexes];
  vertexCity=new boolean[nbVertexes];
  vertexTown=new boolean[nbVertexes];
  vertexNeighbors=new int[nbVertexes][maxNeighbors];
  edgeGreedy=new boolean[nbVertexes][nbVertexes];
  edgeDistance=new int[nbVertexes][nbVertexes];
  edgeUsed=new boolean[nbVertexes][nbVertexes];
  trainCities=new int[nbTrains];
  trainTowns=new int[nbTrains];
  trainTownsCostNothing=new boolean[nbTrains];
  trainMultiplyCities=new int[nbTrains];
  trainMultiplyTowns=new int[nbTrains];
  trainCurrentValue=new int[nbTrains];
  trainMaxCities=new int[nbTrains];
  trainMaxTowns=new int[nbTrains];
  trainVisited=new boolean[nbTrains][nbVertexes];
  trainVertexStack=new int[nbTrains][nbVertexes];
  trainStackPos=new int[nbTrains];
  trainBottomPos=new int[nbTrains];
  trainStartEdge=new int[nbTrains];
  currentBestRun=new int[nbTrains][nbVertexes];
  useRevenuePrediction=false;
}
Program: 173736
Project: 173736
Buggy source:
void setPredictionData(int[] maxCityRevenues,int[] maxTownRevenues){
  this.maxCityRevenues=maxCityRevenues;
  this.maxTownRevenues=maxTownRevenues;
}

Fixed version (ground truth):
void setPredictionData(int[] maxCityRevenues,int[] maxTownRevenues){
  this.maxCityRevenues=maxCityRevenues;
  this.maxTownRevenues=maxTownRevenues;
  useRevenuePrediction=true;
}
Program: 173737
Project: 173737
Buggy source:
int calculateRevenue(int startTrain,int finalTrain){
  log.info("String_Node_Str" + startTrain + "String_Node_Str"+ finalTrain);
  stopped=false;
  maxTrainRevenues=new int[nbTrains];
  for (int j=0; j < nbTrains; j++) {
    maxTrainRevenues[j]=maxCityRevenues[trainMaxCities[j]] * trainMultiplyCities[j] + maxTownRevenues[trainMaxTowns[j]] * trainMultiplyTowns[j];
  }
  this.finalTrain=finalTrain;
  runTrain(startTrain);
  notifyRevenueAdapter(currentBestValue,true);
  return currentBestValue;
}

Fixed version (ground truth):
int calculateRevenue(int startTrain,int finalTrain){
  log.info("String_Node_Str" + startTrain + "String_Node_Str"+ finalTrain);
  nbEvaluations=0;
  nbPredictions=0;
  nbEdges=0;
  if (useRevenuePrediction) {
    maxTrainRevenues=new int[nbTrains];
    for (int j=0; j < nbTrains; j++) {
      maxTrainRevenues[j]=maxCityRevenues[trainMaxCities[j]] * trainMultiplyCities[j] + maxTownRevenues[trainMaxTowns[j]] * trainMultiplyTowns[j];
    }
  }
  this.finalTrain=finalTrain;
  runTrain(startTrain);
  notifyRevenueAdapter(currentBestValue,true);
  return currentBestValue;
}
Program: 173738
Project: 173738
Buggy source:
public static Point2D getVertexPoint2D(HexMap map,NetworkVertex vertex){
  GUIHex guiHex=map.getHexByName(vertex.getHex().getName());
  if (vertex.isCityType()) {
    return guiHex.getCityPoint2D(vertex.getCity());
  }
 else   if (vertex.isTownType()) {
    return guiHex.getCenterPoint2D();
  }
 else   if (vertex.isSide()) {
    return guiHex.getSidePoint2D(vertex.getSide());
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public static Point2D getVertexPoint2D(HexMap map,NetworkVertex vertex){
  GUIHex guiHex=map.getHexByName(vertex.getHex().getName());
  if (vertex.isCityType()) {
    return guiHex.getCityPoint2D(vertex.getCity());
  }
 else   if (vertex.isTownType()) {
    return guiHex.getCenterPoint2D();
  }
 else   if (vertex.isSide()) {
    if (map instanceof EWHexMap)     return guiHex.getSidePoint2D(5 - vertex.getSide());
 else     return guiHex.getSidePoint2D((3 + vertex.getSide()) % 6);
  }
 else {
    return null;
  }
}
Program: 173739
Project: 173739
Buggy source:
/** 
 * arrives at an unvisited vertex
 */
private void nextVertex(int trainId,int vertexId,int previousId){
  Terminated trainTerminated=Terminated.NotYet;
  boolean valueStation=encounterVertex(trainId,vertexId,true);
  if (valueStation) {
    trainTerminated=trainTerminated(trainId);
    if (trainTerminated == Terminated.WithoutEvaluation || trainTerminated == Terminated.NotYet && useRevenuePrediction && predictRevenues(trainId)) {
      encounterVertex(trainId,vertexId,false);
      returnEdge(trainId);
      return;
    }
  }
  if (trainTerminated == Terminated.NotYet) {
    for (int j=0; j < maxNeighbors; j++) {
      int neighborId=vertexNeighbors[vertexId][j];
      log.debug("String_Node_Str" + j + "String_Node_Str"+ vertexId+ "String_Node_Str"+ neighborId);
      if (neighborId == -1)       break;
      if (trainVisited[trainId][neighborId]) {
        log.debug("String_Node_Str");
        continue;
      }
      if (travelEdge(vertexId,neighborId,edgeGreedy[previousId][vertexId])) {
        nextVertex(trainId,neighborId,vertexId);
      }
    }
    if (valueStation && trainBottomPos[trainId] == 0 && (vertexCity[vertexId] || vertexTown[vertexId])) {
      runBottom(trainId);
    }
  }
  finalizeVertex(trainId,vertexId,valueStation);
  encounterVertex(trainId,vertexId,false);
  returnEdge(trainId);
}

Fixed version (ground truth):
/** 
 * arrives at an unvisited vertex
 */
private void nextVertex(int trainId,int vertexId,int previousId){
  Terminated trainTerminated=Terminated.NotYet;
  boolean valueStation=encounterVertex(trainId,vertexId,true);
  if (valueStation) {
    trainTerminated=trainTerminated(trainId);
    if (trainTerminated == Terminated.WithoutEvaluation || useRevenuePrediction && predictRevenues(trainId)) {
      encounterVertex(trainId,vertexId,false);
      returnEdge(trainId);
      return;
    }
  }
  if (trainTerminated == Terminated.NotYet) {
    for (int j=0; j < maxNeighbors; j++) {
      int neighborId=vertexNeighbors[vertexId][j];
      log.debug("String_Node_Str" + j + "String_Node_Str"+ vertexId+ "String_Node_Str"+ neighborId);
      if (neighborId == -1)       break;
      if (trainVisited[trainId][neighborId]) {
        log.debug("String_Node_Str");
        continue;
      }
      if (travelEdge(vertexId,neighborId,edgeGreedy[previousId][vertexId])) {
        nextVertex(trainId,neighborId,vertexId);
      }
    }
    if (valueStation && trainBottomPos[trainId] == 0 && (vertexCity[vertexId] || vertexTown[vertexId])) {
      runBottom(trainId);
    }
  }
  finalizeVertex(trainId,vertexId,valueStation);
  encounterVertex(trainId,vertexId,false);
  returnEdge(trainId);
}
Program: 173740
Project: 173740
Buggy source:
private boolean predictRevenues(int trainId){
  int totalValue=0;
  for (int j=0; j <= finalTrain; j++) {
    int trainValue;
    if (j < trainId) {
      trainValue=trainCurrentValue[j];
    }
 else     if (j > trainId) {
      trainValue=maxTrainRevenues[j];
    }
 else {
      if (trainMaxTowns[j] == 0) {
        trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j];
      }
 else {
        int townDiff=trainMaxTowns[j] - trainTowns[j];
        if (townDiff > 0) {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j] + maxTownRevenues[trainMaxTowns[j] - trainTowns[j]] * trainMultiplyTowns[j];
        }
 else         if (townDiff == 0) {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j];
        }
 else {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j] + townDiff] * trainMultiplyCities[j];
        }
      }
      trainValue=Math.min(trainValue,maxTrainRevenues[j]);
    }
    log.debug("String_Node_Str" + j + "String_Node_Str"+ trainValue);
    totalValue+=trainValue;
  }
  nbPredictions++;
  boolean terminate=(totalValue <= currentBestValue);
  if (terminate)   log.debug("String_Node_Str" + totalValue);
  return terminate;
}

Fixed version (ground truth):
private boolean predictRevenues(int trainId){
  int totalValue=0;
  for (int j=0; j <= finalTrain; j++) {
    int trainValue;
    if (j < trainId) {
      trainValue=trainCurrentValue[j];
    }
 else     if (j > trainId) {
      trainValue=maxTrainRevenues[j];
    }
 else {
      if (trainIgnoreTowns[j]) {
        trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j];
      }
 else       if (trainMaxTowns[j] == 0) {
        trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j] - trainTowns[j]] * trainMultiplyCities[j];
      }
 else {
        int townDiff=trainMaxTowns[j] - trainTowns[j];
        if (townDiff > 0) {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j] + maxTownRevenues[trainMaxTowns[j] - trainTowns[j]] * trainMultiplyTowns[j];
        }
 else         if (townDiff == 0) {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j]] * trainMultiplyCities[j];
        }
 else {
          trainValue=trainCurrentValue[j] + maxCityRevenues[trainMaxCities[j] - trainCities[j] + townDiff] * trainMultiplyCities[j];
        }
      }
      trainValue=Math.min(trainValue,maxTrainRevenues[j]);
    }
    log.debug("String_Node_Str" + j + "String_Node_Str"+ trainValue);
    totalValue+=trainValue;
  }
  nbPredictions++;
  boolean terminate=(totalValue <= currentBestValue);
  if (terminate)   log.debug("String_Node_Str" + totalValue);
  return terminate;
}
Program: 173741
Project: 173741
Buggy source:
private void runTrain(int trainId){
  log.debug("String_Node_Str" + trainId);
  trainStackPos[trainId]=0;
  trainBottomPos[trainId]=0;
  for (int i=0; i < startVertexes.length; i++) {
    int vertexId=startVertexes[i];
    log.debug("String_Node_Str" + i + "String_Node_Str"+ trainId);
    Terminated trainTerminated=Terminated.NotYet;
    boolean valueStation=encounterVertex(trainId,vertexId,true);
    if (valueStation) {
      trainTerminated=trainTerminated(trainId);
      if (trainTerminated == Terminated.WithoutEvaluation || trainTerminated == Terminated.NotYet && useRevenuePrediction && predictRevenues(trainId)) {
        encounterVertex(trainId,vertexId,false);
        log.debug("String_Node_Str" + vertexId + "String_Node_Str"+ trainId);
        continue;
      }
    }
    if (trainTerminated == Terminated.NotYet) {
      for (int j=0; j < maxNeighbors; j++) {
        int neighborId=vertexNeighbors[vertexId][j];
        log.debug("String_Node_Str" + j + "String_Node_Str"+ neighborId);
        if (neighborId == -1)         break;
        if (travelEdge(vertexId,neighborId,true)) {
          trainStartEdge[trainId]=j;
          nextVertex(trainId,neighborId,vertexId);
        }
      }
    }
    finalizeVertex(trainId,vertexId,valueStation);
    encounterVertex(trainId,vertexId,false);
    log.debug("String_Node_Str" + vertexId + "String_Node_Str"+ trainId);
  }
  log.debug("String_Node_Str" + trainId);
}

Fixed version (ground truth):
private void runTrain(int trainId){
  log.debug("String_Node_Str" + trainId);
  trainStackPos[trainId]=0;
  trainBottomPos[trainId]=0;
  for (int i=0; i < startVertexes.length; i++) {
    int vertexId=startVertexes[i];
    log.debug("String_Node_Str" + i + "String_Node_Str"+ trainId);
    Terminated trainTerminated=Terminated.NotYet;
    boolean valueStation=encounterVertex(trainId,vertexId,true);
    if (valueStation) {
      trainTerminated=trainTerminated(trainId);
      if (trainTerminated == Terminated.WithoutEvaluation || useRevenuePrediction && predictRevenues(trainId)) {
        encounterVertex(trainId,vertexId,false);
        log.debug("String_Node_Str" + vertexId + "String_Node_Str"+ trainId);
        continue;
      }
    }
    if (trainTerminated == Terminated.NotYet) {
      for (int j=0; j < maxNeighbors; j++) {
        int neighborId=vertexNeighbors[vertexId][j];
        log.debug("String_Node_Str" + j + "String_Node_Str"+ neighborId);
        if (neighborId == -1)         break;
        if (travelEdge(vertexId,neighborId,true)) {
          trainStartEdge[trainId]=j;
          nextVertex(trainId,neighborId,vertexId);
        }
      }
    }
    finalizeVertex(trainId,vertexId,valueStation);
    encounterVertex(trainId,vertexId,false);
    log.debug("String_Node_Str" + vertexId + "String_Node_Str"+ trainId);
  }
  log.debug("String_Node_Str" + trainId);
}
Program: 173742
Project: 173742
Buggy source:
public Point2D getSidePoint2D(int side){
  side=(5 - side);
  return new Point2D.Double((xVertex[side] + xVertex[(side + 1) % 6]) / 2,(yVertex[side] + yVertex[(side + 1) % 6]) / 2);
}

Fixed version (ground truth):
public Point2D getSidePoint2D(int side){
  return new Point2D.Double((xVertex[side] + xVertex[(side + 1) % 6]) / 2,(yVertex[side] + yVertex[(side + 1) % 6]) / 2);
}
Program: 173744
Project: 173744
Buggy source:
/** 
 * Check if a company must be floated, and if so, do it. <p>This method is included here because it is used in various types of Round.
 * @param company
 */
protected void checkFlotation(PublicCompanyI company){
  if (!company.hasStarted() || company.hasFloated())   return;
  int unsoldPercentage=company.getUnsoldPercentage();
  if (unsoldPercentage <= 100 - company.getFloatPercentage()) {
    floatCompany(company);
  }
}

Fixed version (ground truth):
/** 
 * Check if a company must be floated, and if so, do it. <p>This method is included here because it is used in various types of Round.
 * @param company
 */
protected void checkFlotation(PublicCompanyI company){
  if (!company.hasStarted() || company.hasFloated())   return;
  if (getSoldPercentage(company) >= company.getFloatPercentage()) {
    floatCompany(company);
  }
}
Program: 173747
Project: 173747
Buggy source:
protected void adjustSharePrice(PublicCompanyI company,int numberSold,boolean soldBefore){
  if (company instanceof PublicCompany_CGR) {
    if (company.canSharePriceVary()) {
      int numberOfSpaces;
      if (company.getShareUnit() == 5) {
        numberOfSpaces=(sharesSoldSoFar.intValue() + numberSold) / 2 - squaresDownSoFar.intValue();
        sharesSoldSoFar.add(numberSold);
        squaresDownSoFar.add(numberOfSpaces);
      }
 else {
        numberOfSpaces=numberSold;
      }
      stockMarket.sell(company,numberOfSpaces);
    }
  }
 else {
    super.adjustSharePrice(company,numberSold,soldBefore);
  }
}

Fixed version (ground truth):
@Override protected void adjustSharePrice(PublicCompanyI company,int numberSold,boolean soldBefore){
  if (company instanceof PublicCompany_CGR) {
    if (company.canSharePriceVary()) {
      int numberOfSpaces;
      if (company.getShareUnit() == 5) {
        numberOfSpaces=(sharesSoldSoFar.intValue() + numberSold) / 2 - squaresDownSoFar.intValue();
        sharesSoldSoFar.add(numberSold);
        squaresDownSoFar.add(numberOfSpaces);
      }
 else {
        numberOfSpaces=numberSold;
      }
      stockMarket.sell(company,numberOfSpaces);
    }
  }
 else {
    super.adjustSharePrice(company,numberSold,soldBefore);
  }
}
Program: 173748
Project: 173748
Buggy source:
/** 
 * Special 1856 code to check for company flotation.
 * @param company
 */
@Override protected void checkFlotation(PublicCompanyI company){
  if (!company.hasStarted() || company.hasFloated())   return;
  int unsoldPercentage=company.getUnsoldPercentage();
  PublicCompany_1856 comp=(PublicCompany_1856)company;
  int trainNumberAtStart=comp.getTrainNumberAvailableAtStart();
  int floatPercentage=10 * trainNumberAtStart;
  log.debug("String_Node_Str" + floatPercentage);
  if (unsoldPercentage <= 100 - floatPercentage) {
    if (!company.hasFloated()) {
      floatCompany(company);
    }
  }
}

Fixed version (ground truth):
/** 
 * Special 1856 code to check for company flotation.
 * @param company
 */
@Override protected void checkFlotation(PublicCompanyI company){
  if (!company.hasStarted() || company.hasFloated())   return;
  int soldPercentage=getSoldPercentage(company);
  PublicCompany_1856 comp=(PublicCompany_1856)company;
  int trainNumberAtStart=comp.getTrainNumberAvailableAtStart();
  int floatPercentage=10 * trainNumberAtStart;
  log.debug("String_Node_Str" + floatPercentage);
  if (soldPercentage >= floatPercentage) {
    if (!company.hasFloated()) {
      floatCompany(company);
    }
  }
}
Program: 173749
Project: 173749
Buggy source:
protected void initPlayer(){
  super.initPlayer();
  sharesSoldSoFar.set(0);
  squaresDownSoFar.set(0);
}

Fixed version (ground truth):
@Override protected void initPlayer(){
  super.initPlayer();
  sharesSoldSoFar.set(0);
  squaresDownSoFar.set(0);
}
Program: 173750
Project: 173750
Buggy source:
@Override protected CashHolder getSharePriceRecipient(PublicCertificateI cert,int cost){
  CashHolder recipient;
  Portfolio oldHolder=(Portfolio)cert.getHolder();
  if (cost != 0 && !cert.getCompany().getName().equalsIgnoreCase(PublicCompany_CGR.NAME) && oldHolder == ipo) {
    PublicCompany_1856 comp=(PublicCompany_1856)(cert).getCompany();
switch (comp.getTrainNumberAvailableAtStart()) {
case 2:
case 3:
case 4:
      if (comp.getUnsoldPercentage() <= 50 && !comp.hasReachedDestination()) {
        recipient=oldHolder.getOwner();
        comp.addMoneyInEscrow(cost);
        ReportBuffer.addWaiting(LocalText.getText("String_Node_Str",Bank.format(cost),Bank.format(comp.getMoneyInEscrow()),comp.getName()));
        break;
      }
case 5:
    recipient=(cert).getCompany();
  break;
case 6:
default :
recipient=oldHolder.getOwner();
}
}
 else {
recipient=oldHolder.getOwner();
}
return recipient;
}

Fixed version (ground truth):
@Override protected CashHolder getSharePriceRecipient(PublicCertificateI cert,int cost){
  CashHolder recipient;
  Portfolio oldHolder=(Portfolio)cert.getHolder();
  if (cost != 0 && !cert.getCompany().getName().equalsIgnoreCase(PublicCompany_CGR.NAME) && oldHolder == ipo) {
    PublicCompany_1856 comp=(PublicCompany_1856)(cert).getCompany();
switch (comp.getTrainNumberAvailableAtStart()) {
case 2:
case 3:
case 4:
      if (getSoldPercentage(comp) >= 50 && !comp.hasReachedDestination()) {
        recipient=bank;
        comp.addMoneyInEscrow(cost);
        ReportBuffer.addWaiting(LocalText.getText("String_Node_Str",Bank.format(cost),Bank.format(comp.getMoneyInEscrow()),comp.getName()));
        break;
      }
case 5:
    recipient=comp;
  break;
case 6:
default :
recipient=bank;
}
}
 else {
recipient=oldHolder.getOwner();
}
return recipient;
}
Program: 173751
Project: 173751
Buggy source:
@Override protected void scaleHexesGUI(){
  hexArray=mapManager.getHexes();
  GUIHex hex;
  int ii, jj;
  for (int i=minX; i < hexArray.length; i++) {
    ii=i - minX + 1;
    for (int j=minY; j < hexArray[0].length; j++) {
      jj=j - minY + 1;
      hex=h[i][j];
      if (hex != null) {
        hex.scaleHex(cx + scale * ((GUIHex.SQRT3 * ii) + (GUIHex.SQRT3 / 2 * (jj & 1))),cy + jj * 1.5 * scale,scale,zoomFactor);
      }
    }
  }
  setSize();
}

Fixed version (ground truth):
@Override protected void scaleHexesGUI(){
  hexArray=mapManager.getHexes();
  GUIHex hex;
  int ii, jj;
  for (int i=minX; i < hexArray.length; i++) {
    ii=i - minX + 1;
    for (int j=minY; j < hexArray[0].length; j++) {
      jj=j - minY + 1;
      hex=h[i][j];
      if (hex != null) {
        hex.scaleHex(cx + scale * ((GUIHex.SQRT3 * ii) + (GUIHex.SQRT3 / 2 * (j & 1))),cy + jj * 1.5 * scale,scale,zoomFactor);
      }
    }
  }
  setSize();
}
Program: 173752
Project: 173752
Buggy source:
/** 
 * Add an object.
 * @param object The object to add.
 * @return True if successful.
 */
public boolean addObject(Moveable object){
  if (object instanceof SpecialPropertyI) {
    return addSpecialProperty((SpecialPropertyI)object);
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Add an object.
 * @param object The object to add.
 * @return True if successful.
 */
public boolean addObject(Moveable object){
  if (object instanceof SpecialPropertyI) {
    SpecialPropertyI sp=(SpecialPropertyI)object;
    sp.setHolder(null);
    return addSpecialProperty(sp);
  }
 else {
    return false;
  }
}
Program: 173753
Project: 173753
Buggy source:
/** 
 * Make a full list of trains, like "2 2 3 3", to show in any field describing train possessions, except the IPO.
 * @param holder The Portfolio for which this list will be made.
 */
public String makeFullListOfTrains(){
  if (trains == null || trains.isEmpty())   return "String_Node_Str";
  List<TrainI> trainsOfType;
  StringBuffer b=new StringBuffer();
  for (  TrainTypeI type : GameManager.getInstance().getTrainManager().getTrainTypes()) {
    trainsOfType=trainsPerType.get(type);
    if (trainsOfType != null && !trainsOfType.isEmpty()) {
      for (      TrainI train : trainsOfType) {
        if (b.length() > 0)         b.append("String_Node_Str");
        b.append(train.getName());
      }
    }
  }
  return b.toString();
}

Fixed version (ground truth):
/** 
 * Make a full list of trains, like "2 2 3 3", to show in any field describing train possessions, except the IPO.
 */
public String makeFullListOfTrains(){
  if (trains == null || trains.isEmpty())   return "String_Node_Str";
  List<TrainI> trainsOfType;
  StringBuffer b=new StringBuffer();
  for (  TrainTypeI type : GameManager.getInstance().getTrainManager().getTrainTypes()) {
    trainsOfType=trainsPerType.get(type);
    if (trainsOfType != null && !trainsOfType.isEmpty()) {
      for (      TrainI train : trainsOfType) {
        if (b.length() > 0)         b.append("String_Node_Str");
        b.append(train.getName());
      }
    }
  }
  return b.toString();
}
Program: 173754
Project: 173754
Buggy source:
/** 
 * Add a special property. Used to make special properties independent of the private company that originally held it.
 * @param property The special property object to add.
 * @return True if successful.
 */
public boolean addSpecialProperty(SpecialPropertyI property){
  boolean result=false;
  if (specialProperties == null) {
    specialProperties=new ArrayList<SpecialPropertyI>(2);
  }
  result=specialProperties.add(property);
  if (owner instanceof PublicCompanyI && property instanceof LocatedBonus) {
    PublicCompanyI company=(PublicCompanyI)owner;
    LocatedBonus locBonus=(LocatedBonus)property;
    Bonus bonus=new Bonus(company,locBonus.getName(),locBonus.getValue(),locBonus.getLocations());
    company.addBonus(bonus);
    ReportBuffer.add(LocalText.getText("String_Node_Str",owner.getName(),locBonus.getName(),Bank.format(locBonus.getValue()),locBonus.getLocationNameString()));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Add a special property. Used to make special properties independent of the private company that originally held it.
 * @param property The special property object to add.
 * @return True if successful.
 */
public boolean addSpecialProperty(SpecialPropertyI property){
  boolean result=false;
  if (specialProperties == null) {
    specialProperties=new ArrayList<SpecialPropertyI>(2);
  }
  result=specialProperties.add(property);
  property.setHolder(this);
  if (owner instanceof PublicCompanyI && property instanceof LocatedBonus) {
    PublicCompanyI company=(PublicCompanyI)owner;
    LocatedBonus locBonus=(LocatedBonus)property;
    Bonus bonus=new Bonus(company,locBonus.getName(),locBonus.getValue(),locBonus.getLocations());
    company.addBonus(bonus);
    ReportBuffer.add(LocalText.getText("String_Node_Str",owner.getName(),locBonus.getName(),Bank.format(locBonus.getValue()),locBonus.getLocationNameString()));
  }
  return result;
}
Program: 173755
Project: 173755
Buggy source:
/** 
 * Make an abbreviated list of trains, like "2(6) 3(5)" etc, to show in the IPO.
 * @param holder The Portfolio for which this list will be made (alwaysIPO).
 */
public String makeAbbreviatedListOfTrains(){
  if (trains == null || trains.isEmpty())   return "String_Node_Str";
  StringBuffer b=new StringBuffer();
  List<TrainI> trainsOfType;
  for (  TrainTypeI type : GameManager.getInstance().getTrainManager().getTrainTypes()) {
    trainsOfType=trainsPerType.get(type);
    if (trainsOfType != null && !trainsOfType.isEmpty()) {
      if (b.length() > 0)       b.append("String_Node_Str");
      b.append(type.getName()).append("String_Node_Str");
      if (type.hasInfiniteAmount()) {
        b.append("String_Node_Str");
      }
 else {
        b.append(trainsOfType.size());
      }
      b.append("String_Node_Str");
    }
  }
  return b.toString();
}

Fixed version (ground truth):
/** 
 * Make an abbreviated list of trains, like "2(6) 3(5)" etc, to show in the IPO.
 */
public String makeAbbreviatedListOfTrains(){
  if (trains == null || trains.isEmpty())   return "String_Node_Str";
  StringBuffer b=new StringBuffer();
  List<TrainI> trainsOfType;
  for (  TrainTypeI type : GameManager.getInstance().getTrainManager().getTrainTypes()) {
    trainsOfType=trainsPerType.get(type);
    if (trainsOfType != null && !trainsOfType.isEmpty()) {
      if (b.length() > 0)       b.append("String_Node_Str");
      b.append(type.getName()).append("String_Node_Str");
      if (type.hasInfiniteAmount()) {
        b.append("String_Node_Str");
      }
 else {
        b.append(trainsOfType.size());
      }
      b.append("String_Node_Str");
    }
  }
  return b.toString();
}
Program: 173756
Project: 173756
Buggy source:
public boolean isExecutionable(){
  return holder instanceof Player;
}

Fixed version (ground truth):
public boolean isExecutionable(){
  return originalCompany.getPortfolio().getOwner() instanceof Player;
}
Program: 173757
Project: 173757
Buggy source:
@Override public boolean undo(){
  stockMarket.processMove(company,to,from);
  return true;
}

Fixed version (ground truth):
@Override public boolean undo(){
  stockMarket.processMoveToStackPosition(company,to,from,fromStackPosition);
  return true;
}
Program: 173758
Project: 173758
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + company.getName() + "String_Node_Str"+ from+ "String_Node_Str"+ to;
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + company.getName() + "String_Node_Str"+ from+ "String_Node_Str"+ fromStackPosition+ "String_Node_Str"+ to;
}
Program: 173759
Project: 173759
Buggy source:
public PriceTokenMove(PublicCompanyI company,StockSpaceI from,StockSpaceI to,StockMarketI stockMarket){
  this.company=company;
  this.from=from;
  this.to=to;
  this.stockMarket=stockMarket;
  MoveSet.add(this);
}

Fixed version (ground truth):
public PriceTokenMove(PublicCompanyI company,StockSpaceI from,StockSpaceI to,StockMarketI stockMarket){
  this.company=company;
  this.from=from;
  this.to=to;
  if (from != null)   fromStackPosition=from.getStackPosition(company);
 else   fromStackPosition=0;
  this.stockMarket=stockMarket;
  MoveSet.add(this);
}
Program: 173760
Project: 173760
Buggy source:
/** 
 * @return Returns the isBlocked.
 */
public boolean isBlocked(){
  return isBlocked;
}

Fixed version (ground truth):
/** 
 * @return Returns the isBlocked.
 */
public boolean isBlocked(){
  if (isBlockedState == null)   return false;
 else   return isBlockedState.booleanValue();
}
Program: 173761
Project: 173761
Buggy source:
/** 
 * @param isBlocked The isBlocked to set.
 */
public void setBlocked(boolean isBlocked){
  this.isBlocked=isBlocked;
}

Fixed version (ground truth):
/** 
 * @param isBlocked The isBlocked to set (state variable)
 */
public void setBlocked(boolean isBlocked){
  if (isBlockedState == null)   isBlockedState=new BooleanState("String_Node_Str",isBlocked);
 else   isBlockedState.set(isBlocked);
}
Program: 173762
Project: 173762
Buggy source:
public boolean isUpgradeableNow(){
  if (isBlocked) {
    log.debug("String_Node_Str" + name + "String_Node_Str");
    return false;
  }
  if (currentTile != null) {
    if (currentTile.isUpgradeable()) {
      return true;
    }
 else {
      log.debug("String_Node_Str" + name + "String_Node_Str"+ currentTile.getId()+ "String_Node_Str");
      return false;
    }
  }
  log.debug("String_Node_Str" + name);
  return false;
}

Fixed version (ground truth):
public boolean isUpgradeableNow(){
  if (isBlocked()) {
    log.debug("String_Node_Str" + name + "String_Node_Str");
    return false;
  }
  if (currentTile != null) {
    if (currentTile.isUpgradeable()) {
      return true;
    }
 else {
      log.debug("String_Node_Str" + name + "String_Node_Str"+ currentTile.getId()+ "String_Node_Str");
      return false;
    }
  }
  log.debug("String_Node_Str" + name);
  return false;
}
Program: 173763
Project: 173763
Buggy source:
@Override public boolean setPossibleActions(){
  boolean passAllowed=false;
  setSellableShares();
  if (isPlayerOverLimits(currentPlayer))   return true;
  passAllowed=true;
  setBuyableCerts();
  setSpecialActions();
  setGameSpecificActions();
  if (passAllowed) {
    if (hasActed.booleanValue()) {
      possibleActions.add(new NullAction(NullAction.DONE));
    }
 else {
      possibleActions.add(new NullAction(NullAction.PASS));
      possibleActions.add(new NullAction(NullAction.AUTOPASS));
    }
  }
  if (getAutopasses() != null) {
    for (    Player player : getAutopasses()) {
      possibleActions.add(new RequestTurn(player));
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean setPossibleActions(){
  currentPlayer=getCurrentPlayer();
  boolean passAllowed=false;
  setSellableShares();
  if (isPlayerOverLimits(currentPlayer))   return true;
  passAllowed=true;
  setBuyableCerts();
  setSpecialActions();
  setGameSpecificActions();
  if (passAllowed) {
    if (hasActed.booleanValue()) {
      possibleActions.add(new NullAction(NullAction.DONE));
    }
 else {
      possibleActions.add(new NullAction(NullAction.PASS));
      possibleActions.add(new NullAction(NullAction.AUTOPASS));
    }
  }
  if (getAutopasses() != null) {
    for (    Player player : getAutopasses()) {
      possibleActions.add(new RequestTurn(player));
    }
  }
  return true;
}
Program: 173764
Project: 173764
Buggy source:
protected void setNormalTileLays(){
  currentNormalTileLays.clear();
  if (!tileLaysPerColour.isEmpty()) {
    currentNormalTileLays.add(new LayTile(tileLaysPerColour));
  }
}

Fixed version (ground truth):
protected void setNormalTileLays(){
  currentNormalTileLays.clear();
  Map<String,Integer> tileLaysPerColour=(Map<String,Integer>)(tileLaysPerColourState.getObject());
  if (!tileLaysPerColour.isEmpty()) {
    currentNormalTileLays.add(new LayTile(tileLaysPerColour));
  }
}
Program: 173765
Project: 173765
Buggy source:
/** 
 * Create a List of allowed normal tile lays (see LayTile class). This method should be called only once per company turn in an OR: at the start of the tile laying step.
 */
protected void getNormalTileLays(){
  tileLaysPerColour=new HashMap<String,Integer>(getCurrentPhase().getTileColours());
  int allowedNumber;
  for (  String colour : tileLaysPerColour.keySet()) {
    allowedNumber=operatingCompany.getNumberOfTileLays(colour);
    tileLaysPerColour.put(colour,new Integer(allowedNumber));
  }
}

Fixed version (ground truth):
/** 
 * Create a List of allowed normal tile lays (see LayTile class). This method should be called only once per company turn in an OR: at the start of the tile laying step.
 */
protected void getNormalTileLays(){
  Map<String,Integer> tileLaysPerColour=new HashMap<String,Integer>(getCurrentPhase().getTileColours());
  int allowedNumber;
  for (  String colour : tileLaysPerColour.keySet()) {
    allowedNumber=operatingCompany.getNumberOfTileLays(colour);
    tileLaysPerColour.put(colour,new Integer(allowedNumber));
  }
  tileLaysPerColourState=new GenericState<Map<String,Integer>>("String_Node_Str",tileLaysPerColour);
}
Program: 173767
Project: 173767
Buggy source:
/** 
 * This method is only called at the start of each step (unlike updateStatus(), which is called after each user action)
 */
protected void prepareStep(){
  GameDef.OrStep step=stepObject.value();
  if (step == GameDef.OrStep.LAY_TRACK) {
    getNormalTileLays();
  }
 else   if (step == GameDef.OrStep.LAY_TOKEN) {
  }
 else {
    currentSpecialProperties=null;
  }
}

Fixed version (ground truth):
/** 
 * This method is only called at the start of each step (unlike updateStatus(), which is called after each user action)
 */
protected void prepareStep(){
  GameDef.OrStep step=stepObject.value();
  if (step == GameDef.OrStep.LAY_TRACK) {
  }
 else   if (step == GameDef.OrStep.LAY_TOKEN) {
  }
 else {
    currentSpecialProperties=null;
  }
}
Program: 173768
Project: 173768
Buggy source:
protected boolean checkNormalTileLay(TileI tile,boolean update){
  if (tileLaysPerColour.isEmpty())   return false;
  String colour=tile.getColourName();
  Integer oldAllowedNumberObject=tileLaysPerColour.get(colour);
  if (oldAllowedNumberObject == null)   return false;
  int oldAllowedNumber=oldAllowedNumberObject.intValue();
  if (oldAllowedNumber <= 0)   return false;
  if (!update)   return true;
  if (oldAllowedNumber <= 1) {
    tileLaysPerColour.clear();
    log.debug("String_Node_Str");
    currentNormalTileLays.clear();
  }
 else {
    tileLaysPerColour.clear();
    tileLaysPerColour.put(colour,new Integer(oldAllowedNumber - 1));
    log.debug((oldAllowedNumber - 1) + "String_Node_Str" + colour+ "String_Node_Str");
  }
  return true;
}

Fixed version (ground truth):
protected boolean checkNormalTileLay(TileI tile,boolean update){
  Map<String,Integer> tileLaysPerColour=tileLaysPerColourState.getObject();
  if (tileLaysPerColour.isEmpty())   return false;
  String colour=tile.getColourName();
  Integer oldAllowedNumberObject=tileLaysPerColour.get(colour);
  if (oldAllowedNumberObject == null)   return false;
  int oldAllowedNumber=oldAllowedNumberObject.intValue();
  if (oldAllowedNumber <= 0)   return false;
  if (!update)   return true;
  Map<String,Integer> tileLaysPerColourUpdated=new HashMap<String,Integer>();
  if (oldAllowedNumber <= 1) {
    log.debug("String_Node_Str");
    currentNormalTileLays.clear();
  }
 else {
    tileLaysPerColourUpdated.put(colour,new Integer(oldAllowedNumber - 1));
    log.debug((oldAllowedNumber - 1) + "String_Node_Str" + colour+ "String_Node_Str");
  }
  tileLaysPerColourState.set(tileLaysPerColourUpdated);
  return true;
}
Program: 173771
Project: 173771
Buggy source:
public CashHolder getOwner(){
  return train.getOwner();
}

Fixed version (ground truth):
public CashHolder getOwner(){
  return getTrain().getOwner();
}
Program: 173772
Project: 173772
Buggy source:
public TrainI getTrain(){
  return train;
}

Fixed version (ground truth):
/** 
 * To be used for all usage of train, also within this class.  After reloading the 2nd copy etc. of a train with unlimited quantity,  the train attribute will be null (because readObject() is called and the train is initiated before the actions have been executed - the second train is in this case only created after buying the first one).
 * @return
 */
public TrainI getTrain(){
  if (train == null) {
    train=GameManager.getInstance().getTrainManager().getTrainByUniqueId(trainUniqueId);
  }
  return train;
}
Program: 173774
Project: 173774
Buggy source:
@Override public boolean equals(PossibleAction action){
  if (!(action instanceof BuyTrain))   return false;
  BuyTrain a=(BuyTrain)action;
  return a.train == train && a.from == from && a.fixedCost == fixedCost && a.trainsForExchange == trainsForExchange;
}

Fixed version (ground truth):
@Override public boolean equals(PossibleAction action){
  if (!(action instanceof BuyTrain))   return false;
  BuyTrain a=(BuyTrain)action;
  return a.getTrain() == getTrain() && a.from == from && a.fixedCost == fixedCost && a.trainsForExchange == trainsForExchange;
}
Program: 173775
Project: 173775
Buggy source:
@Override public String toString(){
  StringBuffer b=new StringBuffer();
  b.append(company.getName());
  b.append("String_Node_Str").append(train.getName());
  b.append("String_Node_Str").append(from.getName());
  if (fixedCost > 0) {
    b.append("String_Node_Str").append(Bank.format(fixedCost));
  }
 else {
    b.append("String_Node_Str");
    if (pricePaid > 0)     b.append("String_Node_Str").append(Bank.format(pricePaid));
  }
  if (specialProperty != null) {
    b.append("String_Node_Str").append(specialProperty.getCompany().getName());
  }
  if (isForExchange()) {
    b.append(forcedExchange ? "String_Node_Str" : "String_Node_Str");
  }
  if (presidentMustAddCash)   b.append("String_Node_Str").append(Bank.format(presidentCashToAdd));
 else   if (presidentMayAddCash)   b.append("String_Node_Str").append(Bank.format(presidentCashToAdd));
  if (pricePaid > 0)   b.append("String_Node_Str").append(Bank.format(pricePaid));
  return b.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuffer b=new StringBuffer();
  b.append(company.getName());
  b.append("String_Node_Str").append(getTrain().getName());
  b.append("String_Node_Str").append(from.getName());
  if (fixedCost > 0) {
    b.append("String_Node_Str").append(Bank.format(fixedCost));
  }
 else {
    b.append("String_Node_Str");
    if (pricePaid > 0)     b.append("String_Node_Str").append(Bank.format(pricePaid));
  }
  if (specialProperty != null) {
    b.append("String_Node_Str").append(specialProperty.getCompany().getName());
  }
  if (isForExchange()) {
    b.append(forcedExchange ? "String_Node_Str" : "String_Node_Str");
  }
  if (presidentMustAddCash)   b.append("String_Node_Str").append(Bank.format(presidentCashToAdd));
 else   if (presidentMayAddCash)   b.append("String_Node_Str").append(Bank.format(presidentCashToAdd));
  if (pricePaid > 0)   b.append("String_Node_Str").append(Bank.format(pricePaid));
  return b.toString();
}
Program: 173776
Project: 173776
Buggy source:
public Portfolio getHolder(){
  return train.getHolder();
}

Fixed version (ground truth):
public Portfolio getHolder(){
  return getTrain().getHolder();
}
Program: 173778
Project: 173778
Buggy source:
public void finish(){
  orWindow.finish();
  orWindow.setVisible(false);
}

Fixed version (ground truth):
public void finish(){
  orWindow.finish();
  if (!(gameUIManager.getCurrentRound() instanceof ShareSellingRound)) {
    setORCompanyTurn(-1);
  }
}
Program: 173779
Project: 173779
Buggy source:
public void setORCompanyTurn(int orCompIndex){
  orPanel.resetORCompanyTurn(orCompIndex);
  this.orCompIndex=orCompIndex;
  orComp=orCompIndex >= 0 ? companies[orCompIndex] : null;
  if (orCompIndex >= 0) {
  }
}

Fixed version (ground truth):
public void setORCompanyTurn(int orCompIndex){
  this.orCompIndex=orCompIndex;
  orComp=orCompIndex >= 0 ? companies[orCompIndex] : null;
  if (orCompIndex >= 0) {
  }
}