private static void aggregate(Map<AggregationKey, AggregationValue> map, AggregationKey key, double value) { AggregationValue aggregationValue = map.get(key); if (aggregationValue == null) { aggregationValue = map.putIfAbsent(key, new AggregationValue(value)); if (aggregationValue == null) { return; } } aggregationValue.update(value); }
public static void prepareReportingInsert(PreparedStatement ps, String email, int dashId, int deviceId, short pin, PinType pinType, long ts, double value) throws SQLException { ps.setString(1, email); ps.setInt(2, dashId); ps.setInt(3, deviceId); ps.setShort(4, pin); ps.setInt(5, pinType.ordinal()); ps.setTimestamp(6, new Timestamp(ts), DateTimeUtils.UTC_CALENDAR); ps.setDouble(7, value); }
Path filePath = Paths.get(userReportFolder.toString(), fileName); FileUtils.write(filePath, value.calcAverage(), keyToRemove.getTs(type));