aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/parameters
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-03-15 18:00:11 +0000
committerEduardo Pedroni <ep625@york.ac.uk>2014-03-15 18:00:11 +0000
commitd3527a63e12c0e5288f1e7d2e2dc18e61d16b760 (patch)
tree95a134d7d9a2e1409040cf41240c6d522cf31a06 /src/jcgp/parameters
parentc0269683bcc7fde0d437ae84cd89a93d9d8fd81b (diff)
Did some more refactoring, fixed issues with eclipse crashing.
Diffstat (limited to 'src/jcgp/parameters')
-rw-r--r--src/jcgp/parameters/BooleanParameter.java15
-rw-r--r--src/jcgp/parameters/DoubleParameter.java14
-rw-r--r--src/jcgp/parameters/IntegerParameter.java14
-rw-r--r--src/jcgp/parameters/Parameter.java4
-rw-r--r--src/jcgp/parameters/Parameters.java21
5 files changed, 33 insertions, 35 deletions
diff --git a/src/jcgp/parameters/BooleanParameter.java b/src/jcgp/parameters/BooleanParameter.java
index 9402620..aff0bc5 100644
--- a/src/jcgp/parameters/BooleanParameter.java
+++ b/src/jcgp/parameters/BooleanParameter.java
@@ -3,6 +3,8 @@ package jcgp.parameters;
import javafx.beans.property.SimpleBooleanProperty;
public class BooleanParameter extends Parameter {
+
+ SimpleBooleanProperty value;
public BooleanParameter(boolean value, String name) {
this.value = new SimpleBooleanProperty(value);
@@ -16,18 +18,19 @@ public class BooleanParameter extends Parameter {
this.hidden = hidden;
}
- public void setValue(boolean value) {
- ((SimpleBooleanProperty) this.value).set(value);
- }
-
@Override
public Object getValue() {
- return ((SimpleBooleanProperty) this.value).get();
+ return this.value.get();
}
@Override
public SimpleBooleanProperty valueProperty() {
- return (SimpleBooleanProperty) value;
+ return value;
+ }
+
+ @Override
+ public void setValue(Object value) {
+ this.value.set((boolean) value);
}
}
diff --git a/src/jcgp/parameters/DoubleParameter.java b/src/jcgp/parameters/DoubleParameter.java
index 2c2ec34..2725457 100644
--- a/src/jcgp/parameters/DoubleParameter.java
+++ b/src/jcgp/parameters/DoubleParameter.java
@@ -3,6 +3,8 @@ package jcgp.parameters;
import javafx.beans.property.SimpleDoubleProperty;
public class DoubleParameter extends Parameter {
+
+ SimpleDoubleProperty value;
public DoubleParameter(double value, String name) {
this.value = new SimpleDoubleProperty(value);
@@ -17,16 +19,22 @@ public class DoubleParameter extends Parameter {
}
public void setValue(double value) {
- ((SimpleDoubleProperty) this.value).set(value);
+ this.value.set(value);
}
@Override
public Object getValue() {
- return ((SimpleDoubleProperty) this.value).get();
+ return this.value.get();
}
public SimpleDoubleProperty valueProperty() {
- return (SimpleDoubleProperty) value;
+ return value;
+ }
+
+ @Override
+ public void setValue(Object value) {
+ this.value.set((double) value);
+
}
}
diff --git a/src/jcgp/parameters/IntegerParameter.java b/src/jcgp/parameters/IntegerParameter.java
index 6b4c20f..f0109f7 100644
--- a/src/jcgp/parameters/IntegerParameter.java
+++ b/src/jcgp/parameters/IntegerParameter.java
@@ -4,6 +4,8 @@ import javafx.beans.property.SimpleIntegerProperty;
public class IntegerParameter extends Parameter {
+ SimpleIntegerProperty value;
+
public IntegerParameter(int value, String name) {
this.value = new SimpleIntegerProperty(value);
this.name = name;
@@ -17,17 +19,23 @@ public class IntegerParameter extends Parameter {
}
public void setValue(int value) {
- ((SimpleIntegerProperty) this.value).set(value);
+ this.value.set(value);
}
@Override
public Object getValue() {
- return ((SimpleIntegerProperty) this.value).get();
+ return this.value.get();
}
@Override
public SimpleIntegerProperty valueProperty() {
- return (SimpleIntegerProperty) value;
+ return value;
+ }
+
+ @Override
+ public void setValue(Object value) {
+ this.value.set((int) value);
+
}
}
diff --git a/src/jcgp/parameters/Parameter.java b/src/jcgp/parameters/Parameter.java
index ffcf3b4..64b19c8 100644
--- a/src/jcgp/parameters/Parameter.java
+++ b/src/jcgp/parameters/Parameter.java
@@ -7,8 +7,6 @@ public abstract class Parameter {
protected boolean managed = false;
protected boolean hidden = false;
protected String name;
- @SuppressWarnings("rawtypes")
- protected Property value;
public void setManaged(boolean value) {
managed = value;
@@ -32,6 +30,8 @@ public abstract class Parameter {
public abstract Object getValue();
+ public abstract void setValue(Object value);
+
@SuppressWarnings("rawtypes")
public abstract Property valueProperty();
}
diff --git a/src/jcgp/parameters/Parameters.java b/src/jcgp/parameters/Parameters.java
deleted file mode 100644
index 723c5dc..0000000
--- a/src/jcgp/parameters/Parameters.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package jcgp.parameters;
-
-import java.util.HashMap;
-
-public class Parameters {
-
-
-
-// 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;
-
-
-
-
-
-
-}