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()); } }