diff options
Diffstat (limited to 'src/jcgp/backend/parameters')
-rw-r--r-- | src/jcgp/backend/parameters/BooleanParameter.java | 32 | ||||
-rw-r--r-- | src/jcgp/backend/parameters/DoubleParameter.java | 33 | ||||
-rw-r--r-- | src/jcgp/backend/parameters/IntegerParameter.java | 33 | ||||
-rw-r--r-- | src/jcgp/backend/parameters/Parameter.java | 35 |
4 files changed, 133 insertions, 0 deletions
diff --git a/src/jcgp/backend/parameters/BooleanParameter.java b/src/jcgp/backend/parameters/BooleanParameter.java new file mode 100644 index 0000000..d5904cd --- /dev/null +++ b/src/jcgp/backend/parameters/BooleanParameter.java @@ -0,0 +1,32 @@ +package jcgp.backend.parameters; + +import javafx.beans.property.SimpleBooleanProperty; + +public class BooleanParameter extends Parameter { + + private SimpleBooleanProperty value; + + public BooleanParameter(boolean value, String name, boolean monitor, boolean hidden, boolean critical) { + super(name, monitor, hidden, critical); + this.value = new SimpleBooleanProperty(value); + } + + public BooleanParameter(boolean value, String name) { + super(name, false, false, true); + this.value = new SimpleBooleanProperty(value); + } + + public boolean get() { + return value.get(); + } + + public void set(boolean newValue) { + if (!value.isBound()) { + value.set(newValue); + } + } + + public SimpleBooleanProperty valueProperty() { + return value; + } +} diff --git a/src/jcgp/backend/parameters/DoubleParameter.java b/src/jcgp/backend/parameters/DoubleParameter.java new file mode 100644 index 0000000..26031be --- /dev/null +++ b/src/jcgp/backend/parameters/DoubleParameter.java @@ -0,0 +1,33 @@ +package jcgp.backend.parameters; + +import javafx.beans.property.SimpleDoubleProperty; + +public class DoubleParameter extends Parameter { + + protected SimpleDoubleProperty value; + + public DoubleParameter(double value, String name, boolean monitor, boolean hidden, boolean critical) { + super(name, monitor, hidden, critical); + this.value = new SimpleDoubleProperty(value); + } + + public DoubleParameter(double value, String name) { + super(name, false, false, true); + this.value = new SimpleDoubleProperty(value); + } + + public double get() { + return value.get(); + } + + public void set(double newValue) { + if (!value.isBound()) { + value.set(newValue); + } + } + + public SimpleDoubleProperty valueProperty() { + return value; + } + +} diff --git a/src/jcgp/backend/parameters/IntegerParameter.java b/src/jcgp/backend/parameters/IntegerParameter.java new file mode 100644 index 0000000..dbfa5c5 --- /dev/null +++ b/src/jcgp/backend/parameters/IntegerParameter.java @@ -0,0 +1,33 @@ +package jcgp.backend.parameters; + +import javafx.beans.property.SimpleIntegerProperty; + +public class IntegerParameter extends Parameter { + + protected SimpleIntegerProperty value; + + public IntegerParameter(int value, String name, boolean monitor, boolean hidden, boolean critical) { + super(name, monitor, hidden, critical); + this.value = new SimpleIntegerProperty(value); + } + + public IntegerParameter(int value, String name) { + super(name, false, false, true); + this.value = new SimpleIntegerProperty(value); + } + + public int get() { + return value.get(); + } + + public void set(int newValue) { + if (!value.isBound()) { + value.set(newValue); + } + } + + public SimpleIntegerProperty valueProperty() { + return value; + } + +} diff --git a/src/jcgp/backend/parameters/Parameter.java b/src/jcgp/backend/parameters/Parameter.java new file mode 100644 index 0000000..2f584a4 --- /dev/null +++ b/src/jcgp/backend/parameters/Parameter.java @@ -0,0 +1,35 @@ +package jcgp.backend.parameters; + +import javafx.beans.property.Property; + +public abstract class Parameter { + + protected boolean hidden, monitor, critical; + + protected String name; + + public Parameter(String name, boolean monitor, boolean hidden, boolean critical) { + this.name = name; + this.hidden = hidden; + this.monitor = monitor; + this.critical = critical; + } + + public boolean isHidden() { + return hidden; + } + + public boolean isMonitor() { + return monitor; + } + + public boolean isCritical() { + return critical; + } + + public String getName() { + return name; + } + + public abstract Property<?> valueProperty(); +} |