The main method that updates a value in the histogram with a given sample count This should be called by one of the public interface methods that are synchronized This method is not synchronized on purpose for performance @param value @param count
(X value, int count)
| 137 | * @param count |
| 138 | */ |
| 139 | private void _put(X value, int count) { |
| 140 | if (value == null) { |
| 141 | return; |
| 142 | } |
| 143 | this.num_samples += count; |
| 144 | |
| 145 | // If we already have this value in our histogram, then add the new count |
| 146 | // to its existing total |
| 147 | if (this.histogram.containsKey(value)) { |
| 148 | count += this.histogram.get(value); |
| 149 | } |
| 150 | |
| 151 | // If the new count is zero, then completely remove it if we're not allowed to have zero entries |
| 152 | if (count == 0 && !this.keep_zero_entries) { |
| 153 | this.histogram.remove(value); |
| 154 | } else { |
| 155 | this.histogram.put(value, count); |
| 156 | } |
| 157 | this.dirty = true; |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Recalculate the min/max count value sets Since this is expensive, this should only be done |