Object value = entry.getValue();
if ( value instanceof Long ){
long last_value;
Average a;
boolean new_average;
Object[] a_entry = (Object[])ave.get( key );
if ( a_entry == null ){
a = AverageFactory.MovingImmediateAverage( 10 );
last_value = 0;
a_entry = new Object[]{ a, value };
ave.put( key, a_entry );
new_averages = new_average = true;
}else{
a = (Average)a_entry[0];
last_value = ((Long)a_entry[1]).longValue();
new_average = false;
}
if ( stats_types.get( key ) == CUMULATIVE ){
// skip initial value as 'last_value' is invalid
if ( !new_average ){
a.update(((Long)value).longValue() - last_value);
}
}else{
a.update(((Long)value).longValue());
}
a_entry[1] = value;
}