Ejemplo n.º 1
0
  /**
   * actually recalculates the first average (necessary when we change the average settings)
   *
   * @param d
   */
  public void recalculateAverage1() {

    // average1=new TimeSeries("av1", FixedMillisecond.class);
    average1.delete(0, average1.getItemCount() - 1);

    for (int z = 0; z < x1.getItemCount(); z++) {
      try {
        double v = 0;

        // List l1=x1.getItems();

        for (int i = z; i < z + av1; i++) {
          v += x1.getValue(x1.getItemCount() - (av1 - i)).doubleValue();
        }
        average1.add(x1.getTimePeriod(z), v / av1);

      } catch (Exception e) {
        // e.printStackTrace();
        // System.out.println(timestamp.toString());
      }
    }
  }
Ejemplo n.º 2
0
  public void calcAverage1(int d, Date timestamp) {
    try {
      double v = 0;

      // List l1=x1.getItems();

      for (int i = d; i < d + av1; i++) {
        v += x1.getValue(x1.getItemCount() - (av1 - i)).doubleValue();
      }
      average1.add(new FixedMillisecond(timestamp), v / av1);

    } catch (Exception e) {
      // e.printStackTrace();
      // System.out.println(timestamp.toString());
    }
  }