diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-03-08 14:48:25 +0000 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-03-08 14:48:25 +0000 |
commit | d63d3145f0f2abcee1bb88457324f4aaf9b9320e (patch) | |
tree | dfb19082adfba8989c4fd95ef286b8c1e7a1f2b1 /src/jcgp/parameters | |
parent | ef7a850a8f2f81ccaa07f25d9b7ad602e84d88c9 (diff) |
Slowly refactoring Parameters to fit the GUI a little better...
Diffstat (limited to 'src/jcgp/parameters')
-rw-r--r-- | src/jcgp/parameters/BooleanParameter.java | 32 | ||||
-rw-r--r-- | src/jcgp/parameters/DoubleParameter.java | 32 | ||||
-rw-r--r-- | src/jcgp/parameters/IntegerParameter.java | 32 | ||||
-rw-r--r-- | src/jcgp/parameters/Parameter.java | 22 | ||||
-rw-r--r-- | src/jcgp/parameters/Parameters.java | 31 |
5 files changed, 149 insertions, 0 deletions
diff --git a/src/jcgp/parameters/BooleanParameter.java b/src/jcgp/parameters/BooleanParameter.java new file mode 100644 index 0000000..738b733 --- /dev/null +++ b/src/jcgp/parameters/BooleanParameter.java @@ -0,0 +1,32 @@ +package jcgp.parameters; + +import javafx.beans.property.SimpleBooleanProperty; + +public class BooleanParameter extends Parameter { + + private SimpleBooleanProperty value; + + public BooleanParameter(boolean value) { + + this.value.set(value); + + } + + public BooleanParameter(boolean value, boolean managed) { + this.value.set(value); + this.managed = managed; + } + + public void setValue(boolean value) { + this.value.set(value); + } + + public boolean getValue() { + return this.value.get(); + } + + public SimpleBooleanProperty valueProperty() { + return value; + } + +} diff --git a/src/jcgp/parameters/DoubleParameter.java b/src/jcgp/parameters/DoubleParameter.java new file mode 100644 index 0000000..9349502 --- /dev/null +++ b/src/jcgp/parameters/DoubleParameter.java @@ -0,0 +1,32 @@ +package jcgp.parameters; + +import javafx.beans.property.SimpleDoubleProperty; + +public class DoubleParameter extends Parameter { + + private SimpleDoubleProperty value; + + public DoubleParameter(double value) { + + this.value.set(value); + + } + + public DoubleParameter(double value, boolean managed) { + this.value.set(value); + this.managed = managed; + } + + public void setValue(double value) { + this.value.set(value); + } + + public double getValue() { + return this.value.get(); + } + + public SimpleDoubleProperty valueProperty() { + return value; + } + +} diff --git a/src/jcgp/parameters/IntegerParameter.java b/src/jcgp/parameters/IntegerParameter.java new file mode 100644 index 0000000..2aac3e1 --- /dev/null +++ b/src/jcgp/parameters/IntegerParameter.java @@ -0,0 +1,32 @@ +package jcgp.parameters; + +import javafx.beans.property.SimpleIntegerProperty; + +public class IntegerParameter extends Parameter { + + private SimpleIntegerProperty value; + + public IntegerParameter(int value) { + + this.value.set(value); + + } + + public IntegerParameter(int value, boolean managed) { + this.value.set(value); + this.managed = managed; + } + + public void setValue(int value) { + this.value.set(value); + } + + public int getValue() { + return this.value.get(); + } + + public SimpleIntegerProperty valueProperty() { + return value; + } + +} diff --git a/src/jcgp/parameters/Parameter.java b/src/jcgp/parameters/Parameter.java new file mode 100644 index 0000000..8b63868 --- /dev/null +++ b/src/jcgp/parameters/Parameter.java @@ -0,0 +1,22 @@ +package jcgp.parameters; + +public abstract class Parameter { + protected boolean managed = false; + protected boolean hidden = false; + + public void setManaged(boolean value) { + managed = value; + } + + public boolean isManaged() { + return managed; + } + + public void setHidden(boolean value) { + hidden = value; + } + + public boolean isHidden() { + return hidden; + } +} diff --git a/src/jcgp/parameters/Parameters.java b/src/jcgp/parameters/Parameters.java new file mode 100644 index 0000000..54b54e3 --- /dev/null +++ b/src/jcgp/parameters/Parameters.java @@ -0,0 +1,31 @@ +package jcgp.parameters; + +import java.util.HashMap; + +public class Parameters { + + private static HashMap<String, Parameter> parameters; + + public static void add(String key, Parameter value) { + parameters.put(key, value); + } + + public static Parameter get(String key) { + return parameters.get(key); + } + + public static boolean contains(String key) { + return parameters.containsKey(key); + } + +// private static int rows = 0, columns = 0, inputs = 0, outputs = 0, levelsBack = 0, +// mutationRate = 0, totalGenerations = 0, parents = 0, offspring = 0, +// currentGeneration = 0, totalRuns = 0, currentRun = 0, +// maxArity = 0, maxFitness = 0; + +// private static boolean debug = false; + + + + +} |