aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/parameters
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-03-23 18:05:13 +0000
committerEduardo Pedroni <ep625@york.ac.uk>2014-03-23 18:05:13 +0000
commit0c288cc1952809294c8d70d86b9f41b04878ac2e (patch)
treeef9671b711fe665a3156594663c083595861a4e6 /src/jcgp/parameters
parentd3527a63e12c0e5288f1e7d2e2dc18e61d16b760 (diff)
Majorly refactored, node grid is fully implemented. About to attempt active path locking.
Diffstat (limited to 'src/jcgp/parameters')
-rw-r--r--src/jcgp/parameters/BooleanParameter.java18
-rw-r--r--src/jcgp/parameters/DoubleParameter.java23
-rw-r--r--src/jcgp/parameters/IntegerParameter.java21
-rw-r--r--src/jcgp/parameters/Parameter.java27
4 files changed, 45 insertions, 44 deletions
diff --git a/src/jcgp/parameters/BooleanParameter.java b/src/jcgp/parameters/BooleanParameter.java
index aff0bc5..0f339a1 100644
--- a/src/jcgp/parameters/BooleanParameter.java
+++ b/src/jcgp/parameters/BooleanParameter.java
@@ -3,34 +3,30 @@ package jcgp.parameters;
import javafx.beans.property.SimpleBooleanProperty;
public class BooleanParameter extends Parameter {
-
- SimpleBooleanProperty value;
-
+
public BooleanParameter(boolean value, String name) {
+ super(name);
this.value = new SimpleBooleanProperty(value);
- this.name = name;
}
public BooleanParameter(boolean value, String name, boolean managed, boolean hidden) {
+ super(name, managed, hidden);
this.value = new SimpleBooleanProperty(value);
- this.name = name;
- this.managed = managed;
- this.hidden = hidden;
}
@Override
- public Object getValue() {
- return this.value.get();
+ public Boolean getValue() {
+ return ((SimpleBooleanProperty) this.value).get();
}
@Override
public SimpleBooleanProperty valueProperty() {
- return value;
+ return (SimpleBooleanProperty) value;
}
@Override
public void setValue(Object value) {
- this.value.set((boolean) value);
+ ((SimpleBooleanProperty) this.value).set((boolean) value);
}
}
diff --git a/src/jcgp/parameters/DoubleParameter.java b/src/jcgp/parameters/DoubleParameter.java
index 2725457..ade99cc 100644
--- a/src/jcgp/parameters/DoubleParameter.java
+++ b/src/jcgp/parameters/DoubleParameter.java
@@ -3,37 +3,30 @@ package jcgp.parameters;
import javafx.beans.property.SimpleDoubleProperty;
public class DoubleParameter extends Parameter {
-
- SimpleDoubleProperty value;
-
+
public DoubleParameter(double value, String name) {
+ super(name);
this.value = new SimpleDoubleProperty(value);
- this.name = name;
}
public DoubleParameter(double value, String name, boolean managed, boolean hidden) {
+ super(name, managed, hidden);
this.value = new SimpleDoubleProperty(value);
- this.name = name;
- this.managed = managed;
- this.hidden = hidden;
- }
-
- public void setValue(double value) {
- this.value.set(value);
}
@Override
- public Object getValue() {
- return this.value.get();
+ public Double getValue() {
+ return ((SimpleDoubleProperty) value).get();
}
+ @Override
public SimpleDoubleProperty valueProperty() {
- return value;
+ return (SimpleDoubleProperty) value;
}
@Override
public void setValue(Object value) {
- this.value.set((double) value);
+ ((SimpleDoubleProperty) this.value).set((double) value);
}
diff --git a/src/jcgp/parameters/IntegerParameter.java b/src/jcgp/parameters/IntegerParameter.java
index f0109f7..cc60179 100644
--- a/src/jcgp/parameters/IntegerParameter.java
+++ b/src/jcgp/parameters/IntegerParameter.java
@@ -3,39 +3,30 @@ package jcgp.parameters;
import javafx.beans.property.SimpleIntegerProperty;
public class IntegerParameter extends Parameter {
-
- SimpleIntegerProperty value;
public IntegerParameter(int value, String name) {
+ super(name);
this.value = new SimpleIntegerProperty(value);
- this.name = name;
}
public IntegerParameter(int value, String name, boolean managed, boolean hidden) {
+ super(name, managed, hidden);
this.value = new SimpleIntegerProperty(value);
- this.name = name;
- this.managed = managed;
- this.hidden = hidden;
- }
-
- public void setValue(int value) {
- this.value.set(value);
}
@Override
- public Object getValue() {
- return this.value.get();
+ public Integer getValue() {
+ return ((SimpleIntegerProperty) this.value).get();
}
@Override
public SimpleIntegerProperty valueProperty() {
- return value;
+ return (SimpleIntegerProperty) value;
}
@Override
public void setValue(Object value) {
- this.value.set((int) value);
-
+ ((SimpleIntegerProperty) this.value).set((int) value);
}
}
diff --git a/src/jcgp/parameters/Parameter.java b/src/jcgp/parameters/Parameter.java
index 64b19c8..fcff9fd 100644
--- a/src/jcgp/parameters/Parameter.java
+++ b/src/jcgp/parameters/Parameter.java
@@ -1,13 +1,28 @@
package jcgp.parameters;
import javafx.beans.property.Property;
-
public abstract class Parameter {
protected boolean managed = false;
protected boolean hidden = false;
+
+ protected boolean originalManaged = false;
+ protected boolean originalHidden = false;
+
+ protected Property<?> value;
+
protected String name;
+ public Parameter(String name, boolean managed, boolean hidden) {
+ this.name = name;
+ this.managed = originalManaged = managed;
+ this.hidden = originalHidden = hidden;
+ }
+
+ public Parameter(String name) {
+ this.name = name;
+ }
+
public void setManaged(boolean value) {
managed = value;
}
@@ -32,6 +47,12 @@ public abstract class Parameter {
public abstract void setValue(Object value);
- @SuppressWarnings("rawtypes")
- public abstract Property valueProperty();
+ public Property<?> valueProperty() {
+ return value;
+ }
+
+ public void reset() {
+ hidden = originalHidden;
+ managed = originalManaged;
+ }
}