gedi-geode-extensions-core/src/main/java/gedi/solutions/geode/operations/stats/AbstractValue.java
protected void calcStats(double[] values) {
      if (statsValid) {
        return;
      }
      size = values.length;
      if (size == 0) {
        min = 0.0;
        max = 0.0;
        avg = 0.0;
        stddev = 0.0;
        mostRecent = 0.0;
      } else {
        min = values[0];
        max = values[0];
        mostRecent = values[values.length - 1];
        double total = values[0];
        for (int i = 1; i < size; i++) {
          total += values[i];
          if (values[i] < min) {
            min = values[i];
          } else if (values[i] > max) {
            max = values[i];
          }
        }
        avg = total / size;
        stddev = 0.0;
        if (size > 1) {
          for (int i = 0; i < size; i++) {
            double dv = values[i] - avg;
            stddev += (dv * dv);
          }
          stddev /= (size - 1);
          stddev = Math.sqrt(stddev);
        }
      }
      statsValid = true;
    }
protected void calcStats(double[] values) {
      if (statsValid) {
        return;
      }
      size = values.length;
      if (size == 0) {
        min = 0.0;
        max = 0.0;
        avg = 0.0;
        stddev = 0.0;
        mostRecent = 0.0;
      } else {
        min = values[0];
        max = values[0];
        mostRecent = values[values.length - 1];
        double total = values[0];
        for (int i = 1; i < size; i++) {
          total += values[i];
          if (values[i] < min) {
            min = values[i];
          } else if (values[i] > max) {
            max = values[i];
          }
        }
        avg = total / size;
        stddev = 0.0;
        if (size > 1) {
          for (int i = 0; i < size; i++) {
            double dv = values[i] - avg;
            stddev += (dv * dv);
          }
          stddev /= (size - 1);
          stddev = Math.sqrt(stddev);
        }
      }
      statsValid = true;
    }
protected void calcStats ( double [ ] values ) { if ( statsValid ) { return ; } size = values . length ; if ( size == 0 ) { min = 0.0 ; max = 0.0 ; avg = 0.0 ; stddev = 0.0 ; mostRecent = 0.0 ; } else { min = values [ 0 ] ; max = values [ 0 ] ; mostRecent = values [ values . length - 1 ] ; double total = values [ 0 ] ; for ( int i = 1 ; i < size ; i ++ ) { total += values [ i ] ; if ( values [ i ] < min ) { min = values [ i ] ; } else if ( values [ i ] > max ) { max = values [ i ] ; } } avg = total / size ; stddev = 0.0 ; if ( size > 1 ) { for ( int i = 0 ; i < size ; i ++ ) { double dv = values [ i ] - avg ; stddev += ( dv * dv ) ; } stddev /= ( size - 1 ) ; stddev = Math . sqrt ( stddev ) ; } } statsValid = true ; }
/*
Calculates each stat given the result of calling getSnapshots
/ * Calculates each stat given the result of calling getSnapshots