Cleanup: moved Raw into Aggregator.

Preparation for refactoring.
This commit is contained in:
Dennis Guse
2026-01-27 17:59:08 +01:00
parent 0f2c5adf26
commit 18ff96733e
17 changed files with 77 additions and 98 deletions
@@ -11,7 +11,7 @@ public class AggregatorBarometerTest {
private static void addSensorValue(AggregatorBarometer aggregatorBarometer, float[] values) {
for (float f : values) {
aggregatorBarometer.add(new Raw<>(Instant.MIN, AtmosphericPressure.ofHPA(f)));
aggregatorBarometer.add(Instant.MIN, AtmosphericPressure.ofHPA(f));
}
}
@@ -25,8 +25,8 @@ public class SensorDataCyclingTest {
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 1024)));
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(2, 2048)));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 1024));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(2, 2048));
// then
assertEquals(60, current.getAggregatedValue(Instant.MIN).getRPM(), 0.01);
@@ -37,8 +37,8 @@ public class SensorDataCyclingTest {
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 6184)));
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(2, 8016)));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 6184));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(2, 8016));
// then
assertEquals(33.53, current.getAggregatedValue(Instant.MIN).getRPM(), 0.01);
@@ -49,8 +49,8 @@ public class SensorDataCyclingTest {
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 1024)));
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 2048)));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 1024));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 2048));
// then
assertEquals(Cadence.of(0), current.getAggregatedValue(Instant.MIN));
@@ -62,8 +62,8 @@ public class SensorDataCyclingTest {
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 1024)));
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(2, 1024)));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, 1024));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(2, 1024));
// then
assertFalse(current.hasReceivedData()); //TODO Cadence should be 0?
@@ -74,8 +74,8 @@ public class SensorDataCyclingTest {
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, UintUtils.UINT16_MAX - 1024)));
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(2, 0)));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(1, UintUtils.UINT16_MAX - 1024));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(2, 0));
// then
assertEquals(60, current.getAggregatedValue(Instant.MIN).getRPM(), 0.01);
@@ -87,8 +87,8 @@ public class SensorDataCyclingTest {
AggregatorCyclingCadence current = new AggregatorCyclingCadence("", "");
// when
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(UintUtils.UINT32_MAX - 1, 1024)));
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(0, 2048)));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(UintUtils.UINT32_MAX - 1, 1024));
current.add(Instant.MIN, new BluetoothHandlerCyclingCadence.CrankData(0, 2048));
// then
// TODO See #953
@@ -102,8 +102,8 @@ public class SensorDataCyclingTest {
current.setWheelCircumference(Distance.ofMM(2150));
// when
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingDistanceSpeed.WheelData(1, 6184)));
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingDistanceSpeed.WheelData(2, 8016)));
current.add(Instant.MIN, new BluetoothHandlerCyclingDistanceSpeed.WheelData(1, 6184));
current.add(Instant.MIN, new BluetoothHandlerCyclingDistanceSpeed.WheelData(2, 8016));
// then
assertEquals(2.15, current.getAggregatedValue(Instant.MIN).distance().toM(), 0.01);
@@ -117,8 +117,8 @@ public class SensorDataCyclingTest {
current.setWheelCircumference(Distance.ofMM(2000));
// when
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingDistanceSpeed.WheelData(UintUtils.UINT32_MAX - 1, 1024)));
current.add(new Raw<>(Instant.MIN, new BluetoothHandlerCyclingDistanceSpeed.WheelData(0, 2048)));
current.add(Instant.MIN, new BluetoothHandlerCyclingDistanceSpeed.WheelData(UintUtils.UINT32_MAX - 1, 1024));
current.add(Instant.MIN, new BluetoothHandlerCyclingDistanceSpeed.WheelData(0, 2048));
// then