fun execute(timeSeries: MetricTimeSeries, functionValueMap: FunctionValueMap) { if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN) return } val values: DoubleArray = timeSeries.getValuesAsArray() var min = values[0] var max = values[0] for (i in 1 until values.size) { val 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 .