package jcgp.backend.resources.parameters; import javafx.beans.property.Property; import javafx.beans.property.ReadOnlyProperty; public abstract class Parameter { protected boolean monitor, critical, reset = false; protected ParameterStatus status = ParameterStatus.VALID; protected String name; protected Property valueProperty; public Parameter(String name, boolean monitor, boolean critical) { this.name = name; this.monitor = monitor; this.critical = critical; } public boolean isMonitor() { return monitor; } public boolean isCritical() { return critical; } public boolean requiresReset() { return critical || reset; } public String getName() { return name; } public ParameterStatus getStatus() { return status; } public ReadOnlyProperty 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); }