| | |
| | | public synchronized void save(SimulatorState state, List<CollectorHistoryAppend> historyAppends) |
| | | { |
| | | for (CollectorHistoryAppend append : historyAppends) |
| | | collectorHistory.computeIfAbsent(append.collectorCode(), key -> new ArrayList<>()) |
| | | .addAll(append.records()); |
| | | { |
| | | ArrayList<CollectorMeasurementRecord> history = collectorHistory.computeIfAbsent( |
| | | append.collectorCode(), key -> new ArrayList<>()); |
| | | history.addAll(append.records()); |
| | | int overflow = history.size() - (int) MAX_HISTORY_RECORDS; |
| | | if (overflow > 0) history.subList(0, overflow).clear(); |
| | | } |
| | | this.state = state; |
| | | } |
| | | |