Beispiel #1
0
  public static void saveAnalysisData(
      ExperimentAnalysis.AnalysisEntry analysisEntry,
      IDataAnalysis sensorAnalysis,
      File storageDir,
      List<ISensorData> allSensorData)
      throws IOException {
    Bundle bundle = new Bundle();
    // save plugin
    bundle.putString(PLUGIN_ID_KEY, analysisEntry.plugin.getIdentifier());
    bundle.putString(ANALYSIS_UID_KEY, analysisEntry.analysisUid);

    // save used data
    ISensorData[] dataList = sensorAnalysis.getData();
    int integerList[] = new int[dataList.length];
    for (int i = 0; i < integerList.length; i++)
      integerList[i] = allSensorData.indexOf(dataList[i]);
    bundle.putIntArray(SENSOR_DATA_LIST_KEY, integerList);

    // save experiment data
    Bundle experimentData = sensorAnalysis.exportAnalysisData(storageDir);
    bundle.putBundle(USED_DATA_KEY, experimentData);

    // save the bundle
    File projectFile = new File(storageDir, IDataAnalysis.EXPERIMENT_ANALYSIS_FILE_NAME);
    FileWriter fileWriter = new FileWriter(projectFile);
    PersistentBundle persistentBundle = new PersistentBundle();
    persistentBundle.flattenBundle(bundle, fileWriter);
  }