nus-yam/ex-repair huggingface dataset:
Program: 84400
Project: 84400
Buggy source:
public static void start(){
  if (!isConfigured()) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  Event nextEvent;
  while ((nextEvent=eventSourceMultiplexer.getNextEvent()) != null && isEarlierThanEmulationEnd(now())) {
    Time eventTime=nextEvent.getScheduledTime();
    if (eventTime.isEarlierThan(now())) {
      String msg="String_Node_Str" + now() + "String_Node_Str"+ "String_Node_Str"+ eventTime+ "String_Node_Str";
      if (stopOnError) {
        throw new RuntimeException(msg);
      }
 else {
        System.err.println(msg);
      }
    }
    if (isEarlierThanEmulationEnd(eventTime)) {
      if (isLaterThanEmulationStart(eventTime)) {
        now=eventTime;
        nextEvent.process();
        processCount++;
      }
    }
 else {
      now=emulationEnd;
    }
  }
}

Fixed version (ground truth):
public static void start(){
  if (!isConfigured()) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  Event nextEvent;
  while ((nextEvent=eventSourceMultiplexer.getNextEvent()) != null && isEarlierThanEmulationEnd(now())) {
    Time eventTime=nextEvent.getScheduledTime();
    if (eventTime.isEarlierThan(now())) {
      String msg="String_Node_Str" + now() + "String_Node_Str"+ "String_Node_Str"+ eventTime+ "String_Node_Str";
      if (stopOnError) {
        throw new RuntimeException(msg);
      }
 else {
        System.err.println(msg);
      }
    }
 else     if (isEarlierThanEmulationEnd(eventTime)) {
      if (isLaterThanEmulationStart(eventTime)) {
        now=eventTime;
        nextEvent.process();
        processCount++;
      }
    }
 else {
      now=emulationEnd;
    }
  }
}
Program: 84401
Project: 84401
Buggy source:
public static void reset(){
  emulationStart=null;
  emulationEnd=null;
  eventSourceMultiplexer=null;
  now=new Time(0L,Unit.MILLISECONDS);
}

Fixed version (ground truth):
public static void reset(){
  emulationStart=null;
  emulationEnd=null;
  eventSourceMultiplexer=null;
  processCount=0;
  now=new Time(0L,Unit.MILLISECONDS);
}
Program: 84402
Project: 84402
Buggy source:
public static void setup(Time emulationStart,Time emulationEnd,EventSourceMultiplexer eventSource){
  EventScheduler.emulationStart=emulationStart;
  EventScheduler.emulationEnd=emulationEnd;
  EventScheduler.eventSourceMultiplexer=eventSource;
}

Fixed version (ground truth):
public static void setup(Time emulationStart,Time emulationEnd,EventSourceMultiplexer eventSource){
  reset();
  EventScheduler.emulationStart=emulationStart;
  EventScheduler.emulationEnd=emulationEnd;
  EventScheduler.eventSourceMultiplexer=eventSource;
}
Program: 84403
Project: 84403
Buggy source:
private static MultipleEventSource createMultipleEventParser(Set<FileSystemClient> clients,Set<Machine> machines,File tracesDir,EventsGeneratedBySimulationQueue eventsGeneratedBySimulationQueue){
  EventSource[] parsers=new EventSource[machines.size() + clients.size() + 1];
  try {
    int parserCount=0;
    InputStream traceStream;
    for (    Machine machine : machines) {
      traceStream=new FileInputStream(new File(tracesDir,"String_Node_Str" + machine.getId()));
      parsers[parserCount++]=new MachineActivityEventParser(machine,traceStream);
    }
    for (    FileSystemClient client : clients) {
      traceStream=new FileInputStream(new File(tracesDir,"String_Node_Str" + client.getMachine().getId()));
      parsers[parserCount++]=new FileSystemEventParser(client,traceStream);
    }
    parsers[parserCount]=eventsGeneratedBySimulationQueue;
  }
 catch (  FileNotFoundException e) {
    throw new IllegalStateException(e);
  }
  return new MultipleEventSource(parsers);
}

Fixed version (ground truth):
private static MultipleEventSource createMultipleEventParser(Set<FileSystemClient> clients,Set<Machine> machines,File tracesDir,PriorityQueue<Event> eventsGeneratedBySimulationQueue){
  EventSource[] parsers=new EventSource[machines.size() + clients.size()];
  try {
    int parserCount=0;
    InputStream traceStream;
    for (    Machine machine : machines) {
      traceStream=new FileInputStream(new File(tracesDir,"String_Node_Str" + machine.getId()));
      parsers[parserCount++]=new MachineActivityEventParser(machine,traceStream);
    }
    for (    FileSystemClient client : clients) {
      traceStream=new FileInputStream(new File(tracesDir,"String_Node_Str" + client.getMachine().getId()));
      parsers[parserCount++]=new FileSystemEventParser(client,traceStream);
    }
  }
 catch (  FileNotFoundException e) {
    throw new IllegalStateException(e);
  }
  return new MultipleEventSource(parsers,eventsGeneratedBySimulationQueue);
}
Program: 84405
Project: 84405
Buggy source:
private static Set<Machine> createMachines(EventsGeneratedBySimulationQueue aPlaceForEventsGeneratedBySimulation,File tracesDir,long timeBeforeSleep){
  Set<Machine> machines=new HashSet<Machine>();
  List<String> fsTracesFiles=Arrays.asList(tracesDir.list(fsTracesFilter));
  List<String> idlenessTracesFiles=Arrays.asList(tracesDir.list(idlenessTracesFilter));
  for (  String fsTraceFile : fsTracesFiles) {
    String machineName=fsTraceFile.split("String_Node_Str")[1];
    if (idlenessTracesFiles.contains("String_Node_Str" + machineName)) {
      machines.add(new Machine(aPlaceForEventsGeneratedBySimulation,machineName,timeBeforeSleep));
    }
  }
  return machines;
}

Fixed version (ground truth):
private static Set<Machine> createMachines(PriorityQueue<Event> aPlaceForEventsGeneratedBySimulation,File tracesDir,long timeBeforeSleep){
  Set<Machine> machines=new HashSet<Machine>();
  List<String> fsTracesFiles=Arrays.asList(tracesDir.list(fsTracesFilter));
  List<String> idlenessTracesFiles=Arrays.asList(tracesDir.list(idlenessTracesFilter));
  for (  String fsTraceFile : fsTracesFiles) {
    String machineName=fsTraceFile.split("String_Node_Str")[1];
    if (idlenessTracesFiles.contains("String_Node_Str" + machineName)) {
      machines.add(new Machine(aPlaceForEventsGeneratedBySimulation,machineName,timeBeforeSleep));
    }
  }
  return machines;
}
Program: 84406
Project: 84406
Buggy source:
/** 
 * It create all clients.
 * @param aPlaceForEventsGeneratedBySimulation
 * @param herald
 * @param aggregator
 * @param machines2
 * @return
 */
private static Set<FileSystemClient> createClients(EventsGeneratedBySimulationQueue aPlaceForEventsGeneratedBySimulation,Set<Machine> machines,MetadataServer herald){
  Set<FileSystemClient> newClients=new HashSet<FileSystemClient>();
  for (  Machine machine : machines) {
    newClients.add(new FileSystemClient(aPlaceForEventsGeneratedBySimulation,machine,herald));
  }
  return newClients;
}

Fixed version (ground truth):
/** 
 * It create all clients.
 * @param aPlaceForEventsGeneratedBySimulation
 * @param herald
 * @param aggregator
 * @param machines2
 * @return
 */
private static Set<FileSystemClient> createClients(PriorityQueue<Event> aPlaceForEventsGeneratedBySimulation,Set<Machine> machines,MetadataServer herald){
  Set<FileSystemClient> newClients=new HashSet<FileSystemClient>();
  for (  Machine machine : machines) {
    newClients.add(new FileSystemClient(aPlaceForEventsGeneratedBySimulation,machine,herald));
  }
  return newClients;
}
Program: 84407
Project: 84407
Buggy source:
public MultipleEventSource(EventSource[] parsers){
  this.parsers=new PushBackEventParser[parsers.length];
  for (int i=0; i < parsers.length; i++) {
    this.parsers[i]=new PushBackEventParser(parsers[i]);
  }
}

Fixed version (ground truth):
public MultipleEventSource(EventSource[] parsers,PriorityQueue<Event> simulationGeneratedEventsQueue){
  this.parsers=new PushBackEventParser[parsers.length];
  this.simulationGeneratedEventsQueue=simulationGeneratedEventsQueue;
  for (int i=0; i < parsers.length; i++) {
    this.parsers[i]=new PushBackEventParser(parsers[i]);
  }
}
Program: 84408
Project: 84408
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime()+ "String_Node_Str"+ filePath;
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime()+ "String_Node_Str"+ filePath;
}
Program: 84409
Project: 84409
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime()+ "String_Node_Str"+ filePath;
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime()+ "String_Node_Str"+ filePath;
}
Program: 84410
Project: 84410
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime()+ "String_Node_Str"+ filePath+ "String_Node_Str"+ length;
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime()+ "String_Node_Str"+ filePath+ "String_Node_Str"+ length;
}
Program: 84411
Project: 84411
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime()+ "String_Node_Str"+ filePath;
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime()+ "String_Node_Str"+ filePath;
}
Program: 84412
Project: 84412
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime()+ "String_Node_Str"+ filePath;
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime()+ "String_Node_Str"+ filePath;
}
Program: 84413
Project: 84413
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime()+ "String_Node_Str"+ filePath+ "String_Node_Str"+ length;
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime()+ "String_Node_Str"+ filePath+ "String_Node_Str"+ length;
}
Program: 84414
Project: 84414
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime()+ "String_Node_Str"+ getDuration()+ "String_Node_Str"+ localFSClient;
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime()+ "String_Node_Str"+ getDuration()+ "String_Node_Str"+ localFSClient;
}
Program: 84415
Project: 84415
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime();
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime();
}
Program: 84416
Project: 84416
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime();
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime();
}
Program: 84417
Project: 84417
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime()+ "String_Node_Str"+ getDuration();
}

Fixed version (ground truth):
@Override public String toString(){
  return getHandler() + "String_Node_Str" + EVENT_NAME+ "String_Node_Str"+ getScheduledTime()+ "String_Node_Str"+ getDuration();
}
Program: 84418
Project: 84418
Buggy source:
/** 
 * @param scheduler
 */
public EventHandler(EventsGeneratedBySimulationQueue eventsGeneratedBySimulationQueue){
  this.eventsGeneratedBySimulationQueue=eventsGeneratedBySimulationQueue;
}

Fixed version (ground truth):
/** 
 * @param scheduler
 */
public EventHandler(PriorityQueue<Event> eventsGeneratedBySimulationQueue){
  this.eventsGeneratedBySimulationQueue=eventsGeneratedBySimulationQueue;
}
Program: 84419
Project: 84419
Buggy source:
public void send(Event event){
  eventsGeneratedBySimulationQueue.addEvent(event);
}

Fixed version (ground truth):
public void send(Event event){
  eventsGeneratedBySimulationQueue.add(event);
}
Program: 84420
Project: 84420
Buggy source:
/** 
 * @param scheduler
 * @param machine
 * @param metadataServer
 */
public FileSystemClient(EventsGeneratedBySimulationQueue eventsGeneratedBySimulationQueue,Machine machine,MetadataServer metadataServer){
  super(eventsGeneratedBySimulationQueue);
  this.metadataServer=metadataServer;
  this.machine=machine;
  this.id="String_Node_Str" + machine.bindClient(this) + machine;
}

Fixed version (ground truth):
/** 
 * @param scheduler
 * @param machine
 * @param metadataServer
 */
public FileSystemClient(PriorityQueue<Event> eventsGeneratedBySimulationQueue,Machine machine,MetadataServer metadataServer){
  super(eventsGeneratedBySimulationQueue);
  this.metadataServer=metadataServer;
  this.machine=machine;
  this.id="String_Node_Str" + machine.bindClient(this) + machine;
}
Program: 84421
Project: 84421
Buggy source:
/** 
 * @param eventsGeneratedBySimulationQueue
 * @param id
 * @param timeBeforeSleep
 */
public Machine(EventsGeneratedBySimulationQueue eventsGeneratedBySimulationQueue,String id,long timeBeforeSleep){
  super(eventsGeneratedBySimulationQueue);
  this.id=id;
  this.deployedDataServers=new HashSet<DataServer>();
  this.clients=new HashSet<FileSystemClient>();
  this.timeBeforeSleep=new Time(timeBeforeSleep,Unit.SECONDS);
  currentStateName=ShutdownEvent.EVENT_NAME;
  currentStateStartTime=Time.GENESIS;
  supposedCurrentStateEndTime=Time.END_OF_THE_WORLD;
  pendingFSActivityEvents=new ArrayList<FileSystemActivityEvent>();
}

Fixed version (ground truth):
/** 
 * @param eventsGeneratedBySimulationQueue
 * @param id
 * @param timeBeforeSleep
 */
public Machine(PriorityQueue<Event> eventsGeneratedBySimulationQueue,String id,long timeBeforeSleep){
  super(eventsGeneratedBySimulationQueue);
  this.id=id;
  this.deployedDataServers=new HashSet<DataServer>();
  this.clients=new HashSet<FileSystemClient>();
  this.timeBeforeSleep=new Time(timeBeforeSleep,Unit.SECONDS);
  currentStateName=ShutdownEvent.EVENT_NAME;
  currentStateStartTime=Time.GENESIS;
  supposedCurrentStateEndTime=Time.END_OF_THE_WORLD;
  pendingFSActivityEvents=new ArrayList<FileSystemActivityEvent>();
}
Program: 84422
Project: 84422
Buggy source:
/** 
 * @param scheduler
 * @param dataPlacementAlgorithm
 * @param replicationLevel
 * @param timeBeforeDeleteData in seconds
 * @param timeBeforeUpdateReplicas in seconds
 */
public MetadataServer(EventsGeneratedBySimulationQueue eventsGeneratedBySimulationQueue,DataPlacementAlgorithm dataPlacementAlgorithm,int replicationLevel,long timeBeforeDeleteData,long timeBeforeUpdateReplicas){
  super(eventsGeneratedBySimulationQueue);
  if (dataPlacementAlgorithm == null)   throw new IllegalArgumentException();
  if (replicationLevel < 1)   throw new IllegalArgumentException();
  if (timeBeforeDeleteData < 0)   throw new IllegalArgumentException();
  if (timeBeforeUpdateReplicas < 0)   throw new IllegalArgumentException();
  this.dataPlacement=dataPlacementAlgorithm;
  this.files=new HashMap<String,ReplicationGroup>();
  this.openFiles=new HashMap<String,ReplicationGroup>();
  this.toDelete=new HashMap<String,ReplicationGroup>();
  this.replicationLevel=replicationLevel;
  this.timeBeforeDeleteData=new Time(timeBeforeDeleteData,Unit.SECONDS);
  this.timeBeforeUpdateReplicas=new Time(timeBeforeUpdateReplicas,Unit.SECONDS);
}

Fixed version (ground truth):
/** 
 * @param scheduler
 * @param dataPlacementAlgorithm
 * @param replicationLevel
 * @param timeBeforeDeleteData in seconds
 * @param timeBeforeUpdateReplicas in seconds
 */
public MetadataServer(PriorityQueue<Event> eventsGeneratedBySimulationQueue,DataPlacementAlgorithm dataPlacementAlgorithm,int replicationLevel,long timeBeforeDeleteData,long timeBeforeUpdateReplicas){
  super(eventsGeneratedBySimulationQueue);
  if (dataPlacementAlgorithm == null)   throw new IllegalArgumentException();
  if (replicationLevel < 1)   throw new IllegalArgumentException();
  if (timeBeforeDeleteData < 0)   throw new IllegalArgumentException();
  if (timeBeforeUpdateReplicas < 0)   throw new IllegalArgumentException();
  this.dataPlacement=dataPlacementAlgorithm;
  this.files=new HashMap<String,ReplicationGroup>();
  this.openFiles=new HashMap<String,ReplicationGroup>();
  this.toDelete=new HashMap<String,ReplicationGroup>();
  this.replicationLevel=replicationLevel;
  this.timeBeforeDeleteData=new Time(timeBeforeDeleteData,Unit.SECONDS);
  this.timeBeforeUpdateReplicas=new Time(timeBeforeUpdateReplicas,Unit.SECONDS);
}
Program: 84423
Project: 84423
Buggy source:
private void handleSleep(SleepEvent event){
  Aggregator aggregator=Aggregator.getInstance();
  Time now=event.getScheduledTime();
  Time currentStateActualDuration=now.minus(currentStateStartTime);
  if (currentStateName.equals(ShutdownEvent.EVENT_NAME)) {
    aggregator.aggregateShutdownDuration(getId(),currentStateActualDuration);
  }
 else   if (currentStateName.equals(SleepEvent.EVENT_NAME)) {
    throw new IllegalStateException(String.format("String_Node_Str",getId()));
  }
 else   if (currentStateName.equals(UserActivityEvent.EVENT_NAME)) {
    aggregator.aggregateActiveDuration(getId(),currentStateActualDuration);
  }
 else   if (currentStateName.equals(UserIdlenessEvent.EVENT_NAME)) {
    aggregateIdlenessPeriod(currentStateActualDuration);
  }
  currentStateName=SleepEvent.EVENT_NAME;
  currentStateStartTime=now;
  supposedCurrentStateEndTime=currentStateStartTime.plus(event.getDuration());
}

Fixed version (ground truth):
private void handleSleep(SleepEvent event){
  Aggregator aggregator=Aggregator.getInstance();
  Time now=event.getScheduledTime();
  Time currentStateActualDuration=now.minus(currentStateStartTime);
  if (currentStateName.equals(ShutdownEvent.EVENT_NAME)) {
    aggregator.aggregateShutdownDuration(getId(),currentStateActualDuration);
  }
 else   if (currentStateName.equals(UserActivityEvent.EVENT_NAME)) {
    aggregator.aggregateActiveDuration(getId(),currentStateActualDuration);
  }
 else   if (currentStateName.equals(UserIdlenessEvent.EVENT_NAME)) {
    aggregateIdlenessPeriod(currentStateActualDuration);
  }
  currentStateName=SleepEvent.EVENT_NAME;
  currentStateStartTime=now;
  supposedCurrentStateEndTime=currentStateStartTime.plus(event.getDuration());
}
Program: 84425
Project: 84425
Buggy source:
/** 
 * @param o
 * @return
 */
@Override public int compareTo(Time o){
  double diff=timeMicroSeconds - o.timeMicroSeconds;
  if (diff < 0) {
    return -1;
  }
 else   if (diff > 0) {
    return 1;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * @param o
 * @return
 */
@Override public int compareTo(Time otherTime){
  long diff=timeMicroSeconds - otherTime.timeMicroSeconds;
  if (diff < 0) {
    return -1;
  }
 else   if (diff > 0) {
    return 1;
  }
  return 0;
}
Program: 84426
Project: 84426
Buggy source:
public void closePath(FileSystemClient client,String filePath,Time now){
  ReplicationGroup replicationGroup=openFiles.remove(filePath);
  Time noTime=new Time(0,Unit.SECONDS);
  boolean hasChanged=!noTime.equals(replicationGroup.getTotalChangesDuration());
  if (replicationGroup != null && hasChanged) {
    Time time=now.plus(timeBeforeUpdateReplicas);
    send(new UpdateReplicationGroup(this,time,replicationGroup.getTotalChangesDuration(),filePath));
  }
}

Fixed version (ground truth):
public void closePath(FileSystemClient client,String filePath,Time now){
  ReplicationGroup replicationGroup=openFiles.remove(filePath);
  if (replicationGroup != null) {
    Time noTime=new Time(0,Unit.SECONDS);
    if (!noTime.equals(replicationGroup.getTotalChangesDuration())) {
      Time time=now.plus(timeBeforeUpdateReplicas);
      send(new UpdateReplicationGroup(this,time,replicationGroup.getTotalChangesDuration(),filePath));
    }
  }
}
Program: 84427
Project: 84427
Buggy source:
/** 
 * Create Data Servers.
 * @param scheduler
 * @param machines
 * @return
 */
private static Set<DataServer> createDataServers(EventScheduler scheduler,Set<Machine> machines){
  Set<DataServer> dataServers=new HashSet<DataServer>();
  for (  Machine machine : machines) {
    dataServers.add(new DataServer(scheduler,machine));
  }
  return dataServers;
}

Fixed version (ground truth):
/** 
 * Create Data Servers.
 * @param aPlaceForEventsGeneratedBySimulation
 * @param machines
 * @return
 */
private static Set<DataServer> createDataServers(Set<Machine> machines){
  Set<DataServer> dataServers=new HashSet<DataServer>();
  for (  Machine machine : machines) {
    dataServers.add(new DataServer(machine));
  }
  return dataServers;
}
Program: 84428
Project: 84428
Buggy source:
private static MultipleEventSource createMultipleEventParser(Set<FileSystemClient> clients,Set<Machine> machines,File tracesDir){
  EventSource[] parsers=new EventSource[machines.size() + clients.size()];
  try {
    int parserCount=0;
    InputStream traceStream;
    for (    Machine machine : machines) {
      traceStream=new FileInputStream(new File(tracesDir,"String_Node_Str" + machine.getId()));
      parsers[parserCount++]=new MachineActivityEventParser(machine,traceStream);
    }
    for (    FileSystemClient client : clients) {
      traceStream=new FileInputStream(new File(tracesDir,"String_Node_Str" + client.getMachine().getId()));
      parsers[parserCount++]=new FileSystemEventParser(client,traceStream);
    }
  }
 catch (  FileNotFoundException e) {
    throw new IllegalStateException(e);
  }
  return new MultipleEventSource(parsers);
}

Fixed version (ground truth):
private static MultipleEventSource createMultipleEventParser(Set<FileSystemClient> clients,Set<Machine> machines,File tracesDir,EventsGeneratedBySimulationQueue eventsGeneratedBySimulationQueue){
  EventSource[] parsers=new EventSource[machines.size() + clients.size() + 1];
  try {
    int parserCount=0;
    InputStream traceStream;
    for (    Machine machine : machines) {
      traceStream=new FileInputStream(new File(tracesDir,"String_Node_Str" + machine.getId()));
      parsers[parserCount++]=new MachineActivityEventParser(machine,traceStream);
    }
    for (    FileSystemClient client : clients) {
      traceStream=new FileInputStream(new File(tracesDir,"String_Node_Str" + client.getMachine().getId()));
      parsers[parserCount++]=new FileSystemEventParser(client,traceStream);
    }
    parsers[parserCount]=eventsGeneratedBySimulationQueue;
  }
 catch (  FileNotFoundException e) {
    throw new IllegalStateException(e);
  }
  return new MultipleEventSource(parsers);
}
Program: 84430
Project: 84430
Buggy source:
private static Set<Machine> createMachines(EventScheduler scheduler,File tracesDir,long timeBeforeSleep){
  Set<Machine> machines=new HashSet<Machine>();
  List<String> fsTracesFiles=Arrays.asList(tracesDir.list(fsTracesFilter));
  List<String> idlenessTracesFiles=Arrays.asList(tracesDir.list(idlenessTracesFilter));
  for (  String fsTraceFile : fsTracesFiles) {
    String machineName=fsTraceFile.split("String_Node_Str")[1];
    if (idlenessTracesFiles.contains("String_Node_Str" + machineName)) {
      machines.add(new Machine(scheduler,machineName,timeBeforeSleep));
    }
  }
  return machines;
}

Fixed version (ground truth):
private static Set<Machine> createMachines(EventsGeneratedBySimulationQueue aPlaceForEventsGeneratedBySimulation,File tracesDir,long timeBeforeSleep){
  Set<Machine> machines=new HashSet<Machine>();
  List<String> fsTracesFiles=Arrays.asList(tracesDir.list(fsTracesFilter));
  List<String> idlenessTracesFiles=Arrays.asList(tracesDir.list(idlenessTracesFilter));
  for (  String fsTraceFile : fsTracesFiles) {
    String machineName=fsTraceFile.split("String_Node_Str")[1];
    if (idlenessTracesFiles.contains("String_Node_Str" + machineName)) {
      machines.add(new Machine(aPlaceForEventsGeneratedBySimulation,machineName,timeBeforeSleep));
    }
  }
  return machines;
}
Program: 84431
Project: 84431
Buggy source:
/** 
 * It create all clients.
 * @param scheduler
 * @param herald
 * @param aggregator
 * @param machines2
 * @return
 */
private static Set<FileSystemClient> createClients(EventScheduler scheduler,Set<Machine> machines,MetadataServer herald){
  Set<FileSystemClient> newClients=new HashSet<FileSystemClient>();
  for (  Machine machine : machines) {
    newClients.add(new FileSystemClient(scheduler,machine,herald));
  }
  return newClients;
}

Fixed version (ground truth):
/** 
 * It create all clients.
 * @param aPlaceForEventsGeneratedBySimulation
 * @param herald
 * @param aggregator
 * @param machines2
 * @return
 */
private static Set<FileSystemClient> createClients(EventsGeneratedBySimulationQueue aPlaceForEventsGeneratedBySimulation,Set<Machine> machines,MetadataServer herald){
  Set<FileSystemClient> newClients=new HashSet<FileSystemClient>();
  for (  Machine machine : machines) {
    newClients.add(new FileSystemClient(aPlaceForEventsGeneratedBySimulation,machine,herald));
  }
  return newClients;
}
Program: 84432
Project: 84432
Buggy source:
public SleepEvent(Machine aHandler,Time aScheduledTime){
  super(EVENT_NAME,aHandler,aScheduledTime,null);
}

Fixed version (ground truth):
public SleepEvent(Machine aHandler,Time aScheduledTime,Time duration){
  super(EVENT_NAME,aHandler,aScheduledTime,duration);
}
Program: 84433
Project: 84433
Buggy source:
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime();
}

Fixed version (ground truth):
@Override public String toString(){
  return EVENT_NAME + "String_Node_Str" + getScheduledTime()+ "String_Node_Str"+ getDuration();
}
Program: 84434
Project: 84434
Buggy source:
/** 
 * @param aName
 * @param aHandler
 * @param scheduledTime
 */
public Event(String aName,EventHandler aHandler,Time scheduledTime,Time duration){
  myEventId=eventId++;
  name=aName;
  theTargetHandlerId=aHandler.getHandlerId();
  this.scheduledTime=scheduledTime;
  this.duration=duration;
}

Fixed version (ground truth):
public Event(String name,EventHandler handler,Time scheduledTime,Time duration){
  this.name=name;
  this.handler=handler;
  this.scheduledTime=scheduledTime;
  this.duration=duration;
}
Program: 84435
Project: 84435
Buggy source:
private Event parseWriteEvent(StringTokenizer tokenizer){
  Time[] timestampAndDuration=parseTime(tokenizer.nextToken());
  String filePath=tokenizer.nextToken();
  long length=Long.parseLong(tokenizer.nextToken());
  return new WriteEvent(client,timestampAndDuration[0],length,timestampAndDuration[2],filePath);
}

Fixed version (ground truth):
private Event parseWriteEvent(StringTokenizer tokenizer){
  Time[] timestampAndDuration=parseTime(tokenizer.nextToken());
  String filePath=tokenizer.nextToken();
  long length=Long.parseLong(tokenizer.nextToken());
  return new WriteEvent(client,timestampAndDuration[0],length,timestampAndDuration[1],filePath);
}
Program: 84436
Project: 84436
Buggy source:
/** 
 */
private void schedule(){
  isActive=Boolean.valueOf(true);
  while (!eventsQueue.isEmpty() & isActive.booleanValue() & isEarlierThanEmulationEnd(now())) {
    Event aNextEvent=eventsQueue.peek();
    if (aNextEvent != null) {
      Time anEventTime=aNextEvent.getScheduledTime();
      if (anEventTime.isEarlierThan(now())) {
        throw new RuntimeException("String_Node_Str" + now() + "String_Node_Str"+ "String_Node_Str"+ anEventTime+ "String_Node_Str");
      }
      if (isEarlierThanEmulationEnd(anEventTime)) {
        now=anEventTime;
        processEvent(aNextEvent);
        notifyEventProcessed();
      }
 else {
        now=theEmulationEnd;
      }
    }
  }
  isActive=Boolean.valueOf(false);
}

Fixed version (ground truth):
/** 
 */
private void schedule(){
  isActive=Boolean.valueOf(true);
  while (!eventsQueue.isEmpty() & isActive.booleanValue() & isEarlierThanEmulationEnd(now())) {
    Event aNextEvent=eventsQueue.poll();
    if (aNextEvent != null) {
      Time anEventTime=aNextEvent.getScheduledTime();
      if (anEventTime.isEarlierThan(now())) {
        throw new RuntimeException("String_Node_Str" + now() + "String_Node_Str"+ "String_Node_Str"+ anEventTime+ "String_Node_Str");
      }
      if (isEarlierThanEmulationEnd(anEventTime)) {
        now=anEventTime;
        processEvent(aNextEvent);
        notifyEventProcessed();
      }
 else {
        now=theEmulationEnd;
      }
    }
  }
  isActive=Boolean.valueOf(false);
}
Program: 84438
Project: 84438
Buggy source:
/** 
 * @param aName
 * @param aHandler
 * @param aScheduledTime
 */
public JEEvent(String aName,JEEventHandler aHandler,JETime aScheduledTime){
  myEventId=eventId++;
  name=new String(aName);
  theTargetHandlerId=aHandler.getHandlerId();
  theScheduledTime=aScheduledTime;
  theParameterList=new Vector();
}

Fixed version (ground truth):
/** 
 * @param aName
 * @param aHandler
 * @param aScheduledTime
 */
public JEEvent(String aName,JEEventHandler aHandler,JETime aScheduledTime){
  myEventId=eventId++;
  name=aName;
  theTargetHandlerId=aHandler.getHandlerId();
  theScheduledTime=aScheduledTime;
  theParameterList=new Vector();
}
Program: 84439
Project: 84439
Buggy source:
/** 
 * @param scheduler
 */
public JEEventHandler(JEEventScheduler scheduler){
  if (theUniqueHandlerId != null) {
    theUniqueHandlerId=new Integer(theUniqueHandlerId.intValue() + 1);
  }
 else {
    theUniqueHandlerId=new Integer(1);
  }
  HandlerId=theUniqueHandlerId;
  parameterlist=new LinkedList();
  theUniqueEventScheduler=scheduler;
  theUniqueEventScheduler.register_handler(this);
}

Fixed version (ground truth):
/** 
 * @param scheduler
 */
public JEEventHandler(JEEventScheduler scheduler){
  if (theUniqueHandlerId != null) {
    theUniqueHandlerId=Integer.valueOf(theUniqueHandlerId.intValue() + 1);
  }
 else {
    theUniqueHandlerId=Integer.valueOf(1);
  }
  HandlerId=theUniqueHandlerId;
  parameterlist=new LinkedList();
  theUniqueEventScheduler=scheduler;
  theUniqueEventScheduler.register_handler(this);
}
Program: 84440
Project: 84440
Buggy source:
/** 
 */
private void schedule(){
  isActive=new Boolean(true);
  while (!EventList.isEmpty() & isActive.booleanValue() & isEarlierThanEmulationEnd(now())) {
    JEEvent aNextEvent=peek();
    if (aNextEvent != null) {
      JETime anEventTime=aNextEvent.getTheScheduledTime();
      if (anEventTime.isEarlierThan(now())) {
        throw new RuntimeException("String_Node_Str" + now() + "String_Node_Str"+ "String_Node_Str"+ anEventTime+ "String_Node_Str");
      }
      if (isEarlierThanEmulationEnd(anEventTime)) {
        now=anEventTime;
        processEvent(aNextEvent);
      }
 else {
        now=theEmulationEnd;
      }
    }
  }
  isActive=Boolean.valueOf(false);
}

Fixed version (ground truth):
/** 
 */
private void schedule(){
  isActive=Boolean.valueOf(true);
  while (!EventList.isEmpty() & isActive.booleanValue() & isEarlierThanEmulationEnd(now())) {
    JEEvent aNextEvent=peek();
    if (aNextEvent != null) {
      JETime anEventTime=aNextEvent.getTheScheduledTime();
      if (anEventTime.isEarlierThan(now())) {
        throw new RuntimeException("String_Node_Str" + now() + "String_Node_Str"+ "String_Node_Str"+ anEventTime+ "String_Node_Str");
      }
      if (isEarlierThanEmulationEnd(anEventTime)) {
        now=anEventTime;
        processEvent(aNextEvent);
      }
 else {
        now=theEmulationEnd;
      }
    }
  }
  isActive=Boolean.valueOf(false);
}
Program: 84441
Project: 84441
Buggy source:
/** 
 * @param emulationEnd
 */
public JEEventScheduler(JETime emulationEnd){
  EventList.setSize(10000);
  EventList.clear();
  HandlerList=new Vector<JEEventHandler>();
  HandlerList.setSize(100);
  HandlerList.clear();
  isActive=new Boolean(false);
  theEmulationEnd=emulationEnd;
}

Fixed version (ground truth):
/** 
 * @param emulationEnd
 */
public JEEventScheduler(JETime emulationEnd){
  EventList.setSize(10000);
  EventList.clear();
  HandlerList=new Vector<JEEventHandler>();
  HandlerList.setSize(100);
  HandlerList.clear();
  isActive=Boolean.valueOf(false);
  theEmulationEnd=emulationEnd;
}
Program: 84442
Project: 84442
Buggy source:
@Test public void eventOrderingTest(){
  EventParser[] parsers=new EventParser[3];
  InputStream trace1=new FakeTraceStream(0);
  InputStream trace2=new FakeTraceStream(60);
  InputStream trace3=new FakeTraceStream(30);
  EventScheduler scheduler=new EventScheduler();
  Machine machine1=new Machine(scheduler,"String_Node_Str");
  Machine machine2=new Machine(scheduler,"String_Node_Str");
  Machine machine3=new Machine(scheduler,"String_Node_Str");
  DDGClient client1=new DDGClient(scheduler,1,machine1,null);
  DDGClient client2=new DDGClient(scheduler,2,machine2,null);
  DDGClient client3=new DDGClient(scheduler,3,machine3,null);
  parsers[0]=new FileSystemEventParser(trace1,client1);
  parsers[1]=new FileSystemEventParser(trace2,client2);
  parsers[2]=new FileSystemEventParser(trace3,client3);
  EventParser multipleSourceParser=new MultipleEventParser(parsers);
  Event currentEvent=multipleSourceParser.getNextEvent();
  Event nextEvent=null;
  while ((nextEvent=multipleSourceParser.getNextEvent()) != null) {
    assertTrue(currentEvent.getTheScheduledTime().isEarlierThan(nextEvent.getTheScheduledTime()));
    currentEvent=nextEvent;
  }
}

Fixed version (ground truth):
@Test public void eventOrderingTest(){
  EventParser[] parsers=new EventParser[3];
  InputStream trace1=new FakeTraceStream(0);
  InputStream trace2=new FakeTraceStream(60);
  InputStream trace3=new FakeTraceStream(30);
  EventScheduler scheduler=new EventScheduler();
  Machine machine1=new Machine(scheduler,"String_Node_Str");
  Machine machine2=new Machine(scheduler,"String_Node_Str");
  Machine machine3=new Machine(scheduler,"String_Node_Str");
  DDGClient client1=new DDGClient(scheduler,1,machine1,null);
  DDGClient client2=new DDGClient(scheduler,2,machine2,null);
  DDGClient client3=new DDGClient(scheduler,3,machine3,null);
  parsers[0]=new FileSystemEventParser(trace1,client1);
  parsers[1]=new FileSystemEventParser(trace2,client2);
  parsers[2]=new FileSystemEventParser(trace3,client3);
  EventParser multipleSourceParser=new MultipleEventParser(parsers);
  Event currentEvent=multipleSourceParser.getNextEvent();
  Event nextEvent=null;
  while ((nextEvent=multipleSourceParser.getNextEvent()) != null) {
    assertTrue(currentEvent.getTheScheduledTime().compareTo(nextEvent.getTheScheduledTime()) <= 0);
    currentEvent=nextEvent;
  }
}
Program: 84443
Project: 84443
Buggy source:
/** 
 * @param swapMachineProb
 * @param mSecondsBetweenLogins
 * @param firstClient
 * @param clients
 */
public HomeLessLoginAlgorithm(double swapMachineProb,long mSecondsBetweenLogins,DDGClient firstClient,List<DDGClient> clients){
  super(mSecondsBetweenLogins);
  if (swapMachineProb < 0 || swapMachineProb > 1) {
    throw new IllegalArgumentException();
  }
  this.clients=clients;
  this.swapMachineProb=swapMachineProb;
  this.random=new Random();
  this.lastSampledClient=firstClient;
}

Fixed version (ground truth):
/** 
 * @param swapMachineProb
 * @param mSecondsBetweenLogins
 * @param firstClient
 * @param clients
 */
public HomeLessLoginAlgorithm(double swapMachineProb,long mSecondsBetweenLogins,DDGClient firstClient,List<DDGClient> clients){
  super(mSecondsBetweenLogins,firstClient);
  if (swapMachineProb < 0 || swapMachineProb > 1) {
    throw new IllegalArgumentException();
  }
  this.clients=clients;
  this.swapMachineProb=swapMachineProb;
  this.random=new Random();
  this.lastSampledClient=firstClient;
}
Program: 84444
Project: 84444
Buggy source:
public LoginAlgorithm(long mSecondsBetweenLogins){
  this.mSecondsBetweenLogins=mSecondsBetweenLogins;
}

Fixed version (ground truth):
public LoginAlgorithm(long mSecondsBetweenLogins,DDGClient firstClient){
  this.mSecondsBetweenLogins=mSecondsBetweenLogins;
  this.lastSampledClient=firstClient;
}
Program: 84445
Project: 84445
Buggy source:
/** 
 * @param swapMachineProb
 * @param mSecondsBetweenLogins
 * @param sweetHomeClient
 * @param othersClients
 */
public SweetHomeLoginAlgorithm(double swapMachineProb,long mSecondsBetweenLogins,DDGClient sweetHomeClient,List<DDGClient> othersClients){
  super(mSecondsBetweenLogins);
  if (swapMachineProb < 0 || swapMachineProb >= 1) {
    throw new IllegalArgumentException();
  }
  if (othersClients.contains(sweetHomeClient)) {
    throw new IllegalArgumentException();
  }
  this.migrationProb=swapMachineProb;
  this.sweetHomeClient=sweetHomeClient;
  this.othersClients=othersClients;
  this.random=new Random();
}

Fixed version (ground truth):
/** 
 * @param swapMachineProb
 * @param mSecondsBetweenLogins
 * @param sweetHomeClient
 * @param othersClients
 */
public SweetHomeLoginAlgorithm(double swapMachineProb,long mSecondsBetweenLogins,DDGClient sweetHomeClient,List<DDGClient> othersClients){
  super(mSecondsBetweenLogins,sweetHomeClient);
  if (swapMachineProb < 0 || swapMachineProb >= 1) {
    throw new IllegalArgumentException();
  }
  if (othersClients.contains(sweetHomeClient)) {
    throw new IllegalArgumentException();
  }
  this.migrationProb=swapMachineProb;
  this.sweetHomeClient=sweetHomeClient;
  this.othersClients=othersClients;
  this.random=new Random();
}
Program: 84446
Project: 84446
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@Before public void setUp() throws Exception {
  board=new Board();
}

Fixed version (ground truth):
/** 
 * @throws Exception
 */
@Before public void setUp() throws Exception {
  board=new Board();
}
Program: 84447
Project: 84447
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  board=null;
}

Fixed version (ground truth):
/** 
 * @throws Exception
 */
@After public void tearDown() throws Exception {
  board=null;
}
Program: 84449
Project: 84449
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@Before public void setUp() throws Exception {
  move=new Move();
}

Fixed version (ground truth):
/** 
 * @throws Exception
 */
@Before public void setUp() throws Exception {
  move=new Move();
}
Program: 84450
Project: 84450
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@After public void tearDown() throws Exception {
  move=null;
}

Fixed version (ground truth):
/** 
 * @throws Exception
 */
@After public void tearDown() throws Exception {
  move=null;
}
Program: 84451
Project: 84451
Buggy source:
public void reset_border(EPlayer player){
  for (int i=0; i < this.field.length; i++) {
    for (int j=0; j < this.field[i].length; j++) {
      if (this.field[i][j].get_owner() == player) {
        this.field[i][j].border=false;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Resets 'border' flags on squares bordering the given player's territory. 
 */
public void reset_border(EPlayer player){
  for (int i=0; i < this.field.length; i++) {
    for (int j=0; j < this.field[i].length; j++) {
      if (this.field[i][j].get_owner() == player) {
        this.field[i][j].border=false;
      }
    }
  }
}
Program: 84452
Project: 84452
Buggy source:
public void conquer(ESquare square,EPlayer conqueror){
  square.get_owner().decrement_score();
  square.set_owner(conqueror);
  square.get_owner().increment_score();
  square.set_color(conqueror.get_color());
  return;
}

Fixed version (ground truth):
/** 
 * Adjusts ownership of the given square to the given player and adjusts scores. 
 */
public void conquer(ESquare square,EPlayer conqueror){
  square.get_owner().decrement_score();
  square.set_owner(conqueror);
  square.get_owner().increment_score();
  square.set_color(conqueror.get_color());
  return;
}
Program: 84453
Project: 84453
Buggy source:
private void traverse_owned(EPlayer player,int next_color,int x,int y){
  this.field[x][y].visited=true;
  if (x != 0) {
    ESquare top_square=this.field[x - 1][y];
    if (!top_square.visited) {
      if (top_square.conquered_by_move(next_color,player)) {
        traverse_owned(player,next_color,(x - 1),y);
      }
    }
  }
  if (y != 0) {
    ESquare left_square=this.field[x][y - 1];
    if (!left_square.visited) {
      if (left_square.conquered_by_move(next_color,player)) {
        traverse_owned(player,next_color,x,(y - 1));
      }
    }
  }
  if (x != (x_size - 1)) {
    ESquare bottom_square=this.field[x + 1][y];
    if (!bottom_square.visited) {
      if (bottom_square.conquered_by_move(next_color,player)) {
        traverse_owned(player,next_color,(x + 1),y);
      }
    }
  }
  if (y != (y_size - 1)) {
    ESquare right_square=this.field[x][y + 1];
    if (!right_square.visited) {
      if (right_square.conquered_by_move(next_color,player)) {
        traverse_owned(player,next_color,x,(y + 1));
      }
    }
  }
  conquer(this.field[x][y],player);
  return;
}

Fixed version (ground truth):
/** 
 * Performs a recursive depth-first search on the board, conquering squares for the player. 
 */
private void traverse_owned(EPlayer player,int next_color,int x,int y){
  this.field[x][y].visited=true;
  if (x != 0) {
    ESquare top_square=this.field[x - 1][y];
    if (!top_square.visited) {
      if (top_square.conquered_by_move(next_color,player)) {
        traverse_owned(player,next_color,(x - 1),y);
      }
    }
  }
  if (y != 0) {
    ESquare left_square=this.field[x][y - 1];
    if (!left_square.visited) {
      if (left_square.conquered_by_move(next_color,player)) {
        traverse_owned(player,next_color,x,(y - 1));
      }
    }
  }
  if (x != (x_size - 1)) {
    ESquare bottom_square=this.field[x + 1][y];
    if (!bottom_square.visited) {
      if (bottom_square.conquered_by_move(next_color,player)) {
        traverse_owned(player,next_color,(x + 1),y);
      }
    }
  }
  if (y != (y_size - 1)) {
    ESquare right_square=this.field[x][y + 1];
    if (!right_square.visited) {
      if (right_square.conquered_by_move(next_color,player)) {
        traverse_owned(player,next_color,x,(y + 1));
      }
    }
  }
  conquer(this.field[x][y],player);
  return;
}
Program: 84454
Project: 84454
Buggy source:
public ESquare[][] get_field(){
  return this.field;
}

Fixed version (ground truth):
/** 
 * Returns the game field. 
 */
public ESquare[][] get_field(){
  return this.field;
}
Program: 84455
Project: 84455
Buggy source:
private void traverse_reachable(EPlayer player,int x,int y){
  this.field[x][y].visited=true;
  if (x != 0) {
    ESquare top_square=this.field[x - 1][y];
    if (!top_square.visited) {
      if (top_square.conquerable_by_player(player)) {
        traverse_reachable(player,(x - 1),y);
      }
 else {
        top_square.border=true;
      }
    }
  }
  if (y != 0) {
    ESquare left_square=this.field[x][y - 1];
    if (!left_square.visited) {
      if (left_square.conquerable_by_player(player)) {
        traverse_reachable(player,x,(y - 1));
      }
 else {
        left_square.border=true;
      }
    }
  }
  if (x != (x_size - 1)) {
    ESquare bottom_square=this.field[x + 1][y];
    if (!bottom_square.visited) {
      if (bottom_square.conquerable_by_player(player)) {
        traverse_reachable(player,(x + 1),y);
      }
 else {
        bottom_square.border=true;
      }
    }
  }
  if (y != (y_size - 1)) {
    ESquare right_square=this.field[x][y + 1];
    if (!right_square.visited) {
      if (right_square.conquerable_by_player(player)) {
        traverse_reachable(player,x,(y + 1));
      }
 else {
        right_square.border=true;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs a recursive depth-first search on the board, marking all squares that the player can reach. 
 */
private void traverse_reachable(EPlayer player,int x,int y){
  this.field[x][y].visited=true;
  if (x != 0) {
    ESquare top_square=this.field[x - 1][y];
    if (!top_square.visited) {
      if (top_square.conquerable_by_player(player)) {
        traverse_reachable(player,(x - 1),y);
      }
 else {
        top_square.border=true;
      }
    }
  }
  if (y != 0) {
    ESquare left_square=this.field[x][y - 1];
    if (!left_square.visited) {
      if (left_square.conquerable_by_player(player)) {
        traverse_reachable(player,x,(y - 1));
      }
 else {
        left_square.border=true;
      }
    }
  }
  if (x != (x_size - 1)) {
    ESquare bottom_square=this.field[x + 1][y];
    if (!bottom_square.visited) {
      if (bottom_square.conquerable_by_player(player)) {
        traverse_reachable(player,(x + 1),y);
      }
 else {
        bottom_square.border=true;
      }
    }
  }
  if (y != (y_size - 1)) {
    ESquare right_square=this.field[x][y + 1];
    if (!right_square.visited) {
      if (right_square.conquerable_by_player(player)) {
        traverse_reachable(player,x,(y + 1));
      }
 else {
        right_square.border=true;
      }
    }
  }
}
Program: 84456
Project: 84456
Buggy source:
public Boolean winner_exists(){
  return this.neutral_owner.score == 0;
}

Fixed version (ground truth):
/** 
 * Returns true if either player's score is equal to or greater than the winning score. 
 */
public Boolean winner_exists(){
  return this.neutral_owner.score == 0;
}
Program: 84457
Project: 84457
Buggy source:
public void reset_visited(){
  for (int i=0; i < this.field.length; i++) {
    for (int j=0; j < this.field[i].length; j++) {
      this.field[i][j].visited=false;
    }
  }
}

Fixed version (ground truth):
/** 
 * Resets 'visited' flags on all squares. 
 */
public void reset_visited(){
  for (int i=0; i < this.field.length; i++) {
    for (int j=0; j < this.field[i].length; j++) {
      this.field[i][j].visited=false;
    }
  }
}
Program: 84458
Project: 84458
Buggy source:
public EPlayer winner(){
  if (!winner_exists()) {
    System.err.println("String_Node_Str");
    return null;
  }
  if (this.player_1.score >= this.player_2.score) {
    return this.player_1;
  }
  return this.player_2;
}

Fixed version (ground truth):
/** 
 * Returns the winner of the game. 
 */
public EPlayer winner(){
  if (!winner_exists()) {
    System.err.println("String_Node_Str");
    return null;
  }
  if (this.player_1.score >= this.player_2.score) {
    return this.player_1;
  }
  return this.player_2;
}
Program: 84459
Project: 84459
Buggy source:
public EBoard(int num_colors,int x_size,int y_size){
  this.x_size=x_size;
  this.y_size=y_size;
  this.num_colors=num_colors;
  this.player_1=null;
  this.player_2=null;
  this.neutral_owner=new ENeutral("String_Node_Str",this.x_size * this.y_size);
  this.field=new ESquare[this.x_size][this.y_size];
  for (int i=0; i < this.field.length; i++) {
    for (int j=0; j < this.field[i].length; j++) {
      this.field[i][j]=new ESquare(i,j);
    }
  }
  this.top_left=this.field[0][0];
  this.bottom_right=this.field[this.x_size - 1][this.y_size - 1];
  this.winning_score=(int)Math.ceil((x_size * y_size) / 2);
}

Fixed version (ground truth):
/** 
 * Constructs the board with given colors and dimensions. 
 */
public EBoard(int num_colors,int x_size,int y_size){
  this.x_size=x_size;
  this.y_size=y_size;
  this.num_colors=num_colors;
  this.player_1=null;
  this.player_2=null;
  this.neutral_owner=new ENeutral("String_Node_Str",this.x_size * this.y_size);
  this.field=new ESquare[this.x_size][this.y_size];
  for (int i=0; i < this.field.length; i++) {
    for (int j=0; j < this.field[i].length; j++) {
      this.field[i][j]=new ESquare(i,j);
    }
  }
  this.top_left=this.field[0][0];
  this.bottom_right=this.field[this.x_size - 1][this.y_size - 1];
  this.winning_score=(int)Math.ceil((x_size * y_size) / 2);
}
Program: 84460
Project: 84460
Buggy source:
public Boolean can_play(EPlayer player,int color){
  if (color == player.get_opponent().get_color() || (color < 0 || color >= this.num_colors) || color == player.get_color()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns false if the player cannot play the color - if it's the same color, the opponent's color, or out of bounds. 
 */
public Boolean can_play(EPlayer player,int color){
  if (color == player.get_opponent().get_color() || (color < 0 || color >= this.num_colors) || color == player.get_color()) {
    return false;
  }
  return true;
}