diff --git a/build.gradle b/build.gradle index e75ef0e..5a76904 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'de.tbressler.waterrower' -version '0.9.7' +version '0.9.8' apply plugin: 'java' apply plugin: 'maven' diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/AbstractMemorySubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/AbstractMemorySubscription.java index c9b2db2..73af0b5 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/AbstractMemorySubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/AbstractMemorySubscription.java @@ -31,7 +31,7 @@ abstract class AbstractMemorySubscription implements ISubscription { * @param memory Single, double or triple memory. Must not be null. * @param location The memory location, must not be null. */ - AbstractMemorySubscription(Memory memory, MemoryLocation location) { + public AbstractMemorySubscription(Memory memory, MemoryLocation location) { this.memory = requireNonNull(memory); this.location = requireNonNull(location); } @@ -64,6 +64,6 @@ public final void handle(AbstractMessage msg) { * * @param msg The message, never null. */ - abstract void handle(DataMemoryMessage msg); + abstract protected void handle(DataMemoryMessage msg); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/AverageStrokeTimeSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/AverageStrokeTimeSubscription.java index 6c1029b..e4a8a96 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/AverageStrokeTimeSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/AverageStrokeTimeSubscription.java @@ -74,6 +74,6 @@ protected final void handle(DataMemoryMessage msg) { * * @param averageStrokeTime The new average stroke time. */ - protected abstract void onAverageStrokeTimeUpdated(int averageStrokeTime); + abstract protected void onAverageStrokeTimeUpdated(int averageStrokeTime); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/ClockCountDownSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/ClockCountDownSubscription.java index e2784c9..8af1f48 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/ClockCountDownSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/ClockCountDownSubscription.java @@ -51,6 +51,6 @@ protected final void handle(DataMemoryMessage msg) { * * @param duration The new clock count-down, never null. */ - protected abstract void onClockCountDownUpdated(Duration duration); + abstract protected void onClockCountDownUpdated(Duration duration); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/DisplayedDurationSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/DisplayedDurationSubscription.java index 7b38ae6..71312d0 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/DisplayedDurationSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/DisplayedDurationSubscription.java @@ -51,6 +51,6 @@ protected final void handle(DataMemoryMessage msg) { * * @param duration The new duration, never null. */ - protected abstract void onDurationUpdated(Duration duration); + abstract protected void onDurationUpdated(Duration duration); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/DistanceSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/DistanceSubscription.java index 87bbf49..c5f585b 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/DistanceSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/DistanceSubscription.java @@ -91,6 +91,6 @@ protected final void handle(DataMemoryMessage msg) { * @param mode The distance mode (e.g. total distance or displayed distance), never null. * @param distance The new distance. */ - protected abstract void onDistanceUpdated(DistanceMode mode, int distance); + abstract protected void onDistanceUpdated(DistanceMode mode, int distance); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/IntensitySubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/IntensitySubscription.java index 1c1d922..62f303f 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/IntensitySubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/IntensitySubscription.java @@ -63,7 +63,7 @@ private static MemoryLocation getMemoryLocation(IntensityType intensityType) { @Override - void handle(DataMemoryMessage msg) { + protected void handle(DataMemoryMessage msg) { int intensity = intFromHighAndLow(msg.getValue2(), msg.getValue1()); // If the received intensity is the same as before, @@ -83,6 +83,6 @@ void handle(DataMemoryMessage msg) { * @param intensityType The intensity type, never null. * @param intensity The new value. */ - abstract void onIntensityUpdated(IntensityType intensityType, int intensity); + abstract protected void onIntensityUpdated(IntensityType intensityType, int intensity); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/PulseCountSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/PulseCountSubscription.java index 8db58cf..b4e19aa 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/PulseCountSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/PulseCountSubscription.java @@ -32,6 +32,6 @@ public final void handle(AbstractMessage msg) { * * @param pulsesCount The number of pulse’s counted during the last 25mS period. */ - abstract void onPulseCount(int pulsesCount); + abstract protected void onPulseCount(int pulsesCount); } \ No newline at end of file diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/StrokeCountSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/StrokeCountSubscription.java index 744f310..5236ef0 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/StrokeCountSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/StrokeCountSubscription.java @@ -47,6 +47,6 @@ protected final void handle(DataMemoryMessage msg) { * * @param strokes The new stroke count. */ - protected abstract void onStrokeCountUpdated(int strokes); + abstract protected void onStrokeCountUpdated(int strokes); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/StrokeSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/StrokeSubscription.java index 2da1d6e..f9e76b8 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/StrokeSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/StrokeSubscription.java @@ -38,6 +38,6 @@ public final void handle(AbstractMessage msg) { * * @param strokeType The type of stroke (e.g. start or end), never null. */ - abstract void onStroke(StrokeType strokeType); + abstract protected void onStroke(StrokeType strokeType); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/TankVolumeSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/TankVolumeSubscription.java index bdfa0d7..53cbc61 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/TankVolumeSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/TankVolumeSubscription.java @@ -43,6 +43,6 @@ protected final void handle(DataMemoryMessage msg) { * * @param tankVolume The volume of water in the tank (in liters). */ - protected abstract void onTankVolumeUpdated(int tankVolume); + abstract protected void onTankVolumeUpdated(int tankVolume); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutFlagsSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutFlagsSubscription.java index 6679819..1a89edb 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutFlagsSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutFlagsSubscription.java @@ -57,6 +57,6 @@ public final void handle(DataMemoryMessage msg) { * * @param flags The flags of the workout mode, never null. */ - protected abstract void onWorkoutModeUpdated(WorkoutFlags flags); + abstract protected void onWorkoutModeUpdated(WorkoutFlags flags); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutIntervalSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutIntervalSubscription.java index 3fd674a..9cd2125 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutIntervalSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutIntervalSubscription.java @@ -106,6 +106,6 @@ protected final void handle(DataMemoryMessage msg) { * @param intervalIndex The index of the workout interval. * @param value The new value. */ - protected abstract void onWorkoutIntervalUpdated(IntervalType intervalType, int intervalIndex, int value); + abstract protected void onWorkoutIntervalUpdated(IntervalType intervalType, int intervalIndex, int value); } diff --git a/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutTotalSubscription.java b/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutTotalSubscription.java index b25fb21..60fa00e 100644 --- a/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutTotalSubscription.java +++ b/src/main/java/de/tbressler/waterrower/subscriptions/WorkoutTotalSubscription.java @@ -70,7 +70,7 @@ private static MemoryLocation getMemoryLocation(ValueType valueType) { @Override - void handle(DataMemoryMessage msg) { + protected void handle(DataMemoryMessage msg) { int value = intFromHighAndLow(msg.getValue2(), msg.getValue1()); // If the received value is the same as before, @@ -90,6 +90,6 @@ void handle(DataMemoryMessage msg) { * @param valueType The value type, never null. * @param value The new value. */ - abstract void onTotalWorkoutValueUpdated(ValueType valueType, int value); + abstract protected void onTotalWorkoutValueUpdated(ValueType valueType, int value); } diff --git a/src/test/java/de/tbressler/waterrower/subscriptions/TestAbstractMemorySubscription.java b/src/test/java/de/tbressler/waterrower/subscriptions/TestAbstractMemorySubscription.java index 748085d..314cb0e 100644 --- a/src/test/java/de/tbressler/waterrower/subscriptions/TestAbstractMemorySubscription.java +++ b/src/test/java/de/tbressler/waterrower/subscriptions/TestAbstractMemorySubscription.java @@ -116,7 +116,7 @@ public void handle_withOtherLocationMessage_doesntNotifiesInternalHandler() { private AbstractMemorySubscription newAbstractMemorySubscription(Memory memory, MemoryLocation location) { return new AbstractMemorySubscription(memory, location) { @Override - void handle(DataMemoryMessage msg) { + protected void handle(DataMemoryMessage msg) { internalSubscription.handle(msg); } }; diff --git a/src/test/java/de/tbressler/waterrower/subscriptions/TestDebugSubscription.java b/src/test/java/de/tbressler/waterrower/subscriptions/TestDebugSubscription.java index 06f3991..d5de05b 100644 --- a/src/test/java/de/tbressler/waterrower/subscriptions/TestDebugSubscription.java +++ b/src/test/java/de/tbressler/waterrower/subscriptions/TestDebugSubscription.java @@ -25,7 +25,7 @@ public class TestDebugSubscription { public void new_withNullMemory_throwsNPE() { new DebugSubscription(null, CLOCK_DOWN_DEC) { @Override - void handle(DataMemoryMessage msg) {} + protected void handle(DataMemoryMessage msg) {} }; } @@ -33,7 +33,7 @@ void handle(DataMemoryMessage msg) {} public void new_withNullMemoryLocation_throwsNPE() { new DebugSubscription(SINGLE_MEMORY, null) { @Override - void handle(DataMemoryMessage msg) {} + protected void handle(DataMemoryMessage msg) {} }; } @@ -43,7 +43,7 @@ void handle(DataMemoryMessage msg) {} public void poll_returnsMessageForConstructorValues() { DebugSubscription subscription = new DebugSubscription(DOUBLE_MEMORY, M_S_LOW_AVERAGE) { @Override - void handle(DataMemoryMessage msg) {} + protected void handle(DataMemoryMessage msg) {} }; ReadMemoryMessage msg = (ReadMemoryMessage) subscription.poll(); diff --git a/src/test/java/de/tbressler/waterrower/subscriptions/TestIntensitySubscription.java b/src/test/java/de/tbressler/waterrower/subscriptions/TestIntensitySubscription.java index 57227a6..0557e34 100644 --- a/src/test/java/de/tbressler/waterrower/subscriptions/TestIntensitySubscription.java +++ b/src/test/java/de/tbressler/waterrower/subscriptions/TestIntensitySubscription.java @@ -34,7 +34,7 @@ public class TestIntensitySubscription { public void new_withNull_throwsNPE() { new IntensitySubscription(null) { @Override - void onIntensityUpdated(IntensityType intensityType, int intensity) {} + protected void onIntensityUpdated(IntensityType intensityType, int intensity) {} }; } @@ -106,7 +106,7 @@ public void handle_withOtherMessage_doesntNotifyOnAverageStrokeTimeUpdate() { private IntensitySubscription newIntensitySubscription(IntensityType type) { return new IntensitySubscription(type) { @Override - void onIntensityUpdated(IntensityType intensityType, int intensity) { + protected void onIntensityUpdated(IntensityType intensityType, int intensity) { internalSubscription.onIntensityUpdated(intensityType, intensity); } }; diff --git a/src/test/java/de/tbressler/waterrower/subscriptions/TestPulseCountSubscription.java b/src/test/java/de/tbressler/waterrower/subscriptions/TestPulseCountSubscription.java index 357fe41..29e4357 100644 --- a/src/test/java/de/tbressler/waterrower/subscriptions/TestPulseCountSubscription.java +++ b/src/test/java/de/tbressler/waterrower/subscriptions/TestPulseCountSubscription.java @@ -27,7 +27,7 @@ public class TestPulseCountSubscription { public void setUp() { subscription = new PulseCountSubscription() { @Override - void onPulseCount(int pulsesCount) { + protected void onPulseCount(int pulsesCount) { internalSubscription.onPulseCount(pulsesCount); } }; diff --git a/src/test/java/de/tbressler/waterrower/subscriptions/TestStrokeSubscription.java b/src/test/java/de/tbressler/waterrower/subscriptions/TestStrokeSubscription.java index 06b2fa2..6eb19bb 100644 --- a/src/test/java/de/tbressler/waterrower/subscriptions/TestStrokeSubscription.java +++ b/src/test/java/de/tbressler/waterrower/subscriptions/TestStrokeSubscription.java @@ -30,7 +30,7 @@ public class TestStrokeSubscription { public void setUp() { subscription = new StrokeSubscription() { @Override - void onStroke(StrokeType strokeType) { + protected void onStroke(StrokeType strokeType) { internalSubscription.onStroke(strokeType); } }; diff --git a/src/test/java/de/tbressler/waterrower/subscriptions/TestWorkoutTotalSubscription.java b/src/test/java/de/tbressler/waterrower/subscriptions/TestWorkoutTotalSubscription.java index 7f87b12..18573b2 100644 --- a/src/test/java/de/tbressler/waterrower/subscriptions/TestWorkoutTotalSubscription.java +++ b/src/test/java/de/tbressler/waterrower/subscriptions/TestWorkoutTotalSubscription.java @@ -106,7 +106,7 @@ public void handle_for2DifferentMessages_notifiesTwice() { private WorkoutTotalSubscription newWorkoutTotalSubscription(ValueType valueType) { return new WorkoutTotalSubscription(valueType) { @Override - void onTotalWorkoutValueUpdated(ValueType valueType, int value) { + protected void onTotalWorkoutValueUpdated(ValueType valueType, int value) { internalSubscription.onTotalWorkoutValueUpdated(valueType, value); } };