aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp')
-rw-r--r--src/jcgp/gui/population/GUIGene.java8
-rw-r--r--src/jcgp/gui/population/GUIInput.java18
-rw-r--r--src/jcgp/gui/population/GUINode.java39
-rw-r--r--src/jcgp/gui/population/GUIOutput.java30
-rw-r--r--src/jcgp/gui/settings/parameters/GUIBooleanParameter.java4
-rw-r--r--src/jcgp/gui/settings/parameters/GUIDoubleParameter.java4
-rw-r--r--src/jcgp/gui/settings/parameters/GUIIntegerParameter.java4
7 files changed, 53 insertions, 54 deletions
diff --git a/src/jcgp/gui/population/GUIGene.java b/src/jcgp/gui/population/GUIGene.java
index 3d9cffb..9980d53 100644
--- a/src/jcgp/gui/population/GUIGene.java
+++ b/src/jcgp/gui/population/GUIGene.java
@@ -26,9 +26,9 @@ public abstract class GUIGene extends Group {
ACTIVE_HOVER,
LOCKED_HOVER,
SOURCE,
- TARGET,
+ VALID_TARGET,
NO_CHANGE_TARGET,
- FORBIDDEN_TARGET
+ INVALID_TARGET
}
protected Text text = new Text();
@@ -67,7 +67,7 @@ public abstract class GUIGene extends Group {
return locked;
}
- abstract void setLocked(boolean value);
+ protected abstract void setLocked(boolean value);
public abstract void addLocks(int value);
@@ -79,7 +79,7 @@ public abstract class GUIGene extends Group {
public abstract Connection getChangingConnection();
- public abstract void setConnections(GUIGeneState newState);
+ public abstract void setConnectionStates(GUIGeneState newState);
public abstract void resetState();
diff --git a/src/jcgp/gui/population/GUIInput.java b/src/jcgp/gui/population/GUIInput.java
index fd66ab4..a48be51 100644
--- a/src/jcgp/gui/population/GUIInput.java
+++ b/src/jcgp/gui/population/GUIInput.java
@@ -43,7 +43,7 @@ public class GUIInput extends GUIGene {
if (input == source) {
setState(GUIGeneState.NO_CHANGE_TARGET);
} else {
- setState(GUIGeneState.TARGET);
+ setState(GUIGeneState.VALID_TARGET);
}
}
});
@@ -59,7 +59,7 @@ public class GUIInput extends GUIGene {
setState(GUIGeneState.INDIRECT_HOVER);
} else {
setState(GUIGeneState.NEUTRAL);
- ((GUIGene) event.getGestureSource()).setConnections(GUIGeneState.INDIRECT_HOVER);
+ ((GUIGene) event.getGestureSource()).setConnectionStates(GUIGeneState.INDIRECT_HOVER);
}
}
}
@@ -73,10 +73,10 @@ public class GUIInput extends GUIGene {
// set states to reflect the new situation
if (source.isLocked()) {
source.setState(GUIGeneState.HOVER);
- source.setConnections(GUIGeneState.HOVER);
+ source.setConnectionStates(GUIGeneState.HOVER);
} else {
source.setState(GUIGeneState.NEUTRAL);
- source.setConnections(GUIGeneState.NEUTRAL);
+ source.setConnectionStates(GUIGeneState.NEUTRAL);
}
// the user released the drag gesture on this node, react appropriately
@@ -111,7 +111,7 @@ public class GUIInput extends GUIGene {
// cursor has left this node without dragging, or it is dragging and this is the source
if (getState() == GUIGeneState.HOVER) {
setState(GUIGeneState.NEUTRAL);
- setConnections(GUIGeneState.NEUTRAL);
+ setConnectionStates(GUIGeneState.NEUTRAL);
}
}
});
@@ -129,7 +129,7 @@ public class GUIInput extends GUIGene {
mainCircle.setFill(Paint.valueOf(GUI.SOFT_HIGHLIGHT_COLOUR));
}
break;
- case FORBIDDEN_TARGET:
+ case INVALID_TARGET:
mainCircle.setFill(Paint.valueOf(GUI.BAD_SELECTION_COLOUR));
break;
case LOCKED_HOVER:
@@ -155,7 +155,7 @@ public class GUIInput extends GUIGene {
case SOURCE:
mainCircle.setFill(Paint.valueOf(GUI.MEDIUM_HIGHLIGHT_COLOUR));
break;
- case TARGET:
+ case VALID_TARGET:
parent.setTarget(true);
mainCircle.setFill(Paint.valueOf(GUI.GOOD_SELECTION_COLOUR));
break;
@@ -171,7 +171,7 @@ public class GUIInput extends GUIGene {
* @param newState the state to set connections to.
*/
@Override
- public void setConnections(GUIGeneState newState) {
+ public void setConnectionStates(GUIGeneState newState) {
// nothing
}
@@ -181,7 +181,7 @@ public class GUIInput extends GUIGene {
}
@Override
- void setLocked(boolean value) {
+ protected void setLocked(boolean value) {
locked += value ? 1 : -1;
setState(locked > 0 ? GUIGeneState.HOVER : GUIGeneState.ACTIVE_HOVER);
}
diff --git a/src/jcgp/gui/population/GUINode.java b/src/jcgp/gui/population/GUINode.java
index 3fadbdd..142d650 100644
--- a/src/jcgp/gui/population/GUINode.java
+++ b/src/jcgp/gui/population/GUINode.java
@@ -148,10 +148,10 @@ public class GUINode extends GUIGene {
if (node == source) {
setState(GUIGeneState.NO_CHANGE_TARGET);
} else {
- setState(GUIGeneState.TARGET);
+ setState(GUIGeneState.VALID_TARGET);
}
} else {
- setState(GUIGeneState.FORBIDDEN_TARGET);
+ setState(GUIGeneState.INVALID_TARGET);
}
}
});
@@ -170,7 +170,7 @@ public class GUINode extends GUIGene {
setState(GUIGeneState.INDIRECT_HOVER);
} else {
setState(GUIGeneState.NEUTRAL);
- ((GUIGene) event.getGestureSource()).setConnections(GUIGeneState.INDIRECT_HOVER);
+ ((GUIGene) event.getGestureSource()).setConnectionStates(GUIGeneState.INDIRECT_HOVER);
}
}
}
@@ -184,10 +184,10 @@ public class GUINode extends GUIGene {
// set states to reflect the new situation
if (source.isLocked()) {
source.setState(GUIGeneState.HOVER);
- source.setConnections(GUIGeneState.HOVER);
+ source.setConnectionStates(GUIGeneState.HOVER);
} else {
source.setState(GUIGeneState.NEUTRAL);
- source.setConnections(GUIGeneState.NEUTRAL);
+ source.setConnectionStates(GUIGeneState.NEUTRAL);
}
// the user released the drag gesture on this node, react appropriately
@@ -210,7 +210,6 @@ public class GUINode extends GUIGene {
}
});
-
addEventFilter(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
@@ -218,7 +217,7 @@ public class GUINode extends GUIGene {
if (getState() == GUIGeneState.NEUTRAL) {
setState(GUIGeneState.HOVER);
} else if (locked > 0) {
- setConnections(GUIGeneState.LOCKED_HOVER);
+ setConnectionStates(GUIGeneState.LOCKED_HOVER);
}
}
});
@@ -229,12 +228,12 @@ public class GUINode extends GUIGene {
// cursor has left this node without dragging, or it is dragging and this is the source
if (getState() == GUIGeneState.HOVER && locked <= 0) {
setState(GUIGeneState.NEUTRAL);
- setConnections(GUIGeneState.NEUTRAL);
+ setConnectionStates(GUIGeneState.NEUTRAL);
} else if (locked > 0) {
- if (getState() == GUIGeneState.SOURCE || getState() == GUIGeneState.FORBIDDEN_TARGET) {
- setConnections(GUIGeneState.INDIRECT_HOVER);
+ if (getState() == GUIGeneState.SOURCE || getState() == GUIGeneState.INVALID_TARGET) {
+ setConnectionStates(GUIGeneState.INDIRECT_HOVER);
} else {
- setConnections(GUIGeneState.HOVER);
+ setConnectionStates(GUIGeneState.HOVER);
}
}
@@ -257,21 +256,21 @@ public class GUINode extends GUIGene {
mainCircle.setFill(Paint.valueOf(GUI.SOFT_HIGHLIGHT_COLOUR));
showLines(true);
}
- setConnections(GUIGeneState.ACTIVE_HOVER);
+ setConnectionStates(GUIGeneState.ACTIVE_HOVER);
break;
case LOCKED_HOVER:
mainCircle.setFill(Paint.valueOf(GUI.SOFT_HIGHLIGHT_COLOUR));
break;
- case FORBIDDEN_TARGET:
+ case INVALID_TARGET:
mainCircle.setFill(Paint.valueOf(GUI.BAD_SELECTION_COLOUR));
break;
case HOVER:
mainCircle.setFill(Paint.valueOf(GUI.MEDIUM_HIGHLIGHT_COLOUR));
showLines(true);
if (locked <= 0) {
- setConnections(GUIGeneState.INDIRECT_HOVER);
+ setConnectionStates(GUIGeneState.INDIRECT_HOVER);
} else {
- setConnections(GUIGeneState.HOVER);
+ setConnectionStates(GUIGeneState.HOVER);
}
break;
case INDIRECT_HOVER:
@@ -284,7 +283,7 @@ public class GUINode extends GUIGene {
mainCircle.setFill(Paint.valueOf(GUI.NEUTRAL_COLOUR));
showLines(false);
if (getState() == GUIGeneState.ACTIVE_HOVER) {
- setConnections(GUIGeneState.NEUTRAL);
+ setConnectionStates(GUIGeneState.NEUTRAL);
}
}
break;
@@ -295,7 +294,7 @@ public class GUINode extends GUIGene {
case SOURCE:
mainCircle.setFill(Paint.valueOf(GUI.HARD_HIGHLIGHT_COLOUR));
break;
- case TARGET:
+ case VALID_TARGET:
parent.setTarget(true);
mainCircle.setFill(Paint.valueOf(GUI.GOOD_SELECTION_COLOUR));
break;
@@ -387,7 +386,7 @@ public class GUINode extends GUIGene {
}
@Override
- public void setConnections(GUIGeneState newState) {
+ public void setConnectionStates(GUIGeneState newState) {
for (int i = 0; i < lines.length; i++) {
parent.getGuiGene(node.getConnection(i)).setState(newState);
}
@@ -408,13 +407,13 @@ public class GUINode extends GUIGene {
setState(GUIGeneState.HOVER);
} else {
setState(GUIGeneState.NEUTRAL);
- setConnections(GUIGeneState.NEUTRAL);
+ setConnectionStates(GUIGeneState.NEUTRAL);
}
}
@Override
- void setLocked(boolean value) {
+ protected void setLocked(boolean value) {
locked += value ? 1 : -1;
setState(locked > 0 ? GUIGeneState.HOVER : GUIGeneState.ACTIVE_HOVER);
diff --git a/src/jcgp/gui/population/GUIOutput.java b/src/jcgp/gui/population/GUIOutput.java
index 364458b..a3f5a28 100644
--- a/src/jcgp/gui/population/GUIOutput.java
+++ b/src/jcgp/gui/population/GUIOutput.java
@@ -112,7 +112,7 @@ public class GUIOutput extends GUIGene {
@Override
public void handle(MouseDragEvent event) {
// the drag has entered this node, react appropriately
- setState(GUIGeneState.FORBIDDEN_TARGET);
+ setState(GUIGeneState.INVALID_TARGET);
}
});
@@ -140,10 +140,10 @@ public class GUIOutput extends GUIGene {
if (source.isLocked()) {
source.setState(GUIGeneState.HOVER);
- source.setConnections(GUIGeneState.HOVER);
+ source.setConnectionStates(GUIGeneState.HOVER);
} else {
source.setState(GUIGeneState.NEUTRAL);
- source.setConnections(GUIGeneState.NEUTRAL);
+ source.setConnectionStates(GUIGeneState.NEUTRAL);
}
source.updateLines();
@@ -175,7 +175,7 @@ public class GUIOutput extends GUIGene {
// cursor has left this node without dragging, or it is dragging and this is the source
if (getState() == GUIGeneState.HOVER && !isLocked()) {
setState(GUIGeneState.NEUTRAL);
- setConnections(GUIGeneState.NEUTRAL);
+ setConnectionStates(GUIGeneState.NEUTRAL);
}
}
});
@@ -192,14 +192,14 @@ public class GUIOutput extends GUIGene {
switch (newState) {
case ACTIVE_HOVER:
break;
- case FORBIDDEN_TARGET:
+ case INVALID_TARGET:
mainCircle.setFill(Paint.valueOf(GUI.BAD_SELECTION_COLOUR));
break;
case HOVER:
mainCircle.setFill(Paint.valueOf(GUI.MEDIUM_HIGHLIGHT_COLOUR));
sourceLine.setVisible(true);
if (!isLocked()) {
- setConnections(GUIGeneState.ACTIVE_HOVER);
+ setConnectionStates(GUIGeneState.ACTIVE_HOVER);
}
break;
case INDIRECT_HOVER:
@@ -214,10 +214,10 @@ public class GUIOutput extends GUIGene {
break;
case SOURCE:
mainCircle.setFill(Paint.valueOf(GUI.HARD_HIGHLIGHT_COLOUR));
- setConnections(GUIGeneState.NEUTRAL);
- setConnections(GUIGeneState.INDIRECT_HOVER);
+ setConnectionStates(GUIGeneState.NEUTRAL);
+ setConnectionStates(GUIGeneState.INDIRECT_HOVER);
break;
- case TARGET:
+ case VALID_TARGET:
mainCircle.setFill(Paint.valueOf(GUI.GOOD_SELECTION_COLOUR));
break;
default:
@@ -240,7 +240,7 @@ public class GUIOutput extends GUIGene {
}
@Override
- public void setConnections(GUIGeneState newState) {
+ public void setConnectionStates(GUIGeneState newState) {
parent.getGuiGene(output.getSource()).setState(newState);
}
@@ -248,17 +248,17 @@ public class GUIOutput extends GUIGene {
public void resetState() {
if (locked > 0) {
setState(GUIGeneState.HOVER);
- setConnections(GUIGeneState.HOVER);
+ setConnectionStates(GUIGeneState.HOVER);
} else {
setState(GUIGeneState.NEUTRAL);
- setConnections(GUIGeneState.NEUTRAL);
+ setConnectionStates(GUIGeneState.NEUTRAL);
}
}
@Override
- void setLocked(boolean value) {
+ protected void setLocked(boolean value) {
locked += value ? 1 : -1;
- setConnections(value ? GUIGeneState.HOVER : GUIGeneState.ACTIVE_HOVER);
+ setConnectionStates(value ? GUIGeneState.HOVER : GUIGeneState.ACTIVE_HOVER);
parent.getGuiGene(output.getSource()).setLocked(value);
@@ -295,7 +295,7 @@ public class GUIOutput extends GUIGene {
if (isLocked()) {
setLocked(false);
setState(GUIGeneState.NEUTRAL);
- setConnections(GUIGeneState.NEUTRAL);
+ setConnectionStates(GUIGeneState.NEUTRAL);
}
}
diff --git a/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java b/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
index 29f8e1f..a13a52b 100644
--- a/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
@@ -22,11 +22,11 @@ public class GUIBooleanParameter extends GUIParameter<Boolean> {
private CheckBox checkBox;
/**
- * This default-visibility constructor is intended for use
+ * This protected constructor is intended for use
* by the factory method only.
*
*/
- GUIBooleanParameter(final BooleanParameter parameter, final SettingsPane sp) {
+ protected GUIBooleanParameter(BooleanParameter parameter, SettingsPane sp) {
super(parameter, sp);
}
diff --git a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
index c3c1f59..9f4ea28 100644
--- a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
@@ -7,7 +7,7 @@ import javafx.beans.value.ObservableValue;
import javafx.geometry.Pos;
import javafx.scene.control.Control;
import javafx.scene.control.TextField;
-import jcgp.backend.parameters.Parameter;
+import jcgp.backend.parameters.DoubleParameter;
import jcgp.backend.parameters.ParameterStatus;
import jcgp.gui.settings.SettingsPane;
@@ -30,7 +30,7 @@ public class GUIDoubleParameter extends GUIParameter<Number> {
* by the factory method only.
*
*/
- protected GUIDoubleParameter(Parameter<Number> parameter, SettingsPane sp) {
+ protected GUIDoubleParameter(DoubleParameter parameter, SettingsPane sp) {
super(parameter, sp);
}
diff --git a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
index 5bf6d9c..d36c1b3 100644
--- a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
@@ -5,7 +5,7 @@ import javafx.beans.value.ObservableValue;
import javafx.geometry.Pos;
import javafx.scene.control.Control;
import javafx.scene.control.TextField;
-import jcgp.backend.parameters.Parameter;
+import jcgp.backend.parameters.IntegerParameter;
import jcgp.backend.parameters.ParameterStatus;
import jcgp.gui.settings.SettingsPane;
@@ -27,7 +27,7 @@ public class GUIIntegerParameter extends GUIParameter<Number> {
* by the factory method only.
*
*/
- protected GUIIntegerParameter(Parameter<Number> parameter, SettingsPane sp) {
+ protected GUIIntegerParameter(IntegerParameter parameter, SettingsPane sp) {
super(parameter, sp);
}