nus-yam/ex-repair huggingface dataset:
Program: 21648
Project: 21648
Buggy source:
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position].copy(vec);
}

Fixed version (ground truth):
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position]=vec;
}
Program: 21649
Project: 21649
Buggy source:
public BayesianNetwork toBayesianNetwork(DAG dag){
  BayesianNetwork bayesianNetwork=BayesianNetwork.newBayesianNetwork(dag);
  this.distributionList.stream().forEach(dist -> bayesianNetwork.setDistribution(dist.getVariable(),EF_DistributionBuilder.toDistributionGeneral(dist)));
  return bayesianNetwork;
}

Fixed version (ground truth):
public BayesianNetwork toBayesianNetwork(DAG dag){
  ConditionalDistribution[] dists=new ConditionalDistribution[dag.getStaticVariables().getNumberOfVars()];
  this.distributionList.parallelStream().forEach(dist -> dists[dist.getVariable().getVarID()]=EF_DistributionBuilder.toDistributionGeneral(dist));
  return BayesianNetwork.newBayesianNetwork(dag,Arrays.asList(dists));
}
Program: 21650
Project: 21650
Buggy source:
@Override public SufficientStatistics getSufficientStatistics(DataInstance data){
  CompoundVector vectorSS=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    vectorSS.getVectorByPosition(w.getVariable().getVarID()).copy(w.getSufficientStatistics(data));
  }
);
  return vectorSS;
}

Fixed version (ground truth):
@Override public SufficientStatistics getSufficientStatistics(DataInstance data){
  CompoundVector vectorSS=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    vectorSS.setVectorByPosition(w.getVariable().getVarID(),w.getSufficientStatistics(data));
  }
);
  return vectorSS;
}
Program: 21651
Project: 21651
Buggy source:
public static SufficientStatistics sum(SufficientStatistics vec1,SufficientStatistics vec2){
  return (SufficientStatistics)Vector.sum(vec1,vec2);
}

Fixed version (ground truth):
public static SufficientStatistics sum(SufficientStatistics vec1,SufficientStatistics vec2){
  return vec1;
}
Program: 21652
Project: 21652
Buggy source:
public static BayesianNetwork parallelLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  AtomicInteger count=new AtomicInteger(0);
  SufficientStatistics sumSS=dataBase.parallelStream(batchSize).peek(w -> count.getAndIncrement()).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sumSS.divideBy(count.get());
  efBayesianNetwork.setMomentParameters(sumSS);
  return efBayesianNetwork.toBayesianNetwork(dag);
}

Fixed version (ground truth):
public static BayesianNetwork parallelLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  AtomicInteger count=new AtomicInteger(0);
  SufficientStatistics sumSS=dataBase.parallelStream(batchSize).peek(w -> {
    count.getAndIncrement();
  }
).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sumSS.divideBy(count.get());
  efBayesianNetwork.setMomentParameters(sumSS);
  return efBayesianNetwork.toBayesianNetwork(dag);
}
Program: 21653
Project: 21653
Buggy source:
public static BayesianNetwork serialLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  AtomicInteger count=new AtomicInteger(0);
  SufficientStatistics sum=dataBase.stream().peek(w -> count.getAndIncrement()).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sum.divideBy(count.get());
  efBayesianNetwork.setMomentParameters(sum);
  return efBayesianNetwork.toBayesianNetwork(dag);
}

Fixed version (ground truth):
public static BayesianNetwork serialLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  final int[] count={0};
  SufficientStatistics sum=dataBase.stream().peek(w -> {
    count[0]++;
  }
).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sum.divideBy(count[0]);
  efBayesianNetwork.setMomentParameters(sum);
  return efBayesianNetwork.toBayesianNetwork(dag);
}
Program: 21654
Project: 21654
Buggy source:
private BayesianNetwork(DAG dag){
  this.dag=dag;
  initializeDistributions();
}

Fixed version (ground truth):
private BayesianNetwork(DAG dag,List<ConditionalDistribution> dists){
  this.dag=dag;
  this.distributions=dists;
}
Program: 21655
Project: 21655
Buggy source:
public static BayesianNetwork newBayesianNetwork(DAG dag){
  return new BayesianNetwork(dag);
}

Fixed version (ground truth):
public static BayesianNetwork newBayesianNetwork(DAG dag,List<ConditionalDistribution> dists){
  return new BayesianNetwork(dag);
}
Program: 21656
Project: 21656
Buggy source:
public EF_BaseDistribution_MultinomialParents(List<Variable> multinomialParents1,List<E> distributions1){
  if (multinomialParents1.size() == 0)   throw new IllegalArgumentException("String_Node_Str");
  if (distributions1.size() == 0)   throw new IllegalArgumentException("String_Node_Str");
  int size=MultinomialIndex.getNumberOfPossibleAssignments(multinomialParents1);
  if (size != distributions1.size())   throw new IllegalArgumentException("String_Node_Str");
  this.var=distributions1.get(0).getVariable();
  this.multinomialParents=multinomialParents1;
  this.distributions=distributions1;
  this.parents=new ArrayList();
  for (  Variable v : this.multinomialParents)   this.parents.add(v);
  E dist=distributions.get(0);
  if (dist.getClass().getName().equals("String_Node_Str")) {
    EF_ConditionalDistribution distCond=(EF_ConditionalDistribution)dist;
    for (    Variable v : distCond.getConditioningVariables())     this.parents.add(v);
  }
  this.parents=Collections.unmodifiableList(this.parents);
}

Fixed version (ground truth):
public EF_BaseDistribution_MultinomialParents(List<Variable> multinomialParents1,List<E> distributions1){
  if (distributions1.size() == 0)   throw new IllegalArgumentException("String_Node_Str");
  int size=MultinomialIndex.getNumberOfPossibleAssignments(multinomialParents1);
  if (size != distributions1.size())   throw new IllegalArgumentException("String_Node_Str");
  this.var=distributions1.get(0).getVariable();
  this.multinomialParents=multinomialParents1;
  this.distributions=distributions1;
  this.parents=new ArrayList();
  for (  Variable v : this.multinomialParents)   this.parents.add(v);
  E dist=distributions.get(0);
  if (dist.getClass().getName().equals("String_Node_Str")) {
    EF_ConditionalDistribution distCond=(EF_ConditionalDistribution)dist;
    for (    Variable v : distCond.getConditioningVariables())     this.parents.add(v);
  }
  this.parents=Collections.unmodifiableList(this.parents);
}
Program: 21657
Project: 21657
Buggy source:
@Override public double get(int i){
  i-=nConf;
  return baseVectors[(int)Math.ceil(i / (double)nConf)].get(i % baseSSLength);
}

Fixed version (ground truth):
@Override public double get(int i){
  if (i < nConf) {
    return this.baseConf[i];
  }
 else {
    i-=nConf;
    return baseVectors[Math.floorDiv(i,this.baseSSLength)].get(i % baseSSLength);
  }
}
Program: 21658
Project: 21658
Buggy source:
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position].copy(vec);
}

Fixed version (ground truth):
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position]=vec;
}
Program: 21659
Project: 21659
Buggy source:
@Override public void set(int i,double val){
  if (i < nConf) {
    baseConf[i]=val;
  }
 else {
    i-=nConf;
    baseVectors[(int)Math.ceil(i / (double)nConf)].set(i % baseSSLength,val);
  }
}

Fixed version (ground truth):
@Override public void set(int i,double val){
  if (i < nConf) {
    baseConf[i]=val;
  }
 else {
    i-=nConf;
    baseVectors[Math.floorDiv(i,this.baseSSLength)].set(i % baseSSLength,val);
  }
}
Program: 21660
Project: 21660
Buggy source:
public void updateNaturalFromMomentParameters(){
  CompoundVector<E> globalMomentsParam=(CompoundVector<E>)this.momentParameters;
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=this.getEF_BaseDistribution(i).createZeroedMomentParameters();
    moment.copy(globalMomentsParam.getVectorByPosition(i));
    moment.divideBy(globalMomentsParam.getBaseConf(i));
    this.getEF_BaseDistribution(i).setMomentParameters(momentParameters);
  }
  CompoundVector<E> vectorNatural=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    vectorNatural.setBaseConf(i,-this.getEF_BaseDistribution(i).computeLogNormalizer());
    vectorNatural.getVectorByPosition(i).copy(this.getEF_BaseDistribution(i).getNaturalParameters());
  }
  this.naturalParameters=vectorNatural;
  return;
}

Fixed version (ground truth):
public void updateNaturalFromMomentParameters(){
  CompoundVector<E> globalMomentsParam=(CompoundVector<E>)this.momentParameters;
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=(MomentParameters)globalMomentsParam.getVectorByPosition(i);
    moment.divideBy(globalMomentsParam.getBaseConf(i));
    this.getEF_BaseDistribution(i).setMomentParameters(momentParameters);
  }
  CompoundVector<E> vectorNatural=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    vectorNatural.setBaseConf(i,-this.getEF_BaseDistribution(i).computeLogNormalizer());
    vectorNatural.setVectorByPosition(i,this.getEF_BaseDistribution(i).getNaturalParameters());
  }
  this.naturalParameters=vectorNatural;
  return;
}
Program: 21661
Project: 21661
Buggy source:
public EF_BayesianNetwork(DAG dag){
  distributionList=new ArrayList(dag.getStaticVariables().getNumberOfVars());
  sizeSS=0;
  for (  ParentSet parentSet : dag.getParentSets()) {
    ConditionalDistribution dist=DistributionBuilder.newDistribution(parentSet.getMainVar(),parentSet.getParents());
    EF_ConditionalDistribution ef_dist=EF_DistributionBuilder.toEFDistributionGeneral(dist);
    distributionList.set(ef_dist.getVariable().getVarID(),ef_dist);
    sizeSS+=ef_dist.sizeOfSufficientStatistics();
  }
}

Fixed version (ground truth):
public EF_BayesianNetwork(DAG dag){
  distributionList=new ArrayList(dag.getStaticVariables().getNumberOfVars());
  sizeSS=0;
  for (  ParentSet parentSet : dag.getParentSets()) {
    ConditionalDistribution dist=DistributionBuilder.newDistribution(parentSet.getMainVar(),parentSet.getParents());
    EF_ConditionalDistribution ef_dist=EF_DistributionBuilder.toEFDistributionGeneral(dist);
    distributionList.add(ef_dist.getVariable().getVarID(),ef_dist);
    sizeSS+=ef_dist.sizeOfSufficientStatistics();
  }
}
Program: 21662
Project: 21662
Buggy source:
@Override public void updateNaturalFromMomentParameters(){
  CompoundVector globalMomentsParam=(CompoundVector)this.momentParameters;
  CompoundVector vectorNatural=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    MomentParameters localMomentParam=w.createZeroedMomentParameters();
    localMomentParam.copy(globalMomentsParam.getVectorByPosition(w.getVariable().getVarID()));
    w.setMomentParameters(localMomentParam);
    vectorNatural.setVectorByPosition(w.getVariable().getVarID(),w.getNaturalParameters());
  }
);
}

Fixed version (ground truth):
@Override public void updateNaturalFromMomentParameters(){
  CompoundVector globalMomentsParam=(CompoundVector)this.momentParameters;
  CompoundVector vectorNatural=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    MomentParameters localMomentParam=(MomentParameters)globalMomentsParam.getVectorByPosition(w.getVariable().getVarID());
    w.setMomentParameters(localMomentParam);
    vectorNatural.setVectorByPosition(w.getVariable().getVarID(),w.getNaturalParameters());
  }
);
}
Program: 21663
Project: 21663
Buggy source:
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position].copy(vec);
}

Fixed version (ground truth):
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position]=vec;
}
Program: 21664
Project: 21664
Buggy source:
public BayesianNetwork toBayesianNetwork(DAG dag){
  BayesianNetwork bayesianNetwork=BayesianNetwork.newBayesianNetwork(dag);
  this.distributionList.stream().forEach(dist -> bayesianNetwork.setDistribution(dist.getVariable(),EF_DistributionBuilder.toDistributionGeneral(dist)));
  return bayesianNetwork;
}

Fixed version (ground truth):
public BayesianNetwork toBayesianNetwork(DAG dag){
  ConditionalDistribution[] dists=new ConditionalDistribution[dag.getStaticVariables().getNumberOfVars()];
  this.distributionList.parallelStream().forEach(dist -> dists[dist.getVariable().getVarID()]=EF_DistributionBuilder.toDistributionGeneral(dist));
  return BayesianNetwork.newBayesianNetwork(dag,Arrays.asList(dists));
}
Program: 21665
Project: 21665
Buggy source:
@Override public SufficientStatistics getSufficientStatistics(DataInstance data){
  CompoundVector vectorSS=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    vectorSS.getVectorByPosition(w.getVariable().getVarID()).copy(w.getSufficientStatistics(data));
  }
);
  return vectorSS;
}

Fixed version (ground truth):
@Override public SufficientStatistics getSufficientStatistics(DataInstance data){
  CompoundVector vectorSS=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    vectorSS.setVectorByPosition(w.getVariable().getVarID(),w.getSufficientStatistics(data));
  }
);
  return vectorSS;
}
Program: 21666
Project: 21666
Buggy source:
public static SufficientStatistics sum(SufficientStatistics vec1,SufficientStatistics vec2){
  return (SufficientStatistics)Vector.sum(vec1,vec2);
}

Fixed version (ground truth):
public static SufficientStatistics sum(SufficientStatistics vec1,SufficientStatistics vec2){
  return vec1;
}
Program: 21667
Project: 21667
Buggy source:
public static BayesianNetwork parallelLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  AtomicInteger count=new AtomicInteger(0);
  SufficientStatistics sumSS=dataBase.parallelStream(batchSize).peek(w -> count.getAndIncrement()).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sumSS.divideBy(count.get());
  efBayesianNetwork.setMomentParameters(sumSS);
  return efBayesianNetwork.toBayesianNetwork(dag);
}

Fixed version (ground truth):
public static BayesianNetwork parallelLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  AtomicInteger count=new AtomicInteger(0);
  SufficientStatistics sumSS=dataBase.parallelStream(batchSize).peek(w -> {
    count.getAndIncrement();
  }
).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sumSS.divideBy(count.get());
  efBayesianNetwork.setMomentParameters(sumSS);
  return efBayesianNetwork.toBayesianNetwork(dag);
}
Program: 21668
Project: 21668
Buggy source:
public static BayesianNetwork serialLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  AtomicInteger count=new AtomicInteger(0);
  SufficientStatistics sum=dataBase.stream().peek(w -> count.getAndIncrement()).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sum.divideBy(count.get());
  efBayesianNetwork.setMomentParameters(sum);
  return efBayesianNetwork.toBayesianNetwork(dag);
}

Fixed version (ground truth):
public static BayesianNetwork serialLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  final int[] count={0};
  SufficientStatistics sum=dataBase.stream().peek(w -> {
    count[0]++;
  }
).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sum.divideBy(count[0]);
  efBayesianNetwork.setMomentParameters(sum);
  return efBayesianNetwork.toBayesianNetwork(dag);
}
Program: 21669
Project: 21669
Buggy source:
private BayesianNetwork(DAG dag){
  this.dag=dag;
  initializeDistributions();
}

Fixed version (ground truth):
private BayesianNetwork(DAG dag,List<ConditionalDistribution> dists){
  this.dag=dag;
  this.distributions=dists;
}
Program: 21670
Project: 21670
Buggy source:
public static BayesianNetwork newBayesianNetwork(DAG dag){
  return new BayesianNetwork(dag);
}

Fixed version (ground truth):
public static BayesianNetwork newBayesianNetwork(DAG dag,List<ConditionalDistribution> dists){
  return new BayesianNetwork(dag);
}
Program: 21671
Project: 21671
Buggy source:
public EF_BaseDistribution_MultinomialParents(List<Variable> multinomialParents1,List<E> distributions1){
  if (multinomialParents1.size() == 0)   throw new IllegalArgumentException("String_Node_Str");
  if (distributions1.size() == 0)   throw new IllegalArgumentException("String_Node_Str");
  int size=MultinomialIndex.getNumberOfPossibleAssignments(multinomialParents1);
  if (size != distributions1.size())   throw new IllegalArgumentException("String_Node_Str");
  this.var=distributions1.get(0).getVariable();
  this.multinomialParents=multinomialParents1;
  this.distributions=distributions1;
  this.parents=new ArrayList();
  for (  Variable v : this.multinomialParents)   this.parents.add(v);
  E dist=distributions.get(0);
  if (dist.getClass().getName().equals("String_Node_Str")) {
    EF_ConditionalDistribution distCond=(EF_ConditionalDistribution)dist;
    for (    Variable v : distCond.getConditioningVariables())     this.parents.add(v);
  }
  this.parents=Collections.unmodifiableList(this.parents);
}

Fixed version (ground truth):
public EF_BaseDistribution_MultinomialParents(List<Variable> multinomialParents1,List<E> distributions1){
  if (distributions1.size() == 0)   throw new IllegalArgumentException("String_Node_Str");
  int size=MultinomialIndex.getNumberOfPossibleAssignments(multinomialParents1);
  if (size != distributions1.size())   throw new IllegalArgumentException("String_Node_Str");
  this.var=distributions1.get(0).getVariable();
  this.multinomialParents=multinomialParents1;
  this.distributions=distributions1;
  this.parents=new ArrayList();
  for (  Variable v : this.multinomialParents)   this.parents.add(v);
  E dist=distributions.get(0);
  if (dist.getClass().getName().equals("String_Node_Str")) {
    EF_ConditionalDistribution distCond=(EF_ConditionalDistribution)dist;
    for (    Variable v : distCond.getConditioningVariables())     this.parents.add(v);
  }
  this.parents=Collections.unmodifiableList(this.parents);
}
Program: 21672
Project: 21672
Buggy source:
@Override public double get(int i){
  i-=nConf;
  return baseVectors[(int)Math.ceil(i / (double)nConf)].get(i % baseSSLength);
}

Fixed version (ground truth):
@Override public double get(int i){
  if (i < nConf) {
    return this.baseConf[i];
  }
 else {
    i-=nConf;
    return baseVectors[Math.floorDiv(i,this.baseSSLength)].get(i % baseSSLength);
  }
}
Program: 21673
Project: 21673
Buggy source:
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position].copy(vec);
}

Fixed version (ground truth):
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position]=vec;
}
Program: 21674
Project: 21674
Buggy source:
@Override public void set(int i,double val){
  if (i < nConf) {
    baseConf[i]=val;
  }
 else {
    i-=nConf;
    baseVectors[(int)Math.ceil(i / (double)nConf)].set(i % baseSSLength,val);
  }
}

Fixed version (ground truth):
@Override public void set(int i,double val){
  if (i < nConf) {
    baseConf[i]=val;
  }
 else {
    i-=nConf;
    baseVectors[Math.floorDiv(i,this.baseSSLength)].set(i % baseSSLength,val);
  }
}
Program: 21675
Project: 21675
Buggy source:
public void updateNaturalFromMomentParameters(){
  CompoundVector<E> globalMomentsParam=(CompoundVector<E>)this.momentParameters;
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=this.getEF_BaseDistribution(i).createZeroedMomentParameters();
    moment.copy(globalMomentsParam.getVectorByPosition(i));
    moment.divideBy(globalMomentsParam.getBaseConf(i));
    this.getEF_BaseDistribution(i).setMomentParameters(momentParameters);
  }
  CompoundVector<E> vectorNatural=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    vectorNatural.setBaseConf(i,-this.getEF_BaseDistribution(i).computeLogNormalizer());
    vectorNatural.getVectorByPosition(i).copy(this.getEF_BaseDistribution(i).getNaturalParameters());
  }
  this.naturalParameters=vectorNatural;
  return;
}

Fixed version (ground truth):
public void updateNaturalFromMomentParameters(){
  CompoundVector<E> globalMomentsParam=(CompoundVector<E>)this.momentParameters;
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=(MomentParameters)globalMomentsParam.getVectorByPosition(i);
    moment.divideBy(globalMomentsParam.getBaseConf(i));
    this.getEF_BaseDistribution(i).setMomentParameters(momentParameters);
  }
  CompoundVector<E> vectorNatural=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    vectorNatural.setBaseConf(i,-this.getEF_BaseDistribution(i).computeLogNormalizer());
    vectorNatural.setVectorByPosition(i,this.getEF_BaseDistribution(i).getNaturalParameters());
  }
  this.naturalParameters=vectorNatural;
  return;
}
Program: 21676
Project: 21676
Buggy source:
public EF_BayesianNetwork(DAG dag){
  distributionList=new ArrayList(dag.getStaticVariables().getNumberOfVars());
  sizeSS=0;
  for (  ParentSet parentSet : dag.getParentSets()) {
    ConditionalDistribution dist=DistributionBuilder.newDistribution(parentSet.getMainVar(),parentSet.getParents());
    EF_ConditionalDistribution ef_dist=EF_DistributionBuilder.toEFDistributionGeneral(dist);
    distributionList.set(ef_dist.getVariable().getVarID(),ef_dist);
    sizeSS+=ef_dist.sizeOfSufficientStatistics();
  }
}

Fixed version (ground truth):
public EF_BayesianNetwork(DAG dag){
  distributionList=new ArrayList(dag.getStaticVariables().getNumberOfVars());
  sizeSS=0;
  for (  ParentSet parentSet : dag.getParentSets()) {
    ConditionalDistribution dist=DistributionBuilder.newDistribution(parentSet.getMainVar(),parentSet.getParents());
    EF_ConditionalDistribution ef_dist=EF_DistributionBuilder.toEFDistributionGeneral(dist);
    distributionList.add(ef_dist.getVariable().getVarID(),ef_dist);
    sizeSS+=ef_dist.sizeOfSufficientStatistics();
  }
}
Program: 21677
Project: 21677
Buggy source:
@Override public void updateNaturalFromMomentParameters(){
  CompoundVector globalMomentsParam=(CompoundVector)this.momentParameters;
  CompoundVector vectorNatural=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    MomentParameters localMomentParam=w.createZeroedMomentParameters();
    localMomentParam.copy(globalMomentsParam.getVectorByPosition(w.getVariable().getVarID()));
    w.setMomentParameters(localMomentParam);
    vectorNatural.setVectorByPosition(w.getVariable().getVarID(),w.getNaturalParameters());
  }
);
}

Fixed version (ground truth):
@Override public void updateNaturalFromMomentParameters(){
  CompoundVector globalMomentsParam=(CompoundVector)this.momentParameters;
  CompoundVector vectorNatural=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    MomentParameters localMomentParam=(MomentParameters)globalMomentsParam.getVectorByPosition(w.getVariable().getVarID());
    w.setMomentParameters(localMomentParam);
    vectorNatural.setVectorByPosition(w.getVariable().getVarID(),w.getNaturalParameters());
  }
);
}
Program: 21678
Project: 21678
Buggy source:
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position].copy(vec);
}

Fixed version (ground truth):
public void setVectorByPosition(int position,Vector vec){
  baseVectors[position]=vec;
}
Program: 21679
Project: 21679
Buggy source:
public BayesianNetwork toBayesianNetwork(DAG dag){
  BayesianNetwork bayesianNetwork=BayesianNetwork.newBayesianNetwork(dag);
  this.distributionList.stream().forEach(dist -> bayesianNetwork.setDistribution(dist.getVariable(),EF_DistributionBuilder.toDistributionGeneral(dist)));
  return bayesianNetwork;
}

Fixed version (ground truth):
public BayesianNetwork toBayesianNetwork(DAG dag){
  ConditionalDistribution[] dists=new ConditionalDistribution[dag.getStaticVariables().getNumberOfVars()];
  this.distributionList.parallelStream().forEach(dist -> dists[dist.getVariable().getVarID()]=EF_DistributionBuilder.toDistributionGeneral(dist));
  return BayesianNetwork.newBayesianNetwork(dag,Arrays.asList(dists));
}
Program: 21680
Project: 21680
Buggy source:
@Override public SufficientStatistics getSufficientStatistics(DataInstance data){
  CompoundVector vectorSS=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    vectorSS.getVectorByPosition(w.getVariable().getVarID()).copy(w.getSufficientStatistics(data));
  }
);
  return vectorSS;
}

Fixed version (ground truth):
@Override public SufficientStatistics getSufficientStatistics(DataInstance data){
  CompoundVector vectorSS=this.createCompoundVector();
  this.distributionList.parallelStream().forEach(w -> {
    vectorSS.setVectorByPosition(w.getVariable().getVarID(),w.getSufficientStatistics(data));
  }
);
  return vectorSS;
}
Program: 21681
Project: 21681
Buggy source:
public static SufficientStatistics sum(SufficientStatistics vec1,SufficientStatistics vec2){
  return (SufficientStatistics)Vector.sum(vec1,vec2);
}

Fixed version (ground truth):
public static SufficientStatistics sum(SufficientStatistics vec1,SufficientStatistics vec2){
  return vec1;
}
Program: 21682
Project: 21682
Buggy source:
public static BayesianNetwork parallelLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  AtomicInteger count=new AtomicInteger(0);
  SufficientStatistics sumSS=dataBase.parallelStream(batchSize).peek(w -> count.getAndIncrement()).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sumSS.divideBy(count.get());
  efBayesianNetwork.setMomentParameters(sumSS);
  return efBayesianNetwork.toBayesianNetwork(dag);
}

Fixed version (ground truth):
public static BayesianNetwork parallelLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  AtomicInteger count=new AtomicInteger(0);
  SufficientStatistics sumSS=dataBase.parallelStream(batchSize).peek(w -> {
    count.getAndIncrement();
  }
).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sumSS.divideBy(count.get());
  efBayesianNetwork.setMomentParameters(sumSS);
  return efBayesianNetwork.toBayesianNetwork(dag);
}
Program: 21683
Project: 21683
Buggy source:
public static BayesianNetwork serialLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  AtomicInteger count=new AtomicInteger(0);
  SufficientStatistics sum=dataBase.stream().peek(w -> count.getAndIncrement()).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sum.divideBy(count.get());
  efBayesianNetwork.setMomentParameters(sum);
  return efBayesianNetwork.toBayesianNetwork(dag);
}

Fixed version (ground truth):
public static BayesianNetwork serialLearnStatic(DAG dag,DataBase dataBase){
  EF_BayesianNetwork efBayesianNetwork=new EF_BayesianNetwork(dag);
  final int[] count={0};
  SufficientStatistics sum=dataBase.stream().peek(w -> {
    count[0]++;
  }
).map(efBayesianNetwork::getSufficientStatistics).reduce(efBayesianNetwork.createZeroedSufficientStatistics(),SufficientStatistics::sum);
  sum.divideBy(count[0]);
  efBayesianNetwork.setMomentParameters(sum);
  return efBayesianNetwork.toBayesianNetwork(dag);
}
Program: 21684
Project: 21684
Buggy source:
private BayesianNetwork(DAG dag){
  this.dag=dag;
  initializeDistributions();
}

Fixed version (ground truth):
private BayesianNetwork(DAG dag,List<ConditionalDistribution> dists){
  this.dag=dag;
  this.distributions=dists;
}
Program: 21685
Project: 21685
Buggy source:
public static BayesianNetwork newBayesianNetwork(DAG dag){
  return new BayesianNetwork(dag);
}

Fixed version (ground truth):
public static BayesianNetwork newBayesianNetwork(DAG dag,List<ConditionalDistribution> dists){
  return new BayesianNetwork(dag);
}
Program: 21686
Project: 21686
Buggy source:
public static DataOnMemory samplingNumberOfSamples(int numberOfSamples,DataBase dataBase){
  Random random=new Random(0);
  DataOnMemoryListContainer dataOnMemoryList=new DataOnMemoryListContainer(dataBase.getAttributes());
  int count=0;
  for (  DataInstance instance : dataBase) {
    if (count < numberOfSamples)     dataOnMemoryList.add(count,instance);
 else {
      int r=random.nextInt(count);
      if (r < numberOfSamples)       dataOnMemoryList.add(r,instance);
    }
    count++;
  }
  return dataOnMemoryList;
}

Fixed version (ground truth):
public static DataOnMemory samplingNumberOfSamples(int numberOfSamples,DataBase dataBase){
  Random random=new Random(0);
  DataOnMemoryListContainer dataOnMemoryList=new DataOnMemoryListContainer(dataBase.getAttributes());
  int count=0;
  for (  DataInstance instance : dataBase) {
    if (count < numberOfSamples) {
      dataOnMemoryList.add(count,instance);
    }
 else {
      int r=random.nextInt(count);
      if (r < numberOfSamples)       dataOnMemoryList.add(r,instance);
    }
    count++;
  }
  return dataOnMemoryList;
}
Program: 21687
Project: 21687
Buggy source:
public FiniteStateSpace(List<String> statesNames1){
  super(StateSpaceType.FINITE_SET);
  this.numberOfStates=statesNames1.size();
  this.statesNames=new ArrayList<>();
  this.mapStatesNames=new HashMap<>();
  for (int i=0; i < statesNames.size(); i++) {
    this.statesNames.add(statesNames.get(i));
    this.mapStatesNames.put(statesNames.get(i),i);
  }
}

Fixed version (ground truth):
public FiniteStateSpace(List<String> statesNames1){
  super(StateSpaceType.FINITE_SET);
  this.numberOfStates=statesNames1.size();
  this.statesNames=new ArrayList<>();
  this.mapStatesNames=new HashMap<>();
  for (int i=0; i < statesNames1.size(); i++) {
    this.statesNames.add(statesNames1.get(i));
    this.mapStatesNames.put(statesNames1.get(i),i);
  }
}
Program: 21688
Project: 21688
Buggy source:
public DataRowWeka(Attributes atts,String line){
  data=new double[atts.getNumberOfAttributes()];
  String[] parts=line.split("String_Node_Str");
  for (int i=0; i < parts.length; i++) {
switch (atts.getList().get(i).getStateSpace().getStateSpaceType()) {
case REAL:
      data[i]=Double.parseDouble(parts[i]);
    break;
case FINITE_SET:
  FiniteStateSpace finiteStateSpace=atts.getList().get(i).getStateSpace();
data[i]=finiteStateSpace.getIndexOfState(parts[i]);
}
}
}

Fixed version (ground truth):
public DataRowWeka(Attributes atts,String line){
  data=new double[atts.getNumberOfAttributes()];
  String[] parts=line.split("String_Node_Str");
  if (parts.length != atts.getNumberOfAttributes())   throw new IllegalStateException("String_Node_Str");
  for (int i=0; i < parts.length; i++) {
switch (atts.getList().get(i).getStateSpace().getStateSpaceType()) {
case REAL:
      data[i]=Double.parseDouble(parts[i]);
    break;
case FINITE_SET:
  FiniteStateSpace finiteStateSpace=atts.getList().get(i).getStateSpace();
data[i]=finiteStateSpace.getIndexOfState(parts[i]);
}
}
}
Program: 21689
Project: 21689
Buggy source:
@Override public Stream<DataRow> stream(){
  Stream<String> streamString=null;
  try {
    streamString=Files.lines(pathFile);
  }
 catch (  IOException ex) {
    throw new UncheckedIOException(ex);
  }
  return streamString.skip(this.dataLineCount).map(line -> new DataRowWeka(this.attributes,line));
}

Fixed version (ground truth):
@Override public Stream<DataRow> stream(){
  Stream<String> streamString=null;
  try {
    streamString=Files.lines(pathFile);
  }
 catch (  IOException ex) {
    throw new UncheckedIOException(ex);
  }
  return streamString.filter(w -> !w.isEmpty()).skip(this.dataLineCount).filter(w -> !w.isEmpty()).map(line -> new DataRowWeka(this.attributes,line));
}
Program: 21690
Project: 21690
Buggy source:
private static Attribute createAttributeFromLine(int index,String line){
  String[] parts=line.split("String_Node_Str");
  if (!parts[0].trim().startsWith("String_Node_Str"))   throw new IllegalArgumentException("String_Node_Str");
  String name=parts[1].trim();
  parts[2]=parts[2].trim();
  if (parts[2].equals("String_Node_Str")) {
    return new Attribute(index,name,new RealStateSpace());
  }
 else   if (parts[2].startsWith("String_Node_Str")) {
    String[] states=parts[2].substring(1,parts[2].length() - 1).split("String_Node_Str");
    List<String> statesNames=Arrays.stream(states).map(String::trim).collect(Collectors.toList());
    return new Attribute(index,name,new FiniteStateSpace(statesNames));
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str" + line);
  }
}

Fixed version (ground truth):
private static Attribute createAttributeFromLine(int index,String line){
  String[] parts=line.split("String_Node_Str");
  if (!parts[0].trim().startsWith("String_Node_Str"))   throw new IllegalArgumentException("String_Node_Str");
  String name=parts[1].trim();
  parts[2]=line.substring(parts[0].length() + parts[1].length() + 2);
  parts[2]=parts[2].trim();
  if (parts[2].equals("String_Node_Str")) {
    return new Attribute(index,name,new RealStateSpace());
  }
 else   if (parts[2].startsWith("String_Node_Str")) {
    String[] states=parts[2].substring(1,parts[2].length() - 1).split("String_Node_Str");
    List<String> statesNames=Arrays.stream(states).map(String::trim).collect(Collectors.toList());
    return new Attribute(index,name,new FiniteStateSpace(statesNames));
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str" + line);
  }
}
Program: 21691
Project: 21691
Buggy source:
public ARFFDataReader(String pathString){
  pathFile=Paths.get(pathString);
  try {
    Optional<String> atRelation=Files.lines(pathFile).map(String::trim).limit(0).filter(line -> line.startsWith("String_Node_Str")).findFirst();
    if (!atRelation.isPresent())     throw new IllegalArgumentException("String_Node_Str");
    relationName=atRelation.get().split("String_Node_Str")[1];
    final int[] count={0};
    Optional<String> atData=Files.lines(pathFile).map(String::trim).peek(line -> count[0]++).filter(line -> line.startsWith("String_Node_Str")).findFirst();
    if (!atData.isPresent())     throw new IllegalArgumentException("String_Node_Str");
    dataLineCount=count[0] + 1;
    List<String> attLines=Files.lines(pathFile).map(String::trim).limit(count[0]).filter(line -> line.startsWith("String_Node_Str")).collect(Collectors.toList());
    List<Attribute> atts=IntStream.range(0,attLines.size()).mapToObj(i -> createAttributeFromLine(i,attLines.get(i))).collect(Collectors.toList());
    this.attributes=new Attributes(atts);
    stateSpace=new StateSpaceType[atts.size()];
    for (    Attribute att : atts) {
      stateSpace[att.getIndex()]=att.getStateSpace().getStateSpaceType();
    }
  }
 catch (  IOException ex) {
    throw new UncheckedIOException(ex);
  }
}

Fixed version (ground truth):
public ARFFDataReader(String pathString){
  pathFile=Paths.get(pathString);
  try {
    Optional<String> atRelation=Files.lines(pathFile).map(String::trim).filter(w -> !w.isEmpty()).limit(1).filter(line -> line.startsWith("String_Node_Str")).findFirst();
    if (!atRelation.isPresent())     throw new IllegalArgumentException("String_Node_Str");
    relationName=atRelation.get().split("String_Node_Str")[1];
    final int[] count={0};
    Optional<String> atData=Files.lines(pathFile).map(String::trim).filter(w -> !w.isEmpty()).peek(line -> count[0]++).filter(line -> line.startsWith("String_Node_Str")).findFirst();
    if (!atData.isPresent())     throw new IllegalArgumentException("String_Node_Str");
    dataLineCount=count[0];
    List<String> attLines=Files.lines(pathFile).map(String::trim).filter(w -> !w.isEmpty()).limit(dataLineCount).filter(line -> line.startsWith("String_Node_Str")).collect(Collectors.toList());
    List<Attribute> atts=IntStream.range(0,attLines.size()).mapToObj(i -> createAttributeFromLine(i,attLines.get(i))).collect(Collectors.toList());
    this.attributes=new Attributes(atts);
    stateSpace=new StateSpaceType[atts.size()];
    for (    Attribute att : atts) {
      stateSpace[att.getIndex()]=att.getStateSpace().getStateSpaceType();
    }
  }
 catch (  IOException ex) {
    throw new UncheckedIOException(ex);
  }
}
Program: 21692
Project: 21692
Buggy source:
public DataRowWeka(Attributes atts,String line){
  data=new double[atts.getNumberOfAttributes()];
  String[] parts=line.split("String_Node_Str");
  for (int i=0; i < parts.length; i++) {
switch (atts.getList().get(i).getStateSpace().getStateSpaceType()) {
case REAL:
      data[i]=Double.parseDouble(parts[i]);
    break;
case FINITE_SET:
  FiniteStateSpace finiteStateSpace=atts.getList().get(i).getStateSpace();
data[i]=finiteStateSpace.getIndexOfState(parts[i]);
}
}
}

Fixed version (ground truth):
public DataRowWeka(Attributes atts,String line){
  data=new double[atts.getNumberOfAttributes()];
  String[] parts=line.split("String_Node_Str");
  if (parts.length != atts.getNumberOfAttributes())   throw new IllegalStateException("String_Node_Str");
  for (int i=0; i < parts.length; i++) {
switch (atts.getList().get(i).getStateSpace().getStateSpaceType()) {
case REAL:
      data[i]=Double.parseDouble(parts[i]);
    break;
case FINITE_SET:
  FiniteStateSpace finiteStateSpace=atts.getList().get(i).getStateSpace();
data[i]=finiteStateSpace.getIndexOfState(parts[i]);
}
}
}
Program: 21693
Project: 21693
Buggy source:
@Override public Stream<DataRow> stream(){
  Stream<String> streamString=null;
  try {
    streamString=Files.lines(pathFile);
  }
 catch (  IOException ex) {
    throw new UncheckedIOException(ex);
  }
  return streamString.skip(this.dataLineCount).map(line -> new DataRowWeka(this.attributes,line));
}

Fixed version (ground truth):
@Override public Stream<DataRow> stream(){
  Stream<String> streamString=null;
  try {
    streamString=Files.lines(pathFile);
  }
 catch (  IOException ex) {
    throw new UncheckedIOException(ex);
  }
  return streamString.filter(w -> !w.isEmpty()).skip(this.dataLineCount).filter(w -> !w.isEmpty()).map(line -> new DataRowWeka(this.attributes,line));
}
Program: 21694
Project: 21694
Buggy source:
private static Attribute createAttributeFromLine(int index,String line){
  String[] parts=line.split("String_Node_Str");
  if (!parts[0].trim().startsWith("String_Node_Str"))   throw new IllegalArgumentException("String_Node_Str");
  String name=parts[1].trim();
  parts[2]=parts[2].trim();
  if (parts[2].equals("String_Node_Str")) {
    return new Attribute(index,name,new RealStateSpace());
  }
 else   if (parts[2].startsWith("String_Node_Str")) {
    String[] states=parts[2].substring(1,parts[2].length() - 1).split("String_Node_Str");
    List<String> statesNames=Arrays.stream(states).map(String::trim).collect(Collectors.toList());
    return new Attribute(index,name,new FiniteStateSpace(statesNames));
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str" + line);
  }
}

Fixed version (ground truth):
private static Attribute createAttributeFromLine(int index,String line){
  String[] parts=line.split("String_Node_Str");
  if (!parts[0].trim().startsWith("String_Node_Str"))   throw new IllegalArgumentException("String_Node_Str");
  String name=parts[1].trim();
  parts[2]=line.substring(parts[0].length() + parts[1].length() + 2);
  parts[2]=parts[2].trim();
  if (parts[2].equals("String_Node_Str")) {
    return new Attribute(index,name,new RealStateSpace());
  }
 else   if (parts[2].startsWith("String_Node_Str")) {
    String[] states=parts[2].substring(1,parts[2].length() - 1).split("String_Node_Str");
    List<String> statesNames=Arrays.stream(states).map(String::trim).collect(Collectors.toList());
    return new Attribute(index,name,new FiniteStateSpace(statesNames));
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str" + line);
  }
}
Program: 21695
Project: 21695
Buggy source:
public ARFFDataReader(String pathString){
  pathFile=Paths.get(pathString);
  try {
    Optional<String> atRelation=Files.lines(pathFile).map(String::trim).limit(0).filter(line -> line.startsWith("String_Node_Str")).findFirst();
    if (!atRelation.isPresent())     throw new IllegalArgumentException("String_Node_Str");
    relationName=atRelation.get().split("String_Node_Str")[1];
    final int[] count={0};
    Optional<String> atData=Files.lines(pathFile).map(String::trim).peek(line -> count[0]++).filter(line -> line.startsWith("String_Node_Str")).findFirst();
    if (!atData.isPresent())     throw new IllegalArgumentException("String_Node_Str");
    dataLineCount=count[0] + 1;
    List<String> attLines=Files.lines(pathFile).map(String::trim).limit(count[0]).filter(line -> line.startsWith("String_Node_Str")).collect(Collectors.toList());
    List<Attribute> atts=IntStream.range(0,attLines.size()).mapToObj(i -> createAttributeFromLine(i,attLines.get(i))).collect(Collectors.toList());
    this.attributes=new Attributes(atts);
    stateSpace=new StateSpaceType[atts.size()];
    for (    Attribute att : atts) {
      stateSpace[att.getIndex()]=att.getStateSpace().getStateSpaceType();
    }
  }
 catch (  IOException ex) {
    throw new UncheckedIOException(ex);
  }
}

Fixed version (ground truth):
public ARFFDataReader(String pathString){
  pathFile=Paths.get(pathString);
  try {
    Optional<String> atRelation=Files.lines(pathFile).map(String::trim).filter(w -> !w.isEmpty()).limit(1).filter(line -> line.startsWith("String_Node_Str")).findFirst();
    if (!atRelation.isPresent())     throw new IllegalArgumentException("String_Node_Str");
    relationName=atRelation.get().split("String_Node_Str")[1];
    final int[] count={0};
    Optional<String> atData=Files.lines(pathFile).map(String::trim).filter(w -> !w.isEmpty()).peek(line -> count[0]++).filter(line -> line.startsWith("String_Node_Str")).findFirst();
    if (!atData.isPresent())     throw new IllegalArgumentException("String_Node_Str");
    dataLineCount=count[0];
    List<String> attLines=Files.lines(pathFile).map(String::trim).filter(w -> !w.isEmpty()).limit(dataLineCount).filter(line -> line.startsWith("String_Node_Str")).collect(Collectors.toList());
    List<Attribute> atts=IntStream.range(0,attLines.size()).mapToObj(i -> createAttributeFromLine(i,attLines.get(i))).collect(Collectors.toList());
    this.attributes=new Attributes(atts);
    stateSpace=new StateSpaceType[atts.size()];
    for (    Attribute att : atts) {
      stateSpace[att.getIndex()]=att.getStateSpace().getStateSpaceType();
    }
  }
 catch (  IOException ex) {
    throw new UncheckedIOException(ex);
  }
}
Program: 21696
Project: 21696
Buggy source:
public static DataOnMemory samplingNumberOfSamples(int numberOfSamples,DataBase dataBase){
  Random random=new Random(0);
  DataOnMemoryListContainer dataOnMemoryList=new DataOnMemoryListContainer(dataBase.getAttributes());
  int count=0;
  for (  DataInstance instance : dataBase) {
    if (count < numberOfSamples)     dataOnMemoryList.add(count,instance);
 else {
      int r=random.nextInt(count);
      if (r < numberOfSamples)       dataOnMemoryList.add(r,instance);
    }
    count++;
  }
  return dataOnMemoryList;
}

Fixed version (ground truth):
public static DataOnMemory samplingNumberOfSamples(int numberOfSamples,DataBase dataBase){
  Random random=new Random(0);
  DataOnMemoryListContainer dataOnMemoryList=new DataOnMemoryListContainer(dataBase.getAttributes());
  int count=0;
  for (  DataInstance instance : dataBase) {
    if (count < numberOfSamples) {
      dataOnMemoryList.add(count,instance);
    }
 else {
      int r=random.nextInt(count);
      if (r < numberOfSamples)       dataOnMemoryList.add(r,instance);
    }
    count++;
  }
  return dataOnMemoryList;
}
Program: 21697
Project: 21697
Buggy source:
public FiniteStateSpace(List<String> statesNames1){
  super(StateSpaceType.FINITE_SET);
  this.numberOfStates=statesNames1.size();
  this.statesNames=new ArrayList<>();
  this.mapStatesNames=new HashMap<>();
  for (int i=0; i < statesNames.size(); i++) {
    this.statesNames.add(statesNames.get(i));
    this.mapStatesNames.put(statesNames.get(i),i);
  }
}

Fixed version (ground truth):
public FiniteStateSpace(List<String> statesNames1){
  super(StateSpaceType.FINITE_SET);
  this.numberOfStates=statesNames1.size();
  this.statesNames=new ArrayList<>();
  this.mapStatesNames=new HashMap<>();
  for (int i=0; i < statesNames1.size(); i++) {
    this.statesNames.add(statesNames1.get(i));
    this.mapStatesNames.put(statesNames1.get(i),i);
  }
}
Program: 21698
Project: 21698
Buggy source:
public static DataOnMemory samplingNumberOfSamples(int numberOfSamples,DataBase dataBase){
  Random random=new Random(0);
  DataOnMemoryListContainer dataOnMemoryList=new DataOnMemoryListContainer(dataBase.getAttributes());
  int count=0;
  for (  DataInstance instance : dataBase) {
    if (count < numberOfSamples)     dataOnMemoryList.add(count,instance);
 else {
      int r=random.nextInt(count);
      if (r < numberOfSamples)       dataOnMemoryList.add(r,instance);
    }
    count++;
  }
  return dataOnMemoryList;
}

Fixed version (ground truth):
public static DataOnMemory samplingNumberOfSamples(int numberOfSamples,DataBase dataBase){
  Random random=new Random(0);
  DataOnMemoryListContainer dataOnMemoryList=new DataOnMemoryListContainer(dataBase.getAttributes());
  int count=0;
  for (  DataInstance instance : dataBase) {
    if (count < numberOfSamples) {
      dataOnMemoryList.add(count,instance);
    }
 else {
      int r=random.nextInt(count);
      if (r < numberOfSamples)       dataOnMemoryList.add(r,instance);
    }
    count++;
  }
  return dataOnMemoryList;
}
Program: 21699
Project: 21699
Buggy source:
public FiniteStateSpace(List<String> statesNames1){
  super(StateSpaceType.FINITE_SET);
  this.numberOfStates=statesNames1.size();
  this.statesNames=new ArrayList<>();
  this.mapStatesNames=new HashMap<>();
  for (int i=0; i < statesNames.size(); i++) {
    this.statesNames.add(statesNames.get(i));
    this.mapStatesNames.put(statesNames.get(i),i);
  }
}

Fixed version (ground truth):
public FiniteStateSpace(List<String> statesNames1){
  super(StateSpaceType.FINITE_SET);
  this.numberOfStates=statesNames1.size();
  this.statesNames=new ArrayList<>();
  this.mapStatesNames=new HashMap<>();
  for (int i=0; i < statesNames1.size(); i++) {
    this.statesNames.add(statesNames1.get(i));
    this.mapStatesNames.put(statesNames1.get(i),i);
  }
}
Program: 21700
Project: 21700
Buggy source:
public static DataOnMemory samplingNumberOfSamples(int numberOfSamples,DataBase dataBase){
  Random random=new Random(0);
  DataOnMemoryListContainer dataOnMemoryList=new DataOnMemoryListContainer(dataBase.getAttributes());
  int count=0;
  for (  DataInstance instance : dataBase) {
    if (count < numberOfSamples)     dataOnMemoryList.add(count,instance);
 else {
      int r=random.nextInt(count);
      if (r < numberOfSamples)       dataOnMemoryList.add(r,instance);
    }
    count++;
  }
  return dataOnMemoryList;
}

Fixed version (ground truth):
public static DataOnMemory samplingNumberOfSamples(int numberOfSamples,DataBase dataBase){
  Random random=new Random(0);
  DataOnMemoryListContainer dataOnMemoryList=new DataOnMemoryListContainer(dataBase.getAttributes());
  int count=0;
  for (  DataInstance instance : dataBase) {
    if (count < numberOfSamples) {
      dataOnMemoryList.add(count,instance);
    }
 else {
      int r=random.nextInt(count);
      if (r < numberOfSamples)       dataOnMemoryList.add(r,instance);
    }
    count++;
  }
  return dataOnMemoryList;
}