nus-yam/ex-repair huggingface dataset:
Program: 21503
Project: 21503
Buggy source:
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}

Fixed version (ground truth):
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}
Program: 21504
Project: 21504
Buggy source:
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}

Fixed version (ground truth):
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(-variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}
Program: 21505
Project: 21505
Buggy source:
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  double[] theta_beta=Arrays.stream(coeffParents).map(w -> w / variance).toArray();
  naturalParameters.setThetaCov_NatParam(theta_Minus1,theta_beta,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}

Fixed version (ground truth):
public static EF_Normal_NormalParents toEFDistribution(Normal_NormalParents dist){
  EF_Normal_NormalParents ef_normal_normalParents=new EF_Normal_NormalParents(dist.getVariable(),dist.getConditioningVariables());
  CompoundVector naturalParameters=ef_normal_normalParents.createEmtpyCompoundVector();
  double beta_0=dist.getIntercept();
  double[] coeffParents=dist.getCoeffParents();
  double sd=dist.getSd();
  double variance=sd * sd;
  double theta_0=beta_0 / variance;
  naturalParameters.setThetaBeta0_NatParam(theta_0);
  double variance2Inv=1.0 / (2 * variance);
  double[] theta0_beta=Arrays.stream(coeffParents).map(w -> -w * beta_0 * variance2Inv).toArray();
  naturalParameters.setThetaBeta0Beta_NatParam(theta0_beta);
  double theta_Minus1=-variance2Inv;
  naturalParameters.setThetaCov_NatParam(theta_Minus1,coeffParents,variance2Inv);
  ef_normal_normalParents.setNaturalParameters(naturalParameters);
  return ef_normal_normalParents;
}
Program: 21506
Project: 21506
Buggy source:
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(-variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}

Fixed version (ground truth):
public void setThetaCov_NatParam(double theta_Minus1,double[] beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  double[] theta_beta=Arrays.stream(beta).map(w -> w * variance2Inv).toArray();
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector betaRV=new ArrayRealVector(beta);
  RealMatrix theta_betaBeta=betaRV.outerProduct(betaRV).scalarMultiply(-variance2Inv * 2);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}
Program: 21507
Project: 21507
Buggy source:
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}

Fixed version (ground truth):
public void setThetaCov_NatParam(double theta_Minus1,double[] theta_beta,double variance2Inv){
  double[] theta_Minus1array={theta_Minus1};
  RealVector covXY=new ArrayRealVector(theta_Minus1array,theta_beta);
  covbaseVector.setColumnVector(0,covXY);
  covbaseVector.setRowVector(0,covXY);
  RealVector beta=new ArrayRealVector(theta_beta);
  RealMatrix theta_betaBeta=beta.outerProduct(beta).scalarMultiply(-variance2Inv);
  covbaseVector.setSubMatrix(theta_betaBeta.getData(),1,1);
}
Program: 21508
Project: 21508
Buggy source:
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);
}

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);
  }
  CompoundVector globalMomentsParam=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=this.getEF_BaseDistribution(i).getMomentParameters();
    globalMomentsParam.setBaseConf(i,1.0);
    globalMomentsParam.setVectorByPosition(i,moment);
  }
  CompoundVector 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;
  this.parents=Collections.unmodifiableList(this.parents);
}
Program: 21509
Project: 21509
Buggy source:
public double[] getAllBetaValues(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double[] theta_beta=globalNaturalParameters.getXYbaseMatrix().toArray();
  double beta0=theta_beta[0] * variance;
  double[] beta=Arrays.stream(theta_beta).map(w -> -w * 2 * variance / beta0).toArray();
  beta[0]=beta0;
  return beta;
}

Fixed version (ground truth):
public double[] getAllBetaValues(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double[] theta_beta=globalNaturalParameters.getXYbaseMatrix().toArray();
  double variance=getVariance();
  double beta0=theta_beta[0] * variance;
  double[] beta=Arrays.stream(theta_beta).map(w -> -w * 2 * variance / beta0).toArray();
  beta[0]=beta0;
  return beta;
}
Program: 21510
Project: 21510
Buggy source:
public double dotProduct(CompoundVector vec){
  return 0.0;
}

Fixed version (ground truth):
public double dotProduct(CompoundVector vec){
  double result=0.0;
  result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=this.getcovbaseMatrix().getRowVector(0).dotProduct(vec.getcovbaseMatrix().getRowVector(0));
  result+=this.getcovbaseMatrix().getRowVector(1).dotProduct(vec.getcovbaseMatrix().getRowVector(1));
  return result;
}
Program: 21511
Project: 21511
Buggy source:
@Override public double computeLogNormalizer(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double theta_0=globalNaturalParameters.get(0);
  double beta_0=theta_0 * variance;
  return (beta_0 * beta_0) / (2 * variance) + Math.log(variance);
}

Fixed version (ground truth):
@Override public double computeLogNormalizer(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double theta_0=globalNaturalParameters.get(0);
  double theta_Minus1=globalNaturalParameters.getcovbaseMatrix().getEntry(0,0);
  double variance=-0.5 / theta_Minus1;
  double beta_0=theta_0 * variance;
  return (beta_0 * beta_0) / (2 * variance) + Math.log(variance);
}
Program: 21512
Project: 21512
Buggy source:
@Override public double computeLogBaseMeasure(DataInstance dataInstance){
  return 0.5 * Math.log(2 * Math.PI);
}

Fixed version (ground truth):
@Override public double computeLogBaseMeasure(DataInstance dataInstance){
  return -0.5 * Math.log(2 * Math.PI);
}
Program: 21514
Project: 21514
Buggy source:
public double getVariance(){
  return variance;
}

Fixed version (ground truth):
public double getVariance(){
  double theta_Minus1=((CompoundVector)this.naturalParameters).getcovbaseMatrix().getEntry(0,0);
  return -0.5 / theta_Minus1;
}
Program: 21515
Project: 21515
Buggy source:
public EF_BayesianNetwork(List<ParentSet> parentSets){
  distributionList=new ArrayList(parentSets.size());
  sizeSS=0;
  for (  ParentSet parentSet : parentSets) {
    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();
  }
  this.momentParameters=this.createZeroedMomentParameters();
  this.naturalParameters=this.createZeroedNaturalParameters();
}

Fixed version (ground truth):
public EF_BayesianNetwork(List<ParentSet> parentSets){
  distributionList=new ArrayList(parentSets.size());
  sizeSS=0;
  for (  ParentSet parentSet : parentSets) {
    ConditionalDistribution dist=DistributionBuilder.newDistribution(parentSet.getMainVar(),parentSet.getParents());
    dist.randomInitialization(new Random(0));
    EF_ConditionalDistribution ef_dist=EF_DistributionBuilder.toEFDistributionGeneral(dist);
    distributionList.add(ef_dist.getVariable().getVarID(),ef_dist);
    sizeSS+=ef_dist.sizeOfSufficientStatistics();
  }
  CompoundVector vectorNatural=this.createEmtpyCompoundVector();
  for (  EF_ConditionalDistribution dist : distributionList) {
    vectorNatural.setVectorByPosition(dist.getVariable().getVarID(),dist.getNaturalParameters());
  }
  this.naturalParameters=vectorNatural;
  this.momentParameters=null;
}
Program: 21516
Project: 21516
Buggy source:
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);
  }
  CompoundVector globalMomentsParam=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=this.getEF_BaseDistribution(i).getMomentParameters();
    globalMomentsParam.setBaseConf(i,1.0);
    globalMomentsParam.setVectorByPosition(i,moment);
  }
  CompoundVector 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;
  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);
  }
  CompoundVector 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;
  this.momentParameters=null;
  this.parents=Collections.unmodifiableList(this.parents);
}
Program: 21517
Project: 21517
Buggy source:
public EF_BayesianNetwork(List<ParentSet> parentSets){
  distributionList=new ArrayList(parentSets.size());
  sizeSS=0;
  for (  ParentSet parentSet : parentSets) {
    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();
  }
  this.momentParameters=this.createZeroedMomentParameters();
  this.naturalParameters=this.createZeroedNaturalParameters();
}

Fixed version (ground truth):
public EF_BayesianNetwork(List<ParentSet> parentSets){
  distributionList=new ArrayList(parentSets.size());
  sizeSS=0;
  for (  ParentSet parentSet : parentSets) {
    ConditionalDistribution dist=DistributionBuilder.newDistribution(parentSet.getMainVar(),parentSet.getParents());
    dist.randomInitialization(new Random(0));
    EF_ConditionalDistribution ef_dist=EF_DistributionBuilder.toEFDistributionGeneral(dist);
    distributionList.add(ef_dist.getVariable().getVarID(),ef_dist);
    sizeSS+=ef_dist.sizeOfSufficientStatistics();
  }
  CompoundVector vectorNatural=this.createEmtpyCompoundVector();
  for (  EF_ConditionalDistribution dist : distributionList) {
    vectorNatural.setVectorByPosition(dist.getVariable().getVarID(),dist.getNaturalParameters());
  }
  this.naturalParameters=vectorNatural;
  this.momentParameters=null;
}
Program: 21518
Project: 21518
Buggy source:
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);
  }
  CompoundVector globalMomentsParam=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=this.getEF_BaseDistribution(i).getMomentParameters();
    globalMomentsParam.setBaseConf(i,1.0);
    globalMomentsParam.setVectorByPosition(i,moment);
  }
  CompoundVector 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;
  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);
  }
  CompoundVector 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;
  this.momentParameters=null;
  this.parents=Collections.unmodifiableList(this.parents);
}
Program: 21519
Project: 21519
Buggy source:
public EF_BayesianNetwork(List<ParentSet> parentSets){
  distributionList=new ArrayList(parentSets.size());
  sizeSS=0;
  for (  ParentSet parentSet : parentSets) {
    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();
  }
  this.momentParameters=this.createZeroedMomentParameters();
  this.naturalParameters=this.createZeroedNaturalParameters();
}

Fixed version (ground truth):
public EF_BayesianNetwork(List<ParentSet> parentSets){
  distributionList=new ArrayList(parentSets.size());
  sizeSS=0;
  for (  ParentSet parentSet : parentSets) {
    ConditionalDistribution dist=DistributionBuilder.newDistribution(parentSet.getMainVar(),parentSet.getParents());
    dist.randomInitialization(new Random(0));
    EF_ConditionalDistribution ef_dist=EF_DistributionBuilder.toEFDistributionGeneral(dist);
    distributionList.add(ef_dist.getVariable().getVarID(),ef_dist);
    sizeSS+=ef_dist.sizeOfSufficientStatistics();
  }
  CompoundVector vectorNatural=this.createEmtpyCompoundVector();
  for (  EF_ConditionalDistribution dist : distributionList) {
    vectorNatural.setVectorByPosition(dist.getVariable().getVarID(),dist.getNaturalParameters());
  }
  this.naturalParameters=vectorNatural;
  this.momentParameters=null;
}
Program: 21520
Project: 21520
Buggy source:
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);
  }
  CompoundVector globalMomentsParam=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=this.getEF_BaseDistribution(i).getMomentParameters();
    globalMomentsParam.setBaseConf(i,1.0);
    globalMomentsParam.setVectorByPosition(i,moment);
  }
  CompoundVector 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;
  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);
  }
  CompoundVector 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;
  this.momentParameters=null;
  this.parents=Collections.unmodifiableList(this.parents);
}
Program: 21521
Project: 21521
Buggy source:
public EF_BayesianNetwork(List<ParentSet> parentSets){
  distributionList=new ArrayList(parentSets.size());
  sizeSS=0;
  for (  ParentSet parentSet : parentSets) {
    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();
  }
  this.momentParameters=this.createZeroedMomentParameters();
  this.naturalParameters=this.createZeroedNaturalParameters();
}

Fixed version (ground truth):
public EF_BayesianNetwork(List<ParentSet> parentSets){
  distributionList=new ArrayList(parentSets.size());
  sizeSS=0;
  for (  ParentSet parentSet : parentSets) {
    ConditionalDistribution dist=DistributionBuilder.newDistribution(parentSet.getMainVar(),parentSet.getParents());
    dist.randomInitialization(new Random(0));
    EF_ConditionalDistribution ef_dist=EF_DistributionBuilder.toEFDistributionGeneral(dist);
    distributionList.add(ef_dist.getVariable().getVarID(),ef_dist);
    sizeSS+=ef_dist.sizeOfSufficientStatistics();
  }
  CompoundVector vectorNatural=this.createEmtpyCompoundVector();
  for (  EF_ConditionalDistribution dist : distributionList) {
    vectorNatural.setVectorByPosition(dist.getVariable().getVarID(),dist.getNaturalParameters());
  }
  this.naturalParameters=vectorNatural;
  this.momentParameters=null;
}
Program: 21522
Project: 21522
Buggy source:
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);
}

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);
  }
  CompoundVector globalMomentsParam=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=this.getEF_BaseDistribution(i).getMomentParameters();
    globalMomentsParam.setBaseConf(i,1.0);
    globalMomentsParam.setVectorByPosition(i,moment);
  }
  CompoundVector 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;
  this.parents=Collections.unmodifiableList(this.parents);
}
Program: 21523
Project: 21523
Buggy source:
public double[] getAllBetaValues(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double[] theta_beta=globalNaturalParameters.getXYbaseMatrix().toArray();
  double beta0=theta_beta[0] * variance;
  double[] beta=Arrays.stream(theta_beta).map(w -> -w * 2 * variance / beta0).toArray();
  beta[0]=beta0;
  return beta;
}

Fixed version (ground truth):
public double[] getAllBetaValues(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double[] theta_beta=globalNaturalParameters.getXYbaseMatrix().toArray();
  double variance=getVariance();
  double beta0=theta_beta[0] * variance;
  double[] beta=Arrays.stream(theta_beta).map(w -> -w * 2 * variance / beta0).toArray();
  beta[0]=beta0;
  return beta;
}
Program: 21524
Project: 21524
Buggy source:
public double dotProduct(CompoundVector vec){
  return 0.0;
}

Fixed version (ground truth):
public double dotProduct(CompoundVector vec){
  double result=0.0;
  result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=this.getcovbaseMatrix().getRowVector(0).dotProduct(vec.getcovbaseMatrix().getRowVector(0));
  result+=this.getcovbaseMatrix().getRowVector(1).dotProduct(vec.getcovbaseMatrix().getRowVector(1));
  return result;
}
Program: 21525
Project: 21525
Buggy source:
@Override public double computeLogNormalizer(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double theta_0=globalNaturalParameters.get(0);
  double beta_0=theta_0 * variance;
  return (beta_0 * beta_0) / (2 * variance) + Math.log(variance);
}

Fixed version (ground truth):
@Override public double computeLogNormalizer(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double theta_0=globalNaturalParameters.get(0);
  double theta_Minus1=globalNaturalParameters.getcovbaseMatrix().getEntry(0,0);
  double variance=-0.5 / theta_Minus1;
  double beta_0=theta_0 * variance;
  return (beta_0 * beta_0) / (2 * variance) + Math.log(variance);
}
Program: 21526
Project: 21526
Buggy source:
@Override public double computeLogBaseMeasure(DataInstance dataInstance){
  return 0.5 * Math.log(2 * Math.PI);
}

Fixed version (ground truth):
@Override public double computeLogBaseMeasure(DataInstance dataInstance){
  return -0.5 * Math.log(2 * Math.PI);
}
Program: 21528
Project: 21528
Buggy source:
public double getVariance(){
  return variance;
}

Fixed version (ground truth):
public double getVariance(){
  double theta_Minus1=((CompoundVector)this.naturalParameters).getcovbaseMatrix().getEntry(0,0);
  return -0.5 / theta_Minus1;
}
Program: 21529
Project: 21529
Buggy source:
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);
}

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);
  }
  CompoundVector globalMomentsParam=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=this.getEF_BaseDistribution(i).getMomentParameters();
    globalMomentsParam.setBaseConf(i,1.0);
    globalMomentsParam.setVectorByPosition(i,moment);
  }
  CompoundVector 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;
  this.parents=Collections.unmodifiableList(this.parents);
}
Program: 21530
Project: 21530
Buggy source:
public double[] getAllBetaValues(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double[] theta_beta=globalNaturalParameters.getXYbaseMatrix().toArray();
  double beta0=theta_beta[0] * variance;
  double[] beta=Arrays.stream(theta_beta).map(w -> -w * 2 * variance / beta0).toArray();
  beta[0]=beta0;
  return beta;
}

Fixed version (ground truth):
public double[] getAllBetaValues(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double[] theta_beta=globalNaturalParameters.getXYbaseMatrix().toArray();
  double variance=getVariance();
  double beta0=theta_beta[0] * variance;
  double[] beta=Arrays.stream(theta_beta).map(w -> -w * 2 * variance / beta0).toArray();
  beta[0]=beta0;
  return beta;
}
Program: 21531
Project: 21531
Buggy source:
public double dotProduct(CompoundVector vec){
  return 0.0;
}

Fixed version (ground truth):
public double dotProduct(CompoundVector vec){
  double result=0.0;
  result=this.getXYbaseMatrix().dotProduct(vec.getXYbaseMatrix());
  result+=this.getcovbaseMatrix().getRowVector(0).dotProduct(vec.getcovbaseMatrix().getRowVector(0));
  result+=this.getcovbaseMatrix().getRowVector(1).dotProduct(vec.getcovbaseMatrix().getRowVector(1));
  return result;
}
Program: 21532
Project: 21532
Buggy source:
@Override public double computeLogNormalizer(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double theta_0=globalNaturalParameters.get(0);
  double beta_0=theta_0 * variance;
  return (beta_0 * beta_0) / (2 * variance) + Math.log(variance);
}

Fixed version (ground truth):
@Override public double computeLogNormalizer(){
  CompoundVector globalNaturalParameters=(CompoundVector)this.naturalParameters;
  double theta_0=globalNaturalParameters.get(0);
  double theta_Minus1=globalNaturalParameters.getcovbaseMatrix().getEntry(0,0);
  double variance=-0.5 / theta_Minus1;
  double beta_0=theta_0 * variance;
  return (beta_0 * beta_0) / (2 * variance) + Math.log(variance);
}
Program: 21533
Project: 21533
Buggy source:
@Override public double computeLogBaseMeasure(DataInstance dataInstance){
  return 0.5 * Math.log(2 * Math.PI);
}

Fixed version (ground truth):
@Override public double computeLogBaseMeasure(DataInstance dataInstance){
  return -0.5 * Math.log(2 * Math.PI);
}
Program: 21535
Project: 21535
Buggy source:
public double getVariance(){
  return variance;
}

Fixed version (ground truth):
public double getVariance(){
  double theta_Minus1=((CompoundVector)this.naturalParameters).getcovbaseMatrix().getEntry(0,0);
  return -0.5 / theta_Minus1;
}
Program: 21536
Project: 21536
Buggy source:
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);
}

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);
  }
  CompoundVector globalMomentsParam=this.createCompoundVector();
  for (int i=0; i < numberOfConfigurations(); i++) {
    MomentParameters moment=this.getEF_BaseDistribution(i).getMomentParameters();
    globalMomentsParam.setBaseConf(i,1.0);
    globalMomentsParam.setVectorByPosition(i,moment);
  }
  CompoundVector 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;
  this.parents=Collections.unmodifiableList(this.parents);
}
Program: 21537
Project: 21537
Buggy source:
default String toARFFString(List<Variable> vars){
  StringBuilder builder=new StringBuilder(vars.size() * 2);
  for (int i=0; i < vars.size() - 1; i++) {
    if (vars.get(i).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
      FiniteStateSpace stateSpace=vars.get(i).getStateSpace();
      String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(i)));
      builder.append(nameState + "String_Node_Str");
    }
 else {
      builder.append(this.getValue(vars.get(i)) + "String_Node_Str");
    }
  }
  if (vars.get(vars.size() - 1).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
    FiniteStateSpace stateSpace=vars.get(vars.size() - 1).getStateSpace();
    String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(vars.size() - 1)));
    builder.append(nameState);
  }
 else {
    builder.append(this.getValue(vars.get(vars.size() - 1)));
  }
  return builder.toString();
}

Fixed version (ground truth):
default String toARFFString(List<Variable> vars){
  StringBuilder builder=new StringBuilder(vars.size() * 2);
  for (int i=0; i < vars.size() - 1; i++) {
    if (vars.get(i).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
      FiniteStateSpace stateSpace=vars.get(i).getStateSpace();
      String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(i)));
      builder.append(nameState + "String_Node_Str");
    }
 else     if (vars.get(i).getStateSpace().getStateSpaceType() == StateSpaceType.REAL) {
      builder.append(this.getValue(vars.get(i)) + "String_Node_Str");
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + vars.get(i).getStateSpace().getStateSpaceType());
    }
  }
  if (vars.get(vars.size() - 1).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
    FiniteStateSpace stateSpace=vars.get(vars.size() - 1).getStateSpace();
    String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(vars.size() - 1)));
    builder.append(nameState);
  }
 else   if (vars.get(vars.size() - 1).getStateSpace().getStateSpaceType() == StateSpaceType.REAL) {
    builder.append(this.getValue(vars.get(vars.size() - 1)));
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + vars.get(vars.size() - 1).getStateSpace().getStateSpaceType());
  }
  return builder.toString();
}
Program: 21538
Project: 21538
Buggy source:
default String toARFFString(List<Variable> vars){
  StringBuilder builder=new StringBuilder(vars.size() * 2);
  for (int i=0; i < vars.size() - 1; i++) {
    if (vars.get(i).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
      FiniteStateSpace stateSpace=vars.get(i).getStateSpace();
      String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(i)));
      builder.append(nameState + "String_Node_Str");
    }
 else {
      builder.append(this.getValue(vars.get(i)) + "String_Node_Str");
    }
  }
  if (vars.get(vars.size() - 1).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
    FiniteStateSpace stateSpace=vars.get(vars.size() - 1).getStateSpace();
    String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(vars.size() - 1)));
    builder.append(nameState);
  }
 else {
    builder.append(this.getValue(vars.get(vars.size() - 1)));
  }
  return builder.toString();
}

Fixed version (ground truth):
default String toARFFString(List<Variable> vars){
  StringBuilder builder=new StringBuilder(vars.size() * 2);
  for (int i=0; i < vars.size() - 1; i++) {
    if (vars.get(i).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
      FiniteStateSpace stateSpace=vars.get(i).getStateSpace();
      String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(i)));
      builder.append(nameState + "String_Node_Str");
    }
 else     if (vars.get(i).getStateSpace().getStateSpaceType() == StateSpaceType.REAL) {
      builder.append(this.getValue(vars.get(i)) + "String_Node_Str");
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + vars.get(i).getStateSpace().getStateSpaceType());
    }
  }
  if (vars.get(vars.size() - 1).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
    FiniteStateSpace stateSpace=vars.get(vars.size() - 1).getStateSpace();
    String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(vars.size() - 1)));
    builder.append(nameState);
  }
 else   if (vars.get(vars.size() - 1).getStateSpace().getStateSpaceType() == StateSpaceType.REAL) {
    builder.append(this.getValue(vars.get(vars.size() - 1)));
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + vars.get(vars.size() - 1).getStateSpace().getStateSpaceType());
  }
  return builder.toString();
}
Program: 21539
Project: 21539
Buggy source:
default String toARFFString(List<Variable> vars){
  StringBuilder builder=new StringBuilder(vars.size() * 2);
  for (int i=0; i < vars.size() - 1; i++) {
    if (vars.get(i).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
      FiniteStateSpace stateSpace=vars.get(i).getStateSpace();
      String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(i)));
      builder.append(nameState + "String_Node_Str");
    }
 else {
      builder.append(this.getValue(vars.get(i)) + "String_Node_Str");
    }
  }
  if (vars.get(vars.size() - 1).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
    FiniteStateSpace stateSpace=vars.get(vars.size() - 1).getStateSpace();
    String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(vars.size() - 1)));
    builder.append(nameState);
  }
 else {
    builder.append(this.getValue(vars.get(vars.size() - 1)));
  }
  return builder.toString();
}

Fixed version (ground truth):
default String toARFFString(List<Variable> vars){
  StringBuilder builder=new StringBuilder(vars.size() * 2);
  for (int i=0; i < vars.size() - 1; i++) {
    if (vars.get(i).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
      FiniteStateSpace stateSpace=vars.get(i).getStateSpace();
      String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(i)));
      builder.append(nameState + "String_Node_Str");
    }
 else     if (vars.get(i).getStateSpace().getStateSpaceType() == StateSpaceType.REAL) {
      builder.append(this.getValue(vars.get(i)) + "String_Node_Str");
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + vars.get(i).getStateSpace().getStateSpaceType());
    }
  }
  if (vars.get(vars.size() - 1).getStateSpace().getStateSpaceType() == StateSpaceType.FINITE_SET) {
    FiniteStateSpace stateSpace=vars.get(vars.size() - 1).getStateSpace();
    String nameState=stateSpace.getStatesName((int)this.getValue(vars.get(vars.size() - 1)));
    builder.append(nameState);
  }
 else   if (vars.get(vars.size() - 1).getStateSpace().getStateSpaceType() == StateSpaceType.REAL) {
    builder.append(this.getValue(vars.get(vars.size() - 1)));
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + vars.get(vars.size() - 1).getStateSpace().getStateSpaceType());
  }
  return builder.toString();
}