/**
   * Write the headers.
   *
   * @param tw The output stream.
   */
  private void writeHeaders(final PrintWriter tw) {
    final StringBuilder line = new StringBuilder();
    for (final AnalystField stat : this.analyst.getScript().getNormalize().getNormalizedFields()) {
      final int needed = stat.getColumnsNeeded();

      for (int i = 0; i < needed; i++) {
        BasicFile.appendSeparator(line, getFormat());
        line.append('\"');
        line.append(CSVHeaders.tagColumn(stat.getName(), i, stat.getTimeSlice(), needed > 1));
        line.append('\"');
      }
    }
    tw.println(line.toString());
  }
示例#2
0
  /**
   * Save the normalization data.
   *
   * @param out The output file.
   */
  private void saveNormalize(final EncogWriteHelper out) {
    saveSubSection(out, "NORMALIZE", "CONFIG");

    out.addSubSection("RANGE");
    out.addColumn("name");
    out.addColumn("io");
    out.addColumn("timeSlice");
    out.addColumn("action");
    out.addColumn("high");
    out.addColumn("low");
    out.writeLine();
    for (final AnalystField field : this.script.getNormalize().getNormalizedFields()) {
      out.addColumn(field.getName());
      if (field.isInput()) {
        out.addColumn("input");
      } else {
        out.addColumn("output");
      }
      out.addColumn(field.getTimeSlice());
      switch (field.getAction()) {
        case Ignore:
          out.addColumn("ignore");
          break;
        case Normalize:
          out.addColumn("range");
          break;
        case PassThrough:
          out.addColumn("pass");
          break;
        case OneOf:
          out.addColumn("oneof");
          break;
        case Equilateral:
          out.addColumn("equilateral");
          break;
        case SingleField:
          out.addColumn("single");
          break;
        default:
          throw new AnalystError("Unknown action: " + field.getAction());
      }

      out.addColumn(field.getNormalizedHigh());
      out.addColumn(field.getNormalizedLow());
      out.writeLine();
    }
  }