nus-yam/ex-repair huggingface dataset:
Program: 144054
Project: 144054
Buggy source:
public int sample_one_z_uncollapsed(int domain_id,int classifier_id){
  update_before_sampling_z(domain_id,classifier_id);
  int total_cnt=hdp.prob_table_assignment_for_item(domain_id,classifier_id);
  double z_probabilities[]=new double[total_cnt];
  for (int i=0; i < total_cnt; i++) {
    z_probabilities[i]=Math.log(hdp.pdf[i].prob);
  }
  int topic_id=0;
  error_rate[total_cnt - 1]=(1.0 * disagreement[domain_id][classifier_id]) / num_example[domain_id];
  for (int i=0; i < total_cnt; i++) {
    topic_id=hdp.pdf[i].topic;
    z_probabilities[i]+=disagreement[domain_id][classifier_id] * Math.log(error_rate[topic_id]) + (num_example[domain_id] - disagreement[domain_id][classifier_id]) * Math.log(1 - error_rate[topic_id]);
  }
  for (int i=1; i < total_cnt; i++) {
    z_probabilities[i]=sumLogProb(z_probabilities[i - 1],z_probabilities[i]);
  }
  double uniform=Math.log(rm.nextDouble()) + z_probabilities[total_cnt - 1];
  int loc=total_cnt - 1;
  for (int i=0; i < total_cnt; i++) {
    if (z_probabilities[i] > uniform) {
      loc=i;
      break;
    }
  }
  update_after_sampling_z(domain_id,classifier_id,hdp.pdf[loc].table,hdp.pdf[loc].topic);
  return hdp.pdf[loc].topic;
}

Fixed version (ground truth):
public int sample_one_z_uncollapsed(int domain_id,int classifier_id){
  update_before_sampling_z(domain_id,classifier_id);
  int total_cnt=hdp.prob_table_assignment_for_item(domain_id,classifier_id);
  double z_probabilities[]=new double[total_cnt];
  for (int i=0; i < total_cnt; i++) {
    z_probabilities[i]=Math.log(hdp.pdf[i].prob);
  }
  int topic_id=0;
  error_rate[hdp.pdf[total_cnt - 1].topic]=(1.0 * disagreement[domain_id][classifier_id]) / num_example[domain_id];
  for (int i=0; i < total_cnt; i++) {
    topic_id=hdp.pdf[i].topic;
    z_probabilities[i]+=disagreement[domain_id][classifier_id] * Math.log(error_rate[topic_id]) + (num_example[domain_id] - disagreement[domain_id][classifier_id]) * Math.log(1 - error_rate[topic_id]);
  }
  for (int i=1; i < total_cnt; i++) {
    z_probabilities[i]=sumLogProb(z_probabilities[i - 1],z_probabilities[i]);
  }
  double uniform=Math.log(rm.nextDouble()) + z_probabilities[total_cnt - 1];
  int loc=total_cnt - 1;
  for (int i=0; i < total_cnt; i++) {
    if (z_probabilities[i] > uniform) {
      loc=i;
      break;
    }
  }
  update_after_sampling_z(domain_id,classifier_id,hdp.pdf[loc].table,hdp.pdf[loc].topic);
  return hdp.pdf[loc].topic;
}
Program: 144055
Project: 144055
Buggy source:
public void check_error_negative(){
  for (int i=0; i < err_cnt.length; i++) {
    if (err_cnt[i][0] < 0 || err_cnt[i][1] < 0) {
      System.out.println("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void check_error_negative(){
}
Program: 144056
Project: 144056
Buggy source:
private void projectOnConstraint(int constraintIndex,int[] variableIndexes,Vector variableCopiesSum){
  Vector variables=variableCopies.get(constraintIndex);
  Vector multipliers=lagrangeMultipliers.get(constraintIndex);
  Vector consensusVariables=Vectors.build(variableIndexes.length,currentPoint.type());
  consensusVariables.set(0,variableIndexes.length - 1,currentPoint.get(variableIndexes));
  multipliers.addInPlace(variableCopies.get(constraintIndex).sub(consensusVariables).mult(augmentedLagrangianParameter));
  try {
    variables=constraints.get(constraintIndex).project(consensusVariables);
  }
 catch (  NonSymmetricMatrixException e) {
    logger.error("String_Node_Str");
  }
catch (  NonPositiveDefiniteMatrixException e) {
    logger.error("String_Node_Str");
  }
  Vector termPoint=Vectors.build(currentPoint.size(),currentPoint.type());
  termPoint.set(variableIndexes,variables.add(multipliers.div(augmentedLagrangianParameter)));
  variableCopiesSum.add(termPoint);
}

Fixed version (ground truth):
private void projectOnConstraint(int constraintIndex,int numberOfObjectiveTerms,int[] variableIndexes,Vector variableCopiesSum){
  Vector variables=variableCopies.get(numberOfObjectiveTerms + constraintIndex);
  Vector multipliers=lagrangeMultipliers.get(numberOfObjectiveTerms + constraintIndex);
  Vector consensusVariables=Vectors.build(variableIndexes.length,currentPoint.type());
  consensusVariables.set(0,variableIndexes.length - 1,currentPoint.get(variableIndexes));
  multipliers.addInPlace(variables.sub(consensusVariables).mult(augmentedLagrangianParameter));
  try {
    variables=constraints.get(constraintIndex).project(consensusVariables);
  }
 catch (  NonSymmetricMatrixException e) {
    logger.error("String_Node_Str");
  }
catch (  NonPositiveDefiniteMatrixException e) {
    logger.error("String_Node_Str");
  }
  Vector termPoint=Vectors.build(currentPoint.size(),currentPoint.type());
  termPoint.set(variableIndexes,variables.add(multipliers.div(augmentedLagrangianParameter)));
  variableCopiesSum.addInPlace(termPoint);
}
Program: 144057
Project: 144057
Buggy source:
private void solveSubProblem(int subProblemIndex,int[] variableIndexes,Vector variableCopiesSum){
  Vector variables=variableCopies.get(subProblemIndex);
  Vector multipliers=lagrangeMultipliers.get(subProblemIndex);
  Vector consensusVariables=Vectors.build(variableIndexes.length,currentPoint.type());
  consensusVariables.set(0,variableIndexes.length - 1,currentPoint.get(variableIndexes));
  multipliers.addInPlace(variableCopies.get(subProblemIndex).sub(consensusVariables).mult(augmentedLagrangianParameter));
  variables.set(0,variables.size() - 1,consensusVariables.sub(multipliers.div(augmentedLagrangianParameter)));
  if (objective.getValue(variables,subProblemIndex) > 0) {
    variables=new NewtonSolver.Builder(new SubProblemObjectiveFunction(objective.getTerm(subProblemIndex),consensusVariables,multipliers),variables).build().solve();
    if (objective.getValue(variables,subProblemIndex) < 0) {
      variables=((LinearFunction)objective.getTerm(subProblemIndex)).projectToHyperplane(consensusVariables);
    }
  }
  Vector termPoint=Vectors.build(currentPoint.size(),currentPoint.type());
  termPoint.set(variableIndexes,variables.add(multipliers.div(augmentedLagrangianParameter)));
  variableCopiesSum.addInPlace(termPoint);
}

Fixed version (ground truth):
private void solveSubProblem(int subProblemIndex,int[] variableIndexes,Vector variableCopiesSum){
  Vector variables=variableCopies.get(subProblemIndex);
  Vector multipliers=lagrangeMultipliers.get(subProblemIndex);
  Vector consensusVariables=Vectors.build(variableIndexes.length,currentPoint.type());
  consensusVariables.set(0,variableIndexes.length - 1,currentPoint.get(variableIndexes));
  multipliers.addInPlace(variables.sub(consensusVariables).mult(augmentedLagrangianParameter));
  variables.set(0,variables.size() - 1,consensusVariables.sub(multipliers.div(augmentedLagrangianParameter)));
  if (objective.getValue(variables,subProblemIndex) > 0) {
    variables=new NewtonSolver.Builder(new SubProblemObjectiveFunction(objective.getTerm(subProblemIndex),consensusVariables,multipliers),variables).build().solve();
    if (objective.getValue(variables,subProblemIndex) < 0) {
      variables=((LinearFunction)objective.getTerm(subProblemIndex)).projectToHyperplane(consensusVariables);
    }
  }
  Vector termPoint=Vectors.build(currentPoint.size(),currentPoint.type());
  termPoint.set(variableIndexes,variables.add(multipliers.div(augmentedLagrangianParameter)));
  variableCopiesSum.addInPlace(termPoint);
}
Program: 144059
Project: 144059
Buggy source:
@Override public Vector project(Vector point) throws NonSymmetricMatrixException, NonPositiveDefiniteMatrixException {
  if (linearSystemMatrixCholesky == null) {
    Matrix linearSystemMatrix=new Matrix(A.getRowDimension() + A.getColumnDimension(),A.getRowDimension() + A.getColumnDimension());
    linearSystemMatrix.setSubMatrix(0,A.getColumnDimension() - 1,0,A.getColumnDimension() - 1,Matrix.generateIdentityMatrix(A.getColumnDimension()));
    linearSystemMatrix.setSubMatrix(0,A.getColumnDimension() - 1,A.getColumnDimension(),linearSystemMatrix.getColumnDimension() - 1,A.transpose());
    linearSystemMatrix.setSubMatrix(A.getColumnDimension(),linearSystemMatrix.getRowDimension() - 1,0,A.getColumnDimension() - 1,A);
    linearSystemMatrixCholesky=new CholeskyDecomposition(linearSystemMatrix);
  }
  Vector linearSystemVector=Vectors.build(point.size() + A.getRowDimension(),point.type());
  linearSystemVector.set(0,point.size() - 1,point);
  linearSystemVector.set(point.size(),linearSystemVector.size() - 1,b);
  return linearSystemMatrixCholesky.solve(linearSystemVector).get(0,point.size() - 1);
}

Fixed version (ground truth):
@Override public Vector project(Vector point) throws NonSymmetricMatrixException, NonPositiveDefiniteMatrixException {
  if (linearSystemMatrixCholesky == null) {
    Matrix linearSystemMatrix=new Matrix(A.getRowDimension() + A.getColumnDimension(),A.getRowDimension() + A.getColumnDimension());
    linearSystemMatrix.setSubMatrix(0,A.getColumnDimension() - 1,0,A.getColumnDimension() - 1,Matrix.generateIdentityMatrix(A.getColumnDimension()));
    linearSystemMatrix.setSubMatrix(0,A.getColumnDimension() - 1,A.getColumnDimension(),linearSystemMatrix.getColumnDimension() - 1,A.transpose());
    linearSystemMatrix.setSubMatrix(A.getColumnDimension(),linearSystemMatrix.getRowDimension() - 1,0,A.getColumnDimension() - 1,A);
    linearSystemMatrixCholesky=new SingularValueDecomposition(linearSystemMatrix);
  }
  Vector linearSystemVector=Vectors.build(point.size() + A.getRowDimension(),point.type());
  linearSystemVector.set(0,point.size() - 1,point);
  linearSystemVector.set(point.size(),linearSystemVector.size() - 1,b);
  return linearSystemMatrixCholesky.solve(linearSystemVector).get(0,point.size() - 1);
}
Program: 144060
Project: 144060
Buggy source:
@Test public void testSaxpyPlusConstant(){
  int vectorSize=1000;
  SparseVector vector1=new SparseVector(vectorSize + 1,new int[]{1,5,8,35,56,1000},new double[]{0.53,0.32,0.91,0.05,0,5.63});
  SparseVector vector2=new SparseVector(vectorSize,new int[]{2,5,6,8},new double[]{0.33,0.64,1.97,0.56});
  double alpha=2.5;
  SparseVector expectedVector=new SparseVector(vectorSize + 1,new int[]{1,2,5,6,8,35,56,1000},new double[]{0.53,alpha * 0.33,0.32 + alpha * 0.64,alpha * 1.97,0.91 + alpha * 0.56,0.05,0,5.63});
  SparseVector actualVector=vector1.saxpyPlusConstant(alpha,vector2);
  Assert.assertTrue(expectedVector.equals(actualVector));
}

Fixed version (ground truth):
@Test public void testSaxpyPlusConstant(){
  int vectorSize=1000;
  SparseVector vector1=new SparseVector(vectorSize + 1,new int[]{1,5,8,35,56,1000},new double[]{0.53,0.32,0.91,0.05,0,5.63});
  SparseVector vector2=new SparseVector(vectorSize,new int[]{2,5,6,8},new double[]{0.33,0.64,1.97,0.56});
  double alpha=2.5;
  SparseVector expectedVector=new SparseVector(vectorSize + 1,new int[]{1,2,5,6,8,35,56,1000},new double[]{0.53,alpha * 0.33,0.32 + alpha * 0.64,alpha * 1.97,0.91 + alpha * 0.56,0.05,0,5.63 + alpha});
  SparseVector actualVector=vector1.saxpyPlusConstant(alpha,vector2);
  Assert.assertTrue(expectedVector.equals(actualVector));
}
Program: 144061
Project: 144061
Buggy source:
@Override public Vector.VectorElement next(){
  if (!hasNext())   throw new NoSuchElementException();
  Vector.VectorElement vectorElement=new Vector.VectorElement(this.nextIndex,SparseVector.this.indexes[this.nextIndex]);
  this.nextIndex++;
  return vectorElement;
}

Fixed version (ground truth):
@Override public Vector.VectorElement next(){
  if (!hasNext())   throw new NoSuchElementException();
  Vector.VectorElement vectorElement=new Vector.VectorElement(SparseVector.this.indexes[this.nextIndex],SparseVector.this.values[this.nextIndex]);
  this.nextIndex++;
  return vectorElement;
}
Program: 144062
Project: 144062
Buggy source:
private void performIterationUpdates(){
  previousPoint=currentPoint;
  previousGradient=currentGradient;
  previousObjectiveValue=currentObjectiveValue;
  Vector variableCopiesSum=Vectors.build(currentPoint.size(),currentPoint.type());
  for (int subProblemIndex=0; subProblemIndex < objective.getNumberOfTerms(); subProblemIndex++) {
    int[] variableIndexes=objective.getTermVariables(subProblemIndex);
    final int currentSubProblemIndex=subProblemIndex;
    taskExecutor.submit(() -> solveSubProblem(currentSubProblemIndex,variableIndexes,variableCopiesSum));
  }
  for (int constraintIndex=0; constraintIndex < constraints.size(); constraintIndex++) {
    int[] variableIndexes=constraintsVariablesIndexes.get(constraintIndex);
    final int currentConstraintIndex=constraintIndex;
    taskExecutor.submit(() -> projectOnConstraint(currentConstraintIndex,variableIndexes,variableCopiesSum));
  }
  currentPoint=variableCopiesSum.divElementwise(variableCopiesCounts);
  for (int variableIndex=0; variableIndex < currentPoint.size(); variableIndex++)   if (currentPoint.get(variableIndex) < 0)   currentPoint.set(variableIndex,0);
 else   if (currentPoint.get(variableIndex) > 1)   currentPoint.set(variableIndex,1);
  currentGradient=objective.getGradient(currentPoint);
  currentObjectiveValue=objective.getValue(currentPoint);
}

Fixed version (ground truth):
private void performIterationUpdates(){
  previousPoint=currentPoint;
  previousGradient=currentGradient;
  previousObjectiveValue=currentObjectiveValue;
  Vector variableCopiesSum=Vectors.build(currentPoint.size(),currentPoint.type());
  List<Callable<Object>> subProblemTasks=new ArrayList<>();
  for (int subProblemIndex=0; subProblemIndex < objective.getNumberOfTerms(); subProblemIndex++) {
    int[] variableIndexes=objective.getTermVariables(subProblemIndex);
    final int currentSubProblemIndex=subProblemIndex;
    subProblemTasks.add(Executors.callable(() -> solveSubProblem(currentSubProblemIndex,variableIndexes,variableCopiesSum)));
  }
  for (int constraintIndex=0; constraintIndex < constraints.size(); constraintIndex++) {
    int[] variableIndexes=constraintsVariablesIndexes.get(constraintIndex);
    final int currentConstraintIndex=constraintIndex;
    subProblemTasks.add(Executors.callable(() -> projectOnConstraint(currentConstraintIndex,variableIndexes,variableCopiesSum)));
  }
  try {
    taskExecutor.invokeAll(subProblemTasks);
  }
 catch (  InterruptedException e) {
    logger.error("String_Node_Str");
  }
  currentPoint=variableCopiesSum.divElementwise(variableCopiesCounts);
  for (int variableIndex=0; variableIndex < currentPoint.size(); variableIndex++)   if (currentPoint.get(variableIndex) < 0)   currentPoint.set(variableIndex,0);
 else   if (currentPoint.get(variableIndex) > 1)   currentPoint.set(variableIndex,1);
  currentGradient=objective.getGradient(currentPoint);
  currentObjectiveValue=objective.getValue(currentPoint);
}
Program: 144063
Project: 144063
Buggy source:
public void gibbs_one_iteration_uncollapsed(){
  sample_error_rate_uncollapsed();
  sample_z_uncollapsed();
  sample_tables_topic_uncollapsed();
  sample_l_uncolapsed();
}

Fixed version (ground truth):
public void gibbs_one_iteration_uncollapsed(){
  sample_error_rate_uncollapsed();
  check_error_negative();
  sample_z_uncollapsed();
  check_error_negative();
  sample_tables_topic_uncollapsed();
  check_error_negative();
  sample_l_uncolapsed();
  check_error_negative();
}
Program: 144064
Project: 144064
Buggy source:
public void gibbs_one_iteration_collapsed(){
  sample_z_collapsed();
  sample_tables_topic_collapsed();
  sample_l_colapsed();
}

Fixed version (ground truth):
public void gibbs_one_iteration_collapsed(){
  sample_z_collapsed();
  check_error_negative();
  sample_tables_topic_collapsed();
  check_error_negative();
  sample_l_colapsed();
  check_error_negative();
}
Program: 144065
Project: 144065
Buggy source:
public void update_after_sampling_tables_topic(int domain_id,int table_id,int topic_id,int cls_ids[]){
  hdp.add_tobles_topic_assignment(domain_id,table_id,topic_id);
  for (  int classifier_id : cls_ids) {
    err_cnt[topic_id][0]+=disagreement[domain_id][classifier_id];
    err_cnt[topic_id][1]+=(num_example[domain_id] - disagreement[domain_id][classifier_id]);
    sum_err[topic_id]+=num_example[domain_id];
  }
}

Fixed version (ground truth):
public void update_after_sampling_tables_topic(int domain_id,int table_id,int topic_id,int cls_ids[]){
  hdp.add_tobles_topic_assignment(domain_id,table_id,topic_id);
  for (  int classifier_id : cls_ids) {
    z[domain_id][classifier_id]=topic_id;
    err_cnt[topic_id][0]+=disagreement[domain_id][classifier_id];
    err_cnt[topic_id][1]+=(num_example[domain_id] - disagreement[domain_id][classifier_id]);
    sum_err[topic_id]+=num_example[domain_id];
  }
}
Program: 144066
Project: 144066
Buggy source:
private void solveSubProblem(int subProblemIndex,int[] variableIndexes,Vector variableCopiesSum){
  Vector variables=variableCopies.get(subProblemIndex);
  Vector multipliers=lagrangeMultipliers.get(subProblemIndex);
  Vector consensusVariables=Vectors.build(variableIndexes.length,currentPoint.type());
  consensusVariables.set(0,variableIndexes.length - 1,currentPoint.get(variableIndexes));
  multipliers.addInPlace(variableCopies.get(subProblemIndex).sub(consensusVariables).mult(augmentedLagrangianParameter));
  variables.set(0,variables.size() - 1,consensusVariables.sub(multipliers.div(augmentedLagrangianParameter)));
  if (objective.getValue(variables,subProblemIndex) > 0) {
    variables=new NewtonSolver.Builder(new SubProblemObjectiveFunction(objective.getTerm(subProblemIndex),consensusVariables,multipliers),variables).build().solve();
    if (objective.getValue(variables,subProblemIndex) < 0) {
      variables=((LinearFunction)objective.getTerm(subProblemIndex)).projectToHyperplane(consensusVariables);
    }
  }
  Vector termPoint=Vectors.build(currentPoint.size(),currentPoint.type());
  termPoint.set(variableIndexes,variables.add(multipliers.div(augmentedLagrangianParameter)));
  variableCopiesSum.add(termPoint);
}

Fixed version (ground truth):
private void solveSubProblem(int subProblemIndex,int[] variableIndexes,Vector variableCopiesSum){
  Vector variables=variableCopies.get(subProblemIndex);
  Vector multipliers=lagrangeMultipliers.get(subProblemIndex);
  Vector consensusVariables=Vectors.build(variableIndexes.length,currentPoint.type());
  consensusVariables.set(0,variableIndexes.length - 1,currentPoint.get(variableIndexes));
  multipliers.addInPlace(variableCopies.get(subProblemIndex).sub(consensusVariables).mult(augmentedLagrangianParameter));
  variables.set(0,variables.size() - 1,consensusVariables.sub(multipliers.div(augmentedLagrangianParameter)));
  if (objective.getValue(variables,subProblemIndex) > 0) {
    variables=new NewtonSolver.Builder(new SubProblemObjectiveFunction(objective.getTerm(subProblemIndex),consensusVariables,multipliers),variables).build().solve();
    if (objective.getValue(variables,subProblemIndex) < 0) {
      variables=((LinearFunction)objective.getTerm(subProblemIndex)).projectToHyperplane(consensusVariables);
    }
  }
  Vector termPoint=Vectors.build(currentPoint.size(),currentPoint.type());
  termPoint.set(variableIndexes,variables.add(multipliers.div(augmentedLagrangianParameter)));
  variableCopiesSum.addInPlace(termPoint);
}
Program: 144067
Project: 144067
Buggy source:
private void sampleErrorRates(int iterationNumber){
  for (int k=0; k < numberOfDomains * numberOfFunctions; k++) {
    int disagreementCount=0;
    int zCount=0;
    for (int p=0; p < numberOfDomains; p++) {
      for (int j=0; j < numberOfFunctions; j++) {
        if (zSamples[iterationNumber][p][j] == k) {
          for (int i=0; i < numberOfDataSamples[p]; i++)           if (functionOutputsArray[j][p][i] != labelsSamples[iterationNumber][p][i])           disagreementCount++;
          zCount+=numberOfDataSamples[p];
        }
      }
    }
    errorRateSamples[iterationNumber + 1][k]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
  }
}

Fixed version (ground truth):
private void sampleErrorRates(int iterationNumber){
  for (int k=0; k < numberOfDomains * numberOfFunctions; k++) {
    int disagreementCount=0;
    int zCount=0;
    for (int p=0; p < numberOfDomains; p++) {
      for (int j=0; j < numberOfFunctions; j++) {
        if (zSamples[iterationNumber][p][j] == k) {
          for (int i=0; i < numberOfDataSamples[p]; i++)           if (functionOutputsArray[j][p][i] != labelsSamples[iterationNumber][p][i])           disagreementCount++;
          zCount+=numberOfDataSamples[p];
        }
      }
    }
    errorRateSamples[iterationNumber + 1][k]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
  }
  for (int p=0; p < numberOfDomains; p++) {
    int numberOfErrorRatesBelowChance=0;
    for (int j=0; j < numberOfFunctions; j++)     if (errorRateSamples[iterationNumber + 1][zSamples[iterationNumber][p][j]] < 0.5)     numberOfErrorRatesBelowChance++;
    if (numberOfErrorRatesBelowChance < numberOfFunctions / 2.0)     for (int j=0; j < numberOfFunctions; j++)     errorRateSamples[iterationNumber + 1][zSamples[iterationNumber][p][j]]=1 - errorRateSamples[iterationNumber + 1][zSamples[iterationNumber][p][j]];
  }
}
Program: 144074
Project: 144074
Buggy source:
private void sampleErrorRatesAndBurn(int iterationNumber){
  for (int k=0; k < numberOfDomains * numberOfFunctions; k++) {
    int disagreementCount=0;
    int zCount=0;
    for (int p=0; p < numberOfDomains; p++) {
      for (int j=0; j < numberOfFunctions; j++) {
        if (zSamples[iterationNumber][p][j] == k) {
          for (int i=0; i < numberOfDataSamples[p]; i++)           if (functionOutputsArray[j][p][i] != labelsSamples[iterationNumber][p][i])           disagreementCount++;
          zCount+=numberOfDataSamples[p];
        }
      }
    }
    errorRateSamples[iterationNumber][k]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
  }
}

Fixed version (ground truth):
private void sampleErrorRatesAndBurn(int iterationNumber){
  for (int k=0; k < numberOfDomains * numberOfFunctions; k++) {
    int disagreementCount=0;
    int zCount=0;
    for (int p=0; p < numberOfDomains; p++) {
      for (int j=0; j < numberOfFunctions; j++) {
        if (zSamples[iterationNumber][p][j] == k) {
          for (int i=0; i < numberOfDataSamples[p]; i++)           if (functionOutputsArray[j][p][i] != labelsSamples[iterationNumber][p][i])           disagreementCount++;
          zCount+=numberOfDataSamples[p];
        }
      }
    }
    errorRateSamples[iterationNumber][k]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
  }
  for (int p=0; p < numberOfDomains; p++) {
    int numberOfErrorRatesBelowChance=0;
    for (int j=0; j < numberOfFunctions; j++)     if (errorRateSamples[iterationNumber][zSamples[iterationNumber][p][j]] < 0.5)     numberOfErrorRatesBelowChance++;
    if (numberOfErrorRatesBelowChance < numberOfFunctions / 2.0)     for (int j=0; j < numberOfFunctions; j++)     errorRateSamples[iterationNumber][zSamples[iterationNumber][p][j]]=1 - errorRateSamples[iterationNumber][zSamples[iterationNumber][p][j]];
  }
}
Program: 144075
Project: 144075
Buggy source:
private void sampleErrorRates(int iterationNumber){
  for (int k=0; k < numberOfDomains * numberOfFunctions; k++) {
    int disagreementCount=0;
    int zCount=0;
    for (int p=0; p < numberOfDomains; p++) {
      for (int j=0; j < numberOfFunctions; j++) {
        if (zSamples[iterationNumber][p][j] == k) {
          for (int i=0; i < numberOfDataSamples[p]; i++)           if (functionOutputsArray[j][p][i] != labelsSamples[iterationNumber][p][i])           disagreementCount++;
          zCount+=numberOfDataSamples[p];
        }
      }
    }
    if (zCount > 0)     errorRateSamples[iterationNumber + 1][k]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
  }
}

Fixed version (ground truth):
private void sampleErrorRates(int iterationNumber){
  for (int k=0; k < numberOfDomains * numberOfFunctions; k++) {
    int disagreementCount=0;
    int zCount=0;
    for (int p=0; p < numberOfDomains; p++) {
      for (int j=0; j < numberOfFunctions; j++) {
        if (zSamples[iterationNumber][p][j] == k) {
          for (int i=0; i < numberOfDataSamples[p]; i++)           if (functionOutputsArray[j][p][i] != labelsSamples[iterationNumber][p][i])           disagreementCount++;
          zCount+=numberOfDataSamples[p];
        }
      }
    }
    errorRateSamples[iterationNumber + 1][k]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
  }
}
Program: 144079
Project: 144079
Buggy source:
private void sampleErrorRatesAndBurn(int iterationNumber){
  for (int k=0; k < numberOfDomains * numberOfFunctions; k++) {
    int disagreementCount=0;
    int zCount=0;
    for (int p=0; p < numberOfDomains; p++) {
      for (int j=0; j < numberOfFunctions; j++) {
        if (zSamples[iterationNumber][p][j] == k) {
          for (int i=0; i < numberOfDataSamples[p]; i++)           if (functionOutputsArray[j][p][i] != labelsSamples[iterationNumber][p][i])           disagreementCount++;
          zCount+=numberOfDataSamples[p];
        }
      }
    }
    if (zCount > 0)     errorRateSamples[iterationNumber][k]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
  }
}

Fixed version (ground truth):
private void sampleErrorRatesAndBurn(int iterationNumber){
  for (int k=0; k < numberOfDomains * numberOfFunctions; k++) {
    int disagreementCount=0;
    int zCount=0;
    for (int p=0; p < numberOfDomains; p++) {
      for (int j=0; j < numberOfFunctions; j++) {
        if (zSamples[iterationNumber][p][j] == k) {
          for (int i=0; i < numberOfDataSamples[p]; i++)           if (functionOutputsArray[j][p][i] != labelsSamples[iterationNumber][p][i])           disagreementCount++;
          zCount+=numberOfDataSamples[p];
        }
      }
    }
    errorRateSamples[iterationNumber][k]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
  }
}
Program: 144095
Project: 144095
Buggy source:
private static void buildFeatureMap(){
  featureMap.createDatabase();
  buildCPLFeatureMap(featureMap);
  buildADJFeatureMap(featureMap);
}

Fixed version (ground truth):
private static void buildFeatureMap(FeatureMapMySQL<SparseVector> featureMap){
  featureMap.createDatabase();
  buildCPLFeatureMap(featureMap);
  buildADJFeatureMap(featureMap);
}
Program: 144096
Project: 144096
Buggy source:
public static void filterLabeledDataByFeatureMap(){
  if (Files.exists(Paths.get(filteredLabeledDataDirectory))) {
    filteredLabeledData=readStringStringBooleanMap(filteredLabeledDataDirectory);
    logger.info("String_Node_Str");
  }
 else {
    filteredLabeledData=new HashMap<>();
    for (    String category : labeledData.keySet()) {
      filteredLabeledData.put(category,new HashMap<>());
      labeledData.get(category).keySet().stream().filter(np -> !np.equals("String_Node_Str") && !np.equals("String_Node_Str") && !np.equals("String_Node_Str")&& !featureMap.getFeatureVectors(np).contains(null)).forEach(np -> filteredLabeledData.get(category).put(np,labeledData.get(category).get(np)));
      int totalNumber=filteredLabeledData.get(category).size();
      int numberOfPositive=Maps.filterValues(filteredLabeledData.get(category),x -> x).size();
      int numberOfNegative=Maps.filterValues(filteredLabeledData.get(category),x -> !x).size();
      logger.info("String_Node_Str" + category + "String_Node_Str"+ totalNumber+ "String_Node_Str"+ numberOfPositive+ "String_Node_Str"+ numberOfNegative+ "String_Node_Str");
    }
    writeStringStringBooleanMap(filteredLabeledData,filteredLabeledDataDirectory);
    logger.info("String_Node_Str");
  }
}

Fixed version (ground truth):
public static void filterLabeledDataByFeatureMap(FeatureMapMySQL<SparseVector> featureMap){
  if (Files.exists(Paths.get(filteredLabeledDataDirectory))) {
    filteredLabeledData=readStringStringBooleanMap(filteredLabeledDataDirectory);
    logger.info("String_Node_Str");
  }
 else {
    filteredLabeledData=new HashMap<>();
    for (    String category : labeledData.keySet()) {
      filteredLabeledData.put(category,new HashMap<>());
      labeledData.get(category).keySet().stream().filter(np -> !np.equals("String_Node_Str") && !np.equals("String_Node_Str") && !np.equals("String_Node_Str")&& !featureMap.getFeatureVectors(np).contains(null)).forEach(np -> filteredLabeledData.get(category).put(np,labeledData.get(category).get(np)));
      int totalNumber=filteredLabeledData.get(category).size();
      int numberOfPositive=Maps.filterValues(filteredLabeledData.get(category),x -> x).size();
      int numberOfNegative=Maps.filterValues(filteredLabeledData.get(category),x -> !x).size();
      logger.info("String_Node_Str" + category + "String_Node_Str"+ totalNumber+ "String_Node_Str"+ numberOfPositive+ "String_Node_Str"+ numberOfNegative+ "String_Node_Str");
    }
    writeStringStringBooleanMap(filteredLabeledData,filteredLabeledDataDirectory);
    logger.info("String_Node_Str");
  }
}
Program: 144097
Project: 144097
Buggy source:
public static void main(String[] args){
  parseVariasCategoriesFiles();
  filterLabeledDataByFeatureMap();
}

Fixed version (ground truth):
public static void main(String[] args){
  FeatureMapMySQL<SparseVector> featureMap=new FeatureMapMySQL<>(3,"String_Node_Str","String_Node_Str",null,"String_Node_Str","String_Node_Str");
  parseVariasCategoriesFiles();
  filterLabeledDataByFeatureMap(featureMap);
}
Program: 144101
Project: 144101
Buggy source:
private void sampleErrorRates(int iterationNumber){
  for (int p=0; p < numberOfDomains; p++) {
    for (int j=0; j < numberOfFunctions; j++) {
      int disagreementCount=0;
      int zCount=0;
      for (int k=0; k < numberOfDomains; k++) {
        if (zSamples[iterationNumber][k] == p) {
          for (int i=0; i < numberOfDataSamples[k]; i++)           if (functionOutputsArray[j][k][i] != labelsSamples[iterationNumber][k][i])           disagreementCount++;
          zCount+=numberOfDataSamples[k];
        }
      }
      errorRateSamples[iterationNumber + 1][p][j]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
    }
  }
}

Fixed version (ground truth):
private void sampleErrorRates(int iterationNumber){
  for (int p=0; p < numberOfDomains; p++) {
    int numberOfErrorRatesBelowChance=0;
    for (int j=0; j < numberOfFunctions; j++) {
      int disagreementCount=0;
      int zCount=0;
      for (int k=0; k < numberOfDomains; k++) {
        if (zSamples[iterationNumber][k] == p) {
          for (int i=0; i < numberOfDataSamples[k]; i++)           if (functionOutputsArray[j][k][i] != labelsSamples[iterationNumber][k][i])           disagreementCount++;
          zCount+=numberOfDataSamples[k];
        }
      }
      errorRateSamples[iterationNumber + 1][p][j]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
      if (errorRateSamples[iterationNumber + 1][p][j] < 0.5)       numberOfErrorRatesBelowChance+=1;
    }
    if (numberOfErrorRatesBelowChance < numberOfFunctions / 2.0) {
      priorSamples[iterationNumber + 1][p]=1 - priorSamples[iterationNumber + 1][p];
      for (int j=0; j < numberOfFunctions; j++)       errorRateSamples[iterationNumber + 1][p][j]=1 - errorRateSamples[iterationNumber + 1][p][j];
    }
  }
}
Program: 144105
Project: 144105
Buggy source:
private void sampleErrorRatesAndBurn(int iterationNumber){
  for (int p=0; p < numberOfDomains; p++) {
    for (int j=0; j < numberOfFunctions; j++) {
      int disagreementCount=0;
      int zCount=0;
      for (int k=0; k < numberOfDomains; k++) {
        if (zSamples[iterationNumber][k] == p) {
          for (int i=0; i < numberOfDataSamples[k]; i++)           if (functionOutputsArray[j][k][i] != labelsSamples[iterationNumber][k][i])           disagreementCount++;
          zCount+=numberOfDataSamples[k];
        }
      }
      errorRateSamples[iterationNumber][p][j]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
    }
  }
}

Fixed version (ground truth):
private void sampleErrorRatesAndBurn(int iterationNumber){
  for (int p=0; p < numberOfDomains; p++) {
    int numberOfErrorRatesBelowChance=0;
    for (int j=0; j < numberOfFunctions; j++) {
      int disagreementCount=0;
      int zCount=0;
      for (int k=0; k < numberOfDomains; k++) {
        if (zSamples[iterationNumber][k] == p) {
          for (int i=0; i < numberOfDataSamples[k]; i++)           if (functionOutputsArray[j][k][i] != labelsSamples[iterationNumber][k][i])           disagreementCount++;
          zCount+=numberOfDataSamples[k];
        }
      }
      errorRateSamples[iterationNumber][p][j]=randomDataGenerator.nextBeta(alpha_e + disagreementCount,beta_e + zCount - disagreementCount);
      if (errorRateSamples[iterationNumber][p][j] < 0.5)       numberOfErrorRatesBelowChance+=1;
    }
    if (numberOfErrorRatesBelowChance < numberOfFunctions / 2.0)     for (int j=0; j < numberOfFunctions; j++)     errorRateSamples[iterationNumber][p][j]=1 - errorRateSamples[iterationNumber][p][j];
  }
}
Program: 144111
Project: 144111
Buggy source:
public static void main(String[] args){
  String filename="String_Node_Str";
  filename="String_Node_Str";
  String separator="String_Node_Str";
  double[] classificationThresholds=new double[]{0.1,0.1,0.1,0.1};
  classificationThresholds=new double[]{0.5};
  List<boolean[][]> functionOutputs=new ArrayList<>();
  List<boolean[]> trueLabels=new ArrayList<>();
  for (  File file : new File(filename).listFiles()) {
    if (file.isFile()) {
      DomainData data=parseLabeledDataFromCSVFile(file,separator,classificationThresholds,1);
      functionOutputs.add(data.functionOutputs);
      trueLabels.add(data.trueLabels);
    }
  }
  ErrorEstimationMethod[] errorEstimationMethods=new ErrorEstimationMethod[]{ErrorEstimationMethod.DOMAINS_DP_GM,ErrorEstimationMethod.PAIRS_DP_GM};
  double[] alphaValues=new double[]{1e-3,1e-2,1e-1,1e0,1e1,1e2,1e3};
  runExperiments(errorEstimationMethods,alphaValues,functionOutputs,trueLabels);
}

Fixed version (ground truth):
public static void main(String[] args){
  String filename="String_Node_Str";
  filename="String_Node_Str";
  String separator="String_Node_Str";
  double[] classificationThresholds=new double[]{0.1,0.1,0.1,0.1};
  classificationThresholds=new double[]{0.5};
  List<boolean[][]> functionOutputs=new ArrayList<>();
  List<boolean[]> trueLabels=new ArrayList<>();
  for (  File file : new File(filename).listFiles()) {
    if (file.isFile()) {
      DomainData data=parseLabeledDataFromCSVFile(file,separator,classificationThresholds,1);
      functionOutputs.add(data.functionOutputs);
      trueLabels.add(data.trueLabels);
    }
  }
  ErrorEstimationMethod[] errorEstimationMethods=new ErrorEstimationMethod[]{ErrorEstimationMethod.PAIRS_FAST_HDP_GM};
  double[] alphaValues=new double[]{1e5};
  runExperiments(errorEstimationMethods,alphaValues,functionOutputs,trueLabels);
}
Program: 144114
Project: 144114
Buggy source:
@SuppressWarnings("String_Node_Str") private Map<String,List<T>> selectFeatures(List<String> names) throws SQLException, IOException {
  String selectionQuery="String_Node_Str" + databaseName + "String_Node_Str"+ tableName+ "String_Node_Str";
  for (  String name : names)   selectionQuery+="String_Node_Str" + name + "String_Node_Str";
  selectionQuery=selectionQuery.substring(0,selectionQuery.length() - 1) + "String_Node_Str";
  ResultSet result=connection.createStatement().executeQuery(selectionQuery);
  Map<String,List<T>> featureMappings=new HashMap<>();
  while (result.next()) {
    List<T> features=new ArrayList<>();
    for (int view=0; view < numberOfViews; view++) {
      InputStream inputStream=result.getBinaryStream("String_Node_Str" + view);
      if (inputStream != null)       features.add((T)Vectors.build(inputStream));
 else       features.add(null);
    }
    featureMappings.put(result.getString("String_Node_Str"),features);
  }
  return featureMappings;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private Map<String,List<T>> selectFeatures(List<String> names) throws SQLException, IOException {
  String selectionQuery="String_Node_Str" + databaseName + "String_Node_Str"+ tableName+ "String_Node_Str";
  for (  String name : names)   selectionQuery+="String_Node_Str";
  selectionQuery=selectionQuery.substring(0,selectionQuery.length() - 1) + "String_Node_Str";
  PreparedStatement preparedStatement=connection.prepareStatement(selectionQuery);
  int parameterIndex=1;
  for (  String name : names)   preparedStatement.setString(parameterIndex++,name);
  ResultSet result=preparedStatement.executeQuery();
  Map<String,List<T>> featureMappings=new HashMap<>();
  while (result.next()) {
    List<T> features=new ArrayList<>();
    for (int view=0; view < numberOfViews; view++) {
      InputStream inputStream=result.getBinaryStream("String_Node_Str" + view);
      if (inputStream != null)       features.add((T)Vectors.build(inputStream));
 else       features.add(null);
    }
    featureMappings.put(result.getString("String_Node_Str"),features);
  }
  preparedStatement.close();
  return featureMappings;
}
Program: 144115
Project: 144115
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public DenseVector saxpyPlusConstantInPlace(double scalar,Vector vector){
  if (vector.size() + 1 != this.size())   throw new IllegalArgumentException("String_Node_Str");
  for (int i=0; i < size - 1; i++)   array[i]+=scalar * vector.get(i);
  return this;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public DenseVector saxpyPlusConstantInPlace(double scalar,Vector vector){
  if (vector.size() + 1 != this.size())   throw new IllegalArgumentException("String_Node_Str");
  for (int i=0; i < size - 1; i++)   array[i]+=scalar * vector.get(i);
  array[size - 1]+=scalar;
  return this;
}
Program: 144116
Project: 144116
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public DenseVector saxpyPlusConstant(double scalar,Vector vector){
  if (vector.size() + 1 != this.size())   throw new IllegalArgumentException("String_Node_Str");
  DenseVector resultVector=new DenseVector(size);
  double[] resultVectorArray=resultVector.getArray();
  for (int i=0; i < size - 1; i++)   resultVectorArray[i]=array[i] + scalar * vector.get(i);
  resultVectorArray[size - 1]=array[size - 1];
  return resultVector;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public DenseVector saxpyPlusConstant(double scalar,Vector vector){
  if (vector.size() + 1 != this.size())   throw new IllegalArgumentException("String_Node_Str");
  DenseVector resultVector=new DenseVector(size);
  double[] resultVectorArray=resultVector.getArray();
  for (int i=0; i < size - 1; i++)   resultVectorArray[i]=array[i] + scalar * vector.get(i);
  resultVectorArray[size - 1]=array[size - 1] + scalar;
  return resultVector;
}
Program: 144119
Project: 144119
Buggy source:
/** 
 * Performs a modified saxpy operation, as it is named in LAPACK. Let us denote the current vector by \(\boldsymbol{y}\). Given a scalar \(\alpha\) and another vector \(\boldsymbol{x}\) with size 1 less than the current vector, this function replaces this vector with the value of \(\boldsymbol{y}+\alpha\boldsymbol{x}+y'\), where the last element of the current vector, /(\boldsymbol{y}/) is left as it is (i.e., nothing is added to it).
 * @param scalar  The scalar \(\alpha\).
 * @param vector  The vector \(\boldsymbol{x}\).
 * @return          The result of this operation (i.e., the current vector).
 */
public abstract Vector saxpyPlusConstantInPlace(double scalar,Vector vector);

Fixed version (ground truth):
/** 
 * Performs a modified saxpy operation, as it is named in LAPACK. Let us denote the current vector by \(\boldsymbol{y}\). Given a scalar \(\alpha\) and another vector \(\boldsymbol{x}\) with size 1 less than the current vector, this function replaces this vector with the value of \(\boldsymbol{y}+\alpha\boldsymbol{x}\), where for the last element of the current vector, /(\boldsymbol{y}/), we simply add \(\alpha\).
 * @param scalar  The scalar \(\alpha\).
 * @param vector  The vector \(\boldsymbol{x}\).
 * @return          The result of this operation (i.e., the current vector).
 */
public abstract Vector saxpyPlusConstantInPlace(double scalar,Vector vector);
Program: 144120
Project: 144120
Buggy source:
/** 
 * Performs a modified saxpy operation, as it is named in LAPACK. Let us denote the current vector by \(\boldsymbol{y}\). Given a scalar \(\alpha\) and another vector \(\boldsymbol{x}\) with size 1 less than the current vector, this function returns the value of \(\boldsymbol{y}+\alpha\boldsymbol{x}\), where the last element of the current vector, /(\boldsymbol{y}/) is left as it is (i.e., nothing is added to it).
 * @param scalar  The scalar \(\alpha\).
 * @param vector  The vector \(\boldsymbol{x}\).
 * @return          The result of this operation.
 */
public abstract Vector saxpyPlusConstant(double scalar,Vector vector);

Fixed version (ground truth):
/** 
 * Performs a modified saxpy operation, as it is named in LAPACK. Let us denote the current vector by \(\boldsymbol{y}\). Given a scalar \(\alpha\) and another vector \(\boldsymbol{x}\) with size 1 less than the current vector, this function returns the value of \(\boldsymbol{y}+\alpha\boldsymbol{x}\), where for the last element of the current vector, /(\boldsymbol{y}/), we simply add \(\alpha\).
 * @param scalar  The scalar \(\alpha\).
 * @param vector  The vector \(\boldsymbol{x}\).
 * @return          The result of this operation.
 */
public abstract Vector saxpyPlusConstant(double scalar,Vector vector);
Program: 144121
Project: 144121
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getName(){
  return name;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getName(){
  return name;
}
Program: 144122
Project: 144122
Buggy source:
@Id @GeneratedValue @Column(name="String_Node_Str") public long getId(){
  return id;
}

Fixed version (ground truth):
@Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="String_Node_Str") public long getId(){
  return id;
}
Program: 144123
Project: 144123
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getAbbreviation(){
  return abbreviation;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getAbbreviation(){
  return abbreviation;
}
Program: 144124
Project: 144124
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getName(){
  return name;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getName(){
  return name;
}
Program: 144125
Project: 144125
Buggy source:
@Id @GeneratedValue @Column(name="String_Node_Str") public long getId(){
  return id;
}

Fixed version (ground truth):
@Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="String_Node_Str") public long getId(){
  return id;
}
Program: 144126
Project: 144126
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getName(){
  return name;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getName(){
  return name;
}
Program: 144127
Project: 144127
Buggy source:
@Id @Column(name="String_Node_Str") public long getId(){
  return id;
}

Fixed version (ground truth):
@Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="String_Node_Str") public long getId(){
  return id;
}
Program: 144128
Project: 144128
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getGicsId(){
  return gicsId;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getGicsId(){
  return gicsId;
}
Program: 144129
Project: 144129
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getName(){
  return name;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getName(){
  return name;
}
Program: 144130
Project: 144130
Buggy source:
@Id @Column(name="String_Node_Str") public long getId(){
  return id;
}

Fixed version (ground truth):
@Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="String_Node_Str") public long getId(){
  return id;
}
Program: 144131
Project: 144131
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getGicsId(){
  return gicsId;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getGicsId(){
  return gicsId;
}
Program: 144132
Project: 144132
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getName(){
  return name;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getName(){
  return name;
}
Program: 144133
Project: 144133
Buggy source:
@Id @Column(name="String_Node_Str") public long getId(){
  return id;
}

Fixed version (ground truth):
@Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="String_Node_Str") public long getId(){
  return id;
}
Program: 144134
Project: 144134
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getGicsId(){
  return gicsId;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getGicsId(){
  return gicsId;
}
Program: 144135
Project: 144135
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getTickerSymbol(){
  return tickerSymbol;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getTickerSymbol(){
  return tickerSymbol;
}
Program: 144136
Project: 144136
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getName(){
  return name;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getName(){
  return name;
}
Program: 144137
Project: 144137
Buggy source:
@Id @Column(name="String_Node_Str") public long getId(){
  return id;
}

Fixed version (ground truth):
@Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="String_Node_Str") public long getId(){
  return id;
}
Program: 144138
Project: 144138
Buggy source:
@Basic @Column(name="String_Node_Str") @NotNull public String getGicsId(){
  return gicsId;
}

Fixed version (ground truth):
@Basic @Column(name="String_Node_Str",unique=true) @NotNull public String getGicsId(){
  return gicsId;
}
Program: 144139
Project: 144139
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public SparseVector mult(double scalar){
  SparseVector resultVector=new SparseVector(size,indexes,values);
  for (int i=0; i < numberOfNonzeroEntries; i++) {
    resultVector.values[i]*=scalar;
  }
  return resultVector;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public SparseVector mult(double scalar){
  SparseVector resultVector=new SparseVector(size,numberOfNonzeroEntries,indexes,values);
  for (int i=0; i < numberOfNonzeroEntries; i++)   resultVector.values[i]*=scalar;
  return resultVector;
}
Program: 144140
Project: 144140
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public double norm(VectorNorm normType){
  return normType.compute(values);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public double norm(VectorNorm normType){
  return normType.compute(Arrays.copyOf(values,numberOfNonzeroEntries));
}
Program: 144141
Project: 144141
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public SparseVector div(double scalar){
  SparseVector resultVector=new SparseVector(size,indexes,values);
  for (int i=0; i < numberOfNonzeroEntries; i++) {
    resultVector.values[i]/=scalar;
  }
  return resultVector;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public SparseVector div(double scalar){
  SparseVector resultVector=new SparseVector(size,numberOfNonzeroEntries,indexes,values);
  for (int i=0; i < numberOfNonzeroEntries; i++)   resultVector.values[i]/=scalar;
  return resultVector;
}
Program: 144142
Project: 144142
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public SparseVector divInPlace(double scalar){
  for (int i=0; i < numberOfNonzeroEntries; i++) {
    values[i]/=scalar;
  }
  return this;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public SparseVector divInPlace(double scalar){
  for (int i=0; i < numberOfNonzeroEntries; i++)   values[i]/=scalar;
  return this;
}