Program: 72424
Project: 72424
Buggy source:
/** 
 * Change a parameter in the .xml, making it vary within an interval defined by the parameters start and end. Run a ptolemy simulation for each step between the interval. 
 * @param waitingTime The time the system will wait to close all the windows of a federation, after its execution has finished. This parameter is intended to give the user the ability to choose how long he will have to look at the simulation's results.  If the variable is given a negative value, the user will be asked repetedly if he had time to look at the models and they will  only close when he answers "yes".
 * @param vergil An instance of vergil.
 * @param modelPath The path to the model you want to run.
 * @param propertyLine The xml line of the parameter that we want to change. 
 * @param values The values the new property will assume.
 */
public static void changeParameters(int waitingTime,AutomaticSimulation vergil,String[] modelPath,String[] propertyLines,double[][] values){
  if (propertyLines.length != values.length) {
    System.out.println("String_Node_Str");
    return;
  }
  int numberOfFederates=modelPath.length;
  int numberOfParameters=propertyLines.length;
  File[] file=new File[numberOfFederates];
  String[][][] data=new String[numberOfFederates][numberOfParameters + 1][2];
  for (int i=0; i < numberOfFederates; i++) {
    file[i]=new File(modelPath[i]);
    data[i]=_findPropertyLines(file[i],propertyLines);
  }
  int numberOfInteractions=values[0].length;
  for (int i=0; i < numberOfInteractions; i++) {
    final CompositeEntity[] model=new CompositeEntity[numberOfFederates];
    for (int j=0; j < numberOfFederates; j++) {
      String info="String_Node_Str";
      for (int y=0; y < numberOfParameters; y++) {
        info=info + "String_Node_Str" + data[j][y][0]+ "String_Node_Str"+ data[j][y][1]+ values[y][i]+ "String_Node_Str";
      }
      info=info.substring(1);
      info=info + "String_Node_Str" + data[j][numberOfParameters][0];
      System.out.println("String_Node_Str" + j + "String_Node_Str");
      _writeInFile(file[j],info);
      model[j]=_openModel(modelPath[j]);
    }
    runAllModels(vergil);
    if (waitingTime < 0) {
      while (true) {
        Scanner input=new Scanner(System.in);
        System.out.println("String_Node_Str");
        String answer=input.next();
        if (answer.equalsIgnoreCase("String_Node_Str"))         break;
      }
      _sleep(2000);
    }
 else     if (waitingTime > 0) {
      _sleep(waitingTime);
    }
    for (int j=0; j < numberOfFederates; j++) {
      _closeModel(model[j]);
    }
    _killRTIG();
  }
  try {
    Configuration.closeAllTableaux();
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Change a parameter in the .xml, making it vary within an interval defined by the parameters start and end. Run a ptolemy simulation for each step between the interval. 
 * @param waitingTime The time the system will wait to close all the windows of a federation, after its execution has finished. This parameter is intended to give the user the ability to choose how long he will have to look at the simulation's results.  If the variable is given a negative value, the user will be asked repetedly if he had time to look at the models and they will  only close when he answers "yes".
 * @param vergil An instance of vergil.
 * @param modelPath The path to the model you want to run.
 * @param propertyLine The xml line of the parameter that we want to change. 
 * @param values The values the new property will assume.
 */
public static void changeParameters(int waitingTime,AutomaticSimulation vergil,String[] modelPath,String[] propertyLines,double[][] values){
  if (propertyLines.length != values.length) {
    System.out.println("String_Node_Str");
    return;
  }
  int numberOfFederates=modelPath.length;
  int numberOfParameters=propertyLines.length;
  File[] file=new File[numberOfFederates];
  String[][][] data=new String[numberOfFederates][numberOfParameters + 1][2];
  for (int i=0; i < numberOfFederates; i++) {
    file[i]=new File(modelPath[i]);
    data[i]=_findPropertyLines(file[i],propertyLines);
  }
  int numberOfInteractions=values[0].length;
  for (int i=0; i < numberOfInteractions; i++) {
    final CompositeEntity[] model=new CompositeEntity[numberOfFederates];
    for (int j=0; j < numberOfFederates; j++) {
      StringBuffer info=new StringBuffer();
      for (int y=0; y < numberOfParameters; y++) {
        info.append("String_Node_Str" + data[j][y][0] + "String_Node_Str"+ data[j][y][1]+ values[y][i]+ "String_Node_Str");
      }
      System.out.println("String_Node_Str" + j + "String_Node_Str");
      _writeInFile(file[j],info.substring(1) + "String_Node_Str" + data[j][numberOfParameters][0]);
      model[j]=_openModel(modelPath[j]);
    }
    runAllModels(vergil);
    if (waitingTime < 0) {
      while (true) {
        Scanner input=new Scanner(System.in);
        System.out.println("String_Node_Str");
        String answer=input.next();
        if (answer.equalsIgnoreCase("String_Node_Str"))         break;
      }
      _sleep(2000);
    }
 else     if (waitingTime > 0) {
      _sleep(waitingTime);
    }
    for (int j=0; j < numberOfFederates; j++) {
      _closeModel(model[j]);
    }
    _killRTIG();
  }
  try {
    Configuration.closeAllTableaux();
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}