@Override public void execute(MetricTimeSeries timeSeries,FunctionValueMap functionValueMap){
  if (timeSeries.size() <= 0) {
    functionValueMap.add(this,Double.NaN);
    return;
  }
  double[] values=timeSeries.getValuesAsArray();
  double min=values[0];
  double max=values[0];
  for (int i=1; i < values.length; i++) {
    double current=values[i];
    if (current < min) {
      min=current;
    }
    if (current > max) {
      max=current;
    }
  }
  functionValueMap.add(this,Math.abs(max - min));
}

@ Override public void execute ( MetricTimeSeries timeSeries , FunctionValueMap functionValueMap ) { if ( timeSeries . size ( ) <= 0 ) { functionValueMap . add ( this , Double . NaN ) ; return ; } double [ ] values = timeSeries . getValuesAsArray ( ) ; double min = values [ 0 ] ; double max = values [ 0 ] ; for ( int i = 1 ; i < values . length ; i ++ ) { double current = values [ i ] ; if ( current < min ) { min = current ; } if ( current > max ) { max = current ; } } functionValueMap . add ( this , Math . abs ( max - min ) ) ; }
gets difference between the maximum and the minimum value . it is always a positive value .
