Append a value with number of occurrences to the Histogram. @param value @param numberOfoccurrences
(double value, double numberOfoccurrences)
| 280 | * @param numberOfoccurrences |
| 281 | */ |
| 282 | public synchronized void append(double value, double numberOfoccurrences) { |
| 283 | sum += numberOfoccurrences; |
| 284 | int binNumber = hashCode(value); |
| 285 | // Determine if there have previously been any occurrences for this bin |
| 286 | Double occurrences = bins.get(Integer.valueOf(binNumber)); |
| 287 | if (occurrences == null) { // first occurence for this bin |
| 288 | bins.put(Integer.valueOf(binNumber), new Double(numberOfoccurrences)); |
| 289 | } else { |
| 290 | // need to put Objects in HashMap, but can only add doubles |
| 291 | numberOfoccurrences += occurrences.doubleValue(); // increase occurrences for bin by numberOfoccurrences |
| 292 | bins.put(Integer.valueOf(binNumber), new Double(numberOfoccurrences)); |
| 293 | } |
| 294 | ymax = Math.max(numberOfoccurrences, ymax); |
| 295 | xmin = Math.min(binNumber * binWidth + binOffset, xmin); |
| 296 | xmax = Math.max(binNumber * binWidth + binWidth + binOffset, xmax); |
| 297 | dataChanged = true; |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Appends a value with 1 occurence. |
no test coverage detected