コード例 #1
0
  public static void exportThis(
      String target_sea_state_set,
      String target_sea_state_datum,
      String[] sea_state_headings,
      IntegerTargetTypeLookup states,
      Element envElement,
      Document doc) {
    // ok, put us into the element
    org.w3c.dom.Element itt = doc.createElement(target_sea_state_set);

    // get on with the name attribute
    Double unknown = states.getUnknownResult();
    if (unknown != null) itt.setAttribute(UNKNOWN_TYPE, writeThis(unknown.doubleValue()));

    // now the matrix of sea states
    Collection<String> keys = states.getNames();
    for (Iterator<String> iter = keys.iterator(); iter.hasNext(); ) {
      String thisN = (String) iter.next();

      // ok, cycle through the sea states for this participant
      NamedList thisList = states.getThisSeries(thisN);
      exportThisSeries(thisN, target_sea_state_datum, thisList, sea_state_headings, itt, doc);
    }

    envElement.appendChild(itt);
  }
コード例 #2
0
  private static void exportThisSeries(
      String name,
      String target_sea_state_datum,
      NamedList thisList,
      String[] sea_state_headings,
      Element itt,
      Document doc) {
    // ok, put us into the element
    org.w3c.dom.Element datum = doc.createElement(target_sea_state_datum);

    datum.setAttribute("Type", name);

    // and step through its values
    Collection<Double> indices = thisList.getValues();
    int ctr = 0;
    for (Iterator<Double> iter = indices.iterator(); iter.hasNext(); ) {
      Double val = (Double) iter.next();
      if (val != null) {
        datum.setAttribute(sea_state_headings[ctr], writeThis(val.doubleValue()));
        ctr++;
      } else break;
    }

    itt.appendChild(datum);
  }