Source
ValueUpdate.merge(ValueUpdate oldUpdate, ValueUpdate newUpdate) {
value = newUpdate.value;
ts = newUpdate.ts;
status = newUpdate.status;
count = oldUpdate.count + newUpdate.count;
sum = oldUpdate.sum;
if (!newUpdate.sum.isNaN) {
if (sum == sum) {
sum = newUpdate.sum;
} else {
sum += newUpdate.sum;
}
}
min = oldUpdate.min;
if (min.isNaN || newUpdate.min < min) {
min = newUpdate.min;
}
max = oldUpdate.min;
if (max.isNaN || newUpdate.max > max) {
max = newUpdate.max;
}
created = newUpdate.created;
}