Program: 180690
Project: 180690
Buggy source:
/** 
 * Performs one generation of an evolutionary run. The method receives the  previous population and then performs one generation and returns the  resultant population.  <p> A generation consists of the following sequence of events: <ol> <li>Select the elites and put them into the next population.</li> <li>Select a breeding pool of programs.</li> <li>Randomly choose an operator based upon probablities from the model: <ul> <li>Crossover - pass control to crossover component.</li> <li>Mutation - pass control to mutation component.</li> <li>Reproduction - pass control to reproduction component.</li> </ul> </li> <li>Insert the result of the operator into the next population.</li> <li>Start back at 3. until the next population is full.</li> <li>Return the new population.</li> </ol> <p> The necessary events trigger life cycle events.
 * @param previousPop the previous population which will undergo manipulation to create the next population.
 * @return the population derived from performing genetic operations on theprevious population.
 */
public List<CandidateProgram> generation(final int generationNumber,final List<CandidateProgram> previousPop){
  updateModel();
  LifeCycleManager.getLifeCycleManager().onGenerationStart();
  final long startTime=System.nanoTime();
  StatsManager.getStatsManager().addGenerationData(GEN_NUMBER,generationNumber);
  List<CandidateProgram> pop=new ArrayList<CandidateProgram>(popSize);
  do {
    pop.addAll(elitism.elitism(previousPop));
    final List<CandidateProgram> pool=poolSelection.getPool(previousPop);
    programSelector.setSelectionPool(pool);
    while (pop.size() < popSize) {
      final double random=rng.nextDouble();
      if (random < crossoverProbability) {
        final CandidateProgram[] children=crossover.crossover();
        for (        final CandidateProgram c : children) {
          if (pop.size() < popSize) {
            pop.add(c);
          }
        }
      }
 else       if (random < crossoverProbability + mutationProbability) {
        pop.add(mutation.mutate());
      }
 else {
        pop.add(reproduction.reproduce());
      }
    }
    pop=LifeCycleManager.getLifeCycleManager().onGeneration(pop);
    if (pop == null) {
      reversions++;
    }
  }
 while (pop == null);
  StatsManager.getStatsManager().addGenerationData(GEN_REVERSIONS,reversions);
  StatsManager.getStatsManager().addGenerationData(GEN_POPULATION,pop);
  StatsManager.getStatsManager().addGenerationData(GEN_TIME,(System.nanoTime() - startTime));
  LifeCycleManager.getLifeCycleManager().onGenerationEnd();
  return pop;
}

Fixed version (ground truth):
/** 
 * Performs one generation of an evolutionary run. The method receives the  previous population and then performs one generation and returns the  resultant population.  <p> A generation consists of the following sequence of events: <ol> <li>Select the elites and put them into the next population.</li> <li>Select a breeding pool of programs.</li> <li>Randomly choose an operator based upon probablities from the model: <ul> <li>Crossover - pass control to crossover component.</li> <li>Mutation - pass control to mutation component.</li> <li>Reproduction - pass control to reproduction component.</li> </ul> </li> <li>Insert the result of the operator into the next population.</li> <li>Start back at 3. until the next population is full.</li> <li>Return the new population.</li> </ol> <p> The necessary events trigger life cycle events.
 * @param previousPop the previous population which will undergo manipulation to create the next population.
 * @return the population derived from performing genetic operations on theprevious population.
 */
public List<CandidateProgram> generation(final int generationNumber,final List<CandidateProgram> previousPop){
  LifeCycleManager.getLifeCycleManager().onGenerationStart();
  final long startTime=System.nanoTime();
  StatsManager.getStatsManager().addGenerationData(GEN_NUMBER,generationNumber);
  List<CandidateProgram> pop=new ArrayList<CandidateProgram>(popSize);
  do {
    pop.addAll(elitism.elitism(previousPop));
    final List<CandidateProgram> pool=poolSelection.getPool(previousPop);
    programSelector.setSelectionPool(pool);
    while (pop.size() < popSize) {
      final double random=rng.nextDouble();
      if (random < crossoverProbability) {
        final CandidateProgram[] children=crossover.crossover();
        for (        final CandidateProgram c : children) {
          if (pop.size() < popSize) {
            pop.add(c);
          }
        }
      }
 else       if (random < crossoverProbability + mutationProbability) {
        pop.add(mutation.mutate());
      }
 else {
        pop.add(reproduction.reproduce());
      }
    }
    pop=LifeCycleManager.getLifeCycleManager().onGeneration(pop);
    if (pop == null) {
      reversions++;
    }
  }
 while (pop == null);
  StatsManager.getStatsManager().addGenerationData(GEN_REVERSIONS,reversions);
  StatsManager.getStatsManager().addGenerationData(GEN_POPULATION,pop);
  StatsManager.getStatsManager().addGenerationData(GEN_TIME,(System.nanoTime() - startTime));
  LifeCycleManager.getLifeCycleManager().onGenerationEnd();
  return pop;
}