X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fdata%2Fcontroller%2FAbstractController.java;h=d81086cd7e028b90865a31830e46261530d6647b;hb=1cb3955aa53eee7acfbfd9228d60cfb6ddf747f3;hp=c091573f543dccbe52e79b64d6a61a17ef903da9;hpb=f761d816f6e2f14bc80efb45e4cb5c130fa9a57f;p=sonitus.git diff --git a/src/main/java/net/pterodactylus/sonitus/data/controller/AbstractController.java b/src/main/java/net/pterodactylus/sonitus/data/controller/AbstractController.java index c091573..d81086c 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/controller/AbstractController.java +++ b/src/main/java/net/pterodactylus/sonitus/data/controller/AbstractController.java @@ -30,6 +30,9 @@ import net.pterodactylus.sonitus.data.Controller; */ public abstract class AbstractController> implements Controller { + /** The name of this controller. */ + private final String name; + /** The minimum value of this controller. */ private final V minimum; @@ -45,6 +48,8 @@ public abstract class AbstractController> implements Con /** * Creates a new abstract controller. * + * @param name + * The name of the controller * @param minimum * The minimum value of the controller * @param maximum @@ -53,9 +58,9 @@ public abstract class AbstractController> implements Con * {@code true} if this controller has a “center” position, {@code false} * otherwise * @param currentValue - * The current value of this controller */ - public AbstractController(V minimum, V maximum, boolean centered, V currentValue) { + public AbstractController(String name, V minimum, V maximum, boolean centered, V currentValue) { + this.name = name; this.minimum = minimum; this.maximum = maximum; this.centered = centered; @@ -67,6 +72,11 @@ public abstract class AbstractController> implements Con // @Override + public String name() { + return name; + } + + @Override public V minimum() { return minimum; } @@ -103,10 +113,14 @@ public abstract class AbstractController> implements Con * Adjusts the controller. This method is called from {@link * #value(Comparable)} if the new value is different from the current value. * Also, the value is clamped to fit within the range of this controller. + *

+ * This implementation does nothing. * * @param value * The new value */ - protected abstract void valueSet(V value); + protected void valueSet(V value) { + /* do nothing. */ + } }