From 0c288cc1952809294c8d70d86b9f41b04878ac2e Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Sun, 23 Mar 2014 18:05:13 +0000 Subject: Majorly refactored, node grid is fully implemented. About to attempt active path locking. --- src/jcgp/parameters/BooleanParameter.java | 18 +++++++----------- src/jcgp/parameters/DoubleParameter.java | 23 ++++++++--------------- src/jcgp/parameters/IntegerParameter.java | 21 ++++++--------------- src/jcgp/parameters/Parameter.java | 27 ++++++++++++++++++++++++--- 4 files changed, 45 insertions(+), 44 deletions(-) (limited to 'src/jcgp/parameters') 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; + } } -- cgit v1.2.3