Exemplo n.º 1
0
  public String toString() {
    final StringBuffer outStr = new StringBuffer();
    /*
          // Write labels
          for (int x=0; x<labels.size(); x++)
          {
             outStr.append(labels.get(x));
             if (x < labels.size()-1)
                outStr.append(",");
             else
                outStr.append("\n");
          }  // end for loop
    */
    // Write the data for each row.
    for (int r = 0; r < timeReadings.size(); r++) {
      // Time
      //         outStr.append(timeReadings.get(r).toString());

      // The rest of the value on the row.
      final TimeSeriesPoint values = (TimeSeriesPoint) tsArray.get(r);
      for (int c = 0; c < values.size(); c++) outStr.append(values.get(c));

      if (r < timeReadings.size() - 1) outStr.append("\n");
    } // end for loop

    return outStr.toString();
  } // end toString()
Exemplo n.º 2
0
  public void addFirst(double time, TimeSeriesPoint values) {
    if (labels.size() != values.size() + 1) // labels include a label for time
    throw new InternalError(
          "ERROR:  The TimeSeriesPoint: "
              + values
              + " contains the wrong number of values. "
              + "expected:  "
              + labels.size()
              + ", "
              + "found: "
              + values.size());

    if (time >= ((Double) timeReadings.get(0)).doubleValue())
      throw new InternalError(
          "ERROR:  The point being inserted into the "
              + "beginning of the time series does not have "
              + "the correct time sequence. ");

    timeReadings.add(0, new Double(time));
    tsArray.add(0, values);
  } // end addFirst(..)