nus-yam/ex-repair huggingface dataset:
Program: 180716
Project: 180716
Buggy source:
private Symbol getNthSymbol(int n,int current){
  if (n == current) {
    return this;
  }
  for (  Symbol child : children) {
    if (child instanceof NonTerminalSymbol) {
      NonTerminalSymbol nt=(NonTerminalSymbol)child;
      Symbol nth=nt.getNthSymbol(n,current + 1);
      if (nth != null) {
        return nth;
      }
      current+=nt.getNoSymbols();
    }
 else {
      if (n == current++) {
        return child;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private Symbol getNthSymbol(int n,int current){
  if (n == current) {
    return this;
  }
  for (  Symbol child : children) {
    if (child instanceof NonTerminalSymbol) {
      NonTerminalSymbol nt=(NonTerminalSymbol)child;
      Symbol nth=nt.getNthSymbol(n,current + 1);
      if (nth != null) {
        return nth;
      }
      current+=nt.getNoSymbols();
    }
 else {
      if (n == ++current) {
        return child;
      }
    }
  }
  return null;
}
Program: 180717
Project: 180717
Buggy source:
/** 
 * Constructor for the full initialiser.
 * @param model The current controlling model. Run parameters such as the population size will be obtained from this.
 */
public FullInitialiser(GPModel model){
  this.model=model;
  LifeCycleManager.getLifeCycleManager().addGenerationListener(new GenerationAdapter(){
    @Override public void onGenerationStart(){
      reset();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Constructor for the full initialiser.
 * @param model The current controlling model. Run parameters such as the population size will be obtained from this.
 */
public FullInitialiser(GPModel model){
  this.model=model;
  terminals=new ArrayList<Node>();
  functions=new ArrayList<Node>();
  LifeCycleManager.getLifeCycleManager().addGenerationListener(new GenerationAdapter(){
    @Override public void onGenerationStart(){
      reset();
    }
  }
);
}
Program: 180718
Project: 180718
Buggy source:
private void reset(){
  rng=model.getRNG();
  terminals.clear();
  functions.clear();
  syntax=model.getSyntax();
  maxInitialDepth=model.getInitialMaxDepth();
  for (  Node n : syntax) {
    if (n.getArity() == 0) {
      terminals.add(n);
    }
 else {
      functions.add(n);
    }
  }
}

Fixed version (ground truth):
private void reset(){
  rng=model.getRNG();
  terminals.clear();
  functions.clear();
  syntax=model.getSyntax();
  maxInitialDepth=model.getInitialMaxDepth();
  popSize=model.getPopulationSize();
  for (  Node n : syntax) {
    if (n.getArity() == 0) {
      terminals.add(n);
    }
 else {
      functions.add(n);
    }
  }
}
Program: 180719
Project: 180719
Buggy source:
/** 
 * Constructor for the grow initialiser.
 * @param model The current controlling model. Run parameters such as the population size will be obtained from this.
 */
public GrowInitialiser(GPModel model){
  this.model=model;
  terminals=new ArrayList<Node>();
  functions=new ArrayList<Node>();
  LifeCycleManager.getLifeCycleManager().addGenerationListener(new GenerationAdapter(){
    @Override public void onGenerationStart(){
      reset();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Constructor for the grow initialiser.
 * @param model The current controlling model. Run parameters such as the population size will be obtained from this.
 */
public GrowInitialiser(GPModel model){
  this.model=model;
  terminals=new ArrayList<Node>();
  functions=new ArrayList<Node>();
  reset();
  LifeCycleManager.getLifeCycleManager().addGenerationListener(new GenerationAdapter(){
    @Override public void onGenerationStart(){
      reset();
    }
  }
);
}
Program: 180720
Project: 180720
Buggy source:
/** 
 * Evaluating an <code>IfFunction</code> involves evaluating the first child,  if it evaluates to true then the second child is evaluated as the result.  Otherwise the third child is evaluated and returned.
 */
@Override public Boolean evaluate(){
  boolean c1=((Boolean)getChild(0).evaluate()).booleanValue();
  if (c1) {
    return ((Boolean)getChild(1).evaluate()).booleanValue();
  }
 else {
    return ((Boolean)getChild(2).evaluate()).booleanValue();
  }
}

Fixed version (ground truth):
/** 
 * Evaluating an <code>IfFunction</code> involves evaluating the first child,  if it evaluates to true then the second child is evaluated as the result.  Otherwise the third child is evaluated and returned.
 */
@Override public Boolean evaluate(){
  boolean c1=((Boolean)getChild(0).evaluate()).booleanValue();
  if (c1) {
    return (Boolean)getChild(1).evaluate();
  }
 else {
    return (Boolean)getChild(2).evaluate();
  }
}
Program: 180721
Project: 180721
Buggy source:
@Override public GRCandidateProgram mutate(CandidateProgram program){
  GRCandidateProgram mutatedProgram=(GRCandidateProgram)program;
  NonTerminalSymbol parseTree=mutatedProgram.getParseTree();
  List<NonTerminalSymbol> nonTerminals=parseTree.getNonTerminalSymbols();
  int selection=rng.nextInt(nonTerminals.size());
  NonTerminalSymbol point=nonTerminals.get(selection);
  int originalDepth=point.getDepth();
  GrammarRule rule=point.getGrammarRule();
  NonTerminalSymbol replacement=init.growParseTree(originalDepth,rule);
  point.setChildren(replacement.removeChildren());
  return mutatedProgram;
}

Fixed version (ground truth):
@Override public GRCandidateProgram mutate(CandidateProgram program){
  GRCandidateProgram mutatedProgram=(GRCandidateProgram)program.clone();
  NonTerminalSymbol parseTree=mutatedProgram.getParseTree();
  List<Integer> nonTerminals=parseTree.getNonTerminalIndexes();
  int selection=nonTerminals.get(rng.nextInt(nonTerminals.size()));
  NonTerminalSymbol point=(NonTerminalSymbol)parseTree.getNthSymbol(selection);
  int originalDepth=point.getDepth();
  GrammarRule rule=point.getGrammarRule();
  NonTerminalSymbol replacement=init.growParseTree(originalDepth,rule);
  if (selection == 0) {
    mutatedProgram.setParseTree(replacement);
  }
 else {
    parseTree.setNthSymbol(selection,replacement);
  }
  FunctionParser parser=new FunctionParser();
  try {
    parser.parse(parseTree.toString());
  }
 catch (  MalformedProgramException e) {
    System.out.println("String_Node_Str");
  }
  return mutatedProgram;
}
Program: 180722
Project: 180722
Buggy source:
@Override public GRCandidateProgram[] crossover(CandidateProgram p1,CandidateProgram p2){
  GRCandidateProgram program1=(GRCandidateProgram)p1;
  GRCandidateProgram program2=(GRCandidateProgram)p2;
  GRCandidateProgram child1=(GRCandidateProgram)program1.clone();
  GRCandidateProgram child2=(GRCandidateProgram)program2.clone();
  NonTerminalSymbol parseTree1=child1.getParseTree();
  NonTerminalSymbol parseTree2=child2.getParseTree();
  List<NonTerminalSymbol> nonTerminals1=parseTree1.getNonTerminalSymbols();
  List<NonTerminalSymbol> nonTerminals2=parseTree2.getNonTerminalSymbols();
  int selection=rng.nextInt(nonTerminals1.size());
  NonTerminalSymbol point1=nonTerminals1.get(selection);
  List<NonTerminalSymbol> matchingNonTerminals=new ArrayList<NonTerminalSymbol>();
  for (  NonTerminalSymbol nt : nonTerminals2) {
    if (nt.equals(point1)) {
      matchingNonTerminals.add(nt);
    }
  }
  if (matchingNonTerminals.isEmpty()) {
    return null;
  }
 else {
    selection=rng.nextInt(matchingNonTerminals.size());
    NonTerminalSymbol point2=matchingNonTerminals.get(selection);
    if (point1.getNoChildren() != point2.getNoChildren()) {
      System.out.println("String_Node_Str");
    }
    for (int i=0; i < point1.getNoChildren(); i++) {
      Symbol child=point1.getChild(i);
      point1.setChild(i,point2.getChild(i));
      point2.setChild(i,child);
    }
  }
  return new GRCandidateProgram[]{child1,child2};
}

Fixed version (ground truth):
@Override public GRCandidateProgram[] crossover(CandidateProgram p1,CandidateProgram p2){
  GRCandidateProgram program1=(GRCandidateProgram)p1;
  GRCandidateProgram program2=(GRCandidateProgram)p2;
  GRCandidateProgram child1=(GRCandidateProgram)program1.clone();
  GRCandidateProgram child2=(GRCandidateProgram)program2.clone();
  NonTerminalSymbol parseTree1=child1.getParseTree();
  NonTerminalSymbol parseTree2=child2.getParseTree();
  List<NonTerminalSymbol> nonTerminals1=parseTree1.getNonTerminalSymbols();
  List<NonTerminalSymbol> nonTerminals2=parseTree2.getNonTerminalSymbols();
  int selection=rng.nextInt(nonTerminals1.size());
  NonTerminalSymbol point1=nonTerminals1.get(selection);
  List<NonTerminalSymbol> matchingNonTerminals=new ArrayList<NonTerminalSymbol>();
  for (  NonTerminalSymbol nt : nonTerminals2) {
    if (nt.equals(point1)) {
      matchingNonTerminals.add(nt);
    }
  }
  if (matchingNonTerminals.isEmpty()) {
    return null;
  }
 else {
    selection=rng.nextInt(matchingNonTerminals.size());
    NonTerminalSymbol point2=matchingNonTerminals.get(selection);
    List<Symbol> temp=point1.getChildren();
    point1.setChildren(point2.getChildren());
    point2.setChildren(temp);
  }
  return new GRCandidateProgram[]{child1,child2};
}
Program: 180723
Project: 180723
Buggy source:
@Override public List<CandidateProgram<Action>> getInitialPopulation(){
  return generatePopulation();
}

Fixed version (ground truth):
@Override public List<CandidateProgram<Object>> getInitialPopulation(){
  return generatePopulation();
}
Program: 180724
Project: 180724
Buggy source:
/** 
 * Construcor for AA hybrid SDI method
 * @param model The GP model in use
 * @param semMod The relevant semantic module
 */
public AntHybridSemanticallyDrivenInitialiser(GPModel<Action> model,SemanticModule<Action> semMod){
  this.model=model;
  this.semMod=(AntSemanticModule)semMod;
}

Fixed version (ground truth):
/** 
 * Construcor for AA hybrid SDI method
 * @param model The GP model in use
 * @param semMod The relevant semantic module
 */
public AntHybridSemanticallyDrivenInitialiser(GPModel<Object> model,SemanticModule<Object> semMod){
  this.model=model;
  this.semMod=(AntSemanticModule)semMod;
}
Program: 180726
Project: 180726
Buggy source:
/** 
 * Constructor for semantically driven initialisation for artificial ant
 * @param model The GP model in use
 * @param semMod The semantic module on use
 */
public AntSemanticallyDrivenInitialiser(GPModel<Action> model,SemanticModule<Action> semMod){
  this.model=model;
  this.semMod=(AntSemanticModule)semMod;
}

Fixed version (ground truth):
/** 
 * Constructor for semantically driven initialisation for artificial ant
 * @param model The GP model in use
 * @param semMod The semantic module on use
 */
public AntSemanticallyDrivenInitialiser(GPModel<Object> model,SemanticModule<Object> semMod){
  this.model=model;
  this.semMod=(AntSemanticModule)semMod;
}
Program: 180727
Project: 180727
Buggy source:
@Override public List<CandidateProgram<Action>> getInitialPopulation(){
  return generatePopulation();
}

Fixed version (ground truth):
@Override public List<CandidateProgram<Object>> getInitialPopulation(){
  return generatePopulation();
}
Program: 180729
Project: 180729
Buggy source:
@Override public List<CandidateProgram<TYPE>> getInitialPopulation(){
  int popSize=model.getPopulationSize();
  List<CandidateProgram<TYPE>> firstGen=new ArrayList<CandidateProgram<TYPE>>(popSize);
  this.semanticModule.start();
  for (int i=0; i < popSize; i++) {
    CandidateProgram<TYPE> candidate;
    Representation representation;
    do {
      candidate=new CandidateProgram<TYPE>(full.buildFullNodeTree(model.getInitialMaxDepth()),model);
      representation=semanticModule.codeToBehaviour(candidate);
    }
 while (firstGen.contains(candidate) || representation.isConstant());
    firstGen.add(candidate);
  }
  this.semanticModule.stop();
  return firstGen;
}

Fixed version (ground truth):
@Override public List<CandidateProgram<TYPE>> getInitialPopulation(){
  int popSize=model.getPopulationSize();
  List<CandidateProgram<TYPE>> firstGen=new ArrayList<CandidateProgram<TYPE>>(popSize);
  this.semanticModule.start();
  for (int i=0; i < popSize; i++) {
    CandidateProgram<TYPE> candidate;
    Representation representation;
    do {
      candidate=new CandidateProgram<TYPE>(full.buildFullNodeTree(model.getInitialMaxDepth()),model);
      representation=semanticModule.codeToBehaviour(candidate.getRootNode());
    }
 while (firstGen.contains(candidate) || representation.isConstant());
    firstGen.add(candidate);
  }
  this.semanticModule.stop();
  return firstGen;
}
Program: 180730
Project: 180730
Buggy source:
@Override public List<CandidateProgram<TYPE>> getInitialPopulation(){
  int popSize=model.getPopulationSize();
  List<CandidateProgram<TYPE>> firstGen=new ArrayList<CandidateProgram<TYPE>>(popSize);
  this.semanticModule.start();
  for (int i=0; i < popSize; i++) {
    CandidateProgram<TYPE> candidate;
    Representation representation;
    do {
      candidate=new CandidateProgram<TYPE>(full.buildFullNodeTree(model.getInitialMaxDepth()),model);
      representation=semanticModule.codeToBehaviour(candidate);
    }
 while (firstGen.contains(candidate) || representation.isConstant());
    firstGen.add(candidate);
  }
  for (int i=0; i < popSize; i++) {
    CandidateProgram<TYPE> candidate;
    Representation representation;
    Node<TYPE> reducedCandidate;
    candidate=firstGen.get(i);
    representation=semanticModule.codeToBehaviour(candidate);
    reducedCandidate=semanticModule.behaviourToCode(representation);
    firstGen.set(i,new CandidateProgram<TYPE>(reducedCandidate,model));
  }
  this.semanticModule.stop();
  return firstGen;
}

Fixed version (ground truth):
@Override public List<CandidateProgram<TYPE>> getInitialPopulation(){
  int popSize=model.getPopulationSize();
  List<CandidateProgram<TYPE>> firstGen=new ArrayList<CandidateProgram<TYPE>>(popSize);
  this.semanticModule.start();
  for (int i=0; i < popSize; i++) {
    CandidateProgram<TYPE> candidate;
    Representation representation;
    do {
      candidate=new CandidateProgram<TYPE>(full.buildFullNodeTree(model.getInitialMaxDepth()),model);
      representation=semanticModule.codeToBehaviour(candidate.getRootNode());
    }
 while (firstGen.contains(candidate) || representation.isConstant());
    firstGen.add(candidate);
  }
  for (int i=0; i < popSize; i++) {
    CandidateProgram<TYPE> candidate;
    Representation representation;
    Node<TYPE> reducedCandidate;
    candidate=firstGen.get(i);
    representation=semanticModule.codeToBehaviour(candidate.getRootNode());
    reducedCandidate=semanticModule.behaviourToCode(representation);
    firstGen.set(i,new CandidateProgram<TYPE>(reducedCandidate,model));
  }
  this.semanticModule.stop();
  return firstGen;
}
Program: 180733
Project: 180733
Buggy source:
/** 
 * Constructor for Ant Semantic Module
 * @param list List of terminal nodes
 * @param model The GPModel object
 * @param ant The Ant object
 * @param antLandscape The AntLanscape object
 */
public AntSemanticModule(List<TerminalNode<Action>> list,GPModel<Action> model,Ant ant,AntLandscape landscape){
  this.model=model;
  this.ant=ant;
  this.landscape=landscape;
}

Fixed version (ground truth):
/** 
 * Constructor for Ant Semantic Module
 * @param list List of terminal nodes
 * @param model The GPModel object
 * @param ant The Ant object
 * @param antLandscape The AntLanscape object
 */
public AntSemanticModule(List<TerminalNode<Action>> list,Ant ant,AntLandscape landscape){
  this.ant=ant;
  this.landscape=landscape;
}
Program: 180734
Project: 180734
Buggy source:
/** 
 * Build a full node tree with a given depth. As the node tree will be full  the maximum and minimum depths of the returned node tree should be equal  to the depth argument. The internal and leaf nodes will be selected from  the function and terminal sets respectively, as provided by the model.
 * @param depth The depth of the full node tree, where the depth is the number of nodes from the root.
 * @return The root node of a randomly generated full node tree of the requested depth.
 */
public Node<TYPE> buildFullNodeTree(int depth){
  int randomIndex=(int)Math.floor(Math.random() * model.getFunctions().size());
  Node<TYPE> root=(Node<TYPE>)model.getFunctions().get(randomIndex).clone();
  fillChildren(root,0,depth);
  return root;
}

Fixed version (ground truth):
/** 
 * Build a full node tree with a given depth. As the node tree will be full  the maximum and minimum depths of the returned node tree should be equal  to the depth argument. The internal and leaf nodes will be selected from  the function and terminal sets respectively, as provided by the model.
 * @param depth The depth of the full node tree, where the depth is the number of nodes from the root.
 * @return The root node of a randomly generated full node tree of the requested depth.
 */
public Node<TYPE> buildFullNodeTree(int depth){
  Node<TYPE> root;
  if (depth == 0) {
    int randomIndex=(int)Math.floor(Math.random() * model.getTerminals().size());
    root=(Node<TYPE>)model.getTerminals().get(randomIndex).clone();
  }
 else {
    int randomIndex=(int)Math.floor(Math.random() * model.getFunctions().size());
    root=(Node<TYPE>)model.getFunctions().get(randomIndex).clone();
    fillChildren(root,0,depth);
  }
  return root;
}
Program: 180735
Project: 180735
Buggy source:
/** 
 * Perform point mutation on the given CandidateProgram. Each node in the  program tree is considered in turn, with each having the given  probability of actually being exchanged. Given that a node is chosen  then a new function or terminal node of the same arity is used to  replace it.
 * @param program The CandidateProgram selected to undergo this mutation operation.
 * @return A CandidateProgram that was the result of a point mutation on the provided CandidateProgram.
 */
@Override public CandidateProgram<TYPE> mutate(CandidateProgram<TYPE> program){
  List<Node<TYPE>> syntax=model.getSyntax();
  int length=program.getProgramLength();
  for (int i=0; i < length; i++) {
    if (Math.random() < pointProbability) {
      Node<TYPE> node=(Node<TYPE>)program.getNthNode(i);
      int arity=node.getArity();
      int rand=(int)Math.floor(Math.random() * syntax.size());
      for (int j=0; j < syntax.size(); j++) {
        int index=(j + rand) % syntax.size();
        Node<TYPE> n=syntax.get(index);
        if (n.getArity() == arity) {
          n=(Node<TYPE>)n.clone();
          for (int k=0; k < arity; k++) {
            n.setChild(k,node.getChild(k));
          }
          program.setNthNode(i,n);
          break;
        }
      }
    }
  }
  return program;
}

Fixed version (ground truth):
/** 
 * Perform point mutation on the given CandidateProgram. Each node in the  program tree is considered in turn, with each having the given  probability of actually being exchanged. Given that a node is chosen  then a new function or terminal node of the same arity is used to  replace it.
 * @param program The CandidateProgram selected to undergo this mutation operation.
 * @return A CandidateProgram that was the result of a point mutation on the provided CandidateProgram.
 */
@Override public CandidateProgram<TYPE> mutate(CandidateProgram<TYPE> program){
  List<Node<TYPE>> syntax=model.getSyntax();
  int length=program.getProgramLength();
  for (int i=0; i < length; i++) {
    if (Math.random() < pointProbability) {
      Node<TYPE> node=(Node<TYPE>)program.getNthNode(i);
      int arity=node.getArity();
      int rand=(int)Math.floor(Math.random() * syntax.size());
      for (int j=0; j < syntax.size(); j++) {
        int index=(j + rand) % syntax.size();
        Node<TYPE> n=syntax.get(index);
        if ((n.getArity() == arity) && !nodesEqual(node,n)) {
          n=(Node<TYPE>)n.clone();
          for (int k=0; k < arity; k++) {
            n.setChild(k,node.getChild(k));
          }
          program.setNthNode(i,n);
          break;
        }
      }
    }
  }
  return program;
}
Program: 180737
Project: 180737
Buggy source:
/** 
 * Evaluating an <code>IfFoodAheadFunction</code> involves identifying the  next location the ant would move to on the landscape were it to be moved.  If this position contains a food item then the first child is evaluated  and executed, else the second child is evaluated and executed. <p>One of the children will thus have been evaluated (triggering  execution of actions at the <code>TerminalNodes</code>) and then this  method which must return an Action, returns Action.DO_NOTHING which any   functions higher up in the program tree will execute, but with no  effect.</p>
 */
@Override public Action evaluate(){
  Point ahead=landscape.getNextLocation(ant.getLocation(),ant.getOrientation());
  if (landscape.isFoodLocation(ahead)) {
    ((Action)getChild(0).evaluate()).execute();
  }
 else {
    ((Action)getChild(1).evaluate()).execute();
  }
  return Action.DO_NOTHING;
}

Fixed version (ground truth):
/** 
 * Evaluating an <code>IfFoodAheadFunction</code> involves identifying the  next location the ant would move to on the landscape were it to be moved.  If this position contains a food item then the first child is evaluated  and executed, else the second child is evaluated and executed. <p>One of the children will thus have been evaluated (triggering  execution of actions at the <code>TerminalNodes</code>) and then this  method which must return an Action, returns Action.DO_NOTHING which any   functions higher up in the program tree will execute, but with no  effect.</p>
 */
@Override public Action evaluate(){
  if (ant.isFoodAhead()) {
    ((Action)getChild(0).evaluate()).execute();
  }
 else {
    ((Action)getChild(1).evaluate()).execute();
  }
  return Action.DO_NOTHING;
}
Program: 180738
Project: 180738
Buggy source:
private void gatherDistinctFunctionStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_AVE) || stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_STDEV) || stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_MAX)|| stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_MIN)) {
    double[] noDFunctions=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      noDFunctions[i]=pop.get(i).getNoDistinctFunctions();
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_AVE)) {
      stats.put(GenerationStatField.NO_DISTINCT_FUNCTIONS_AVE,Double.toString(ave(noDFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_STDEV)) {
      stats.put(GenerationStatField.NO_DISTINCT_FUNCTIONS_STDEV,Double.toString(stdev(noDFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_MAX)) {
      stats.put(GenerationStatField.NO_DISTINCT_FUNCTIONS_MAX,Double.toString(max(noDFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_MIN)) {
      stats.put(GenerationStatField.NO_DISTINCT_FUNCTIONS_MIN,Double.toString(min(noDFunctions)));
    }
  }
}

Fixed version (ground truth):
private void gatherDistinctFunctionStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_AVE) || stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_STDEV) || stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_MAX)|| stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_MIN)) {
    double[] noDFunctions=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      noDFunctions[i]=pop.get(i).getNoDistinctFunctions();
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_AVE)) {
      stats.put(GenerationStatField.NO_DISTINCT_FUNCTIONS_AVE,new Double(ave(noDFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_STDEV)) {
      stats.put(GenerationStatField.NO_DISTINCT_FUNCTIONS_STDEV,new Double(stdev(noDFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_MAX)) {
      stats.put(GenerationStatField.NO_DISTINCT_FUNCTIONS_MAX,new Double(max(noDFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_FUNCTIONS_MIN)) {
      stats.put(GenerationStatField.NO_DISTINCT_FUNCTIONS_MIN,new Double(min(noDFunctions)));
    }
  }
}
Program: 180739
Project: 180739
Buggy source:
private void gatherDepthStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.DEPTH_AVE) || stats.containsKey(GenerationStatField.DEPTH_STDEV) || stats.containsKey(GenerationStatField.DEPTH_MAX)|| stats.containsKey(GenerationStatField.DEPTH_MIN)|| stats.containsKey(GenerationStatField.AVE_NODES_PER_DEPTH)) {
    double[] depths=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      depths[i]=pop.get(i).getProgramDepth();
    }
    if (stats.containsKey(GenerationStatField.DEPTH_AVE)) {
      stats.put(GenerationStatField.DEPTH_AVE,Double.toString(ave(depths)));
    }
    if (stats.containsKey(GenerationStatField.DEPTH_STDEV)) {
      stats.put(GenerationStatField.DEPTH_STDEV,Double.toString(stdev(depths)));
    }
    if (stats.containsKey(GenerationStatField.DEPTH_MAX)) {
      stats.put(GenerationStatField.DEPTH_MAX,Double.toString(max(depths)));
    }
    if (stats.containsKey(GenerationStatField.DEPTH_MIN)) {
      stats.put(GenerationStatField.DEPTH_MIN,Double.toString(min(depths)));
    }
    if (stats.containsKey(GenerationStatField.AVE_NODES_PER_DEPTH)) {
      stats.put(GenerationStatField.AVE_NODES_PER_DEPTH,getAveNodesPerDepth(pop));
    }
  }
}

Fixed version (ground truth):
private void gatherDepthStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.DEPTH_AVE) || stats.containsKey(GenerationStatField.DEPTH_STDEV) || stats.containsKey(GenerationStatField.DEPTH_MAX)|| stats.containsKey(GenerationStatField.DEPTH_MIN)|| stats.containsKey(GenerationStatField.AVE_NODES_PER_DEPTH)) {
    double[] depths=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      depths[i]=pop.get(i).getProgramDepth();
    }
    if (stats.containsKey(GenerationStatField.DEPTH_AVE)) {
      stats.put(GenerationStatField.DEPTH_AVE,new Double(ave(depths)));
    }
    if (stats.containsKey(GenerationStatField.DEPTH_STDEV)) {
      stats.put(GenerationStatField.DEPTH_STDEV,new Double(stdev(depths)));
    }
    if (stats.containsKey(GenerationStatField.DEPTH_MAX)) {
      stats.put(GenerationStatField.DEPTH_MAX,new Double(max(depths)));
    }
    if (stats.containsKey(GenerationStatField.DEPTH_MIN)) {
      stats.put(GenerationStatField.DEPTH_MIN,new Double(min(depths)));
    }
    if (stats.containsKey(GenerationStatField.AVE_NODES_PER_DEPTH)) {
      stats.put(GenerationStatField.AVE_NODES_PER_DEPTH,getAveNodesPerDepth(pop));
    }
  }
}
Program: 180740
Project: 180740
Buggy source:
private void gatherDistinctTerminalStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_AVE) || stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_STDEV) || stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_MAX)|| stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_MIN)) {
    double[] noDTerminals=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      noDTerminals[i]=pop.get(i).getNoDistinctTerminals();
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_AVE)) {
      stats.put(GenerationStatField.NO_DISTINCT_TERMINALS_AVE,Double.toString(ave(noDTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_STDEV)) {
      stats.put(GenerationStatField.NO_DISTINCT_TERMINALS_STDEV,Double.toString(stdev(noDTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_MAX)) {
      stats.put(GenerationStatField.NO_DISTINCT_TERMINALS_MAX,Double.toString(max(noDTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_MIN)) {
      stats.put(GenerationStatField.NO_DISTINCT_TERMINALS_MIN,Double.toString(min(noDTerminals)));
    }
  }
}

Fixed version (ground truth):
private void gatherDistinctTerminalStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_AVE) || stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_STDEV) || stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_MAX)|| stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_MIN)) {
    double[] noDTerminals=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      noDTerminals[i]=pop.get(i).getNoDistinctTerminals();
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_AVE)) {
      stats.put(GenerationStatField.NO_DISTINCT_TERMINALS_AVE,new Double(ave(noDTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_STDEV)) {
      stats.put(GenerationStatField.NO_DISTINCT_TERMINALS_STDEV,new Double(stdev(noDTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_MAX)) {
      stats.put(GenerationStatField.NO_DISTINCT_TERMINALS_MAX,new Double(max(noDTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_DISTINCT_TERMINALS_MIN)) {
      stats.put(GenerationStatField.NO_DISTINCT_TERMINALS_MIN,new Double(min(noDTerminals)));
    }
  }
}
Program: 180741
Project: 180741
Buggy source:
private void gatherFunctionStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_AVE) || stats.containsKey(GenerationStatField.NO_FUNCTIONS_STDEV) || stats.containsKey(GenerationStatField.NO_FUNCTIONS_MAX)|| stats.containsKey(GenerationStatField.NO_FUNCTIONS_MIN)) {
    double[] noFunctions=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      noFunctions[i]=pop.get(i).getNoFunctions();
    }
    if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_AVE)) {
      stats.put(GenerationStatField.NO_FUNCTIONS_AVE,Double.toString(ave(noFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_STDEV)) {
      stats.put(GenerationStatField.NO_FUNCTIONS_STDEV,Double.toString(stdev(noFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_MAX)) {
      stats.put(GenerationStatField.NO_FUNCTIONS_MAX,Double.toString(max(noFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_MIN)) {
      stats.put(GenerationStatField.NO_FUNCTIONS_MIN,Double.toString(min(noFunctions)));
    }
  }
}

Fixed version (ground truth):
private void gatherFunctionStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_AVE) || stats.containsKey(GenerationStatField.NO_FUNCTIONS_STDEV) || stats.containsKey(GenerationStatField.NO_FUNCTIONS_MAX)|| stats.containsKey(GenerationStatField.NO_FUNCTIONS_MIN)) {
    double[] noFunctions=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      noFunctions[i]=pop.get(i).getNoFunctions();
    }
    if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_AVE)) {
      stats.put(GenerationStatField.NO_FUNCTIONS_AVE,new Double(ave(noFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_STDEV)) {
      stats.put(GenerationStatField.NO_FUNCTIONS_STDEV,new Double(stdev(noFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_MAX)) {
      stats.put(GenerationStatField.NO_FUNCTIONS_MAX,new Double(max(noFunctions)));
    }
    if (stats.containsKey(GenerationStatField.NO_FUNCTIONS_MIN)) {
      stats.put(GenerationStatField.NO_FUNCTIONS_MIN,new Double(min(noFunctions)));
    }
  }
}
Program: 180743
Project: 180743
Buggy source:
private void gatherLengthStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.LENGTH_AVE) || stats.containsKey(GenerationStatField.LENGTH_STDEV) || stats.containsKey(GenerationStatField.LENGTH_MAX)|| stats.containsKey(GenerationStatField.LENGTH_MIN)) {
    double[] lengths=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      lengths[i]=pop.get(i).getProgramLength();
    }
    if (stats.containsKey(GenerationStatField.LENGTH_AVE)) {
      stats.put(GenerationStatField.LENGTH_AVE,Double.toString(ave(lengths)));
    }
    if (stats.containsKey(GenerationStatField.LENGTH_STDEV)) {
      stats.put(GenerationStatField.LENGTH_STDEV,Double.toString(stdev(lengths)));
    }
    if (stats.containsKey(GenerationStatField.LENGTH_MAX)) {
      stats.put(GenerationStatField.LENGTH_MAX,Double.toString(max(lengths)));
    }
    if (stats.containsKey(GenerationStatField.LENGTH_MIN)) {
      stats.put(GenerationStatField.LENGTH_MIN,Double.toString(min(lengths)));
    }
  }
}

Fixed version (ground truth):
private void gatherLengthStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.LENGTH_AVE) || stats.containsKey(GenerationStatField.LENGTH_STDEV) || stats.containsKey(GenerationStatField.LENGTH_MAX)|| stats.containsKey(GenerationStatField.LENGTH_MIN)) {
    double[] lengths=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      lengths[i]=pop.get(i).getProgramLength();
    }
    if (stats.containsKey(GenerationStatField.LENGTH_AVE)) {
      stats.put(GenerationStatField.LENGTH_AVE,new Double(ave(lengths)));
    }
    if (stats.containsKey(GenerationStatField.LENGTH_STDEV)) {
      stats.put(GenerationStatField.LENGTH_STDEV,new Double(stdev(lengths)));
    }
    if (stats.containsKey(GenerationStatField.LENGTH_MAX)) {
      stats.put(GenerationStatField.LENGTH_MAX,new Double(max(lengths)));
    }
    if (stats.containsKey(GenerationStatField.LENGTH_MIN)) {
      stats.put(GenerationStatField.LENGTH_MIN,new Double(min(lengths)));
    }
  }
}
Program: 180744
Project: 180744
Buggy source:
private void gatherTerminalStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.NO_TERMINALS_AVE) || stats.containsKey(GenerationStatField.NO_TERMINALS_STDEV) || stats.containsKey(GenerationStatField.NO_TERMINALS_MAX)|| stats.containsKey(GenerationStatField.NO_TERMINALS_MIN)) {
    double[] noTerminals=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      noTerminals[i]=pop.get(i).getNoTerminals();
    }
    if (stats.containsKey(GenerationStatField.NO_TERMINALS_AVE)) {
      stats.put(GenerationStatField.NO_TERMINALS_AVE,Double.toString(ave(noTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_TERMINALS_STDEV)) {
      stats.put(GenerationStatField.NO_TERMINALS_STDEV,Double.toString(stdev(noTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_TERMINALS_MAX)) {
      stats.put(GenerationStatField.NO_TERMINALS_MAX,Double.toString(max(noTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_TERMINALS_MIN)) {
      stats.put(GenerationStatField.NO_TERMINALS_MIN,Double.toString(min(noTerminals)));
    }
  }
}

Fixed version (ground truth):
private void gatherTerminalStats(Map<GenerationStatField,Object> stats,List<CandidateProgram<TYPE>> pop){
  if (stats.containsKey(GenerationStatField.NO_TERMINALS_AVE) || stats.containsKey(GenerationStatField.NO_TERMINALS_STDEV) || stats.containsKey(GenerationStatField.NO_TERMINALS_MAX)|| stats.containsKey(GenerationStatField.NO_TERMINALS_MIN)) {
    double[] noTerminals=new double[pop.size()];
    for (int i=0; i < pop.size(); i++) {
      noTerminals[i]=pop.get(i).getNoTerminals();
    }
    if (stats.containsKey(GenerationStatField.NO_TERMINALS_AVE)) {
      stats.put(GenerationStatField.NO_TERMINALS_AVE,new Double(ave(noTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_TERMINALS_STDEV)) {
      stats.put(GenerationStatField.NO_TERMINALS_STDEV,new Double(stdev(noTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_TERMINALS_MAX)) {
      stats.put(GenerationStatField.NO_TERMINALS_MAX,new Double(max(noTerminals)));
    }
    if (stats.containsKey(GenerationStatField.NO_TERMINALS_MIN)) {
      stats.put(GenerationStatField.NO_TERMINALS_MIN,new Double(min(noTerminals)));
    }
  }
}
Program: 180745
Project: 180745
Buggy source:
/** 
 * Moves the ant's position one place in the direction it is currently  facing based upon its orientation. If the ant's new location on the  landscape contains a food pellet then the ant will attempt to eat it.  If the ant has reached its maximum number of allowed time steps then  this method will do nothing.
 */
public void move(){
  if (moves >= maxMoves) {
    return;
  }
  if (orientation == EAST) {
    if (xLocation < 31) {
      xLocation++;
    }
 else {
      xLocation=0;
    }
  }
 else   if (orientation == NORTH) {
    if (yLocation > 0) {
      yLocation--;
    }
 else {
      yLocation=31;
    }
  }
 else   if (orientation == WEST) {
    if (xLocation > 0) {
      xLocation--;
    }
 else {
      xLocation=31;
    }
  }
 else   if (orientation == SOUTH) {
    if (yLocation < 31) {
      yLocation++;
    }
 else {
      yLocation=0;
    }
  }
  moves++;
  if (landscape.isFoodLocation(getLocation())) {
    this.eatFood();
    landscape.removeFoodLocation(getLocation());
  }
}

Fixed version (ground truth):
/** 
 * Moves the ant's position one place in the direction it is currently  facing based upon its orientation. If the ant's new location on the  landscape contains a food pellet then the ant will attempt to eat it.  If the ant has reached its maximum number of allowed time steps then  this method will do nothing.
 */
public void move(){
  if (timesteps >= maxTimesteps) {
    return;
  }
  if (orientation == EAST) {
    if (xLocation < 31) {
      xLocation++;
    }
 else {
      xLocation=0;
    }
  }
 else   if (orientation == NORTH) {
    if (yLocation > 0) {
      yLocation--;
    }
 else {
      yLocation=31;
    }
  }
 else   if (orientation == WEST) {
    if (xLocation > 0) {
      xLocation--;
    }
 else {
      xLocation=31;
    }
  }
 else   if (orientation == SOUTH) {
    if (yLocation < 31) {
      yLocation++;
    }
 else {
      yLocation=0;
    }
  }
  timesteps++;
  if (landscape.isFoodLocation(getLocation())) {
    this.eatFood();
    landscape.removeFoodLocation(getLocation());
  }
}
Program: 180746
Project: 180746
Buggy source:
/** 
 * Turn the ant to the right relative to its current orientation. For  example, if calling getOrientation() returns EAST before calling this  method it will return SOUTH after calling this method. If the ant  has reached its maximum number of allowed time steps then this method  will do nothing.
 */
public void turnRight(){
  if (moves >= maxMoves) {
    return;
  }
  if (orientation == EAST) {
    orientation=SOUTH;
  }
 else   if (orientation == SOUTH) {
    orientation=WEST;
  }
 else   if (orientation == WEST) {
    orientation=NORTH;
  }
 else   if (orientation == NORTH) {
    orientation=EAST;
  }
  moves++;
}

Fixed version (ground truth):
/** 
 * Turn the ant to the right relative to its current orientation. For  example, if calling getOrientation() returns EAST before calling this  method it will return SOUTH after calling this method. If the ant  has reached its maximum number of allowed time steps then this method  will do nothing.
 */
public void turnRight(){
  if (timesteps >= maxTimesteps) {
    return;
  }
  if (orientation == EAST) {
    orientation=SOUTH;
  }
 else   if (orientation == SOUTH) {
    orientation=WEST;
  }
 else   if (orientation == WEST) {
    orientation=NORTH;
  }
 else   if (orientation == NORTH) {
    orientation=EAST;
  }
  timesteps++;
}
Program: 180747
Project: 180747
Buggy source:
/** 
 * Increments the number of food pellets the ant has eaten.
 */
public void eatFood(){
  if (moves >= maxMoves) {
    return;
  }
  foodEaten++;
}

Fixed version (ground truth):
/** 
 * Increments the number of food pellets the ant has eaten.
 */
public void eatFood(){
  if (timesteps >= maxTimesteps) {
    return;
  }
  foodEaten++;
}
Program: 180748
Project: 180748
Buggy source:
/** 
 * Skipping will cause the ant to fill one timestep without moving in its  ant landscape. This is required for the skip algorithm to prevent the  ant falling into dead ends.
 */
public void skip(){
  moves++;
}

Fixed version (ground truth):
/** 
 * Skipping will cause the ant to fill one timestep without moving in its  ant landscape. This is required for the skip algorithm to prevent the  ant falling into dead ends.
 */
public void skip(){
  timesteps++;
}
Program: 180749
Project: 180749
Buggy source:
/** 
 * Turn the ant to the left relative to its current orientation. For  example, if calling getOrientation() returns EAST before calling this  method it will return NORTH after calling this method. If the ant  has reached its maximum number of allowed time steps then this method  will do nothing.
 */
public void turnLeft(){
  if (moves >= maxMoves) {
    return;
  }
  if (orientation == EAST) {
    orientation=NORTH;
  }
 else   if (orientation == NORTH) {
    orientation=WEST;
  }
 else   if (orientation == WEST) {
    orientation=SOUTH;
  }
 else   if (orientation == SOUTH) {
    orientation=EAST;
  }
  moves++;
}

Fixed version (ground truth):
/** 
 * Turn the ant to the left relative to its current orientation. For  example, if calling getOrientation() returns EAST before calling this  method it will return NORTH after calling this method. If the ant  has reached its maximum number of allowed time steps then this method  will do nothing.
 */
public void turnLeft(){
  if (timesteps >= maxTimesteps) {
    return;
  }
  if (orientation == EAST) {
    orientation=NORTH;
  }
 else   if (orientation == NORTH) {
    orientation=WEST;
  }
 else   if (orientation == WEST) {
    orientation=SOUTH;
  }
 else   if (orientation == SOUTH) {
    orientation=EAST;
  }
  timesteps++;
}
Program: 180750
Project: 180750
Buggy source:
/** 
 * Reset the ant using the same number of time steps and on the same  <code>AntLandscape</code>.
 */
public void reset(){
  orientation=EAST;
  moves=0;
  xLocation=0;
  yLocation=0;
  foodEaten=0;
}

Fixed version (ground truth):
/** 
 * Reset the ant using the same number of time steps and on the same  <code>AntLandscape</code>.
 */
public void reset(){
  orientation=EAST;
  timesteps=0;
  xLocation=0;
  yLocation=0;
  foodEaten=0;
}
Program: 180751
Project: 180751
Buggy source:
/** 
 * Returns the maximum number of time steps the ant is allowed to  move. Turning, moving and skipping all count as one time step.
 * @return the maximum number of time steps the ant is allowed to move
 */
public int getMaxMoves(){
  return maxMoves;
}

Fixed version (ground truth):
/** 
 * Returns the maximum number of time steps the ant is allowed to  move. Turning, moving and skipping all count as one time step.
 * @return the maximum number of time steps the ant is allowed to move
 */
public int getMaxMoves(){
  return maxTimesteps;
}
Program: 180752
Project: 180752
Buggy source:
@Override public String toString(){
  return xLocation + "String_Node_Str" + yLocation+ "String_Node_Str"+ orientation+ "String_Node_Str"+ moves;
}

Fixed version (ground truth):
@Override public String toString(){
  return xLocation + "String_Node_Str" + yLocation+ "String_Node_Str"+ orientation+ "String_Node_Str"+ timesteps;
}
Program: 180753
Project: 180753
Buggy source:
/** 
 * Gets the number of time steps the ant has completed. Turning, moving and  skipping all count as one time step.
 * @return The number of time steps the ant has gone through.
 */
public int getMoves(){
  return moves;
}

Fixed version (ground truth):
/** 
 * Gets the number of time steps the ant has completed. Turning, moving and  skipping all count as one time step.
 * @return The number of time steps the ant has gone through.
 */
public int getMoves(){
  return timesteps;
}
Program: 180755
Project: 180755
Buggy source:
/** 
 * Crossover the two <code>CandidatePrograms</code> provided as arguments  using Koza crossover. The crossover points will be chosen from the  function or terminal sets with the probability assigned at construction  or the default value of 90% function node.
 * @param program1 The first CandidateProgram selected to undergo Koza crossover.
 * @param program2 The second CandidateProgram selected to undergo Koza crossover.
 */
@Override public CandidateProgram<TYPE>[] crossover(CandidateProgram<TYPE> program1,CandidateProgram<TYPE> program2){
  int swapPoint1=getCrossoverPoint(program1);
  int swapPoint2=getCrossoverPoint(program2);
  Node<TYPE> subtree1=(Node<TYPE>)program1.getNthNode(swapPoint1).clone();
  Node<TYPE> subtree2=(Node<TYPE>)program2.getNthNode(swapPoint2).clone();
  program1.setNthNode(swapPoint1,subtree2);
  program2.setNthNode(swapPoint2,subtree1);
  return new CandidateProgram[]{program1,program2};
}

Fixed version (ground truth):
/** 
 * Crossover the two <code>CandidatePrograms</code> provided as arguments  using Koza crossover. The crossover points will be chosen from the  function or terminal sets with the probability assigned at construction  or the default value of 90% function node.
 * @param program1 The first CandidateProgram selected to undergo Koza crossover.
 * @param program2 The second CandidateProgram selected to undergo Koza crossover.
 */
@Override public CandidateProgram<TYPE>[] crossover(CandidateProgram<TYPE> program1,CandidateProgram<TYPE> program2){
  int swapPoint1=getCrossoverPoint(program1);
  int swapPoint2=getCrossoverPoint(program2);
  Node<TYPE> subtree1=(Node<TYPE>)program1.getNthNode(swapPoint1);
  Node<TYPE> subtree2=(Node<TYPE>)program2.getNthNode(swapPoint2);
  program1.setNthNode(swapPoint1,subtree2);
  program2.setNthNode(swapPoint2,subtree1);
  return new CandidateProgram[]{program1,program2};
}
Program: 180756
Project: 180756
Buggy source:
/** 
 * Crossover the two <code>CandidatePrograms</code> provided as arguments  using uniform swap points. Random crossover points are chosen at random  in both programs, the genetic material at the points are then exchanged. The resulting programs are returned as new CandidateProgram objects.
 * @param program1 The first CandidateProgram selected to undergo uniform  point crossover.
 * @param program2 The second CandidateProgram selected to undergo uniform  point crossover.
 */
@Override public CandidateProgram<TYPE>[] crossover(CandidateProgram<TYPE> program1,CandidateProgram<TYPE> program2){
  int swapPoint1=(int)Math.floor(Math.random() * program1.getProgramLength());
  int swapPoint2=(int)Math.floor(Math.random() * program2.getProgramLength());
  Node<TYPE> subTree1=(Node<TYPE>)program1.getNthNode(swapPoint1).clone();
  Node<TYPE> subTree2=(Node<TYPE>)program2.getNthNode(swapPoint2).clone();
  program1.setNthNode(swapPoint1,subTree2);
  program2.setNthNode(swapPoint2,subTree1);
  return new CandidateProgram[]{program1,program2};
}

Fixed version (ground truth):
/** 
 * Crossover the two <code>CandidatePrograms</code> provided as arguments  using uniform swap points. Random crossover points are chosen at random  in both programs, the genetic material at the points are then exchanged. The resulting programs are returned as new CandidateProgram objects.
 * @param program1 The first CandidateProgram selected to undergo uniform  point crossover.
 * @param program2 The second CandidateProgram selected to undergo uniform  point crossover.
 */
@Override public CandidateProgram<TYPE>[] crossover(CandidateProgram<TYPE> program1,CandidateProgram<TYPE> program2){
  int swapPoint1=(int)Math.floor(Math.random() * program1.getProgramLength());
  int swapPoint2=(int)Math.floor(Math.random() * program2.getProgramLength());
  Node<TYPE> subTree1=(Node<TYPE>)program1.getNthNode(swapPoint1);
  Node<TYPE> subTree2=(Node<TYPE>)program2.getNthNode(swapPoint2);
  program1.setNthNode(swapPoint1,subTree2);
  program2.setNthNode(swapPoint2,subTree1);
  return new CandidateProgram[]{program1,program2};
}