- if (isValidValue) {
- // Set last value
- if (i.current.hasLastValue()) {
- i.current.setLastValue( value.getBinding(), value.getValue() );
- }
+ if (i.isNumeric && !isNanValue) {
+ // Add sum
+ if (i.current.hasAvg() && !restep) {
+ double duration = (currentTime - i.itemState.firstTime);
+ if(duration < 1e-9) {
+ i.current.setAvg( Bindings.DOUBLE, 0.0 );
+ } else {
+ i.current.setAvg( Bindings.DOUBLE, i.itemState.sum / duration);
+ }
+ }
+
+ // Update min-max
+ if (i.current.hasMin()) {
+ Binding minBinding = i.current.getMinBinding();
+ Object prevMinValue = i.current.getMin();
+ Object currentValueWithMinBinding = value.getValue( minBinding );
+ int diff = minBinding.compare( prevMinValue, currentValueWithMinBinding );
+ if (diff>0) i.current.setMin( minBinding, currentValueWithMinBinding );
+ }
+ if (i.current.hasMax()) {
+ Binding maxBinding = i.current.getMaxBinding();
+ Object prevMaxValue = i.current.getMax();
+ Object currentValueWithMaxBinding = value.getValue( maxBinding );
+ int diff = maxBinding.compare( prevMaxValue, currentValueWithMaxBinding );
+ if (diff<0) i.current.setMax( maxBinding, currentValueWithMaxBinding );
+ }