@Override public DoubleAnalysisCounter add(Writable writable) { double value = writable.toDouble(); if (value == 0) countZero++; if (value == Double.NaN) countNaN++; if (value == getMinValueSeen()) countMinValue++; else if (value < getMinValueSeen()) { countMinValue = 1; } if (value == getMaxValueSeen()) countMaxValue++; else if (value > getMaxValueSeen()) { countMaxValue = 1; } if (value >= 0) { countPositive++; } else { countNegative++; } ; counter.merge(value); return this; }
@Override public DoubleAnalysisCounter add(Writable writable) { double value = writable.toDouble(); if (value == 0) countZero++; if (value == Double.NaN) countNaN++; if (value == getMinValueSeen()) countMinValue++; else if (value < getMinValueSeen()) { countMinValue = 1; } if (value == getMaxValueSeen()) countMaxValue++; else if (value > getMaxValueSeen()) { countMaxValue = 1; } if (value >= 0) { countPositive++; } else { countNegative++; } ; counter.merge(value); return this; }
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()); } }
case Double: DoubleAnalysisCounter dac = (DoubleAnalysisCounter) counters.get(i); DoubleAnalysis da = new DoubleAnalysis.Builder().min(dac.getMinValueSeen()) .max(dac.getMaxValueSeen()).mean(dac.getMean()).sampleStdev(dac.getSampleStdev()) .sampleVariance(dac.getSampleVariance()).countZero(dac.getCountZero()) list.add(da); minsMaxes[i][0] = dac.getMinValueSeen(); minsMaxes[i][1] = dac.getMaxValueSeen();
case Double: DoubleAnalysisCounter dac = (DoubleAnalysisCounter) counters.get(i); DoubleAnalysis da = new DoubleAnalysis.Builder().min(dac.getMinValueSeen()) .max(dac.getMaxValueSeen()).mean(dac.getMean()).sampleStdev(dac.getSampleStdev()) .sampleVariance(dac.getSampleVariance()).countZero(dac.getCountZero()) list.add(da); minsMaxes[i][0] = dac.getMinValueSeen(); minsMaxes[i][1] = dac.getMaxValueSeen();