diff --git a/modules/common-math/src/main/java/edu/tigers/sumatra/math/Hysteresis.java b/modules/common-math/src/main/java/edu/tigers/sumatra/math/Hysteresis.java index 4b2c8223..d82c1e04 100644 --- a/modules/common-math/src/main/java/edu/tigers/sumatra/math/Hysteresis.java +++ b/modules/common-math/src/main/java/edu/tigers/sumatra/math/Hysteresis.java @@ -23,8 +23,10 @@ public class Hysteresis private boolean upper = false; - private Runnable onUpperCallback = () -> {}; - private Runnable onLowerCallback = () -> {}; + private Runnable onUpperCallback = () -> { + }; + private Runnable onLowerCallback = () -> { + }; /** @@ -54,7 +56,7 @@ public Hysteresis initiallyInUpperState() /** * @param value */ - public void update(final double value) + public Hysteresis update(final double value) { boolean lower = !upper; if (lower && (value > upperThreshold)) @@ -67,6 +69,7 @@ public void update(final double value) upper = false; onLowerCallback.run(); } + return this; }