nus-yam/ex-repair huggingface dataset:
Program: 131798
Project: 131798
Buggy source:
@Override public double[] getChooseMulti(Label parent,List<Label> children){
  Map<Label,Integer> childCounts=chooseCounts.get(parent);
  double[] mult=new double[children.size()];
  for (int i=0; i < mult.length; i++) {
    int childCount;
    if (childCounts != null) {
      childCount=Utilities.safeGet(childCounts,children.get(i));
    }
 else {
      childCount=0;
    }
    mult[i]=childCount + lambda;
  }
  Multinomials.normalizeProps(mult);
  return mult;
}

Fixed version (ground truth):
@Override public double[] getChooseMulti(Pair<Label,String> pair,List<Label> children){
  Map<Label,Integer> childCounts=chooseCounts.get(pair);
  double[] mult=new double[children.size()];
  for (int i=0; i < mult.length; i++) {
    int childCount;
    if (childCounts != null) {
      childCount=Utilities.safeGet(childCounts,children.get(i));
    }
 else {
      childCount=0;
    }
    mult[i]=childCount + lambda;
  }
  Multinomials.normalizeProps(mult);
  return mult;
}
Program: 131799
Project: 131799
Buggy source:
public Map<Pair<Label,Label>,Double> getChooseWeights(){
  return cwMap;
}

Fixed version (ground truth):
public Map<Triple<Label,String,Label>,Double> getChooseWeights(){
  return cwMap;
}
Program: 131800
Project: 131800
Buggy source:
public void putChooseWeight(Pair<Label,Label> pair,double d){
  cwMap.put(pair,d);
}

Fixed version (ground truth):
public void putChooseWeight(Triple<Label,String,Label> triple,double d){
  cwMap.put(triple,d);
}
Program: 131801
Project: 131801
Buggy source:
@Override public double[] getChooseMulti(Label parent,List<Label> children){
  return Multinomials.randomMultinomial(children.size());
}

Fixed version (ground truth):
@Override public double[] getChooseMulti(Pair<Label,String> pair,List<Label> children){
  return Multinomials.randomMultinomial(children.size());
}
Program: 131802
Project: 131802
Buggy source:
@Override public Model getInstance(SentenceCollection sentences){
  DmvModel dmv=new DmvModel();
  Set<Label> vocab=getVocab(sentences);
  for (  Label label : vocab) {
    for (    String lr : leftRight) {
      for (      boolean adj : adjacent) {
        Triple<Label,String,Boolean> triple=new Triple<Label,String,Boolean>(label,lr,adj);
        double weight;
        weight=weightGen.getStopWeight(triple);
        dmv.putStopWeight(triple,weight);
      }
    }
  }
  Map<Label,Set<Label>> parentChildMap=getParentChildMap(sentences);
  for (  Entry<Label,Set<Label>> entry : parentChildMap.entrySet()) {
    Label parent=entry.getKey();
    List<Label> children=new ArrayList<Label>(entry.getValue());
    double[] multinomial=weightGen.getChooseMulti(parent,children);
    for (int i=0; i < multinomial.length; i++) {
      Pair<Label,Label> pair=new Pair<Label,Label>(parent,children.get(i));
      dmv.putChooseWeight(pair,multinomial[i]);
    }
  }
  return dmv;
}

Fixed version (ground truth):
@Override public Model getInstance(SentenceCollection sentences){
  DmvModel dmv=new DmvModel();
  Set<Label> vocab=sentences.getVocab();
  for (  Label label : vocab) {
    for (    String lr : leftRight) {
      for (      boolean adj : adjacent) {
        Triple<Label,String,Boolean> triple=new Triple<Label,String,Boolean>(label,lr,adj);
        double weight;
        weight=weightGen.getStopWeight(triple);
        dmv.putStopWeight(triple,weight);
      }
    }
  }
  List<Label> vocabList=new ArrayList<Label>(vocab);
  for (  Label parent : vocabList) {
    for (    String lr : leftRight) {
      Pair<Label,String> pair=new Pair<Label,String>(parent,lr);
      double[] multinomial=weightGen.getChooseMulti(pair,vocabList);
      for (int i=0; i < multinomial.length; i++) {
        Triple<Label,String,Label> triple=new Triple<Label,String,Label>(parent,lr,vocabList.get(i));
        dmv.putChooseWeight(triple,multinomial[i]);
      }
    }
  }
  return dmv;
}
Program: 131804
Project: 131804
Buggy source:
public SentenceCollection(DepTreebank treebank){
  super();
  for (  DepTree tree : treebank) {
    Sentence sentence=new Sentence(tree);
    add(sentence);
  }
}

Fixed version (ground truth):
SentenceCollection(DepTreebank treebank){
  super();
  for (  DepTree tree : treebank) {
    Sentence sentence=new Sentence(tree);
    add(sentence);
  }
}
Program: 131805
Project: 131805
Buggy source:
@Override public void print(PrintWriter pw){
}

Fixed version (ground truth):
@Override public void print(){
  log.info(String.format("String_Node_Str",accuracy));
}
Program: 131806
Project: 131806
Buggy source:
@Override public void evaluate(Trainer model){
}

Fixed version (ground truth):
@Override public void evaluate(Model model){
  int correct=0;
  int total=0;
  SentenceCollection sentences=depTreebank.getSentences();
  DepTreebank parses=parser.getViterbiParse(sentences,model);
  for (int i=0; i < depTreebank.size(); i++) {
    int[] goldParents=depTreebank.get(i).getParents();
    int[] parseParents=parses.get(i).getParents();
    for (int j=0; j < goldParents.length; j++) {
      if (goldParents[j] == parseParents[j]) {
        correct++;
      }
      total++;
    }
  }
  accuracy=(double)correct / (double)total;
}
Program: 131807
Project: 131807
Buggy source:
void print(PrintWriter pw);

Fixed version (ground truth):
void print();
Program: 131808
Project: 131808
Buggy source:
void evaluate(Trainer model);

Fixed version (ground truth):
void evaluate(Model model);
Program: 131809
Project: 131809
Buggy source:
@Override public Model getModel(DepTreebank treebank){
  WeightGenerator weightGen=new MLWeightGenerator(getChooseCounts(treebank),getStopCounts(treebank));
  DmvModelFactory dmvFactory=new DmvModelFactory(weightGen);
  SentenceCollection sentences=new SentenceCollection(treebank);
  DmvModel dmv=(DmvModel)dmvFactory.getInstance(sentences);
  return dmv;
}

Fixed version (ground truth):
@Override public Model getModel(DepTreebank treebank){
  WeightGenerator weightGen=new MLWeightGenerator(getChooseCounts(treebank),getStopCounts(treebank),lambda);
  DmvModelFactory dmvFactory=new DmvModelFactory(weightGen);
  SentenceCollection sentences=treebank.getSentences();
  DmvModel dmv=(DmvModel)dmvFactory.getInstance(sentences);
  return dmv;
}
Program: 131810
Project: 131810
Buggy source:
@Override public double getStopWeight(Triple<Label,String,Boolean> triple){
  Map<Boolean,Integer> map=stopCounts.get(triple);
  double numStop=Utilities.safeGet(map,Boolean.TRUE);
  double numNotStop=Utilities.safeGet(map,Boolean.FALSE);
  double weight=numStop / (numStop + numNotStop);
  return weight;
}

Fixed version (ground truth):
@Override public double getStopWeight(Triple<Label,String,Boolean> triple){
  Map<Boolean,Integer> map=stopCounts.get(triple);
  double numStop;
  double numNotStop;
  if (map != null) {
    numStop=Utilities.safeGet(map,Boolean.TRUE);
    numNotStop=Utilities.safeGet(map,Boolean.FALSE);
  }
 else {
    numStop=0;
    numNotStop=0;
  }
  double weight=(numStop + lambda) / (numStop + numNotStop + 2 * lambda);
  return weight;
}
Program: 131811
Project: 131811
Buggy source:
public MLWeightGenerator(Map<Label,Map<Label,Integer>> chooseCounts,Map<Triple<Label,String,Boolean>,Map<Boolean,Integer>> stopCounts){
  this.chooseCounts=chooseCounts;
  this.stopCounts=stopCounts;
}

Fixed version (ground truth):
public MLWeightGenerator(Map<Label,Map<Label,Integer>> chooseCounts,Map<Triple<Label,String,Boolean>,Map<Boolean,Integer>> stopCounts,double lambda){
  this.chooseCounts=chooseCounts;
  this.stopCounts=stopCounts;
  this.lambda=lambda;
}
Program: 131812
Project: 131812
Buggy source:
@Override public double[] getChooseMulti(Label parent,List<Label> children){
  Map<Label,Integer> childCounts=chooseCounts.get(parent);
  double[] mult=new double[children.size()];
  for (int i=0; i < mult.length; i++) {
    mult[i]=childCounts.get(children.get(i));
  }
  Multinomials.normalizeProps(mult);
  return mult;
}

Fixed version (ground truth):
@Override public double[] getChooseMulti(Label parent,List<Label> children){
  Map<Label,Integer> childCounts=chooseCounts.get(parent);
  double[] mult=new double[children.size()];
  for (int i=0; i < mult.length; i++) {
    int childCount;
    if (childCounts != null) {
      childCount=Utilities.safeGet(childCounts,children.get(i));
    }
 else {
      childCount=0;
    }
    mult[i]=childCount + lambda;
  }
  Multinomials.normalizeProps(mult);
  return mult;
}
Program: 131813
Project: 131813
Buggy source:
@Override public void train(SentenceCollection sentences){
  Model model=modelFactory.getInstance(sentences);
  for (int i=0; i < iterations; i++) {
    C counts=eStep.getCounts(sentences,model);
    model=mStep.getModel(counts);
  }
}

Fixed version (ground truth):
@Override public void train(SentenceCollection sentences){
  model=modelFactory.getInstance(sentences);
  for (int i=0; i < iterations; i++) {
    C counts=eStep.getCounts(sentences,model);
    model=mStep.getModel(counts);
  }
}
Program: 131814
Project: 131814
Buggy source:
public static Trainer getModel(CommandLine cmd) throws ParseException {
  final String algorithm=cmd.hasOption("String_Node_Str") ? cmd.getOptionValue("String_Node_Str") : "String_Node_Str";
  final int iterations=cmd.hasOption("String_Node_Str") ? Integer.parseInt(cmd.getOptionValue("String_Node_Str")) : 10;
  final String modelName=cmd.hasOption("String_Node_Str") ? cmd.getOptionValue("String_Node_Str") : "String_Node_Str";
  final IlpFormulation formulation=cmd.hasOption("String_Node_Str") ? IlpFormulation.getById(cmd.getOptionValue("String_Node_Str")) : IlpFormulation.DP_PROJ;
  Trainer trainer=null;
  if (algorithm.equals("String_Node_Str")) {
    ViterbiParser parser;
    MStep<DepTreebank> mStep;
    ModelFactory modelFactory;
    if (modelName.equals("String_Node_Str")) {
      parser=new IlpViterbiParser(formulation);
      mStep=new DmvMStep();
      modelFactory=new DmvModelFactory(new RandomWeightGenerator());
    }
 else {
      throw new ParseException("String_Node_Str" + modelName);
    }
    trainer=new ViterbiTrainer(parser,mStep,modelFactory,iterations);
  }
 else {
    throw new ParseException("String_Node_Str" + algorithm);
  }
  return trainer;
}

Fixed version (ground truth):
public static Trainer getModel(CommandLine cmd) throws ParseException {
  final String algorithm=cmd.hasOption("String_Node_Str") ? cmd.getOptionValue("String_Node_Str") : "String_Node_Str";
  final int iterations=cmd.hasOption("String_Node_Str") ? Integer.parseInt(cmd.getOptionValue("String_Node_Str")) : 10;
  final String modelName=cmd.hasOption("String_Node_Str") ? cmd.getOptionValue("String_Node_Str") : "String_Node_Str";
  final IlpFormulation formulation=cmd.hasOption("String_Node_Str") ? IlpFormulation.getById(cmd.getOptionValue("String_Node_Str")) : IlpFormulation.DP_PROJ;
  final double lambda=cmd.hasOption("String_Node_Str") ? Double.parseDouble(cmd.getOptionValue("String_Node_Str")) : 0.1;
  Trainer trainer=null;
  if (algorithm.equals("String_Node_Str")) {
    ViterbiParser parser;
    MStep<DepTreebank> mStep;
    ModelFactory modelFactory;
    if (modelName.equals("String_Node_Str")) {
      parser=new IlpViterbiParser(formulation);
      mStep=new DmvMStep(lambda);
      modelFactory=new DmvModelFactory(new RandomWeightGenerator());
    }
 else {
      throw new ParseException("String_Node_Str" + modelName);
    }
    trainer=new ViterbiTrainer(parser,mStep,modelFactory,iterations);
  }
 else {
    throw new ParseException("String_Node_Str" + algorithm);
  }
  return trainer;
}
Program: 131815
Project: 131815
Buggy source:
public static void addOptions(Options options){
  options.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
}

Fixed version (ground truth):
public static void addOptions(Options options){
  options.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  options.addOption("String_Node_Str","String_Node_Str",true,"String_Node_Str");
}
Program: 131816
Project: 131816
Buggy source:
@Override public DepTree getViterbiParse(Sentence sentence,Model model){
  File tempDir=Command.createTempDir("String_Node_Str",workspace);
  File zimplFile=encode(tempDir,sentence,model);
  ZimplSolver solver=new ZimplSolver(tempDir,new JavaGurobiIlpSolver(tempDir));
  solver.solve(zimplFile);
  Map<String,Double> result=solver.getResult();
  DepTree tree=decode(sentence,result);
  return tree;
}

Fixed version (ground truth):
@Override public DepTree getViterbiParse(Sentence sentence,Model model){
  File tempDir=Command.createTempDir("String_Node_Str",workspace);
  File zimplFile=encode(tempDir,sentence,model);
  ZimplSolver solver=new ZimplSolver(tempDir,new ClGurobiIlpSolver(tempDir));
  solver.solve(zimplFile);
  Map<String,Double> result=solver.getResult();
  DepTree tree=decode(sentence,result);
  return tree;
}
Program: 131817
Project: 131817
Buggy source:
public IlpViterbiParser(boolean projective){
  XmlCodeContainerReader reader=new XmlCodeContainerReader();
  reader.loadZimplCodeFromResource(ZIMPL_CODE_XML);
  codeMap=reader.getCodeMap();
  workspace=Command.createTempDir("String_Node_Str",new File("String_Node_Str"));
}

Fixed version (ground truth):
public IlpViterbiParser(boolean projective){
  this.projective=projective;
  XmlCodeContainerReader reader=new XmlCodeContainerReader();
  reader.loadZimplCodeFromResource(ZIMPL_CODE_XML);
  codeMap=reader.getCodeMap();
  workspace=Command.createTempDir("String_Node_Str",new File("String_Node_Str"));
}
Program: 131818
Project: 131818
Buggy source:
@Override public void solve(File lpFile){
  result=null;
  File solFile=new File(tempDir,lpFile.getName().replaceAll("String_Node_Str","String_Node_Str"));
  String[] cmdArray=new String[]{gurobiBinary,"String_Node_Str" + solFile,lpFile.getAbsolutePath()};
  File gurobiLog=new File(tempDir,"String_Node_Str");
  Command.runCommand(cmdArray,gurobiLog,tempDir);
  try {
    result=readGurobiSol(solFile);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public void solve(File lpFile){
  result=null;
  File solFile=new File(tempDir,lpFile.getName().replace("String_Node_Str","String_Node_Str"));
  String[] cmdArray=new String[]{gurobiBinary,"String_Node_Str" + solFile.getAbsolutePath(),lpFile.getAbsolutePath()};
  File gurobiLog=new File(tempDir,"String_Node_Str");
  Command.runCommand(cmdArray,gurobiLog,tempDir);
  try {
    result=readGurobiSol(solFile);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 131819
Project: 131819
Buggy source:
private void runZimpl(String type,int verbosity){
  String[] cmdArray=new String[]{zimplBinary,"String_Node_Str",outputPrefix,"String_Node_Str",type,"String_Node_Str" + String.valueOf(verbosity),zimplFile.getAbsolutePath()};
  File zimplLog=new File(outputPrefix + "String_Node_Str");
  Command.runCommand(cmdArray,zimplLog,tempDir);
}

Fixed version (ground truth):
private void runZimpl(String type,int verbosity){
  String[] cmdArray=new String[]{zimplBinary,"String_Node_Str",outputPrefix,"String_Node_Str",type,"String_Node_Str" + String.valueOf(verbosity),zimplFile.getAbsolutePath()};
  File zimplLog=new File(tempDir,"String_Node_Str");
  Command.runCommand(cmdArray,zimplLog,tempDir);
}
Program: 131820
Project: 131820
Buggy source:
private void checkTree(){
  int emptyCount=countChildrenOf(EMPTY);
  if (emptyCount != 0) {
    throw new IllegalStateException("String_Node_Str" + emptyCount);
  }
  int wallCount=countChildrenOf(WALL);
  if (wallCount != 1) {
    throw new IllegalStateException("String_Node_Str" + wallCount);
  }
  for (int i=0; i < parents.length; i++) {
    int numAncestors=0;
    int parent=parents[i];
    while (parent != WALL) {
      numAncestors+=1;
      if (numAncestors > parents.length - 1) {
        throw new IllegalStateException("String_Node_Str");
      }
      parent=parents[parent];
    }
  }
  if (nodes.size() != parents.length) {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void checkTree(){
  int emptyCount=countChildrenOf(EMPTY);
  if (emptyCount != 0) {
    throw new IllegalStateException("String_Node_Str" + emptyCount);
  }
  int wallCount=countChildrenOf(WALL);
  if (wallCount != 1) {
    throw new IllegalStateException("String_Node_Str" + wallCount);
  }
  for (int i=0; i < parents.length; i++) {
    int numAncestors=0;
    int parent=parents[i];
    while (parent != WALL) {
      numAncestors+=1;
      if (numAncestors > parents.length - 1) {
        throw new IllegalStateException("String_Node_Str");
      }
      parent=parents[parent];
    }
  }
  if (nodes.size() - 1 != parents.length) {
    throw new IllegalStateException("String_Node_Str");
  }
}
Program: 131821
Project: 131821
Buggy source:
private void addParentChildLinksToNodes(){
  checkTree();
  for (int i=0; i < parents.length; i++) {
    DepTreeNode node=nodes.get(i);
    if (parents[i] != WALL) {
      node.setParent(nodes.get(parents[i]));
    }
    for (int j=0; j < parents.length; j++) {
      if (parents[j] == i) {
        node.addChild(nodes.get(j));
      }
    }
  }
}

Fixed version (ground truth):
private void addParentChildLinksToNodes(){
  checkTree();
  for (int i=0; i < parents.length; i++) {
    DepTreeNode node=getNodeByPosition(i);
    node.setParent(getNodeByPosition(parents[i]));
    for (int j=0; j < parents.length; j++) {
      if (parents[j] == i) {
        node.addChild(getNodeByPosition(j));
      }
    }
  }
}
Program: 131822
Project: 131822
Buggy source:
public DepTree(Sentence sentence,int[] parents){
  this.parents=parents;
  for (int i=0; i < sentence.size(); i++) {
    Label label=sentence.get(i);
    nodes.add(new DepTreeNode(label,i));
  }
  addParentChildLinksToNodes();
}

Fixed version (ground truth):
public DepTree(Sentence sentence,int[] parents){
  this.parents=parents;
  nodes.add(new WallDepTreeNode());
  for (int i=0; i < sentence.size(); i++) {
    Label label=sentence.get(i);
    nodes.add(new DepTreeNode(label,i));
  }
  addParentChildLinksToNodes();
}
Program: 131823
Project: 131823
Buggy source:
public Sentence(DepTree tree){
  super();
  for (  DepTreeNode node : tree.getNodes()) {
    add(node.getLabel());
  }
}

Fixed version (ground truth):
public Sentence(DepTree tree){
  super();
  for (  DepTreeNode node : tree.getNodes()) {
    if (!node.isWall()) {
      add(node.getLabel());
    }
  }
}
Program: 131824
Project: 131824
Buggy source:
public static Map<Label,Set<Label>> getParentChildMap(SentenceCollection sentences){
  Map<Label,Set<Label>> map=new HashMap<Label,Set<Label>>();
  for (  Sentence sent : sentences) {
    for (int i=0; i < sent.size(); i++) {
      for (int j=0; j < sent.size(); j++) {
        if (j != i) {
          Label parent=sent.get(i);
          Label child=sent.get(j);
          Utilities.addToSet(map,parent,child);
        }
      }
    }
  }
  return map;
}

Fixed version (ground truth):
public static Map<Label,Set<Label>> getParentChildMap(SentenceCollection sentences){
  Map<Label,Set<Label>> map=new HashMap<Label,Set<Label>>();
  for (  Sentence sent : sentences) {
    for (int i=0; i < sent.size(); i++) {
      Label parent=sent.get(i);
      for (int j=0; j < sent.size(); j++) {
        if (j != i) {
          Label child=sent.get(j);
          Utilities.addToSet(map,parent,child);
        }
      }
      Utilities.addToSet(map,WallDepTreeNode.WALL_LABEL,parent);
      Utilities.addToSet(map,parent,WallDepTreeNode.WALL_LABEL);
    }
  }
  return map;
}
Program: 131825
Project: 131825
Buggy source:
public static Set<Label> getVocab(SentenceCollection sentences){
  Set<Label> vocab=new HashSet<Label>();
  for (  Sentence sent : sentences) {
    for (    Label label : sent) {
      vocab.add(label);
    }
  }
  return vocab;
}

Fixed version (ground truth):
public static Set<Label> getVocab(SentenceCollection sentences){
  Set<Label> vocab=new HashSet<Label>();
  for (  Sentence sent : sentences) {
    for (    Label label : sent) {
      vocab.add(label);
    }
  }
  vocab.add(WallDepTreeNode.WALL_LABEL);
  return vocab;
}
Program: 131826
Project: 131826
Buggy source:
private String encode(File tempDir,Sentence sentence,Model model){
  try {
    encodeSentence(tempDir,sentence);
    DmvModel dmv=(DmvModel)model;
    encodeDmv(tempDir,dmv);
    File zimplFile=createZimplFile(tempDir);
    return zimplFile.getAbsolutePath();
  }
 catch (  FileNotFoundException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private String encode(File tempDir,Sentence sentence,Model model){
  try {
    SentenceCollection sentences=new SentenceCollection();
    sentences.add(sentence);
    encodeSentences(tempDir,sentences);
    DmvModel dmv=(DmvModel)model;
    WeightCopier weightCopier=new WeightCopier(dmv);
    DmvModel filteredDmv=(DmvModel)(new DmvModelFactory(weightCopier)).getInstance(sentences);
    encodeDmv(tempDir,filteredDmv);
    File zimplFile=createZimplFile(tempDir);
    return zimplFile.getAbsolutePath();
  }
 catch (  FileNotFoundException e) {
    throw new RuntimeException(e);
  }
}
Program: 131827
Project: 131827
Buggy source:
public void updateAccTime(long timestamp){
  int counter=0;
  if (timestamp < this.accTime) {
    this.accTime=timestamp;
    counter=accImageMapping.size() - accImageMappingIdx;
    accImageMappingIdx=0;
  }
 else {
    this.accTime=timestamp;
    while (accImageMapping.get(accImageMappingIdx).second < timestamp) {
      accImageMappingIdx++;
      counter++;
      if (accImageMappingIdx == accImageMapping.size()) {
        accImageMappingIdx--;
        counter--;
        break;
      }
    }
  }
  this.imageTime.getAndAdd(counter);
}

Fixed version (ground truth):
public void updateAccTime(long timestamp){
  if (accImageMapping == null) {
    this.accTime=timestamp;
    return;
  }
  int counter=0;
  if (timestamp < this.accTime) {
    this.accTime=timestamp;
    counter=accImageMapping.size() - accImageMappingIdx;
    accImageMappingIdx=0;
  }
 else {
    this.accTime=timestamp;
    while (accImageMapping.get(accImageMappingIdx).second < timestamp) {
      accImageMappingIdx++;
      counter++;
      if (accImageMappingIdx == accImageMapping.size()) {
        accImageMappingIdx--;
        counter--;
        break;
      }
    }
  }
  this.imageTime.getAndAdd(counter);
}
Program: 131828
Project: 131828
Buggy source:
public void updateAccTime(long timestamp){
  int counter=0;
  if (timestamp < this.accTime) {
    this.accTime=timestamp;
    counter=accImageMapping.size() - accImageMappingIdx;
    accImageMappingIdx=0;
  }
 else {
    this.accTime=timestamp;
    while (accImageMapping.get(accImageMappingIdx).second < timestamp) {
      accImageMappingIdx++;
      counter++;
      if (accImageMappingIdx == accImageMapping.size()) {
        accImageMappingIdx--;
        counter--;
        break;
      }
    }
  }
  this.imageTime.getAndAdd(counter);
}

Fixed version (ground truth):
public void updateAccTime(long timestamp){
  if (accImageMapping == null) {
    this.accTime=timestamp;
    return;
  }
  int counter=0;
  if (timestamp < this.accTime) {
    this.accTime=timestamp;
    counter=accImageMapping.size() - accImageMappingIdx;
    accImageMappingIdx=0;
  }
 else {
    this.accTime=timestamp;
    while (accImageMapping.get(accImageMappingIdx).second < timestamp) {
      accImageMappingIdx++;
      counter++;
      if (accImageMappingIdx == accImageMapping.size()) {
        accImageMappingIdx--;
        counter--;
        break;
      }
    }
  }
  this.imageTime.getAndAdd(counter);
}
Program: 131829
Project: 131829
Buggy source:
public void onPreviewFrame(byte[] frame,Camera mCamera){
  if (isRunning) {
    Camera.Parameters parameters=mCamera.getParameters();
    if (videoStreamingThread != null) {
      videoStreamingThread.push(frame,parameters);
    }
  }
}

Fixed version (ground truth):
public void onPreviewFrame(byte[] frame,Camera mCamera){
  if (isRunning) {
    Camera.Parameters parameters=mCamera.getParameters();
    if (videoStreamingThread != null) {
      videoStreamingThread.push(frame,parameters);
    }
  }
  mCamera.addCallbackBuffer(frame);
}
Program: 131830
Project: 131830
Buggy source:
/** 
 * Called whenever a new frame is generated Puts the new frame into the @frameBuffer
 */
public void push(byte[] frame,Parameters parameters){
  Log.v(LOG_TAG,"String_Node_Str");
  if (!Const.LOAD_IMAGES) {
synchronized (frameLock) {
      Size cameraImageSize=parameters.getPreviewSize();
      YuvImage image=new YuvImage(frame,parameters.getPreviewFormat(),cameraImageSize.width,cameraImageSize.height,null);
      ByteArrayOutputStream tmpBuffer=new ByteArrayOutputStream();
      image.compressToJpeg(new Rect(0,0,image.getWidth(),image.getHeight()),67,tmpBuffer);
      this.frameBuffer=tmpBuffer.toByteArray();
      this.frameID++;
      frameLock.notify();
    }
  }
 else {
    try {
      long dataTime=System.currentTimeMillis();
      int dataSize=(int)this.imageFiles[indexImageFile].length();
      FileInputStream fi=new FileInputStream(this.imageFiles[indexImageFile]);
      byte[] buffer=new byte[dataSize];
      fi.read(buffer,0,dataSize);
synchronized (frameLock) {
        this.frameBuffer=buffer;
        this.frameID++;
        frameLock.notify();
      }
      indexImageFile=(indexImageFile + 1) % this.imageFiles.length;
    }
 catch (    FileNotFoundException e) {
    }
catch (    IOException e) {
    }
  }
  mCamera.addCallbackBuffer(frame);
}

Fixed version (ground truth):
/** 
 * Called whenever a new frame is generated Puts the new frame into the @frameBuffer
 */
public void push(byte[] frame,Parameters parameters){
  Log.v(LOG_TAG,"String_Node_Str");
  if (!Const.LOAD_IMAGES) {
synchronized (frameLock) {
      Size cameraImageSize=parameters.getPreviewSize();
      YuvImage image=new YuvImage(frame,parameters.getPreviewFormat(),cameraImageSize.width,cameraImageSize.height,null);
      ByteArrayOutputStream tmpBuffer=new ByteArrayOutputStream();
      image.compressToJpeg(new Rect(0,0,image.getWidth(),image.getHeight()),67,tmpBuffer);
      this.frameBuffer=tmpBuffer.toByteArray();
      this.frameID++;
      frameLock.notify();
    }
  }
 else {
    try {
      long dataTime=System.currentTimeMillis();
      int dataSize=(int)this.imageFiles[indexImageFile].length();
      FileInputStream fi=new FileInputStream(this.imageFiles[indexImageFile]);
      byte[] buffer=new byte[dataSize];
      fi.read(buffer,0,dataSize);
synchronized (frameLock) {
        this.frameBuffer=buffer;
        this.frameID++;
        frameLock.notify();
      }
      indexImageFile=(indexImageFile + 1) % this.imageFiles.length;
    }
 catch (    FileNotFoundException e) {
    }
catch (    IOException e) {
    }
  }
}
Program: 131831
Project: 131831
Buggy source:
public void reset(){
  this.prevRecvFrameID=0;
  this.sentPackets.clear();
}

Fixed version (ground truth):
public void reset(){
  this.currentToken=Const.TOKEN_SIZE;
  this.prevRecvFrameID=0;
  this.sentPackets.clear();
}
Program: 131832
Project: 131832
Buggy source:
public void onPreviewFrame(byte[] frame,Camera mCamera){
  if (isRunning) {
    Camera.Parameters parameters=mCamera.getParameters();
    if (videoStreamingThread != null) {
      videoStreamingThread.push(frame,parameters);
    }
  }
}

Fixed version (ground truth):
public void onPreviewFrame(byte[] frame,Camera mCamera){
  if (isRunning) {
    Camera.Parameters parameters=mCamera.getParameters();
    if (videoStreamingThread != null) {
      videoStreamingThread.push(frame,parameters);
    }
  }
  mCamera.addCallbackBuffer(frame);
}
Program: 131833
Project: 131833
Buggy source:
/** 
 * Called whenever a new frame is generated Puts the new frame into the @frameBuffer
 */
public void push(byte[] frame,Parameters parameters){
  Log.v(LOG_TAG,"String_Node_Str");
  if (!Const.LOAD_IMAGES) {
synchronized (frameLock) {
      Size cameraImageSize=parameters.getPreviewSize();
      YuvImage image=new YuvImage(frame,parameters.getPreviewFormat(),cameraImageSize.width,cameraImageSize.height,null);
      ByteArrayOutputStream tmpBuffer=new ByteArrayOutputStream();
      image.compressToJpeg(new Rect(0,0,image.getWidth(),image.getHeight()),67,tmpBuffer);
      this.frameBuffer=tmpBuffer.toByteArray();
      this.frameID++;
      frameLock.notify();
    }
  }
 else {
    try {
      long dataTime=System.currentTimeMillis();
      int dataSize=(int)this.imageFiles[indexImageFile].length();
      FileInputStream fi=new FileInputStream(this.imageFiles[indexImageFile]);
      byte[] buffer=new byte[dataSize];
      fi.read(buffer,0,dataSize);
synchronized (frameLock) {
        this.frameBuffer=buffer;
        this.frameID++;
        frameLock.notify();
      }
      indexImageFile=(indexImageFile + 1) % this.imageFiles.length;
    }
 catch (    FileNotFoundException e) {
    }
catch (    IOException e) {
    }
  }
  mCamera.addCallbackBuffer(frame);
}

Fixed version (ground truth):
/** 
 * Called whenever a new frame is generated Puts the new frame into the @frameBuffer
 */
public void push(byte[] frame,Parameters parameters){
  Log.v(LOG_TAG,"String_Node_Str");
  if (!Const.LOAD_IMAGES) {
synchronized (frameLock) {
      Size cameraImageSize=parameters.getPreviewSize();
      YuvImage image=new YuvImage(frame,parameters.getPreviewFormat(),cameraImageSize.width,cameraImageSize.height,null);
      ByteArrayOutputStream tmpBuffer=new ByteArrayOutputStream();
      image.compressToJpeg(new Rect(0,0,image.getWidth(),image.getHeight()),67,tmpBuffer);
      this.frameBuffer=tmpBuffer.toByteArray();
      this.frameID++;
      frameLock.notify();
    }
  }
 else {
    try {
      long dataTime=System.currentTimeMillis();
      int dataSize=(int)this.imageFiles[indexImageFile].length();
      FileInputStream fi=new FileInputStream(this.imageFiles[indexImageFile]);
      byte[] buffer=new byte[dataSize];
      fi.read(buffer,0,dataSize);
synchronized (frameLock) {
        this.frameBuffer=buffer;
        this.frameID++;
        frameLock.notify();
      }
      indexImageFile=(indexImageFile + 1) % this.imageFiles.length;
    }
 catch (    FileNotFoundException e) {
    }
catch (    IOException e) {
    }
  }
}
Program: 131834
Project: 131834
Buggy source:
public void reset(){
  this.prevRecvFrameID=0;
  this.sentPackets.clear();
}

Fixed version (ground truth):
public void reset(){
  this.currentToken=Const.TOKEN_SIZE;
  this.prevRecvFrameID=0;
  this.sentPackets.clear();
}
Program: 131835
Project: 131835
Buggy source:
/** 
 * Terminates all services.
 */
private void terminate(){
  Log.v(LOG_TAG,"String_Node_Str");
  isRunning=false;
  if ((resultThread != null) && (resultThread.isAlive())) {
    resultThread.close();
    resultThread=null;
  }
  if ((videoStreamingThread != null) && (videoStreamingThread.isAlive())) {
    videoStreamingThread.stopStreaming();
    videoStreamingThread=null;
  }
  if ((accStreamingThread != null) && (accStreamingThread.isAlive())) {
    accStreamingThread.stopStreaming();
    accStreamingThread=null;
  }
  if (tokenController != null) {
    tokenController.close();
    tokenController=null;
  }
  if (tts != null) {
    tts.stop();
    tts.shutdown();
    tts=null;
  }
  if (preview != null) {
    preview.setPreviewCallback(null);
    preview.close();
    preview=null;
  }
  if (sensorManager != null) {
    sensorManager.unregisterListener(this);
    sensorManager=null;
    sensorAcc=null;
  }
}

Fixed version (ground truth):
/** 
 * Terminates all services.
 */
private void terminate(){
  Log.v(LOG_TAG,"String_Node_Str");
  isRunning=false;
  if ((resultThread != null) && (resultThread.isAlive())) {
    resultThread.close();
    resultThread=null;
  }
  if ((videoStreamingThread != null) && (videoStreamingThread.isAlive())) {
    videoStreamingThread.stopStreaming();
    videoStreamingThread=null;
  }
  if ((accStreamingThread != null) && (accStreamingThread.isAlive())) {
    accStreamingThread.stopStreaming();
    accStreamingThread=null;
  }
  if ((controlThread != null) && (controlThread.isAlive())) {
    controlThread.close();
    controlThread=null;
  }
  if (tokenController != null) {
    tokenController.close();
    tokenController=null;
  }
  if (tts != null) {
    tts.stop();
    tts.shutdown();
    tts=null;
  }
  if (preview != null) {
    preview.setPreviewCallback(null);
    preview.close();
    preview=null;
  }
  if (sensorManager != null) {
    sensorManager.unregisterListener(this);
    sensorManager=null;
    sensorAcc=null;
  }
}
Program: 131836
Project: 131836
Buggy source:
@Override public void run(){
  Log.v(LOG_TAG,"String_Node_Str");
  animationDisplayIdx=(animationDisplayIdx + 1) % nAnimationFrames;
  Message msg=Message.obtain();
  msg.what=NetworkProtocol.NETWORK_RET_ANIMATION;
  msg.obj=animationFrames[animationDisplayIdx];
  returnMsgHandler.sendMessage(msg);
  timer.schedule(new animationTask(),animationPeriods[animationDisplayIdx]);
}

Fixed version (ground truth):
@Override public void run(){
  Log.v(LOG_TAG,"String_Node_Str");
  animationDisplayIdx=(animationDisplayIdx + 1) % nAnimationFrames;
  Message msg=Message.obtain();
  msg.what=NetworkProtocol.NETWORK_RET_ANIMATION;
  msg.obj=animationFrames[animationDisplayIdx];
  returnMsgHandler.sendMessage(msg);
  if (isRunning)   timer.schedule(new animationTask(),animationPeriods[animationDisplayIdx]);
}
Program: 131837
Project: 131837
Buggy source:
public void close(){
  this.isRunning=false;
  try {
    if (this.networkReader != null) {
      this.networkReader.close();
      this.networkReader=null;
    }
  }
 catch (  IOException e) {
  }
  try {
    if (this.networkWriter != null) {
      this.networkWriter.close();
      this.networkWriter=null;
    }
  }
 catch (  IOException e) {
  }
  try {
    if (this.tcpSocket != null) {
      this.tcpSocket.shutdownInput();
      this.tcpSocket.shutdownOutput();
      this.tcpSocket.close();
      this.tcpSocket=null;
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public void close(){
  this.isRunning=false;
  if (timer != null) {
    timer.cancel();
    timer=null;
  }
  try {
    if (this.networkReader != null) {
      this.networkReader.close();
      this.networkReader=null;
    }
  }
 catch (  IOException e) {
  }
  try {
    if (this.networkWriter != null) {
      this.networkWriter.close();
      this.networkWriter=null;
    }
  }
 catch (  IOException e) {
  }
  try {
    if (this.tcpSocket != null) {
      this.tcpSocket.shutdownInput();
      this.tcpSocket.shutdownOutput();
      this.tcpSocket.close();
      this.tcpSocket=null;
    }
  }
 catch (  IOException e) {
  }
}
Program: 131838
Project: 131838
Buggy source:
private void init_once(){
  mPreview=(CameraPreview)findViewById(R.id.camera_preview);
  mPreview.setPreviewCallback(previewCallback);
  Const.ROOT_DIR.mkdirs();
  if (mTTS == null) {
    mTTS=new TextToSpeech(this,this);
  }
  if (mSensorManager == null) {
    mSensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
    mAccelerometer=mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mSensorManager.registerListener(this,mAccelerometer,SensorManager.SENSOR_DELAY_NORMAL);
  }
  if (this.errorAlertDialog == null) {
    this.errorAlertDialog=new AlertDialog.Builder(GabrielClientActivity.this).create();
    this.errorAlertDialog.setTitle("String_Node_Str");
    this.errorAlertDialog.setIcon(R.drawable.ic_launcher);
  }
  if (cameraRecorder != null) {
    cameraRecorder.close();
    cameraRecorder=null;
  }
  if (localOutputStream != null) {
    try {
      localOutputStream.close();
    }
 catch (    IOException e) {
    }
    localOutputStream=null;
  }
  if (cameraRecorder == null) {
    cameraRecorder=new CameraConnector();
    cameraRecorder.init();
    Log.d(LOG_TAG,"String_Node_Str");
  }
  if (localOutputStream == null) {
    localOutputStream=new BufferedOutputStream(new FileOutputStream(cameraRecorder.getInputFileDescriptor()),LOCAL_OUTPUT_BUFF_SIZE);
    Log.d(LOG_TAG,"String_Node_Str");
  }
  hasStarted=true;
}

Fixed version (ground truth):
private void init_once(){
  mPreview=(CameraPreview)findViewById(R.id.camera_preview);
  mPreview.setPreviewCallback(previewCallback);
  Const.ROOT_DIR.mkdirs();
  Const.LATENCY_DIR.mkdirs();
  if (mTTS == null) {
    mTTS=new TextToSpeech(this,this);
  }
  if (mSensorManager == null) {
    mSensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
    mAccelerometer=mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mSensorManager.registerListener(this,mAccelerometer,SensorManager.SENSOR_DELAY_NORMAL);
  }
  if (this.errorAlertDialog == null) {
    this.errorAlertDialog=new AlertDialog.Builder(GabrielClientActivity.this).create();
    this.errorAlertDialog.setTitle("String_Node_Str");
    this.errorAlertDialog.setIcon(R.drawable.ic_launcher);
  }
  if (cameraRecorder != null) {
    cameraRecorder.close();
    cameraRecorder=null;
  }
  if (localOutputStream != null) {
    try {
      localOutputStream.close();
    }
 catch (    IOException e) {
    }
    localOutputStream=null;
  }
  if (cameraRecorder == null) {
    cameraRecorder=new CameraConnector();
    cameraRecorder.init();
    Log.d(LOG_TAG,"String_Node_Str");
  }
  if (localOutputStream == null) {
    localOutputStream=new BufferedOutputStream(new FileOutputStream(cameraRecorder.getInputFileDescriptor()),LOCAL_OUTPUT_BUFF_SIZE);
    Log.d(LOG_TAG,"String_Node_Str");
  }
  hasStarted=true;
}
Program: 131839
Project: 131839
Buggy source:
public void init(){
  try {
    localLoop=new LocalServerSocket("String_Node_Str");
    localReceiver=new LocalSocket();
    localReceiver.connect(localLoop.getLocalSocketAddress());
    localReceiver.setReceiveBufferSize(LOCAL_BUFF_SIZE);
    localReceiver.setSendBufferSize(LOCAL_BUFF_SIZE);
    localSender=localLoop.accept();
    localSender.setReceiveBufferSize(LOCAL_BUFF_SIZE);
    localSender.setSendBufferSize(LOCAL_BUFF_SIZE);
    Log.d(LOG_TAG,"String_Node_Str");
  }
 catch (  IOException e) {
    Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
public void init(){
  try {
    localLoop=new LocalServerSocket("String_Node_Str");
    localReceiver=new LocalSocket();
    localReceiver.connect(localLoop.getLocalSocketAddress());
    localReceiver.setReceiveBufferSize(LOCAL_BUFF_SIZE);
    localReceiver.setSendBufferSize(LOCAL_BUFF_SIZE);
    localSender=localLoop.accept();
    localSender.setReceiveBufferSize(LOCAL_BUFF_SIZE);
    localSender.setSendBufferSize(LOCAL_BUFF_SIZE);
    Log.d(LOG_TAG,"String_Node_Str");
  }
 catch (  IOException e) {
    Log.e(LOG_TAG,"String_Node_Str" + e);
  }
}
Program: 131840
Project: 131840
Buggy source:
public JdbcDaoImpl(NamedParameterJdbcTemplate namedParameterJdbcTemplate){
  this.npJdbcTemplate=namedParameterJdbcTemplate;
  List<File> fileList=this.getFileInfo(Constants.CLASSPATH + "String_Node_Str");
  for (  File file : fileList) {
    this.loadFileContents(file);
  }
}

Fixed version (ground truth):
public JdbcDaoImpl(NamedParameterJdbcTemplate namedParameterJdbcTemplate){
  this.npJdbcTemplate=namedParameterJdbcTemplate;
  List<File> fileList=this.getFileList(Constants.CLASSPATH + "String_Node_Str");
  for (  File file : fileList) {
    this.loadFileContents(file);
  }
}
Program: 131841
Project: 131841
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public boolean preHandle(HttpServletRequest request,HttpServletResponse response,Object handler) throws Exception {
  String uri=request.getRequestURI();
  if (uri.endsWith("String_Node_Str")) {
    Pagination pagination=PaginationThreadUtils.get();
    if (pagination == null) {
      pagination=new Pagination();
      PaginationThreadUtils.set(pagination);
    }
    Map<String,String[]> params=request.getParameterMap();
    if (params.get(PAGE_NOW) == null) {
      pagination.setPageNow(1);
    }
 else {
      String pageNow=params.get(PAGE_NOW)[0];
      if (StringUtils.isBlank(pageNow)) {
        pagination.setPageNow(1);
      }
 else {
        pagination.setPageNow(Integer.parseInt(pageNow));
      }
    }
    if (params.get(PAGE_SIZE) != null) {
      String pageSize=params.get(PAGE_SIZE)[0];
      if (StringUtils.isNotBlank(pageSize)) {
        pagination.setPageSize(Integer.parseInt(pageSize));
      }
    }
    logger.info("String_Node_Str",pagination.getPageNow(),pagination.getPageSize());
  }
  return true;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public boolean preHandle(HttpServletRequest request,HttpServletResponse response,Object handler) throws Exception {
  String uri=request.getRequestURI();
  if (uri.endsWith("String_Node_Str")) {
    Pagination pagination=PaginationThreadUtils.get();
    if (pagination == null) {
      pagination=new Pagination();
      PaginationThreadUtils.set(pagination);
    }
    Map<String,String[]> params=request.getParameterMap();
    if (params.get(PAGE_NOW) == null) {
      pagination.setPageNow(1);
    }
 else {
      String pageNow=params.get(PAGE_NOW)[0];
      if (StringUtils.isBlank(pageNow)) {
        pagination.setPageNow(1);
      }
 else {
        pagination.setPageNow(NumberUtils.toInt(pageNow,1));
      }
    }
    if (params.get(PAGE_SIZE) != null) {
      String pageSize=params.get(PAGE_SIZE)[0];
      if (StringUtils.isNotBlank(pageSize)) {
        pagination.setPageSize(NumberUtils.toInt(pageSize));
      }
    }
    logger.info("String_Node_Str",pagination.getPageNow(),pagination.getPageSize());
  }
  return true;
}
Program: 131843
Project: 131843
Buggy source:
public double[] run(int times){
  double[] runtimes=new double[times];
  final int offset=engine.getInputVariables().size();
  for (int t=0; t < times; ++t) {
    obtained=new ArrayList<double[]>(expected.size());
    for (int i=0; i < obtained.size(); ++i) {
      obtained.add(new double[engine.variables().size()]);
    }
    engine.restart();
    long start=System.nanoTime();
    for (int evaluation=0; evaluation < expected.size(); ++evaluation) {
      double[] expectedValues=expected.get(evaluation);
      double[] obtainedValues=obtained.get(evaluation);
      if (expectedValues.length < engine.getInputVariables().size()) {
        throw new RuntimeException(MessageFormat.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",expectedValues.length,evaluation + 1,engine.numberOfInputVariables()));
      }
      for (int i=0; i < engine.getInputVariables().size(); ++i) {
        engine.getInputVariables().get(i).setValue(expectedValues[i]);
        obtainedValues[i]=expectedValues[i];
      }
      engine.process();
      for (int i=0; i < engine.getOutputVariables().size(); ++i) {
        obtainedValues[i + offset]=engine.getOutputVariables().get(i).getValue();
      }
    }
    long end=System.nanoTime();
    runtimes[t]=end - start;
  }
  for (  double x : runtimes) {
    this.times.add(x);
  }
  return runtimes;
}

Fixed version (ground truth):
public double[] run(int times){
  double[] runtimes=new double[times];
  final int offset=engine.getInputVariables().size();
  for (int t=0; t < times; ++t) {
    obtained=new ArrayList<double[]>(expected.size());
    for (int i=0; i < expected.size(); ++i) {
      obtained.add(new double[engine.variables().size()]);
    }
    engine.restart();
    long start=System.nanoTime();
    for (int evaluation=0; evaluation < expected.size(); ++evaluation) {
      double[] expectedValues=expected.get(evaluation);
      double[] obtainedValues=obtained.get(evaluation);
      if (expectedValues.length < engine.getInputVariables().size()) {
        throw new RuntimeException(MessageFormat.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",expectedValues.length,evaluation + 1,engine.numberOfInputVariables()));
      }
      for (int i=0; i < engine.getInputVariables().size(); ++i) {
        engine.getInputVariables().get(i).setValue(expectedValues[i]);
        obtainedValues[i]=expectedValues[i];
      }
      engine.process();
      for (int i=0; i < engine.getOutputVariables().size(); ++i) {
        obtainedValues[i + offset]=engine.getOutputVariables().get(i).getValue();
      }
    }
    long end=System.nanoTime();
    runtimes[t]=end - start;
  }
  for (  double x : runtimes) {
    this.times.add(x);
  }
  return runtimes;
}
Program: 131845
Project: 131845
Buggy source:
public HedgeFactory(){
  register(Any.class);
  register(Extremely.class);
  register(Not.class);
  register(Seldom.class);
  register(Somewhat.class);
  register(Very.class);
}

Fixed version (ground truth):
public HedgeFactory(){
  register(new Any().getName(),Any.class);
  register(new Extremely().getName(),Extremely.class);
  register(new Not().getName(),Not.class);
  register(new Seldom().getName(),Seldom.class);
  register(new Somewhat().getName(),Somewhat.class);
  register(new Very().getName(),Very.class);
}
Program: 131849
Project: 131849
Buggy source:
public double activationDegree(TNorm conjunction,SNorm disjunction,Expression node){
  if (node instanceof Proposition) {
    Proposition proposition=(Proposition)node;
    boolean isAny=false;
    for (    Hedge hedge : proposition.getHedges()) {
      isAny|=(hedge instanceof Any);
      if (isAny) {
        return 1.0;
      }
    }
    InputVariable inputVariable=(InputVariable)proposition.getVariable();
    double result=proposition.getTerm().membership(inputVariable.getInputValue());
    for (    Hedge hedge : proposition.getHedges()) {
      result=hedge.hedge(result);
    }
    return result;
  }
 else   if (node instanceof Operator) {
    Operator operator=(Operator)node;
    if (operator.getLeft() == null || operator.getRight() == null) {
      throw new RuntimeException("String_Node_Str");
    }
    if (Rule.FL_AND.equals(operator.getName())) {
      return conjunction.compute(activationDegree(conjunction,disjunction,operator.getLeft()),activationDegree(conjunction,disjunction,operator.getRight()));
    }
    if (Rule.FL_OR.equals(operator.getName())) {
      return disjunction.compute(activationDegree(conjunction,disjunction,operator.getLeft()),activationDegree(conjunction,disjunction,operator.getRight()));
    }
    throw new RuntimeException(String.format("String_Node_Str",operator.getName()));
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public double activationDegree(TNorm conjunction,SNorm disjunction,Expression node){
  if (node instanceof Proposition) {
    Proposition proposition=(Proposition)node;
    if (!proposition.variable.isEnabled()) {
      return 0.0;
    }
    boolean isAny=false;
    for (    Hedge hedge : proposition.getHedges()) {
      isAny|=(hedge instanceof Any);
      if (isAny) {
        return 1.0;
      }
    }
    InputVariable inputVariable=(InputVariable)proposition.getVariable();
    double result=proposition.getTerm().membership(inputVariable.getInputValue());
    for (    Hedge hedge : proposition.getHedges()) {
      result=hedge.hedge(result);
    }
    return result;
  }
 else   if (node instanceof Operator) {
    Operator operator=(Operator)node;
    if (operator.getLeft() == null || operator.getRight() == null) {
      throw new RuntimeException("String_Node_Str");
    }
    if (Rule.FL_AND.equals(operator.getName())) {
      return conjunction.compute(activationDegree(conjunction,disjunction,operator.getLeft()),activationDegree(conjunction,disjunction,operator.getRight()));
    }
    if (Rule.FL_OR.equals(operator.getName())) {
      return disjunction.compute(activationDegree(conjunction,disjunction,operator.getLeft()),activationDegree(conjunction,disjunction,operator.getRight()));
    }
    throw new RuntimeException(String.format("String_Node_Str",operator.getName()));
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}