public LongAnalysisCounter merge(LongAnalysisCounter other) { long otherMin = other.getMinValueSeen(); long newCountMinValue; if (getMinValueSeen() == otherMin) { newCountMinValue = countMinValue + other.getCountMinValue(); } else if (getMinValueSeen() > otherMin) { //Keep other, take count from other newCountMinValue = other.getCountMinValue(); } else { //Keep this min, no change to count newCountMinValue = countMinValue; } long 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 LongAnalysisCounter(counter.merge(other.getCounter()), countZero + other.getCountZero(), newCountMinValue, newCountMaxValue, countPositive + other.getCountPositive(), countNegative + other.getCountNegative()); } }
public LongAnalysisCounter merge(LongAnalysisCounter other) { long otherMin = other.getMinValueSeen(); long newCountMinValue; if (getMinValueSeen() == otherMin) { newCountMinValue = countMinValue + other.getCountMinValue(); } else if (getMinValueSeen() > otherMin) { //Keep other, take count from other newCountMinValue = other.getCountMinValue(); } else { //Keep this min, no change to count newCountMinValue = countMinValue; } long 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 LongAnalysisCounter(counter.merge(other.getCounter()), countZero + other.getCountZero(), newCountMinValue, newCountMaxValue, countPositive + other.getCountPositive(), countNegative + other.getCountNegative()); } }
.mean(lac.getMean()).sampleStdev(lac.getSampleStdev()) .sampleVariance(lac.getSampleVariance()).countZero(lac.getCountZero()) .countNegative(lac.getCountNegative()).countPositive(lac.getCountPositive()) .countMinValue(lac.getCountMinValue()).countMaxValue(lac.getCountMaxValue()) .countTotal(lac.getCountTotal()).build(); .max(lac2.getMaxValueSeen()).mean(lac2.getMean()).sampleStdev(lac2.getSampleStdev()) .sampleVariance(lac2.getSampleVariance()).countZero(lac2.getCountZero()) .countNegative(lac2.getCountNegative()).countPositive(lac2.getCountPositive()) .countMinValue(lac2.getCountMinValue()).countMaxValue(lac2.getCountMaxValue()) .countTotal(lac2.getCountTotal()).build();
.mean(lac.getMean()).sampleStdev(lac.getSampleStdev()) .sampleVariance(lac.getSampleVariance()).countZero(lac.getCountZero()) .countNegative(lac.getCountNegative()).countPositive(lac.getCountPositive()) .countMinValue(lac.getCountMinValue()).countMaxValue(lac.getCountMaxValue()) .countTotal(lac.getCountTotal()).build(); .max(lac2.getMaxValueSeen()).mean(lac2.getMean()).sampleStdev(lac2.getSampleStdev()) .sampleVariance(lac2.getSampleVariance()).countZero(lac2.getCountZero()) .countNegative(lac2.getCountNegative()).countPositive(lac2.getCountPositive()) .countMinValue(lac2.getCountMinValue()).countMaxValue(lac2.getCountMaxValue()) .countTotal(lac2.getCountTotal()).build();