@Override public IntegerAnalysisCounter add(Writable writable) { int value = writable.toInt(); if (value == 0) countZero++; 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((double) value); return this; }
@Override public IntegerAnalysisCounter add(Writable writable) { int value = writable.toInt(); if (value == 0) countZero++; 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((double) value); return this; }
public IntegerAnalysisCounter merge(IntegerAnalysisCounter other) { int 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; } int 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 IntegerAnalysisCounter(counter.merge(other.getCounter()), countZero + other.getCountZero(), newCountMinValue, newCountMaxValue, countPositive + other.getCountPositive(), countNegative + other.getCountNegative()); } }
public IntegerAnalysisCounter merge(IntegerAnalysisCounter other) { int 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; } int 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 IntegerAnalysisCounter(counter.merge(other.getCounter()), countZero + other.getCountZero(), newCountMinValue, newCountMaxValue, countPositive + other.getCountPositive(), countNegative + other.getCountNegative()); } }
case Integer: IntegerAnalysisCounter iac = (IntegerAnalysisCounter) counters.get(i); IntegerAnalysis ia = new IntegerAnalysis.Builder().min(iac.getMinValueSeen()) .max(iac.getMaxValueSeen()).mean(iac.getMean()).sampleStdev(iac.getSampleStdev()) .sampleVariance(iac.getSampleVariance()).countZero(iac.getCountZero()) list.add(ia); minsMaxes[i][0] = iac.getMinValueSeen(); minsMaxes[i][1] = iac.getMaxValueSeen();
case Integer: IntegerAnalysisCounter iac = (IntegerAnalysisCounter) counters.get(i); IntegerAnalysis ia = new IntegerAnalysis.Builder().min(iac.getMinValueSeen()) .max(iac.getMaxValueSeen()).mean(iac.getMean()).sampleStdev(iac.getSampleStdev()) .sampleVariance(iac.getSampleVariance()).countZero(iac.getCountZero()) list.add(ia); minsMaxes[i][0] = iac.getMinValueSeen(); minsMaxes[i][1] = iac.getMaxValueSeen();