nus-yam/ex-repair huggingface dataset:
Program: 173684
Project: 173684
Buggy source:
/** 
 * creates a new virtual vertex with identical properties and links
 */
public static NetworkVertex duplicateVertex(SimpleGraph<NetworkVertex,NetworkEdge> graph,NetworkVertex vertex,String newIdentifier,boolean addOldVertexAsHidden){
  NetworkVertex newVertex=NetworkVertex.getVirtualVertex(vertex.type,newIdentifier);
  newVertex.stationType=vertex.stationType;
  newVertex.value=vertex.value;
  newVertex.sink=vertex.sink;
  newVertex.cityName=vertex.cityName;
  graph.addVertex(newVertex);
  Set<NetworkEdge> edges=graph.edgesOf(vertex);
  for (  NetworkEdge edge : edges) {
    List<NetworkVertex> hiddenVertices;
    if (edge.getSource() == vertex) {
      hiddenVertices=edge.getHiddenVertexes();
      if (addOldVertexAsHidden)       hiddenVertices.add(vertex);
      NetworkEdge newEdge=new NetworkEdge(newVertex,edge.getTarget(),edge.isGreedy(),edge.getDistance(),hiddenVertices);
      graph.addEdge(newVertex,edge.getTarget(),newEdge);
    }
 else {
      hiddenVertices=new ArrayList<NetworkVertex>();
      if (addOldVertexAsHidden)       hiddenVertices.add(vertex);
      hiddenVertices.addAll(edge.getHiddenVertexes());
      NetworkEdge newEdge=new NetworkEdge(edge.getSource(),newVertex,edge.isGreedy(),edge.getDistance(),hiddenVertices);
      graph.addEdge(newEdge.getSource(),newVertex,newEdge);
    }
  }
  return newVertex;
}

Fixed version (ground truth):
/** 
 * creates a new virtual vertex with identical properties and links
 */
public static NetworkVertex duplicateVertex(SimpleGraph<NetworkVertex,NetworkEdge> graph,NetworkVertex vertex,String newIdentifier,boolean addOldVertexAsHidden){
  NetworkVertex newVertex=NetworkVertex.getVirtualVertex(vertex.type,newIdentifier);
  newVertex.stationType=vertex.stationType;
  newVertex.value=vertex.value;
  newVertex.sink=vertex.sink;
  newVertex.cityName=vertex.cityName;
  graph.addVertex(newVertex);
  Set<NetworkEdge> edges=graph.edgesOf(vertex);
  for (  NetworkEdge edge : edges) {
    List<NetworkVertex> hiddenVertices;
    if (edge.getSource() == vertex) {
      hiddenVertices=edge.getHiddenVertices();
      if (addOldVertexAsHidden)       hiddenVertices.add(vertex);
      NetworkEdge newEdge=new NetworkEdge(newVertex,edge.getTarget(),edge.isGreedy(),edge.getDistance(),hiddenVertices);
      graph.addEdge(newVertex,edge.getTarget(),newEdge);
    }
 else {
      hiddenVertices=new ArrayList<NetworkVertex>();
      if (addOldVertexAsHidden)       hiddenVertices.add(vertex);
      hiddenVertices.addAll(edge.getHiddenVertices());
      NetworkEdge newEdge=new NetworkEdge(edge.getSource(),newVertex,edge.isGreedy(),edge.getDistance(),hiddenVertices);
      graph.addEdge(newEdge.getSource(),newVertex,newEdge);
    }
  }
  return newVertex;
}
Program: 173685
Project: 173685
Buggy source:
GeneralPath getAsPath(HexMap map){
  GeneralPath path=new GeneralPath();
  for (  NetworkEdge edge : edges) {
    Point2D sourcePoint=NetworkVertex.getVertexPoint2D(map,edge.getSource());
    if (sourcePoint != null) {
      path.moveTo((float)sourcePoint.getX(),(float)sourcePoint.getY());
    }
    for (    NetworkVertex hiddenVertex : edge.getHiddenVertexes()) {
      Point2D hiddenPoint=NetworkVertex.getVertexPoint2D(map,hiddenVertex);
      if (hiddenPoint != null) {
        path.lineTo((float)hiddenPoint.getX(),(float)hiddenPoint.getY());
      }
    }
    Point2D targetPoint=NetworkVertex.getVertexPoint2D(map,edge.getTarget());
    if (targetPoint != null) {
      path.lineTo((float)targetPoint.getX(),(float)targetPoint.getY());
    }
  }
  return path;
}

Fixed version (ground truth):
GeneralPath getAsPath(HexMap map){
  GeneralPath path=new GeneralPath();
  for (  NetworkEdge edge : edges) {
    List<NetworkVertex> edgeVertices=edge.getVertexPath();
    boolean initPath=false;
    for (    NetworkVertex edgeVertex : edgeVertices) {
      Point2D edgePoint=NetworkVertex.getVertexPoint2D(map,edgeVertex);
      if (edgePoint == null)       continue;
      if (!initPath) {
        path.moveTo((float)edgePoint.getX(),(float)edgePoint.getY());
        initPath=true;
      }
 else {
        path.lineTo((float)edgePoint.getX(),(float)edgePoint.getY());
      }
    }
  }
  return path;
}
Program: 173686
Project: 173686
Buggy source:
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  ObjectInputStream.GetField fields=in.readFields();
  certUniqueId=(String)fields.get("String_Node_Str",null);
  companyName=(String)fields.get("String_Node_Str",null);
  fromName=(String)fields.get("String_Node_Str",fromName);
  price=fields.get("String_Node_Str",price);
  maximumNumber=fields.get("String_Node_Str",maximumNumber);
  sharePerCert=fields.get("String_Node_Str",-1);
  numberBought=fields.get("String_Node_Str",numberBought);
  GameManagerI gameManager=GameManager.getInstance();
  CompanyManagerI companyManager=gameManager.getCompanyManager();
  companyName=companyManager.checkAlias(companyName);
  certUniqueId=companyManager.checkAliasInCertId(certUniqueId);
  if (certUniqueId != null) {
    certificate=PublicCertificate.getByUniqueId(certUniqueId);
    from=gameManager.getPortfolioByName(fromName);
    company=certificate.getCompany();
    companyName=company.getName();
    sharePerCert=certificate.getShare();
  }
 else   if (companyName != null) {
    company=gameManager.getCompanyManager().getPublicCompany(companyName);
    from=gameManager.getPortfolioByUniqueName(fromName);
  }
}

Fixed version (ground truth):
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  ObjectInputStream.GetField fields=in.readFields();
  certUniqueId=(String)fields.get("String_Node_Str",null);
  companyName=(String)fields.get("String_Node_Str",null);
  fromName=(String)fields.get("String_Node_Str",fromName);
  price=fields.get("String_Node_Str",price);
  maximumNumber=fields.get("String_Node_Str",maximumNumber);
  sharePerCert=fields.get("String_Node_Str",-1);
  numberBought=fields.get("String_Node_Str",numberBought);
  GameManagerI gameManager=GameManager.getInstance();
  CompanyManagerI companyManager=gameManager.getCompanyManager();
  companyName=companyManager.checkAlias(companyName);
  if (certUniqueId != null) {
    certUniqueId=companyManager.checkAliasInCertId(certUniqueId);
    certificate=PublicCertificate.getByUniqueId(certUniqueId);
    from=gameManager.getPortfolioByName(fromName);
    company=certificate.getCompany();
    companyName=company.getName();
    sharePerCert=certificate.getShare();
  }
 else   if (companyName != null) {
    company=gameManager.getCompanyManager().getPublicCompany(companyName);
    from=gameManager.getPortfolioByUniqueName(fromName);
  }
}
Program: 173688
Project: 173688
Buggy source:
/** 
 * Adds cash back to the bank
 */
public boolean addCash(int amount){
  boolean negative=money.addCash(amount);
  if (money.getCash() <= 0 && !broken.booleanValue()) {
    broken.set(true);
    GameManager.getInstance().registerBrokenBank();
  }
  return negative;
}

Fixed version (ground truth):
/** 
 * Adds cash back to the bank
 */
public void addCash(int amount){
  money.addCash(amount);
  if (money.getCash() <= 0 && !broken.booleanValue()) {
    broken.set(true);
    GameManager.getInstance().registerBrokenBank();
  }
}
Program: 173689
Project: 173689
Buggy source:
/** 
 * Add (or subtract) cash.
 */
public abstract boolean addCash(int amount);

Fixed version (ground truth):
/** 
 * Add (or subtract) cash.
 */
public abstract void addCash(int amount);
Program: 173690
Project: 173690
Buggy source:
public boolean addCash(int amount){
  boolean result=wallet.addCash(amount);
  return result;
}

Fixed version (ground truth):
public void addCash(int amount){
  wallet.addCash(amount);
}
Program: 173691
Project: 173691
Buggy source:
/** 
 * Add a given amount to the company treasury.
 * @param amount The amount to add (may be negative).
 */
public boolean addCash(int amount){
  return treasury.addCash(amount);
}

Fixed version (ground truth):
/** 
 * Add a given amount to the company treasury.
 * @param amount The amount to add (may be negative).
 */
public void addCash(int amount){
  treasury.addCash(amount);
}
Program: 173693
Project: 173693
Buggy source:
public boolean addCash(int addedCash){
  cash+=addedCash;
  update();
  if (cash <= 0)   return false;
 else   return true;
}

Fixed version (ground truth):
public void addCash(int addedCash){
  cash+=addedCash;
  update();
}
Program: 173694
Project: 173694
Buggy source:
public String getText(){
  if (cash == 0 && (option & SUPPRESS_ZERO) > 0 || owner instanceof PublicCompanyI && !((PublicCompanyI)owner).hasStarted()) {
    return "String_Node_Str";
  }
 else {
    return Bank.format(cash);
  }
}

Fixed version (ground truth):
@Override public String getText(){
  if (cash == 0 && (option & SUPPRESS_ZERO) > 0 || owner instanceof PublicCompanyI && !((PublicCompanyI)owner).hasStarted()) {
    return "String_Node_Str";
  }
 else {
    return Bank.format(cash);
  }
}
Program: 173695
Project: 173695
Buggy source:
private boolean transferCash(CashHolder from,CashHolder to,int amount){
  return to.addCash(amount) && from.addCash(-amount);
}

Fixed version (ground truth):
private void transferCash(CashHolder from,CashHolder to,int amount){
  to.addCash(amount);
  from.addCash(-amount);
}
Program: 173696
Project: 173696
Buggy source:
public void linkToPreviousMoveSet(){
  if (currentMoveSet != null) {
    currentMoveSet.linkToPreviousMoveSet();
  }
 else {
    log.warn("String_Node_Str");
  }
}

Fixed version (ground truth):
public void linkToPreviousMoveSet(){
  if (currentMoveSet != null) {
    currentMoveSet.linkToPreviousMoveSet();
    log.debug("String_Node_Str");
  }
 else {
    log.warn("String_Node_Str");
  }
}
Program: 173697
Project: 173697
Buggy source:
public boolean discardTrain(DiscardTrain action){
  TrainI train=action.getDiscardedTrain();
  PublicCompanyI company=action.getCompany();
  String companyName=company.getName();
  String errMsg=null;
  while (true) {
    if (company != cgr) {
      errMsg=LocalText.getText("String_Node_Str",company.getName(),cgrName);
      break;
    }
    if (getStep() != STEP_DISCARD_TRAINS) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    if (train == null && action.isForced()) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    if (train != null && !company.getPortfolio().getTrainList().contains(train)) {
      errMsg=LocalText.getText("String_Node_Str",company.getName(),train.getName());
      break;
    }
    break;
  }
  if (errMsg != null) {
    DisplayBuffer.add(LocalText.getText("String_Node_Str",companyName,train.getName(),errMsg));
    return false;
  }
  moveStack.start(true);
  if (train != null) {
    if (action.isForced())     moveStack.linkToPreviousMoveSet();
    train.moveTo(pool);
    ReportBuffer.add(LocalText.getText("String_Node_Str",companyName,train.getName()));
  }
 else {
    cgrHasDiscardedTrains.set(true);
  }
  return true;
}

Fixed version (ground truth):
public boolean discardTrain(DiscardTrain action){
  TrainI train=action.getDiscardedTrain();
  PublicCompanyI company=action.getCompany();
  String companyName=company.getName();
  String errMsg=null;
  while (true) {
    if (company != cgr) {
      errMsg=LocalText.getText("String_Node_Str",company.getName(),cgrName);
      break;
    }
    if (getStep() != STEP_DISCARD_TRAINS) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    if (train == null && action.isForced()) {
      errMsg=LocalText.getText("String_Node_Str");
      break;
    }
    if (train != null && !company.getPortfolio().getTrainList().contains(train)) {
      errMsg=LocalText.getText("String_Node_Str",company.getName(),train.getName());
      break;
    }
    break;
  }
  if (errMsg != null) {
    DisplayBuffer.add(LocalText.getText("String_Node_Str",companyName,train.getName(),errMsg));
    return false;
  }
  moveStack.start(true);
  if (train != null) {
    train.moveTo(pool);
    ReportBuffer.add(LocalText.getText("String_Node_Str",companyName,train.getName()));
  }
 else {
    cgrHasDiscardedTrains.set(true);
  }
  moveStack.linkToPreviousMoveSet();
  return true;
}
Program: 173699
Project: 173699
Buggy source:
public City getSelectedHomeStation(){
  return selectedHomeStation;
}

Fixed version (ground truth):
public City getSelectedHomeStation(){
  if (selectedHomeStation == null && selectedHomeStationName != null) {
    MapManager mapManager=GameManager.getInstance().getMapManager();
    String[] parts=parseStationName(selectedHomeStationName);
    MapHex hex=mapManager.getHex(parts[0]);
    selectedHomeStation=hex.getCity(Integer.parseInt(parts[1]));
  }
  return selectedHomeStation;
}
Program: 173700
Project: 173700
Buggy source:
/** 
 * Deserialize 
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  CompanyManagerI cmgr=getCompanyManager();
  if (minorsToMergeNames != null) {
    minorsToMerge=new ArrayList<PublicCompanyI>();
    for (    String name : minorsToMergeNames.split("String_Node_Str")) {
      minorsToMerge.add(cmgr.getPublicCompany(name));
    }
  }
  if (chosenMinorName != null) {
    chosenMinor=cmgr.getPublicCompany(chosenMinorName);
  }
  MapManager mapManager=GameManager.getInstance().getMapManager();
  if (availableHomeStationNames != null) {
    availableHomeStations=new ArrayList<City>();
    for (    String cityName : availableHomeStationNames.split("String_Node_Str")) {
      String[] parts=parseStationName(cityName);
      MapHex hex=mapManager.getHex(parts[0]);
      availableHomeStations.add(hex.getCity(Integer.parseInt(parts[1])));
    }
  }
  if (selectedHomeStationName != null) {
    String[] parts=parseStationName(selectedHomeStationName);
    MapHex hex=mapManager.getHex(parts[0]);
    selectedHomeStation=hex.getCity(Integer.parseInt(parts[1]));
  }
}

Fixed version (ground truth):
/** 
 * Deserialize 
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  CompanyManagerI cmgr=getCompanyManager();
  if (minorsToMergeNames != null) {
    minorsToMerge=new ArrayList<PublicCompanyI>();
    for (    String name : minorsToMergeNames.split("String_Node_Str")) {
      minorsToMerge.add(cmgr.getPublicCompany(name));
    }
  }
  if (chosenMinorName != null) {
    chosenMinor=cmgr.getPublicCompany(chosenMinorName);
  }
  MapManager mapManager=GameManager.getInstance().getMapManager();
  if (availableHomeStationNames != null) {
    availableHomeStations=new ArrayList<City>();
    for (    String cityName : availableHomeStationNames.split("String_Node_Str")) {
      String[] parts=parseStationName(cityName);
      MapHex hex=mapManager.getHex(parts[0]);
      availableHomeStations.add(hex.getCity(Integer.parseInt(parts[1])));
    }
  }
}
Program: 173702
Project: 173702
Buggy source:
public void modifyCalculator(RevenueAdapter revenueAdapter){
  if (dynamic)   return;
  for (  NetworkTrain networkTrain : revenueAdapter.getTrains()) {
    TrainI train=networkTrain.getRailsTrain();
    if (!(train instanceof NameableTrain))     continue;
    NamedTrainToken token=((NameableTrain)train).getNameToken();
    if (token == null)     continue;
    RevenueBonus bonus=new RevenueBonus(token.getValue(),token.getName());
    bonus.addTrain(train);
    for (    NetworkVertex vertex : NetworkVertex.getVerticesByHexes(revenueAdapter.getVertices(),token.getHexesToPass())) {
      if (!vertex.isStation())       continue;
      bonus.addVertex(vertex);
    }
    revenueAdapter.addRevenueBonus(bonus);
  }
}

Fixed version (ground truth):
public void modifyCalculator(RevenueAdapter revenueAdapter){
  if (dynamic)   return;
  for (  NetworkTrain networkTrain : revenueAdapter.getTrains()) {
    TrainI train=networkTrain.getRailsTrain();
    if (!(train instanceof NameableTrain))     continue;
    NamedTrainToken token=((NameableTrain)train).getNameToken();
    if (token == null)     continue;
    RevenueBonus bonus=defineBonus(revenueAdapter,token,false);
    if (bonus == null)     continue;
    bonus.addTrain(train);
    revenueAdapter.addRevenueBonus(bonus);
  }
}
Program: 173703
Project: 173703
Buggy source:
public boolean prepareModifier(RevenueAdapter revenueAdapter){
  if (!dynamic)   return false;
  List<NameTrains> sp=revenueAdapter.getCompany().getPortfolio().getSpecialProperties(NameTrains.class,false);
  if (sp.isEmpty())   return false;
  bonuses=new ArrayList<RevenueBonus>();
  bonusMaximum=0;
  for (  NamedTrainToken token : sp.get(0).getTokens()) {
    RevenueBonus bonus=new RevenueBonus(token.getValue(),token.getLongName());
    for (    NetworkVertex vertex : NetworkVertex.getVerticesByHexes(revenueAdapter.getVertices(),token.getHexesToPass())) {
      if (!vertex.isStation())       continue;
      bonus.addVertex(vertex);
    }
    bonuses.add(bonus);
    bonusMaximum+=token.getValue();
  }
  return true;
}

Fixed version (ground truth):
public boolean prepareModifier(RevenueAdapter revenueAdapter){
  if (!dynamic)   return false;
  List<NameTrains> sp=revenueAdapter.getCompany().getPortfolio().getSpecialProperties(NameTrains.class,false);
  if (sp.isEmpty())   return false;
  bonuses=new ArrayList<RevenueBonus>();
  bonusMaximum=0;
  for (  NamedTrainToken token : sp.get(0).getTokens()) {
    RevenueBonus bonus=defineBonus(revenueAdapter,token,true);
    if (bonus == null)     continue;
    bonuses.add(bonus);
    bonusMaximum+=token.getValue();
  }
  return true;
}
Program: 173705
Project: 173705
Buggy source:
/** 
 * Register a bid. <p> This method does <b>not</b> check off the amount of money that a player has available for bidding.
 * @param amount The bid amount.
 * @param bidder The bidding player.
 */
public void setBid(int amount,Player bidder){
  int index=bidder.getIndex();
  bids[index].set(amount);
  if (amount > 0) {
    lastBidderIndex.set(index);
    minimumBid.set(amount + 5);
  }
 else   if (amount == 0) {
    bids[index].resetOption(MoneyModel.SUPPRESS_ZERO);
    bids[index].update();
  }
 else {
    bids[index].set(0);
    bids[index].update();
  }
}

Fixed version (ground truth):
/** 
 * Register a bid. <p> This method does <b>not</b> check off the amount of money that a player has available for bidding.
 * @param amount The bid amount.
 * @param bidder The bidding player.special amounts are 0 for 18EU as buy price, -1 as standard pass, -2 and below as pass in 18EU 
 */
public void setBid(int amount,Player bidder){
  int index=bidder.getIndex();
  bids[index].set(amount);
  if (amount > 0) {
    lastBidderIndex.set(index);
    minimumBid.set(amount + 5);
  }
 else   if (amount == 0) {
    bids[index].resetOption(MoneyModel.SUPPRESS_ZERO);
    bids[index].update();
  }
 else   if (amount == -1) {
    bids[index].set(0);
    bids[index].update();
  }
}
Program: 173707
Project: 173707
Buggy source:
/** 
 * Process a player's pass.
 * @param playerName The name of the current player (for checking purposes).
 */
@Override public boolean pass(String playerName){
  ReportBuffer.add(LocalText.getText("String_Node_Str",playerName));
  moveStack.start(false);
  StartItem auctionedItem=(StartItem)currentAuctionItem.getObject();
switch (getStep()) {
case OPEN_STEP:
case BUY_STEP:
    setNextPlayer();
  if (currentPlayer == selectingPlayer.getObject()) {
    currentBuyPrice.add(-10);
    auctionedItem.setMinimumBid(currentBuyPrice.intValue());
    ReportBuffer.add(LocalText.getText("String_Node_Str",auctionedItem.getName(),Bank.format(currentBuyPrice.intValue())));
    setStep(BUY_STEP);
    if (currentBuyPrice.intValue() == 0) {
      auctionedItem.setBid(0,currentPlayer);
      assignItem(currentPlayer,auctionedItem,0,0);
      setStep(SELECT_STEP);
      setNextSelectingPlayer();
    }
  }
break;
case BID_STEP:
auctionedItem.setBid(-1,currentPlayer);
setNextBiddingPlayer();
if (currentPlayer == auctionedItem.getBidder()) {
assignItem(auctionedItem.getBidder(),auctionedItem,auctionedItem.getBid(),0);
setStep(SELECT_STEP);
setNextSelectingPlayer();
}
}
return true;
}

Fixed version (ground truth):
/** 
 * Process a player's pass.
 * @param playerName The name of the current player (for checking purposes).
 */
@Override public boolean pass(String playerName){
  ReportBuffer.add(LocalText.getText("String_Node_Str",playerName));
  moveStack.start(false);
  StartItem auctionedItem=(StartItem)currentAuctionItem.getObject();
switch (getStep()) {
case OPEN_STEP:
case BUY_STEP:
    setNextPlayer();
  if (currentPlayer == selectingPlayer.getObject()) {
    currentBuyPrice.add(-10);
    auctionedItem.setMinimumBid(currentBuyPrice.intValue());
    ReportBuffer.add(LocalText.getText("String_Node_Str",auctionedItem.getName(),Bank.format(currentBuyPrice.intValue())));
    setStep(BUY_STEP);
    if (currentBuyPrice.intValue() == 0) {
      auctionedItem.setBid(0,currentPlayer);
      assignItem(currentPlayer,auctionedItem,0,0);
      setStep(SELECT_STEP);
      setNextSelectingPlayer();
    }
  }
break;
case BID_STEP:
auctionedItem.setBid(-2,currentPlayer);
setNextBiddingPlayer();
if (currentPlayer == auctionedItem.getBidder()) {
assignItem(auctionedItem.getBidder(),auctionedItem,auctionedItem.getBid(),0);
setStep(SELECT_STEP);
setNextSelectingPlayer();
}
}
return true;
}
Program: 173708
Project: 173708
Buggy source:
/** 
 * Count the number of shares per revenue recipient<p> A special rule applies to 1835 to prevent black privates and minors providing income twice during an OR.
 */
protected Map<CashHolder,Integer> countSharesPerRecipient(){
  Map<CashHolder,Integer> sharesPerRecipient=super.countSharesPerRecipient();
  if (operatingCompany.getName().equalsIgnoreCase(GameManager_1835.PR_ID)) {
    for (    Player player : deniedIncomeShare.keySet()) {
      int share=deniedIncomeShare.get(player);
      int shares=share / operatingCompany.getShareUnit();
      sharesPerRecipient.put(player,sharesPerRecipient.get(player) - shares);
      ReportBuffer.add(LocalText.getText("String_Node_Str",player.getName(),share,GameManager_1835.PR_ID));
    }
  }
  return sharesPerRecipient;
}

Fixed version (ground truth):
/** 
 * Count the number of shares per revenue recipient<p> A special rule applies to 1835 to prevent black privates and minors providing income twice during an OR.
 */
protected Map<CashHolder,Integer> countSharesPerRecipient(){
  Map<CashHolder,Integer> sharesPerRecipient=super.countSharesPerRecipient();
  if (operatingCompany.getName().equalsIgnoreCase(GameManager_1835.PR_ID)) {
    for (    Player player : deniedIncomeShare.keySet()) {
      if (!sharesPerRecipient.containsKey(player))       continue;
      int share=deniedIncomeShare.get(player);
      int shares=share / operatingCompany.getShareUnit();
      sharesPerRecipient.put(player,sharesPerRecipient.get(player) - shares);
      ReportBuffer.add(LocalText.getText("String_Node_Str",player.getName(),share,GameManager_1835.PR_ID));
    }
  }
  return sharesPerRecipient;
}
Program: 173711
Project: 173711
Buggy source:
public void initRevenueCalculator(){
  if (gameManager.getRevenueManager() != null) {
    dynamicModifiers=gameManager.getRevenueManager().callDynamicModifiers(this);
  }
 else {
    dynamicModifiers=null;
  }
  rcGraph=NetworkGraphBuilder.optimizeGraph(graph,protectedVertices);
  rcVertices=new ArrayList<NetworkVertex>(rcGraph.vertexSet());
  Collections.sort(rcVertices,new NetworkVertex.ValueOrder());
  rcEdges=new ArrayList<NetworkEdge>(rcGraph.edgeSet());
  prepareTrainLengths(rcVertices);
  int maxVisitVertices=maxVisitVertices();
  int maxBonusVertices=maxRevenueBonusVertices();
  int maxNeighbors=maxVertexNeighbors(rcVertices);
  rc=new RevenueCalculator(this,rcVertices.size(),rcEdges.size(),maxNeighbors,maxVisitVertices,trains.size(),maxBonusVertices);
  populateRevenueCalculator();
}

Fixed version (ground truth):
public void initRevenueCalculator(){
  if (gameManager.getRevenueManager() != null) {
    dynamicModifiers=gameManager.getRevenueManager().callDynamicModifiers(this);
  }
 else {
    dynamicModifiers=new HashSet<RevenueDynamicModifier>();
  }
  rcGraph=NetworkGraphBuilder.optimizeGraph(graph,protectedVertices);
  rcVertices=new ArrayList<NetworkVertex>(rcGraph.vertexSet());
  Collections.sort(rcVertices,new NetworkVertex.ValueOrder());
  rcEdges=new ArrayList<NetworkEdge>(rcGraph.edgeSet());
  prepareTrainLengths(rcVertices);
  int maxVisitVertices=maxVisitVertices();
  int maxBonusVertices=maxRevenueBonusVertices();
  int maxNeighbors=maxVertexNeighbors(rcVertices);
  rc=new RevenueCalculator(this,rcVertices.size(),rcEdges.size(),maxNeighbors,maxVisitVertices,trains.size(),maxBonusVertices);
  populateRevenueCalculator();
}
Program: 173713
Project: 173713
Buggy source:
private boolean resetOperatingCompanies(List<PublicCompanyI> mergingCompanies){
  PublicCompanyI cgr=companyManager.getPublicCompany(PublicCompany_CGR.NAME);
  boolean cgrCanOperate=cgr.hasStarted();
  boolean roundFinished=false;
  for (  PublicCompanyI company : mergingCompanies) {
    if (companiesOperatedThisRound.contains(company))     cgrCanOperate=false;
  }
  for (  PublicCompanyI c : operatingCompanies) {
    if (c.isClosed()) {
      log.info(c.getName() + "String_Node_Str");
    }
 else {
      log.debug(c.getName() + "String_Node_Str");
    }
  }
  String message;
  int operatingCompanyIndex=getOperatingCompanyIndex();
  if (cgr.hasStarted()) {
    if (cgrCanOperate) {
      operatingCompanyIndex=Math.max(0,operatingCompanyIndex);
      operatingCompanies.add(operatingCompanyIndex,cgr);
      setOperatingCompany(cgr);
      message=LocalText.getText("String_Node_Str",cgr.getName());
    }
 else {
      message=LocalText.getText("String_Node_Str",cgr.getName());
      roundFinished=!setNextOperatingCompany(false);
    }
  }
 else {
    message=LocalText.getText("String_Node_Str",cgr.getName());
  }
  ReportBuffer.add(LocalText.getText("String_Node_Str",cgr.getName(),getRoundName()));
  ReportBuffer.add(message);
  DisplayBuffer.add(message);
  if (!roundFinished) {
    log.debug("String_Node_Str" + operatingCompany.getName());
  }
 else {
    finishOR();
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean resetOperatingCompanies(List<PublicCompanyI> mergingCompanies){
  PublicCompanyI cgr=companyManager.getPublicCompany(PublicCompany_CGR.NAME);
  boolean cgrCanOperate=cgr.hasStarted();
  boolean roundFinished=false;
  for (  PublicCompanyI company : mergingCompanies) {
    if (companiesOperatedThisRound.contains(company))     cgrCanOperate=false;
  }
  for (  PublicCompanyI c : operatingCompanies) {
    if (c.isClosed()) {
      log.info(c.getName() + "String_Node_Str");
    }
 else {
      log.debug(c.getName() + "String_Node_Str");
    }
  }
  String message;
  int operatingCompanyIndex=getOperatingCompanyIndex();
  if (cgr.hasStarted()) {
    if (cgrCanOperate) {
      operatingCompanyIndex=Math.max(0,operatingCompanyIndex);
      operatingCompanies.add(operatingCompanyIndex + 1,cgr);
      setOperatingCompany(cgr);
      message=LocalText.getText("String_Node_Str",cgr.getName());
    }
 else {
      message=LocalText.getText("String_Node_Str",cgr.getName());
      roundFinished=!setNextOperatingCompany(false);
    }
  }
 else {
    message=LocalText.getText("String_Node_Str",cgr.getName());
    roundFinished=!setNextOperatingCompany(false);
  }
  ReportBuffer.add(LocalText.getText("String_Node_Str",cgr.getName(),getRoundName()));
  ReportBuffer.add(message);
  DisplayBuffer.add(message);
  if (!roundFinished) {
    log.debug("String_Node_Str" + operatingCompany.getName());
  }
 else {
    finishOR();
    return false;
  }
  return true;
}
Program: 173714
Project: 173714
Buggy source:
void setTrain(int id,int majors,int minors,boolean ignoreMinors,int multiplyMajors,int multiplyMinors){
  trainMaxMajors[id]=majors;
  trainMaxMinors[id]=minors;
  trainIgnoreMinors[id]=ignoreMinors;
  for (int j=0; j < nbVertexes; j++) {
    if (vertexMajor[id]) {
      vertexValueByTrain[j][id]=vertexValueByTrain[j][id] * multiplyMajors;
    }
    if (vertexMinor[id]) {
      vertexValueByTrain[j][id]=vertexValueByTrain[j][id] * multiplyMinors;
    }
  }
}

Fixed version (ground truth):
void setTrain(int id,int majors,int minors,boolean ignoreMinors,int multiplyMajors,int multiplyMinors){
  trainMaxMajors[id]=majors;
  trainMaxMinors[id]=minors;
  trainIgnoreMinors[id]=ignoreMinors;
  for (int j=0; j < nbVertexes; j++) {
    if (vertexMajor[j]) {
      vertexValueByTrain[j][id]=vertexValueByTrain[j][id] * multiplyMajors;
    }
 else     if (vertexMinor[j]) {
      if (ignoreMinors) {
        vertexValueByTrain[j][id]=0;
      }
 else {
        vertexValueByTrain[j][id]=vertexValueByTrain[j][id] * multiplyMinors;
      }
    }
  }
}
Program: 173715
Project: 173715
Buggy source:
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);
}

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";
  log.info("String_Node_Str" + modifier + "String_Node_Str"+ revenue+ "String_Node_Str"+ getStatistics());
  revenueAdapter.notifyRevenueListener(revenue,finalResult);
}
Program: 173716
Project: 173716
Buggy source:
void initialPredictionRuns(int startTrain,int finalTrain){
  if (startTrain > finalTrain)   return;
  useRevenuePrediction=true;
  this.maxCumulatedTrainRevenues=new int[nbTrains];
  initRevenueValues(startTrain,finalTrain);
  if (startTrain == finalTrain)   return;
  nbEvaluations=0;
  nbPredictions=0;
  nbEdges=0;
  log.info("String_Node_Str");
  int cumulatedRevenues=0;
  int[] maxSingleTrainRevenues=new int[nbTrains];
  for (int j=finalTrain; j >= startTrain; j--) {
    this.startTrain=j;
    this.finalTrain=j;
    currentBestValue=0;
    runTrain(j);
    log.info("String_Node_Str" + j + "String_Node_Str"+ currentBestValue);
    maxSingleTrainRevenues[j]=currentBestValue;
    cumulatedRevenues+=currentBestValue;
    maxCumulatedTrainRevenues[j]=cumulatedRevenues;
  }
  if (startTrain == finalTrain - 1)   return;
  log.info("String_Node_Str");
  this.finalTrain=finalTrain;
  for (int j=finalTrain - 1; j > startTrain; j--) {
    this.startTrain=j;
    currentBestValue=0;
    runTrain(j);
    log.info("String_Node_Str" + j + "String_Node_Str"+ currentBestValue);
    maxCumulatedTrainRevenues[j]=currentBestValue;
    maxCumulatedTrainRevenues[j - 1]=currentBestValue + maxSingleTrainRevenues[j - 1];
  }
}

Fixed version (ground truth):
void initialPredictionRuns(int startTrain,int finalTrain){
  if (startTrain > finalTrain)   return;
  nbEvaluations=0;
  nbPredictions=0;
  nbEdges=0;
  useRevenuePrediction=true;
  this.maxCumulatedTrainRevenues=new int[nbTrains];
  initRevenueValues(startTrain,finalTrain);
  if (startTrain == finalTrain)   return;
  nbEvaluations=0;
  nbPredictions=0;
  nbEdges=0;
  log.info("String_Node_Str");
  int cumulatedRevenues=0;
  int[] maxSingleTrainRevenues=new int[nbTrains];
  for (int j=finalTrain; j >= startTrain; j--) {
    this.startTrain=j;
    this.finalTrain=j;
    currentBestValue=0;
    runTrain(j);
    log.info("String_Node_Str" + j + "String_Node_Str"+ currentBestValue+ "String_Node_Str"+ getStatistics());
    maxSingleTrainRevenues[j]=currentBestValue;
    cumulatedRevenues+=currentBestValue;
    maxCumulatedTrainRevenues[j]=cumulatedRevenues;
  }
  if (startTrain == finalTrain - 1)   return;
  log.info("String_Node_Str");
  this.finalTrain=finalTrain;
  for (int j=finalTrain - 1; j > startTrain; j--) {
    this.startTrain=j;
    currentBestValue=0;
    runTrain(j);
    log.info("String_Node_Str" + j + "String_Node_Str"+ currentBestValue+ "String_Node_Str"+ getStatistics());
    maxCumulatedTrainRevenues[j]=currentBestValue;
    maxCumulatedTrainRevenues[j - 1]=currentBestValue + maxSingleTrainRevenues[j - 1];
  }
}
Program: 173717
Project: 173717
Buggy source:
int calculateRevenue(int startTrain,int finalTrain){
  log.info("String_Node_Str" + startTrain + "String_Node_Str"+ finalTrain);
  nbEvaluations=0;
  nbPredictions=0;
  nbEdges=0;
  this.startTrain=startTrain;
  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);
  this.startTrain=startTrain;
  this.finalTrain=finalTrain;
  runTrain(startTrain);
  notifyRevenueAdapter(currentBestValue,true);
  return currentBestValue;
}
Program: 173718
Project: 173718
Buggy source:
protected boolean setNextOperatingCompany(boolean initial){
  if (operatingCompanyIndexObject == null) {
    operatingCompanyIndexObject=new IntegerState("String_Node_Str");
  }
  if (initial) {
    operatingCompanyIndexObject.set(0);
  }
 else {
    operatingCompanyIndexObject.add(1);
  }
  int operatingCompanyIndex=operatingCompanyIndexObject.intValue();
  if (operatingCompanyIndex >= operatingCompanyArray.length) {
    operatingCompany=null;
    return false;
  }
 else {
    operatingCompany=operatingCompanyArray[operatingCompanyIndex];
    log.debug("String_Node_Str" + operatingCompany.getName() + "String_Node_Str"+ getRoundName());
    return true;
  }
}

Fixed version (ground truth):
protected boolean setNextOperatingCompany(boolean initial){
  if (operatingCompanyIndexObject == null) {
    operatingCompanyIndexObject=new IntegerState("String_Node_Str");
  }
  while (true) {
    if (initial) {
      operatingCompanyIndexObject.set(0);
      initial=false;
    }
 else {
      operatingCompanyIndexObject.add(1);
    }
    int operatingCompanyIndex=operatingCompanyIndexObject.intValue();
    if (operatingCompanyIndex >= operatingCompanyArray.length) {
      return false;
    }
 else {
      operatingCompany=operatingCompanyArray[operatingCompanyIndex];
      if (operatingCompany.isClosed())       continue;
      return true;
    }
  }
}
Program: 173720
Project: 173720
Buggy source:
public void start(){
  thisOrNumber=gameManager.getORId();
  ReportBuffer.add(LocalText.getText("String_Node_Str",thisOrNumber));
  int count=0;
  for (  PrivateCompanyI priv : companyManager.getAllPrivateCompanies()) {
    if (!priv.isClosed()) {
      if (((Portfolio)priv.getHolder()).getOwner().getClass() != Bank.class) {
        CashHolder recipient=((Portfolio)priv.getHolder()).getOwner();
        int revenue=priv.getRevenueByPhase(getCurrentPhase());
        if (count++ == 0)         ReportBuffer.add("String_Node_Str");
        ReportBuffer.add(LocalText.getText("String_Node_Str",recipient.getName(),Bank.format(revenue),priv.getName()));
        new CashMove(bank,recipient,revenue);
      }
    }
  }
  if (operatingCompanyArray.length > 0) {
    StringBuilder msg=new StringBuilder();
    for (    PublicCompanyI company : operatingCompanyArray) {
      msg.append("String_Node_Str").append(company.getName());
    }
    if (msg.length() > 0)     msg.deleteCharAt(0);
    log.info("String_Node_Str" + msg.toString());
    if (stepObject == null) {
      stepObject=new EnumState<GameDef.OrStep>("String_Node_Str",GameDef.OrStep.INITIAL);
      stepObject.addObserver(this);
    }
    if (setNextOperatingCompany(true)) {
      setStep(GameDef.OrStep.INITIAL);
    }
    return;
  }
  String text=LocalText.getText("String_Node_Str");
  ReportBuffer.add(text);
  DisplayBuffer.add(text);
  finishRound();
}

Fixed version (ground truth):
public void start(){
  thisOrNumber=gameManager.getORId();
  ReportBuffer.add(LocalText.getText("String_Node_Str",thisOrNumber));
  privatesPayOut();
  if (operatingCompanyArray.length > 0) {
    StringBuilder msg=new StringBuilder();
    for (    PublicCompanyI company : operatingCompanyArray) {
      msg.append("String_Node_Str").append(company.getName());
    }
    if (msg.length() > 0)     msg.deleteCharAt(0);
    log.info("String_Node_Str" + msg.toString());
    if (stepObject == null) {
      stepObject=new EnumState<GameDef.OrStep>("String_Node_Str",GameDef.OrStep.INITIAL);
      stepObject.addObserver(this);
    }
    if (setNextOperatingCompany(true)) {
      setStep(GameDef.OrStep.INITIAL);
    }
    return;
  }
  String text=LocalText.getText("String_Node_Str");
  ReportBuffer.add(text);
  DisplayBuffer.add(text);
  finishRound();
}
Program: 173721
Project: 173721
Buggy source:
public OperatingRound_1835(GameManagerI gameManager){
  super(gameManager);
}

Fixed version (ground truth):
public OperatingRound_1835(GameManagerI gameManager){
  super(gameManager);
  deniedIncomeShare=new HashMap<Player,Integer>();
}
Program: 173722
Project: 173722
Buggy source:
/** 
 * copy of standard dfs 
 */
private void encounterVertexAgain(NetworkVertex vertex,NetworkEdge edge){
  VisitColor color=getSeenData(vertex);
  if (color != VisitColor.WHITE && color != VisitColor.YELLOW) {
    return;
  }
  int i=stack.indexOf(vertex);
  assert(i > -1);
  stack.remove(i);
  stack.add(vertex);
}

Fixed version (ground truth):
/** 
 * copy of standard dfs 
 */
private void encounterVertexAgain(NetworkVertex vertex,NetworkEdge edge){
  VisitColor color=getSeenData(vertex);
  if (color != VisitColor.WHITE) {
    return;
  }
  int i=stack.indexOf(vertex);
  assert(i > -1);
  stack.remove(i);
  stack.add(vertex);
}
Program: 173723
Project: 173723
Buggy source:
private void recordFinish(){
  NetworkVertex v=popStack();
  putSeenData(v,VisitColor.BLACK);
  finishVertex(v);
}

Fixed version (ground truth):
private void recordFinish(){
  NetworkVertex v=popStack();
  if (getSeenData(v) == VisitColor.WHITE)   putSeenData(v,VisitColor.BLACK);
  finishVertex(v);
}
Program: 173724
Project: 173724
Buggy source:
private void addUnseenChildrenOf(NetworkVertex vertex,VisitColor previousColor){
  if (company != null && !vertex.canCompanyRunThrough(company))   return;
  for (  NetworkEdge edge : graph.edgesOf(vertex)) {
    if (previousColor == VisitColor.WHITE || edge.isGreedy()) {
      NetworkVertex oppositeV=Graphs.getOppositeVertex(graph,edge,vertex);
      if (isSeenVertex(oppositeV)) {
        encounterVertexAgain(oppositeV,edge);
      }
 else {
        encounterVertex(oppositeV,edge);
      }
    }
  }
}

Fixed version (ground truth):
private void addUnseenChildrenOf(NetworkVertex vertex,VisitColor previousColor){
  if (company != null && !vertex.canCompanyRunThrough(company))   return;
  for (  NetworkEdge edge : graph.edgesOf(vertex)) {
    if (previousColor == VisitColor.WHITE || edge.isGreedy()) {
      NetworkVertex oppositeV=Graphs.getOppositeVertex(graph,edge,vertex);
      if (isSeenVertex(oppositeV,vertex.isSide() && !edge.isGreedy())) {
        encounterVertexAgain(oppositeV,edge);
      }
 else {
        encounterVertex(oppositeV,edge);
      }
    }
  }
}
Program: 173725
Project: 173725
Buggy source:
/** 
 * Determines whether a vertex has been seen yet by this traversal.
 * @param vertex vertex in question
 * @return <tt>true</tt> if vertex has already been seen
 */
private boolean isSeenVertex(NetworkVertex vertex){
  return seen.containsKey(vertex);
}

Fixed version (ground truth):
/** 
 * Determines whether a vertex has been seen yet by this traversal.
 * @param vertex vertex in question
 * @return <tt>true</tt> if vertex has already been seen
 */
private boolean isSeenVertex(NetworkVertex vertex,boolean mustUseGreedy){
  return seen.containsKey(vertex) && (mustUseGreedy || !this.mustUseGreedy.get(vertex));
}
Program: 173726
Project: 173726
Buggy source:
/** 
 * copy of standard dfs 
 */
private void encounterVertex(NetworkVertex vertex,NetworkEdge edge){
  VisitColor color=VisitColor.WHITE;
  if (vertex.isSide() && !edge.isGreedy())   color=VisitColor.YELLOW;
  putSeenData(vertex,color);
  stack.add(vertex);
  log.debug("String_Node_Str" + vertex + "String_Node_Str"+ color);
}

Fixed version (ground truth):
/** 
 * copy of standard dfs 
 */
private void encounterVertex(NetworkVertex vertex,NetworkEdge edge){
  putSeenData(vertex,VisitColor.WHITE);
  mustUseGreedy.put(vertex,vertex.isSide() && !edge.isGreedy());
  stack.add(vertex);
  log.debug("String_Node_Str" + vertex);
}
Program: 173727
Project: 173727
Buggy source:
public void refreshRevenueCalculator(){
  rc=null;
}

Fixed version (ground truth):
public void refreshRevenueCalculator(){
  rc=null;
  this.startVertexes=new ArrayList<NetworkVertex>();
}
Program: 173728
Project: 173728
Buggy source:
public void populateRevenueCalculator(PublicCompanyI company,PhaseI phase){
  if (rc == null)   initRevenueCalculator();
  NetworkVertex.setPhaseForAll(vertexes,phase);
  Collections.sort(vertexes,new NetworkVertex.ValueOrder());
  for (int id=0; id < vertexes.size(); id++) {
    NetworkVertex v=vertexes.get(id);
    if (v.isHQ()) {
      startVertexes.addAll(Graphs.neighborListOf(graph,v));
    }
 else {
      int value=v.getValue();
      boolean city=v.isCityType();
      boolean town=v.isTownType();
      int j=0, e[]=new int[maxNeighbors];
      if (v.canCompanyRunThrough(company)) {
        for (        NetworkVertex n : Graphs.neighborListOf(graph,v)) {
          if (!n.isHQ()) {
            e[j++]=vertexes.lastIndexOf(n);
          }
        }
      }
      Arrays.sort(e,0,j);
      e[j]=-1;
      rc.setVertex(id,value,city,town,e);
    }
  }
  int[] sv=new int[startVertexes.size()];
  for (int j=0; j < startVertexes.size(); j++) {
    sv[j]=vertexes.lastIndexOf(startVertexes.get(j));
  }
  Arrays.sort(sv);
  rc.setStartVertexes(sv);
  for (int id=0; id < edges.size(); id++) {
    NetworkEdge e=edges.get(id);
    int vA=vertexes.lastIndexOf(e.getSource());
    int vB=vertexes.lastIndexOf(e.getTarget());
    boolean greedy=e.isGreedy();
    int distance=e.getDistance();
    rc.setEdge(vA,vB,greedy,distance);
    rc.setEdge(vB,vA,greedy,distance);
  }
  for (int id=0; id < trains.size(); id++) {
    NetworkTrain train=trains.get(id);
    train.addToRevenueCalculator(rc,id);
  }
}

Fixed version (ground truth):
public void populateRevenueCalculator(PublicCompanyI company,PhaseI phase,boolean activatePrediction){
  if (rc == null)   initRevenueCalculator();
  prepareRevenuePrediction(activatePrediction);
  NetworkVertex.setPhaseForAll(vertexes,phase);
  Collections.sort(vertexes,new NetworkVertex.ValueOrder());
  for (int id=0; id < vertexes.size(); id++) {
    NetworkVertex v=vertexes.get(id);
    if (v.isHQ()) {
      startVertexes.addAll(Graphs.neighborListOf(graph,v));
    }
 else {
      int value=v.getValue();
      boolean city=v.isCityType();
      boolean town=v.isTownType();
      int j=0, e[]=new int[maxNeighbors];
      if (v.canCompanyRunThrough(company)) {
        for (        NetworkVertex n : Graphs.neighborListOf(graph,v)) {
          if (!n.isHQ()) {
            e[j++]=vertexes.lastIndexOf(n);
          }
        }
      }
      Arrays.sort(e,0,j);
      e[j]=-1;
      rc.setVertex(id,value,city,town,e);
    }
  }
  int[] sv=new int[startVertexes.size()];
  for (int j=0; j < startVertexes.size(); j++) {
    sv[j]=vertexes.lastIndexOf(startVertexes.get(j));
  }
  Arrays.sort(sv);
  rc.setStartVertexes(sv);
  for (int id=0; id < edges.size(); id++) {
    NetworkEdge e=edges.get(id);
    int vA=vertexes.lastIndexOf(e.getSource());
    int vB=vertexes.lastIndexOf(e.getTarget());
    boolean greedy=e.isGreedy();
    int distance=e.getDistance();
    rc.setEdge(vA,vB,greedy,distance);
    rc.setEdge(vB,vA,greedy,distance);
  }
  for (int id=0; id < trains.size(); id++) {
    NetworkTrain train=trains.get(id);
    train.addToRevenueCalculator(rc,id);
  }
}
Program: 173729
Project: 173729
Buggy source:
/** 
 * arrives at an unvisited vertex
 */
private void nextVertex(int trainId,int vertexId,int previousId){
  boolean trainTerminated;
  if (encounterVertex(trainId,vertexId,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"+ 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])) {
        evaluateResult=false;
        nextVertex(trainId,neighborId,vertexId);
      }
    }
    if (trainBottomPos[trainId] == 0 && (vertexCity[vertexId] || vertexTown[vertexId])) {
      runBottom(trainId);
    }
  }
  finalizeVertex(trainId,vertexId,evaluateResult);
  encounterVertex(trainId,vertexId,false);
  returnEdge(trainId);
}

Fixed version (ground truth):
/** 
 * arrives at an unvisited vertex
 */
private void nextVertex(int trainId,int vertexId,int previousId){
  boolean trainTerminated=false;
  if (encounterVertex(trainId,vertexId,true)) {
    if (useRevenuePrediction && predictRevenues(trainId)) {
      encounterVertex(trainId,vertexId,false);
      returnEdge(trainId);
      return;
    }
 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"+ 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])) {
        evaluateResult=false;
        nextVertex(trainId,neighborId,vertexId);
      }
    }
    if (trainBottomPos[trainId] == 0 && (vertexCity[vertexId] || vertexTown[vertexId])) {
      runBottom(trainId);
    }
  }
  finalizeVertex(trainId,vertexId,evaluateResult);
  encounterVertex(trainId,vertexId,false);
  returnEdge(trainId);
}
Program: 173730
Project: 173730
Buggy source:
private void evaluateResults(){
  int totalValue=0;
  for (int j=0; j <= finalTrain; j++) {
    if (trainCities[j] + trainTowns[j] <= 1) {
      log.debug("String_Node_Str" + j + "String_Node_Str");
    }
 else {
      totalValue+=trainCurrentValue[j];
      log.debug("String_Node_Str" + j + "String_Node_Str"+ trainCurrentValue);
    }
  }
  log.debug("String_Node_Str" + totalValue);
  if (totalValue > currentBestValue) {
    currentBestValue=totalValue;
    for (int j=0; j <= finalTrain; j++)     for (int v=0; v < nbVertexes; v++)     if (v < trainStackPos[j])     currentBestRun[j][v]=trainVertexStack[j][v];
 else {
      currentBestRun[j][v]=-1;
      break;
    }
    log.info("String_Node_Str" + totalValue);
    notifyRevenueAdapter(currentBestValue,false);
  }
}

Fixed version (ground truth):
private void evaluateResults(){
  int totalValue=0;
  for (int j=0; j <= finalTrain; j++) {
    if (trainCities[j] + trainTowns[j] <= 1) {
      log.debug("String_Node_Str" + j + "String_Node_Str");
    }
 else {
      totalValue+=trainCurrentValue[j];
      log.debug("String_Node_Str" + j + "String_Node_Str"+ trainCurrentValue);
    }
  }
  nbEvaluations++;
  log.debug("String_Node_Str" + totalValue);
  if (totalValue > currentBestValue) {
    currentBestValue=totalValue;
    for (int j=0; j <= finalTrain; j++)     for (int v=0; v < nbVertexes; v++)     if (v < trainStackPos[j])     currentBestRun[j][v]=trainVertexStack[j][v];
 else {
      currentBestRun[j][v]=-1;
      break;
    }
    log.info("String_Node_Str" + totalValue);
    notifyRevenueAdapter(currentBestValue,false);
  }
}