public void update(double x) {
   if (x < minValue) minValue = x;
   if (x > maxValue) maxValue = x;
   sumValue += lastValue * (Sim.time() - lastTime);
   sumSquares += lastValue * lastValue * (Sim.time() - lastTime);
   lastValue = x;
   lastTime = Sim.time();
 }
  public void report() {
    System.out.println("REPORT on Accumulate stat. collector ==> " + descriptor);
    /*    System.out.println ("      from time   to time       min         max         average");
    Num.printD (initTime, 12, 2, 2);
    Num.printD (Sim.time(), 13, 2, 2);
    Num.printD (minValue, 11, 3, 2);
    Num.printD ((double)maxValue, 12, 3, 2);
    Num.printD ((double)average(), 14, 3, 2);*/
    String[] myheads = {
      "      from time   to time        min         max      average",
      "      =========   =========     ======     ======    ========="
    };
    String[] linefmt1 = {"      ******.**   ******.**     ****.**    ****.**    ****.**"};
    printThus.printthus(myheads);
    Object[] lineval1 = {
      new Double(initTime),
      new Double(Sim.time()),
      new Double(minValue),
      new Double(maxValue),
      new Double((double) average())
    };
    int ierr = printThus.printthus(linefmt1, lineval1); // simple test

    System.out.println("\n");
  }
 public double variance() {
   update(lastValue);
   double periode = Sim.time() - initTime;
   double temp = sumSquares / periode - (sumValue * sumValue);
   if ((periode > 0.0) && (temp > 0.0)) return temp;
   else return 0.0;
 } // added ANA
 public void init() {
   maxValue = Double.MIN_VALUE;
   minValue = Double.MAX_VALUE;
   lastValue = 0.0;
   sumValue = 0.0;
   sumSquares = 0.0; // added
   initTime = lastTime = Sim.time();
 }
 public double average() {
   update(lastValue);
   double periode = Sim.time() - initTime;
   if (periode > 0.0) return sumValue / periode;
   else return 0.0;
 }