Ejemplo n.º 1
0
  /**
   * It does return a new header (not necessary the same header as the input file one). It only
   * includes the valid attributes, those ones defined in @inputs and @outputs (or taken as that
   * role following the keel format specification).
   *
   * @return a String with the new header
   */
  public String getNewHeader() {
    String line = "";
    Attribute[] attrs = null;

    // Getting the relation name and the attributes
    if (storeAttributesAsNonStatic && attributes != null) {
      line = "@relation " + attributes.getRelationName() + "\n";
      attrs = attributes.getInputAttributes();
    } else {
      line = "@relation " + Attributes.getRelationName() + "\n";
      attrs = Attributes.getInputAttributes();
    }

    for (int i = 0; i < attrs.length; i++) {
      line += attrs[i].toString() + "\n";
    }

    // Gettin all the outputs attributes
    if (storeAttributesAsNonStatic && attributes != null) {
      attrs = attributes.getOutputAttributes();
      line += attrs[0].toString() + "\n";

      // Getting @inputs and @outputs
      line += attributes.getInputHeader() + "\n";
      line += attributes.getOutputHeader() + "\n";
    } else {
      attrs = Attributes.getOutputAttributes();
      line += attrs[0].toString() + "\n";

      // Getting @inputs and @outputs
      line += Attributes.getInputHeader() + "\n";
      line += Attributes.getOutputHeader() + "\n";
    }

    return line;
  } // end getNewHeader