示例#1
0
  public static String experimentConfigToString(ExperimentConfig currentConfig) {
    String ret = "ExperimentConfig\n";

    ret += "  deviceName " + currentConfig.getDeviceName() + "\n";
    ret += "  dataReadPeriod " + currentConfig.getDataReadPeriod() + "\n";
    ret += "  exactPeriod " + currentConfig.getExactPeriod() + "\n";
    ret += "  invalid " + currentConfig.isValid() + "\n";
    ret += "  invalidReason " + currentConfig.getInvalidReason() + "\n";

    SensorConfig[] sensors = currentConfig.getSensorConfigs();
    for (int i = 0; i < sensors.length; i++) {
      SensorConfig sensor = sensors[i];
      ret += "  SensorConfig" + "\n";
      ret += "    name " + sensor.getName() + "\n";
      ret += "    type " + sensor.getType() + "\n";
      ret += "    typeConstant " + getTypeConstantName(sensor.getType()) + "\n";
      ret += "    port " + sensor.getPort() + "\n";
      ret += "    portName " + sensor.getPortName() + "\n";
      ret += "    stepSize " + sensor.getStepSize() + "\n";
      ret += "    confirmed " + sensor.isConfirmed() + "\n";
      ret += "    unit " + sensor.getUnit().getDimension() + "\n";
    }

    return ret;
  }
示例#2
0
  public static void printExperimentConfig(ExperimentConfig currentConfig) {
    PrintStream out = System.out;

    out.println("ExperimentConfig");
    out.println("  deviceName " + currentConfig.getDeviceName());
    out.println("  dataReadPeriod " + currentConfig.getDataReadPeriod());
    out.println("  exactPeriod " + currentConfig.getExactPeriod());
    out.println("  invalid " + currentConfig.isValid());
    out.println("  invalidReason " + currentConfig.getInvalidReason());

    SensorConfig[] sensors = currentConfig.getSensorConfigs();
    for (int i = 0; i < sensors.length; i++) {
      SensorConfig sensor = sensors[i];
      out.println("  SensorConfig");
      out.println("    name " + sensor.getName());
      out.println("    type " + sensor.getType());
      out.println("    typeConstant " + getTypeConstantName(sensor.getType()));
      out.println("    port " + sensor.getPort());
      out.println("    portName " + sensor.getPortName());
      out.println("    stepSize " + sensor.getStepSize());
      out.println("    confirmed " + sensor.isConfirmed());
      out.println("    unit " + sensor.getUnit().getDimension());
    }
  }