public DoubleAnalysisCounter merge(DoubleAnalysisCounter other) { double otherMin = other.getMinValueSeen(); long newCountMinValue; if (getMinValueSeen() == otherMin) { newCountMinValue = countMinValue + other.getCountMinValue(); } else if (getMinValueSeen() > otherMin) { //Keep other, take count from othergetSampleStdDev newCountMinValue = other.getCountMinValue(); } else { //Keep this min, no change to count newCountMinValue = countMinValue; } double otherMax = other.getMaxValueSeen(); long newCountMaxValue; if (getMaxValueSeen() == otherMax) { newCountMaxValue = countMaxValue + other.getCountMaxValue(); } else if (getMaxValueSeen() < otherMax) { //Keep other, take count from other newCountMaxValue = other.getCountMaxValue(); } else { //Keep this max, no change to count newCountMaxValue = countMaxValue; } return new DoubleAnalysisCounter(counter.merge(other.getCounter()), countZero + other.getCountZero(), newCountMinValue, newCountMaxValue, countPositive + other.getCountPositive(), countNegative + other.getCountNegative(), countNaN + other.getCountNaN()); } }
public DoubleAnalysisCounter merge(DoubleAnalysisCounter other) { double otherMin = other.getMinValueSeen(); long newCountMinValue; if (getMinValueSeen() == otherMin) { newCountMinValue = countMinValue + other.getCountMinValue(); } else if (getMinValueSeen() > otherMin) { //Keep other, take count from othergetSampleStdDev newCountMinValue = other.getCountMinValue(); } else { //Keep this min, no change to count newCountMinValue = countMinValue; } double otherMax = other.getMaxValueSeen(); long newCountMaxValue; if (getMaxValueSeen() == otherMax) { newCountMaxValue = countMaxValue + other.getCountMaxValue(); } else if (getMaxValueSeen() < otherMax) { //Keep other, take count from other newCountMaxValue = other.getCountMaxValue(); } else { //Keep this max, no change to count newCountMaxValue = countMaxValue; } return new DoubleAnalysisCounter(counter.merge(other.getCounter()), countZero + other.getCountZero(), newCountMinValue, newCountMaxValue, countPositive + other.getCountPositive(), countNegative + other.getCountNegative(), countNaN + other.getCountNaN()); } }
.max(dac.getMaxValueSeen()).mean(dac.getMean()).sampleStdev(dac.getSampleStdev()) .sampleVariance(dac.getSampleVariance()).countZero(dac.getCountZero()) .countNegative(dac.getCountNegative()).countPositive(dac.getCountPositive()) .countMinValue(dac.getCountMinValue()).countMaxValue(dac.getCountMaxValue()) .countNaN(dac.getCountNaN()).countTotal(dac.getCountTotal()).build();
.max(dac.getMaxValueSeen()).mean(dac.getMean()).sampleStdev(dac.getSampleStdev()) .sampleVariance(dac.getSampleVariance()).countZero(dac.getCountZero()) .countNegative(dac.getCountNegative()).countPositive(dac.getCountPositive()) .countMinValue(dac.getCountMinValue()).countMaxValue(dac.getCountMaxValue()) .countNaN(dac.getCountNaN()).countTotal(dac.getCountTotal()).build();