/** * Adds an existing Distribution to the current one. * It will create the entries if they don't exist. * Can be used to add the values of children resources for example * <p/> * Since 2.2, the distribution returned will be invalidated in case the * measure given does not use the same bottom limits * * @param measure the measure to add to the current one * @return the current object */ public RangeDistributionBuilder add(@Nullable Measure<String> measure) { if (measure != null && measure.getData() != null) { Map<Double, Double> map = KeyValueFormat.parse(measure.getData(), KeyValueFormat.newDoubleConverter(), KeyValueFormat.newDoubleConverter()); Number[] limits = map.keySet().toArray(new Number[map.size()]); if (bottomLimits == null) { init(limits); } else if (!areSameLimits(bottomLimits, map.keySet())) { isValid = false; } if (isValid) { for (Map.Entry<Double, Double> entry : map.entrySet()) { addLimitCount(entry.getKey(), entry.getValue().intValue()); } } } return this; }