nus-yam/ex-repair huggingface dataset:
Program: 180569
Project: 180569
Buggy source:
@Override public void process(OurSim ourSim){
  ourSim.addNetworkEvent(ourSim.createEvent(BrokerEvents.HERE_IS_WORKER,getTime(),workerId,requestSpec));
}

Fixed version (ground truth):
@Override public void process(OurSim ourSim){
  Peer peer=ourSim.getGrid().getObject(peerId);
  PeerRequest request=peer.getRequest(requestSpec.getId());
  if (request == null || !request.getAllocatedWorkers().contains(workerId)) {
    return;
  }
  ourSim.addNetworkEvent(ourSim.createEvent(BrokerEvents.HERE_IS_WORKER,getTime(),workerId,requestSpec));
}
Program: 180570
Project: 180570
Buggy source:
public WorkerInUseEvent(RequestSpec requestSpec,String workerId){
  super(Event.DEF_PRIORITY);
  this.requestSpec=requestSpec;
  this.workerId=workerId;
}

Fixed version (ground truth):
public WorkerInUseEvent(RequestSpec requestSpec,String workerId,String peerId){
  super(Event.DEF_PRIORITY);
  this.requestSpec=requestSpec;
  this.workerId=workerId;
  this.peerId=peerId;
}
Program: 180571
Project: 180571
Buggy source:
public static void redistributeWorker(long time,Peer peer,String workerId,OurSim ourSim){
  Allocation workerAllocation=peer.getAllocation(workerId);
  if (workerAllocation == null) {
    return;
  }
  PeerRequest request=workerAllocation.getRequest();
  request.removeAllocatedWorker(workerId);
  peer.setWorkerState(workerId,WorkerState.IDLE);
  workerAllocation.setRequest(null);
  workerAllocation.setConsumer(null);
  workerAllocation.setLastAssign(time);
  if (workerAllocation.isWorkerLocal()) {
    redistributeLocalWorker(time,peer,workerId,ourSim);
  }
 else {
    redistributeRemoteWorker(time,peer,workerId,ourSim);
  }
  if (request != null) {
    request.removeAllocatedWorker(workerId);
    if (!request.isPaused() && request.getNeededWorkers() > 0) {
      Event requestWorkersEvent=ourSim.createEvent(PeerEvents.REQUEST_WORKERS,time + ourSim.getLongProperty(Configuration.PROP_REQUEST_REPETITION_INTERVAL),peer.getId(),request.getSpec(),true);
      ourSim.addEvent(requestWorkersEvent);
    }
  }
}

Fixed version (ground truth):
public static void redistributeWorker(long time,Peer peer,String workerId,OurSim ourSim){
  Allocation workerAllocation=peer.getAllocation(workerId);
  if (workerAllocation == null) {
    return;
  }
  PeerRequest request=workerAllocation.getRequest();
  if (request != null) {
    request.removeAllocatedWorker(workerId);
  }
  peer.setWorkerState(workerId,WorkerState.IDLE);
  workerAllocation.setRequest(null);
  workerAllocation.setConsumer(null);
  workerAllocation.setLastAssign(time);
  if (workerAllocation.isWorkerLocal()) {
    redistributeLocalWorker(time,peer,workerId,ourSim);
  }
 else {
    redistributeRemoteWorker(time,peer,workerId,ourSim);
  }
  if (request != null && !request.isPaused() && request.getNeededWorkers() > 0) {
    Event requestWorkersEvent=ourSim.createEvent(PeerEvents.REQUEST_WORKERS,time + ourSim.getLongProperty(Configuration.PROP_REQUEST_REPETITION_INTERVAL),peer.getId(),request.getSpec(),true);
    ourSim.addEvent(requestWorkersEvent);
  }
}
Program: 180572
Project: 180572
Buggy source:
public static void cleanWorker(long time,Worker worker,boolean releaseRemotePeer,OurSim ourSim){
  String oldConsumer=worker.getConsumer();
  if (oldConsumer != null) {
    ourSim.addEvent(ourSim.createEvent(FailureDetectionEvents.RELEASE,time,worker.getId(),oldConsumer));
    worker.setConsumer(null);
  }
  WorkAccounting workAccounting=worker.getCurrentWorkAccounting();
  if (worker.getRemotePeer() != null && workAccounting != null) {
    workAccounting.setCPUTime(time - workAccounting.getInitCPUtime());
    worker.addWorkAccounting(workAccounting);
    worker.setCurrentWorkAccounting(null);
  }
  if (releaseRemotePeer && worker.getRemotePeer() != null) {
    ourSim.addEvent(ourSim.createEvent(FailureDetectionEvents.RELEASE,time,worker.getId(),worker.getRemotePeer()));
    worker.setRemotePeer(null);
  }
}

Fixed version (ground truth):
public static void cleanWorker(long time,Worker worker,boolean releaseRemotePeer,OurSim ourSim){
  String oldConsumer=worker.getConsumer();
  if (oldConsumer != null) {
    ourSim.addEvent(ourSim.createEvent(BrokerEvents.WORKER_PREEMPTED,time,oldConsumer,worker.getId()));
    ourSim.addEvent(ourSim.createEvent(FailureDetectionEvents.RELEASE,time,worker.getId(),oldConsumer));
    worker.setConsumer(null);
  }
  WorkAccounting workAccounting=worker.getCurrentWorkAccounting();
  if (worker.getRemotePeer() != null && workAccounting != null) {
    workAccounting.setCPUTime(time - workAccounting.getInitCPUtime());
    worker.addWorkAccounting(workAccounting);
    worker.setCurrentWorkAccounting(null);
  }
  if (releaseRemotePeer && worker.getRemotePeer() != null) {
    ourSim.addEvent(ourSim.createEvent(FailureDetectionEvents.RELEASE,time,worker.getId(),worker.getRemotePeer()));
    worker.setRemotePeer(null);
  }
}
Program: 180573
Project: 180573
Buggy source:
@Override public void process(OurSim ourSim){
  Worker worker=ourSim.getGrid().getObject(workerId);
  CleanWorkerHelper.cleanWorker(getTime(),worker,false,ourSim);
  worker.setConsumer(consumer);
  ourSim.addNetworkEvent(ourSim.createEvent(PeerEvents.WORKER_IN_USE,getTime(),requestSpec,workerId));
  if (worker.getRemotePeer() != null) {
    WorkAccounting accounting=new WorkAccounting(worker.getId(),worker.getRemotePeer());
    worker.setCurrentWorkAccounting(accounting);
  }
}

Fixed version (ground truth):
@Override public void process(OurSim ourSim){
  Worker worker=ourSim.getGrid().getObject(workerId);
  CleanWorkerHelper.cleanWorker(getTime(),worker,false,ourSim);
  worker.setConsumer(consumer);
  String peerId=worker.getPeer();
  ourSim.addNetworkEvent(ourSim.createEvent(PeerEvents.WORKER_IN_USE,getTime(),requestSpec,workerId,peerId));
  if (worker.getRemotePeer() != null) {
    WorkAccounting accounting=new WorkAccounting(worker.getId(),worker.getRemotePeer());
    worker.setCurrentWorkAccounting(accounting);
  }
}
Program: 180574
Project: 180574
Buggy source:
@Override public Grid createGrid(){
  JSONObject gridJson=null;
  try {
    String gridStr=IOUtils.toString(inputStream);
    gridJson=JSONUtils.asJSON(gridStr);
  }
 catch (  Exception e) {
    throw new IllegalArgumentException(e);
  }
  Grid grid=new Grid();
  JSONObject dsJson=JSONUtils.getJSONObject(gridJson,"String_Node_Str");
  DiscoveryService ds=new DiscoveryService();
  ds.setId(JSONUtils.getJSONString(dsJson,"String_Node_Str"));
  grid.addObject(ds);
  JSONArray peersArray=JSONUtils.getJSONArray(gridJson,"String_Node_Str");
  for (int i=0; i < peersArray.length(); i++) {
    try {
      JSONObject peerJson=(JSONObject)peersArray.get(i);
      grid.addObject(createPeer(peerJson,grid));
    }
 catch (    JSONException e) {
      throw new IllegalArgumentException(e);
    }
  }
  JSONArray brokersArray=JSONUtils.getJSONArray(gridJson,"String_Node_Str");
  for (int i=0; i < brokersArray.length(); i++) {
    try {
      JSONObject brokerJson=(JSONObject)brokersArray.get(i);
      grid.addObject(createBroker(brokerJson));
    }
 catch (    JSONException e) {
      throw new IllegalArgumentException(e);
    }
  }
  configureFailureDetectors(grid);
  return grid;
}

Fixed version (ground truth):
@Override public Grid createGrid(){
  JSONObject gridJson=null;
  try {
    String gridStr=IOUtils.toString(inputStream);
    gridJson=JSONUtils.asJSON(gridStr);
  }
 catch (  Exception e) {
    throw new IllegalArgumentException(e);
  }
  Grid grid=new Grid();
  JSONObject dsJson=JSONUtils.getJSONObject(gridJson,"String_Node_Str");
  DiscoveryService ds=new DiscoveryService();
  ds.setId(JSONUtils.getJSONString(dsJson,"String_Node_Str"));
  grid.addObject(ds);
  JSONArray peersArray=JSONUtils.getJSONArray(gridJson,"String_Node_Str");
  for (int i=0; i < peersArray.length(); i++) {
    try {
      JSONObject peerJson=(JSONObject)peersArray.get(i);
      grid.addObject(createPeer(peerJson,grid));
    }
 catch (    JSONException e) {
      throw new IllegalArgumentException(e);
    }
  }
  JSONArray brokersArray=JSONUtils.getJSONArray(gridJson,"String_Node_Str");
  for (int i=0; i < brokersArray.length(); i++) {
    try {
      JSONObject brokerJson=(JSONObject)brokersArray.get(i);
      grid.addObject(createBroker(brokerJson));
    }
 catch (    JSONException e) {
      throw new IllegalArgumentException(e);
    }
  }
  new FailureDetectorOptInjector().inject(grid,properties);
  return grid;
}
Program: 180575
Project: 180575
Buggy source:
public List<ReplicaAccounting> getReplicaAccountings(long requestId){
  return replicaAccountings.get(requestId);
}

Fixed version (ground truth):
public List<ReplicaAccounting> getReplicaAccountings(long requestId){
  return replicaAccountings.containsKey(requestId) ? new LinkedList<ReplicaAccounting>(replicaAccountings.get(requestId)) : new LinkedList<ReplicaAccounting>();
}
Program: 180576
Project: 180576
Buggy source:
public void updateStatusReceived(String monitored,Long time){
  getMonitor(monitored).setUp(true);
  getMonitor(monitored).setCreatingConnection(false);
  fd.messageReceived(monitored,time,MessageType.PING);
}

Fixed version (ground truth):
public void updateStatusReceived(String monitored,Long time){
  getMonitor(monitored).setUp(true);
  getMonitor(monitored).setCreatingConnection(false);
  if (fd != null) {
    fd.messageReceived(monitored,time,MessageType.PING);
  }
}
Program: 180577
Project: 180577
Buggy source:
public void isItAliveSent(String monitored,Long time){
  fd.messageSent(monitored,time,MessageType.PING);
}

Fixed version (ground truth):
public void isItAliveSent(String monitored,Long time){
  if (fd != null) {
    fd.messageSent(monitored,time,MessageType.PING);
  }
}
Program: 180578
Project: 180578
Buggy source:
public static void sendIsItAlive(OurSim ourSim,Long time,String interested,String monitored){
  ActiveEntity interestedObj=ourSim.getGrid().getObject(interested);
  Monitor monitor=interestedObj.getMonitor(monitored);
  if (monitor == null) {
    return;
  }
  Event isItAliveReceivedEvent=ourSim.createEvent(FailureDetectionEvents.IS_IT_ALIVE_RECEIVED,time,interested,monitored,monitor.isCreatingConnection());
  interestedObj.isItAliveSent(monitored,time);
  ourSim.addNetworkEvent(isItAliveReceivedEvent);
  Event isItAliveSentEvent=ourSim.createEvent(FailureDetectionEvents.IS_IT_ALIVE_SENT,time + interestedObj.getTimeToNextPing(monitored,time),interested,monitored);
  ourSim.addEvent(isItAliveSentEvent);
}

Fixed version (ground truth):
public static void sendIsItAlive(OurSim ourSim,Long time,String interested,String monitored){
  ActiveEntity interestedObj=ourSim.getGrid().getObject(interested);
  Monitor monitor=interestedObj.getMonitor(monitored);
  if (monitor == null) {
    return;
  }
  Event isItAliveReceivedEvent=ourSim.createEvent(FailureDetectionEvents.IS_IT_ALIVE_RECEIVED,time,interested,monitored,monitor.isCreatingConnection());
  interestedObj.isItAliveSent(monitored,time);
  ourSim.addNetworkEvent(isItAliveReceivedEvent);
  if (ourSim.getBooleanProperty(Configuration.PROP_USE_FAILURE_DETECTOR)) {
    Event isItAliveSentEvent=ourSim.createEvent(FailureDetectionEvents.IS_IT_ALIVE_SENT,time + interestedObj.getTimeToNextPing(monitored,time),interested,monitored);
    ourSim.addEvent(isItAliveSentEvent);
  }
}
Program: 180579
Project: 180579
Buggy source:
public static Monitor registerMonitored(OurSim ourSim,Long time,String interested,String monitored,Event callbackAliveEvent,Event callbackDownEvent,boolean isUp){
  ActiveEntity interestedObj=ourSim.getGrid().getObject(interested);
  ActiveEntity monitoredObj=ourSim.getGrid().getObject(monitored);
  Monitor monitor=new Monitor(monitoredObj,callbackAliveEvent,callbackDownEvent);
  monitor.setUp(isUp);
  interestedObj.addMonitor(monitor,time);
  if (ourSim.getBooleanProperty(Configuration.PROP_USE_FAILURE_DETECTOR)) {
    sendIsItAlive(ourSim,time,interested,monitored);
  }
  return monitor;
}

Fixed version (ground truth):
public static Monitor registerMonitored(OurSim ourSim,Long time,String interested,String monitored,Event callbackAliveEvent,Event callbackDownEvent,boolean isUp){
  ActiveEntity interestedObj=ourSim.getGrid().getObject(interested);
  ActiveEntity monitoredObj=ourSim.getGrid().getObject(monitored);
  Monitor monitor=new Monitor(monitoredObj,callbackAliveEvent,callbackDownEvent);
  monitor.setUp(isUp);
  interestedObj.addMonitor(monitor,time);
  sendIsItAlive(ourSim,time,interested,monitored);
  return monitor;
}
Program: 180580
Project: 180580
Buggy source:
@Override public void process(OurSim ourSim){
  ActiveEntity interestedObj=ourSim.getGrid().getObject(interested);
  Monitor monitor=interestedObj.getMonitor(monitored);
  if (monitor == null) {
    return;
  }
  boolean wasUp=monitor.isUp();
  interestedObj.updateStatusReceived(monitored,getTime());
  Monitor monitoredRef=monitor;
  if (!wasUp) {
    Event callbackAliveEvent=monitoredRef.getCallbackAliveEvent();
    if (callbackAliveEvent != null) {
      callbackAliveEvent.setTime(getTime());
      ourSim.addEvent(callbackAliveEvent);
    }
  }
  MonitorUtil.checkLiveness(ourSim,getTime(),interested,monitored);
}

Fixed version (ground truth):
@Override public void process(OurSim ourSim){
  ActiveEntity interestedObj=ourSim.getGrid().getObject(interested);
  Monitor monitor=interestedObj.getMonitor(monitored);
  if (monitor == null) {
    return;
  }
  boolean wasUp=monitor.isUp();
  interestedObj.updateStatusReceived(monitored,getTime());
  Monitor monitoredRef=monitor;
  if (!wasUp) {
    Event callbackAliveEvent=monitoredRef.getCallbackAliveEvent();
    if (callbackAliveEvent != null) {
      callbackAliveEvent.setTime(getTime());
      ourSim.addEvent(callbackAliveEvent);
    }
  }
  if (ourSim.getBooleanProperty(Configuration.PROP_USE_FAILURE_DETECTOR)) {
    MonitorUtil.checkLiveness(ourSim,getTime(),interested,monitored);
  }
}
Program: 180581
Project: 180581
Buggy source:
private int map(GrammarRule grammarRule,NonTerminalSymbol parseNode,int depth,Chromosome chromosome,int currentCodon){
  if (depth + 1 > maxDepth - 1) {
    return -1;
  }
  int noProductions=grammarRule.getNoProductions();
  GrammarProduction production;
  if (noProductions == 1) {
    production=grammarRule.getProduction(0);
  }
 else {
    Codon codon=chromosome.getCodon(currentCodon++);
    if (codon == null) {
      return -1;
    }
    int productionChoice=(int)Math.abs(codon.value() % noProductions);
    production=grammarRule.getProduction(productionChoice);
  }
  for (  GrammarNode s : production.getGrammarNodes()) {
    if (s instanceof GrammarLiteral) {
      parseNode.addChild(new TerminalSymbol((GrammarLiteral)s));
    }
 else {
      GrammarRule nextGrammarRule=(GrammarRule)s;
      NonTerminalSymbol nextParseNode=new NonTerminalSymbol(nextGrammarRule);
      parseNode.addChild(nextParseNode);
      currentCodon=map(nextGrammarRule,nextParseNode,depth + 1,chromosome,currentCodon);
      if (currentCodon == -1) {
        return -1;
      }
    }
  }
  return currentCodon;
}

Fixed version (ground truth):
private int map(GrammarRule grammarRule,NonTerminalSymbol parseNode,int depth,Chromosome chromosome,int currentCodon){
  if (depth + 1 > maxDepth) {
    return -1;
  }
  int noProductions=grammarRule.getNoProductions();
  GrammarProduction production;
  if (noProductions == 1) {
    production=grammarRule.getProduction(0);
  }
 else {
    Codon codon=chromosome.getCodon(currentCodon++);
    if (codon == null) {
      return -1;
    }
    int productionChoice=(int)Math.abs(codon.value() % noProductions);
    production=grammarRule.getProduction(productionChoice);
  }
  for (  GrammarNode s : production.getGrammarNodes()) {
    if (s instanceof GrammarLiteral) {
      parseNode.addChild(new TerminalSymbol((GrammarLiteral)s));
    }
 else {
      GrammarRule nextGrammarRule=(GrammarRule)s;
      NonTerminalSymbol nextParseNode=new NonTerminalSymbol(nextGrammarRule);
      parseNode.addChild(nextParseNode);
      currentCodon=map(nextGrammarRule,nextParseNode,depth + 1,chromosome,currentCodon);
      if (currentCodon == -1) {
        return -1;
      }
    }
  }
  return currentCodon;
}
Program: 180582
Project: 180582
Buggy source:
public CachedSourceGenerator(SourceGenerator<T> delegate){
  this.delegate=delegate;
}

Fixed version (ground truth):
public CachedSourceGenerator(SourceGenerator<T> delegate){
  this.delegate=delegate;
  cache=new HashMap<Object,String>();
}
Program: 180583
Project: 180583
Buggy source:
@Override public String getSource(T program){
  return delegate.getSource(program);
}

Fixed version (ground truth):
@Override public String getSource(T individual){
  Object key=key(individual);
  String source=cache.get(key);
  if (source == null) {
    source=delegate.getSource(individual);
    cache.put(key,source);
  }
  return source;
}
Program: 180584
Project: 180584
Buggy source:
/** 
 * Returns a clone of this individual with a copy of its fitness assigned
 * @return an individual which is a copy of this individual
 */
@Override public AbstractIndividual clone(){
  try {
    AbstractIndividual clone=(AbstractIndividual)super.clone();
    clone.fitness=fitness.clone();
    return clone;
  }
 catch (  CloneNotSupportedException e) {
    throw new InternalError();
  }
}

Fixed version (ground truth):
/** 
 * Returns a clone of this individual with a copy of its fitness assigned
 * @return an individual which is a copy of this individual
 */
@Override public AbstractIndividual clone(){
  try {
    AbstractIndividual clone=(AbstractIndividual)super.clone();
    if (fitness != null) {
      clone.fitness=fitness.clone();
    }
    return clone;
  }
 catch (  CloneNotSupportedException e) {
    throw new InternalError();
  }
}
Program: 180585
Project: 180585
Buggy source:
/** 
 * Returns a string representation of the generation population.
 * @return a string representation of the generation population.
 */
@Override public String toString(){
  return population.toString();
}

Fixed version (ground truth):
/** 
 * Returns a string representation of the generation population.
 * @return a string representation of the generation population.
 */
@Override public String toString(){
  StringBuffer buffer=new StringBuffer();
  boolean sep=false;
  for (  Individual individual : population) {
    if (sep) {
      buffer.append("String_Node_Str");
    }
    buffer.append(individual);
    sep=true;
  }
  return buffer.toString();
}
Program: 180586
Project: 180586
Buggy source:
/** 
 * Appends multiple codons to the end of the chromosome
 * @param codons a list of codons to append
 */
public void appendCodons(List<Codon> codons){
  codons.addAll(codons);
}

Fixed version (ground truth):
/** 
 * Appends multiple codons to the end of the chromosome
 * @param newCodons a list of codons to append
 */
public void appendCodons(List<Codon> newCodons){
  codons.addAll(newCodons);
}
Program: 180590
Project: 180590
Buggy source:
/** 
 * Returns a clone of this individual with a copy of its fitness assigned
 * @return an individual which is a copy of this individual
 */
public AbstractIndividual clone(){
  try {
    AbstractIndividual clone=(AbstractIndividual)super.clone();
    clone.fitness=fitness.clone();
    return clone;
  }
 catch (  CloneNotSupportedException e) {
    throw new InternalError();
  }
}

Fixed version (ground truth):
/** 
 * Returns a clone of this individual with a copy of its fitness assigned
 * @return an individual which is a copy of this individual
 */
public AbstractIndividual clone(){
  try {
    AbstractIndividual clone=(AbstractIndividual)super.clone();
    if (fitness != null) {
      clone.fitness=fitness.clone();
    }
    return clone;
  }
 catch (  CloneNotSupportedException e) {
    throw new InternalError();
  }
}
Program: 180593
Project: 180593
Buggy source:
/** 
 * Constructs an <code>IntegerCodonFactory</code> with control parameters initially loaded from the config. If the <code>autoConfig</code> argument is set to <code>true</code> then the configuration will be automatically updated when the config is modified.
 * @param autoConfig whether this operator should automatically update itsconfiguration settings from the config
 */
public IntegerCodonFactory(boolean autoConfig){
  maxCodon=Long.MAX_VALUE;
  minCodon=Long.MIN_VALUE;
  setup();
  if (autoConfig) {
    EventManager.getInstance().add(ConfigEvent.class,this);
  }
}

Fixed version (ground truth):
/** 
 * Constructs an <code>IntegerCodonFactory</code> with control parameters initially loaded from the config. If the <code>autoConfig</code> argument is set to <code>true</code> then the configuration will be automatically updated when the config is modified.
 * @param autoConfig whether this operator should automatically update itsconfiguration settings from the config
 */
public IntegerCodonFactory(boolean autoConfig){
  maxCodon=Long.MAX_VALUE;
  minCodon=0L;
  setup();
  if (autoConfig) {
    EventManager.getInstance().add(ConfigEvent.class,this);
  }
}
Program: 180594
Project: 180594
Buggy source:
/** 
 * Sets up this operator with the appropriate configuration settings. This method is called whenever a <code>ConfigEvent</code> occurs for a change in any of the following configuration parameters: <ul> <li>  {@link RandomSequence#RANDOM_SEQUENCE}<li>  {@link Codon#MAXIMUM_VALUE}<li>  {@link Codon#MINIMUM_VALUE}</ul>
 */
protected void setup(){
  random=Config.getInstance().get(RANDOM_SEQUENCE);
  maxCodon=Config.getInstance().get(MAXIMUM_VALUE,maxCodon);
  minCodon=Config.getInstance().get(MINIMUM_VALUE,minCodon);
  codonRange=maxCodon - minCodon;
}

Fixed version (ground truth):
/** 
 * Sets up this operator with the appropriate configuration settings. This method is called whenever a <code>ConfigEvent</code> occurs for a change in any of the following configuration parameters: <ul> <li>  {@link RandomSequence#RANDOM_SEQUENCE}<li>  {@link Codon#MAXIMUM_VALUE}<li>  {@link Codon#MINIMUM_VALUE}</ul>
 */
protected void setup(){
  random=Config.getInstance().get(RANDOM_SEQUENCE);
  maxCodon=Config.getInstance().get(MAXIMUM_VALUE,maxCodon);
  minCodon=Config.getInstance().get(MINIMUM_VALUE,minCodon);
  if (minCodon < 0) {
    new IllegalStateException("String_Node_Str");
  }
 else   if (maxCodon <= minCodon) {
    new IllegalStateException("String_Node_Str");
  }
  codonRange=maxCodon - minCodon;
}
Program: 180595
Project: 180595
Buggy source:
/** 
 * Sets the number of individuals to be generated in a population created by the <tt>createPopulation</tt> method. If automatic configuration is enabled thenAny value set here will be overwritten by the  {@link Population#SIZE} configuration setting on the next config event.
 * @param size the size of the populations generated
 */
public void setPopulationSize(int size){
  this.populationSize=size;
}

Fixed version (ground truth):
/** 
 * Sets the number of individuals to be generated in a population created by the <tt>createPopulation</tt> method. If automatic configuration is enabled then any value set here will be overwritten by the  {@link Population#SIZE} configuration setting on the next config event.
 * @param size the size of the populations generated
 */
public void setPopulationSize(int size){
  this.populationSize=size;
}
Program: 180596
Project: 180596
Buggy source:
/** 
 * Constructs a new <tt>STGPIndividual</tt> instance with a program tree composed of nodes provided by the   {@link STGPIndividual#SYNTAX} configparameter. A grow or a full initialisation method is used, select at random
 * @return a new individual
 */
@Override public STGPIndividual createIndividual(){
  if (random.nextBoolean()) {
    return grow.createIndividual();
  }
 else {
    return full.createIndividual();
  }
}

Fixed version (ground truth):
/** 
 * Constructs a new <tt>STGPIndividual</tt> instance with a program tree composed of nodes provided by the   {@link STGPIndividual#SYNTAX} configparameter. A grow or a full initialisation method is used, selected at random
 * @return a new individual
 */
@Override public STGPIndividual createIndividual(){
  if (random.nextBoolean()) {
    return grow.createIndividual();
  }
 else {
    return full.createIndividual();
  }
}
Program: 180597
Project: 180597
Buggy source:
public abstract AbstractIndividual clone();

Fixed version (ground truth):
public AbstractIndividual clone(){
  try {
    return (AbstractIndividual)super.clone();
  }
 catch (  CloneNotSupportedException e) {
    throw new InternalError();
  }
}
Program: 180598
Project: 180598
Buggy source:
/** 
 * Compares this individual to another based on their fitness. It returns a negative integer, zero, or a positive integer as this instance represents the quality of an individual that is less fit, equally fit, or more fit than the specified object. The individuals do not need to be of the same object type, but must have comparable <tt>Fitness</tt> instances.
 * @param other an individual to compare against
 * @return a negative integer, zero, or a positive integer as this object isless fit than, equally fit as, or fitter than the specified object
 */
@Override public int compareTo(Individual other){
  return fitness.compareTo(other.getFitness());
}

Fixed version (ground truth):
/** 
 * Compares this individual to another based on their fitness. It returns a negative integer, zero, or a positive integer as this instance represents the quality of an individual that is less fit, equally fit, or more fit than the specified object. The individuals do not need to be of the same object type, but must have non-null, comparable <tt>Fitness</tt> instances.
 * @param other an individual to compare against
 * @return a negative integer, zero, or a positive integer as this object isless fit than, equally fit as, or fitter than the specified object
 */
@Override public int compareTo(Individual other){
  return getFitness().compareTo(other.getFitness());
}
Program: 180599
Project: 180599
Buggy source:
@Override public int hashCode(){
  int hash=1;
  hash=hash * 13 + (root == null ? 0 : root.hashCode());
  return hash;
}

Fixed version (ground truth):
/** 
 * Returns a hash code value for the object.
 * @return a hash code value for this object
 */
@Override public int hashCode(){
  int hash=1;
  hash=hash * 13 + (root == null ? 0 : root.hashCode());
  return hash;
}
Program: 180600
Project: 180600
Buggy source:
/** 
 * Compares the given object to this instance for equality. Equivalence is defined as them both being instances of <tt>STGPIndividual</tt> and having equal program trees according to <tt>getRoot().equals(obj)</tt>.
 * @param obj an object to be compared for equivalence.
 * @return true if this individual is equivalent to the specified object andfalse otherwise.
 */
@Override public boolean equals(Object obj){
  boolean equal=false;
  if ((obj != null) && (obj instanceof STGPIndividual)) {
    STGPIndividual p=(STGPIndividual)obj;
    if (ObjectUtils.equals(root,p.root)) {
      equal=true;
    }
  }
  return equal;
}

Fixed version (ground truth):
/** 
 * Compares the given object to this instance for equality. Equivalence is defined as them both being instances of <tt>STGPIndividual</tt> and having equal program trees according to <tt>getRoot().equals(obj)</tt> (or if both root nodes are <tt>null</tt>).
 * @param obj an object to be compared for equivalence.
 * @return true if this individual is equivalent to the specified object andfalse otherwise.
 */
@Override public boolean equals(Object obj){
  boolean equal=false;
  if ((obj != null) && (obj instanceof STGPIndividual)) {
    STGPIndividual p=(STGPIndividual)obj;
    if (ObjectUtils.equals(root,p.root)) {
      equal=true;
    }
  }
  return equal;
}
Program: 180601
Project: 180601
Buggy source:
/** 
 * Creates and returns a copy of this program. The copied individual has a deep clone of the program tree.
 * @return a clone of this <tt>STGPIndividual</tt> instance
 */
@Override public STGPIndividual clone(){
  STGPIndividual clone=null;
  try {
    clone=(STGPIndividual)super.clone();
  }
 catch (  CloneNotSupportedException e) {
    e.printStackTrace();
  }
  if (root == null) {
    clone.root=null;
  }
 else {
    clone.root=root.clone();
  }
  return clone;
}

Fixed version (ground truth):
/** 
 * Creates and returns a copy of this program. The copied individual has a deep clone of the program tree. The clone is not assigned this individual's fitness.
 * @return a clone of this <tt>STGPIndividual</tt> instance
 */
@Override public STGPIndividual clone(){
  STGPIndividual clone=(STGPIndividual)super.clone();
  if (root == null) {
    clone.root=null;
  }
 else {
    clone.root=root.clone();
  }
  return clone;
}
Program: 180602
Project: 180602
Buggy source:
/** 
 * Returns a string representation of this individual
 * @return a string representation of this individual
 */
@Override public String toString(){
  if (root == null) {
    return null;
  }
 else {
    return root.toString();
  }
}

Fixed version (ground truth):
/** 
 * Returns a string representation of this individual. The string representation is the Epox source code of the program tree.
 * @return a string representation of this individual
 */
@Override public String toString(){
  if (root == null) {
    return null;
  }
 else {
    return root.toString();
  }
}
Program: 180603
Project: 180603
Buggy source:
/** 
 * Evaluates the strongly typed program tree this individual represents and returns the value returned from the root
 * @return the result of evaluating the program tree
 */
public Object evaluate(){
  return root.evaluate();
}

Fixed version (ground truth):
/** 
 * Evaluates the strongly typed program tree this individual represents and returns the value returned from the root. If no root node has been set then  an exception will be thrown.
 * @return the result of evaluating the program tree
 */
public Object evaluate(){
  return root.evaluate();
}
Program: 180604
Project: 180604
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Object[] eval(T program,Parameters params) throws MalformedProgramException {
  int noParamSets=params.getNoParameterSets();
  int noParams=params.getNoParameters();
  String expression=generator.getSource(program);
  Object[] results=new Object[noParamSets];
  for (int i=0; i < noParamSets; i++) {
    parser.undeclareAllVariables();
    Object[] paramSet=params.getParameterSet(i);
    for (int j=0; j < noParams; j++) {
      parser.declareVariable(new Variable(params.getIdentifier(j),paramSet[j]));
    }
    final Node programTree=parser.parse(expression);
    results[i]=programTree.evaluate();
  }
  return results;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Object[] eval(T program,Parameters params) throws MalformedProgramException {
  int noParamSets=params.getNoParameterSets();
  int noParams=params.getNoParameters();
  VariableNode[] declaredVariables=new VariableNode[noParams];
  String expression=generator.getSource(program);
  Object[] results=new Object[noParamSets];
  for (int i=0; i < noParamSets; i++) {
    for (int j=0; j < noParams; j++) {
      parser.undeclare(declaredVariables[j]);
    }
    Object[] paramSet=params.getParameterSet(i);
    for (int j=0; j < noParams; j++) {
      declaredVariables[j]=new VariableNode(new Variable(params.getIdentifier(j),paramSet[j]));
      parser.declare(declaredVariables[j]);
    }
    final Node programTree=parser.parse(expression);
    results[i]=programTree.evaluate();
  }
  return results;
}
Program: 180605
Project: 180605
Buggy source:
/** 
 * Sets the array of nodes to generate program trees from. If automatic configuration is enabled then any value set here will be overwritten by  the   {@link STGPIndividual#SYNTAX} configuration setting on the next config event.
 * @param syntax an array of nodes to generate new program trees from
 */
public void setSyntax(Node[] syntax){
  this.syntax=syntax;
  updateSyntax();
}

Fixed version (ground truth):
/** 
 * Sets the array of nodes to generate program trees from. If automatic configuration is enabled then any value set here will be overwritten by the   {@link STGPIndividual#SYNTAX} configuration setting on the nextconfig event.
 * @param syntax an array of nodes to generate new program trees from
 */
public void setSyntax(Node[] syntax){
  this.syntax=syntax;
  updateSyntax();
}
Program: 180606
Project: 180606
Buggy source:
/** 
 * Sets the random number sequence to use. If automatic configuration is  enabled thenAny value set here will be overwritten by the   {@link RandomSequence#RANDOM_SEQUENCE} configuration setting on the next config event.
 * @param random the random number generator to set
 */
public void setRandomSequence(RandomSequence random){
  this.random=random;
}

Fixed version (ground truth):
/** 
 * Sets the random number sequence to use. If automatic configuration is enabled thenAny value set here will be overwritten by the  {@link RandomSequence#RANDOM_SEQUENCE} configuration setting on the nextconfig event.
 * @param random the random number generator to set
 */
public void setRandomSequence(RandomSequence random){
  this.random=random;
}
Program: 180607
Project: 180607
Buggy source:
/** 
 * Sets the number of individuals to be generated in a population created by the <tt>createPopulation</tt> method. If automatic configuration is  enabled thenAny value set here will be overwritten by the   {@link Population#SIZE} configuration setting on the next config event.
 * @param size the size of the populations generated
 */
public void setPopulationSize(int size){
  this.populationSize=size;
}

Fixed version (ground truth):
/** 
 * Sets the number of individuals to be generated in a population created by the <tt>createPopulation</tt> method. If automatic configuration is enabled thenAny value set here will be overwritten by the  {@link Population#SIZE} configuration setting on the next config event.
 * @param size the size of the populations generated
 */
public void setPopulationSize(int size){
  this.populationSize=size;
}
Program: 180608
Project: 180608
Buggy source:
/** 
 * Sets the required data-type of the program trees generated. If automatic configuration is enabled then any value set here will be overwritten by  the   {@link STGPIndividual#RETURN_TYPE} configuration setting on the next config event.
 * @param returnType the data-type of the generated programs
 */
public void setReturnType(final Class<?> returnType){
  this.returnType=returnType;
  dataTypesTable=null;
}

Fixed version (ground truth):
/** 
 * Sets the required data-type of the program trees generated. If automatic configuration is enabled then any value set here will be overwritten by the   {@link STGPIndividual#RETURN_TYPE} configuration setting on the nextconfig event.
 * @param returnType the data-type of the generated programs
 */
public void setReturnType(final Class<?> returnType){
  this.returnType=returnType;
  dataTypesTable=null;
}
Program: 180609
Project: 180609
Buggy source:
/** 
 * Constructs a <tt>FullInitialisation</tt> with control parameters initially loaded from the config. If the <tt>autoConfig</tt> argument is set to <tt>true</tt> then the configuration will be automatically updated when the config is modified.
 * @param autoConfig whether this operator should automatically update itsconfiguration settings from the config
 */
public FullInitialisation(boolean autoConfig){
  setup();
  if (autoConfig) {
    EventManager.getInstance().add(ConfigEvent.class,this);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a <tt>FullInitialisation</tt> with control parameters initially loaded from the config. If the <tt>autoConfig</tt> argument is set to <tt>true</tt> then the configuration will be automatically updated when the config is modified.
 * @param autoConfig whether this operator should automatically update itsconfiguration settings from the config
 */
public FullInitialisation(boolean autoConfig){
  setup();
  updateSyntax();
  if (autoConfig) {
    EventManager.getInstance().add(ConfigEvent.class,this);
  }
}
Program: 180610
Project: 180610
Buggy source:
/** 
 * Sets up this operator with the appropriate configuration settings. This method is called whenever a <tt>ConfigEvent</tt> occurs for a change in any of the following configuration parameters: <ul> <li>  {@link RandomSequence#RANDOM_SEQUENCE}<li>  {@link Population#SIZE}<li>  {@link STGPIndividual#SYNTAX}<li>  {@link STGPIndividual#RETURN_TYPE}<li>  {@link STGPIndividual#MAXIMUM_DEPTH}<li>  {@link STGPInitialisation#MAXIMUM_INITIAL_DEPTH}<li>  {@link InitialisationMethod#ALLOW_DUPLICATES}</ul>
 */
protected void setup(){
  random=Config.getInstance().get(RANDOM_SEQUENCE);
  populationSize=Config.getInstance().get(SIZE);
  syntax=Config.getInstance().get(SYNTAX);
  returnType=Config.getInstance().get(RETURN_TYPE);
  allowDuplicates=Config.getInstance().get(ALLOW_DUPLICATES);
  Integer maxDepth=Config.getInstance().get(MAXIMUM_DEPTH);
  Integer maxInitialDepth=Config.getInstance().get(MAXIMUM_INITIAL_DEPTH);
  if (maxInitialDepth != null && (maxDepth == null || maxInitialDepth < maxDepth)) {
    depth=maxInitialDepth;
  }
 else {
    depth=maxDepth;
  }
}

Fixed version (ground truth):
/** 
 * Sets up this operator with the appropriate configuration settings. This method is called whenever a <tt>ConfigEvent</tt> occurs for a change in any of the following configuration parameters: <ul> <li>  {@link RandomSequence#RANDOM_SEQUENCE}<li>  {@link Population#SIZE}<li>  {@link STGPIndividual#SYNTAX}<li>  {@link STGPIndividual#RETURN_TYPE}<li>  {@link STGPIndividual#MAXIMUM_DEPTH}<li>  {@link STGPInitialisation#MAXIMUM_INITIAL_DEPTH}<li>  {@link InitialisationMethod#ALLOW_DUPLICATES} (default: <tt>true</tt>)</ul>
 */
protected void setup(){
  random=Config.getInstance().get(RANDOM_SEQUENCE);
  populationSize=Config.getInstance().get(SIZE);
  syntax=Config.getInstance().get(SYNTAX);
  returnType=Config.getInstance().get(RETURN_TYPE);
  allowDuplicates=Config.getInstance().get(ALLOW_DUPLICATES,true);
  Integer maxDepth=Config.getInstance().get(MAXIMUM_DEPTH);
  Integer maxInitialDepth=Config.getInstance().get(MAXIMUM_INITIAL_DEPTH);
  if (maxInitialDepth != null && (maxDepth == null || maxInitialDepth < maxDepth)) {
    depth=maxInitialDepth;
  }
 else {
    depth=(maxDepth == null) ? -1 : maxDepth;
  }
}
Program: 180611
Project: 180611
Buggy source:
/** 
 * Sets the depth of the program trees created by the <tt>createIndividual</tt> method. If automatic configuration is enabled  then any value set here will be overwritten by the   {@link STGPInitialisation#MAXIMUM_INITIAL_DEPTH} configuration setting onthe next config event, or the  {@link STGPIndividual#MAXIMUM_DEPTH} setting if no initial maximum depth is set.
 * @param depth the depth of all program trees generated
 */
public void setDepth(int depth){
  if (depth > dataTypesTable.length) {
    dataTypesTable=null;
  }
  this.depth=depth;
}

Fixed version (ground truth):
/** 
 * Sets the depth of the program trees created by the <tt>createIndividual</tt> method. If automatic configuration is enabled then any value set here will be overwritten by the  {@link STGPInitialisation#MAXIMUM_INITIAL_DEPTH} configuration setting onthe next config event, or the  {@link STGPIndividual#MAXIMUM_DEPTH}setting if no initial maximum depth is set.
 * @param depth the depth of all program trees generated
 */
public void setDepth(int depth){
  if (dataTypesTable != null && depth > dataTypesTable.length) {
    dataTypesTable=null;
  }
  this.depth=depth;
}
Program: 180612
Project: 180612
Buggy source:
/** 
 * Sets the maximum depth of the program trees created by the <tt>createIndividual</tt> method. If automatic configuration is enabled  then any value set here will be overwritten by the   {@link STGPInitialisation#MAXIMUM_INITIAL_DEPTH} configuration setting onthe next config event, or the  {@link STGPIndividual#MAXIMUM_DEPTH} setting if no initial maximum depth is set.
 * @param maxDepth the maximum depth of all program trees generated
 */
public void setMaximumDepth(int maxDepth){
  if (maxDepth > dataTypesTable.length) {
    dataTypesTable=null;
  }
  this.maxDepth=maxDepth;
}

Fixed version (ground truth):
/** 
 * Sets the maximum depth of the program trees created by the <tt>createIndividual</tt> method. If automatic configuration is enabled  then any value set here will be overwritten by the   {@link STGPInitialisation#MAXIMUM_INITIAL_DEPTH} configuration setting onthe next config event, or the  {@link STGPIndividual#MAXIMUM_DEPTH} setting if no initial maximum depth is set.
 * @param maxDepth the maximum depth of all program trees generated
 */
public void setMaximumDepth(int maxDepth){
  if (dataTypesTable != null && maxDepth > dataTypesTable.length) {
    dataTypesTable=null;
  }
  this.maxDepth=maxDepth;
}
Program: 180613
Project: 180613
Buggy source:
/** 
 * Sets up this operator with the appropriate configuration settings. This method is called whenever a <tt>ConfigEvent</tt> occurs for a change in any of the following configuration parameters: <ul> <li>  {@link RandomSequence#RANDOM_SEQUENCE}<li>  {@link Population#SIZE}<li>  {@link STGPIndividual#SYNTAX}<li>  {@link STGPIndividual#RETURN_TYPE}<li>  {@link STGPIndividual#MAXIMUM_DEPTH}<li>  {@link STGPInitialisation#MAXIMUM_INITIAL_DEPTH}<li>  {@link InitialisationMethod#ALLOW_DUPLICATES}</ul>
 */
protected void setup(){
  random=Config.getInstance().get(RANDOM_SEQUENCE);
  populationSize=Config.getInstance().get(SIZE);
  syntax=Config.getInstance().get(SYNTAX);
  returnType=Config.getInstance().get(RETURN_TYPE);
  allowDuplicates=Config.getInstance().get(ALLOW_DUPLICATES);
  Integer maxDepth=Config.getInstance().get(MAXIMUM_DEPTH);
  Integer maxInitialDepth=Config.getInstance().get(MAXIMUM_INITIAL_DEPTH);
  if (maxInitialDepth != null && (maxDepth == null || maxInitialDepth < maxDepth)) {
    this.maxDepth=maxInitialDepth;
  }
 else {
    this.maxDepth=maxDepth;
  }
}

Fixed version (ground truth):
/** 
 * Sets up this operator with the appropriate configuration settings. This method is called whenever a <tt>ConfigEvent</tt> occurs for a change in any of the following configuration parameters: <ul> <li>  {@link RandomSequence#RANDOM_SEQUENCE}<li>  {@link Population#SIZE}<li>  {@link STGPIndividual#SYNTAX}<li>  {@link STGPIndividual#RETURN_TYPE}<li>  {@link STGPIndividual#MAXIMUM_DEPTH}<li>  {@link STGPInitialisation#MAXIMUM_INITIAL_DEPTH}<li>  {@link InitialisationMethod#ALLOW_DUPLICATES} (default: <tt>true</tt>)</ul>
 */
protected void setup(){
  random=Config.getInstance().get(RANDOM_SEQUENCE);
  populationSize=Config.getInstance().get(SIZE);
  syntax=Config.getInstance().get(SYNTAX);
  returnType=Config.getInstance().get(RETURN_TYPE);
  allowDuplicates=Config.getInstance().get(ALLOW_DUPLICATES,true);
  Integer maxDepth=Config.getInstance().get(MAXIMUM_DEPTH);
  Integer maxInitialDepth=Config.getInstance().get(MAXIMUM_INITIAL_DEPTH);
  if (maxInitialDepth != null && (maxDepth == null || maxInitialDepth < maxDepth)) {
    this.maxDepth=maxInitialDepth;
  }
 else {
    this.maxDepth=(maxDepth == null) ? -1 : maxDepth;
  }
}
Program: 180614
Project: 180614
Buggy source:
/** 
 * Constructs a <tt>GrowInitialisation</tt> with control parameters  initially loaded from the config. If the <tt>autoConfig</tt> argument is  set to <tt>true</tt> then the configuration will be automatically updated when the config is modified.
 * @param autoConfig whether this operator should automatically update itsconfiguration settings from the config
 */
public GrowInitialisation(boolean autoConfig){
  setup();
  if (autoConfig) {
    EventManager.getInstance().add(ConfigEvent.class,this);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a <tt>GrowInitialisation</tt> with control parameters  initially loaded from the config. If the <tt>autoConfig</tt> argument is  set to <tt>true</tt> then the configuration will be automatically updated when the config is modified.
 * @param autoConfig whether this operator should automatically update itsconfiguration settings from the config
 */
public GrowInitialisation(boolean autoConfig){
  setup();
  updateSyntax();
  if (autoConfig) {
    EventManager.getInstance().add(ConfigEvent.class,this);
  }
}
Program: 180616
Project: 180616
Buggy source:
/** 
 * Returns the life cycle manager for all models undergoing evolution.
 * @return the Life instance that is managing life cycle events for the models undergoing evolution.
 */
public Life getLife(){
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the life cycle manager for all models undergoing evolution.
 * @return the Life instance that is managing life cycle events for the models undergoing evolution.
 */
public Life getLife(){
  return life;
}
Program: 180617
Project: 180617
Buggy source:
/** 
 * Adds the given model to the end of the queue of models to be executed.
 * @param model a model to be executed.
 */
public void enqueue(Model model){
  models.add(model);
}

Fixed version (ground truth):
/** 
 * Adds the given model to the end of the queue of models to be executed.
 * @param model a model to be executed.
 */
public void enqueue(Model model){
  models.add(model);
  stats.put(model,new Stats(model,life));
}
Program: 180618
Project: 180618
Buggy source:
@Override public int compare(T o1,T o2){
  double fitness1=evaluator.getFitness(o1);
  double fitness2=evaluator.getFitness(o2);
  if (fitness1 > fitness2) {
    return -1;
  }
 else   if (fitness1 == fitness2) {
    return 0;
  }
 else {
    return 1;
  }
}

Fixed version (ground truth):
@Override public int compare(T o1,T o2){
  double fitness1=evaluator.getFitness(o1);
  double fitness2=evaluator.getFitness(o2);
  if (fitness1 > fitness2) {
    return reverse ? 1 : -1;
  }
 else   if (fitness1 == fitness2) {
    return 0;
  }
 else {
    return reverse ? -1 : 1;
  }
}
Program: 180619
Project: 180619
Buggy source:
public FitnessComparator(FitnessEvaluator<T> evaluator){
  this.evaluator=evaluator;
}

Fixed version (ground truth):
public FitnessComparator(FitnessEvaluator<T> evaluator,boolean reverse){
  this.evaluator=evaluator;
  this.reverse=reverse;
}
Program: 180620
Project: 180620
Buggy source:
@Override public void setSelectionPool(final List<CandidateProgram> pool){
  if ((pool == null) || pool.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  this.pool=pool;
  if (overSelection) {
    Collections.sort(pool,Collections.reverseOrder());
  }
  overSelectionProportion=getOverSelectionProportion(pool.size());
  final double[] adjusted=new double[pool.size()];
  double adjustedSum=0.0;
  for (int i=0; i < adjusted.length; i++) {
    final double adjustedFitness=fitnessEvaluator.getFitness(pool.get(i));
    adjusted[i]=adjustedFitness;
    adjustedSum+=adjustedFitness;
  }
  normalised=new double[pool.size()];
  double normalisedSum=0.0;
  for (int i=0; i < normalised.length; i++) {
    normalisedSum+=(adjusted[i] / adjustedSum);
    normalised[i]=normalisedSum;
  }
  normalised[normalised.length - 1]=1.0;
}

Fixed version (ground truth):
@Override public void setSelectionPool(final List<CandidateProgram> pool){
  if ((pool == null) || pool.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  this.pool=pool;
  if (overSelection) {
    Collections.sort(pool,new FitnessComparator(fitnessEvaluator,false));
  }
  overSelectionProportion=getOverSelectionProportion(pool.size());
  final double[] adjusted=new double[pool.size()];
  double adjustedSum=0.0;
  for (int i=0; i < adjusted.length; i++) {
    final double adjustedFitness=fitnessEvaluator.getFitness(pool.get(i));
    adjusted[i]=adjustedFitness;
    adjustedSum+=adjustedFitness;
  }
  normalised=new double[pool.size()];
  double normalisedSum=0.0;
  for (int i=0; i < normalised.length; i++) {
    normalisedSum+=(adjusted[i] / adjustedSum);
    normalised[i]=normalisedSum;
  }
  normalised[normalised.length - 1]=1.0;
}
Program: 180621
Project: 180621
Buggy source:
/** 
 * Tests Santa Fe trail with standard setup. Expecting success rate between % and %.
 */
@Test public void testSantaFeTrail(){
  final int LOWER_SUCCESS=0;
  final int UPPER_SUCCESS=0;
  final AntTrail model=new SantaFeTrail(getEvolver(),600);
  setupModel(model);
  int noSuccess=getNoSuccesses(model);
  assertBetween("String_Node_Str",LOWER_SUCCESS,UPPER_SUCCESS,noSuccess);
}

Fixed version (ground truth):
/** 
 * Tests Santa Fe trail with standard setup. Expecting success rate between % and %.
 */
@Test public void testSantaFeTrail(){
  final int LOWER_SUCCESS=0;
  final int UPPER_SUCCESS=0;
  final AntTrail model=new SantaFeTrail(getEvolver(),600);
  setupModel(model);
  int noSuccess=getNoSuccesses(model,false,false);
  assertBetween("String_Node_Str",LOWER_SUCCESS,UPPER_SUCCESS,noSuccess);
}