diff options
Diffstat (limited to 'src/jcgp/backend/resources/parameters/Parameter.java')
-rw-r--r-- | src/jcgp/backend/resources/parameters/Parameter.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/jcgp/backend/resources/parameters/Parameter.java b/src/jcgp/backend/resources/parameters/Parameter.java index 7e12ff8..3990ae6 100644 --- a/src/jcgp/backend/resources/parameters/Parameter.java +++ b/src/jcgp/backend/resources/parameters/Parameter.java @@ -1,8 +1,9 @@ package jcgp.backend.resources.parameters; import javafx.beans.property.Property; +import javafx.beans.property.ReadOnlyProperty; -public abstract class Parameter { +public abstract class Parameter<T> { protected boolean monitor, critical, reset = false; @@ -10,6 +11,8 @@ public abstract class Parameter { protected String name; + protected Property<T> valueProperty; + public Parameter(String name, boolean monitor, boolean critical) { this.name = name; this.monitor = monitor; @@ -36,6 +39,19 @@ public abstract class Parameter { return status; } - public abstract Property<?> valueProperty(); - + public ReadOnlyProperty<T> valueProperty() { + return valueProperty; + } + + public T get() { + return valueProperty.getValue(); + } + + public void set(T newValue) { + if (!valueProperty.isBound()) { + valueProperty.setValue(newValue); + } + } + + public abstract void validate(T newValue); } |