diff options
-rw-r--r-- | res/mult3.plu | 6 | ||||
-rw-r--r-- | res/mult4.plu | 12 | ||||
-rw-r--r-- | src/jcgp/gui/population/GUIGene.java | 8 | ||||
-rw-r--r-- | src/jcgp/gui/population/GUIInput.java | 18 | ||||
-rw-r--r-- | src/jcgp/gui/population/GUINode.java | 39 | ||||
-rw-r--r-- | src/jcgp/gui/population/GUIOutput.java | 30 | ||||
-rw-r--r-- | src/jcgp/gui/settings/parameters/GUIBooleanParameter.java | 4 | ||||
-rw-r--r-- | src/jcgp/gui/settings/parameters/GUIDoubleParameter.java | 4 | ||||
-rw-r--r-- | src/jcgp/gui/settings/parameters/GUIIntegerParameter.java | 4 |
9 files changed, 71 insertions, 54 deletions
diff --git a/res/mult3.plu b/res/mult3.plu new file mode 100644 index 0000000..3cfb9d4 --- /dev/null +++ b/res/mult3.plu @@ -0,0 +1,6 @@ +.i 6
+.o 6
+.p 2
+0 4294901760 4278255360 4042322160 3435973836 2863311530 0 3221225472 955252736 3033329664 1722469376 2852170240
+4294967295 4294901760 4278255360 4042322160 3435973836 2863311530 3770712064 2553835760 1421110476 510024362 1722469376 2852170240
+.e
\ No newline at end of file diff --git a/res/mult4.plu b/res/mult4.plu new file mode 100644 index 0000000..c984944 --- /dev/null +++ b/res/mult4.plu @@ -0,0 +1,12 @@ +.i 8
+.o 8
+.p 8
+0 0 0 4294901760 4278255360 4042322160 3435973836 2863311530 0 0 0 0 4278190080 4042260480 3435921408 2863267840
+0 0 4294967295 4294901760 4278255360 4042322160 3435973836 2863311530 0 0 4160749568 130088704 3342397680 3031747788 1718004394 2863267840
+0 4294967295 0 4294901760 4278255360 4042322160 3435973836 2863311530 0 3758096384 528547584 477163760 2473381068 1515891370 3435921408 2863267840
+0 4294967295 4294967295 4294901760 4278255360 4042322160 3435973836 2863311530 0 4227921920 3286239168 865650488 2874455220 505308774 1718004394 2863267840
+4294967295 0 0 4294901760 4278255360 4042322160 3435973836 2863311530 2147483648 2130771712 2029056240 1724697804 1437248170 4042260480 3435921408 2863267840
+4294967295 0 4294967295 4294901760 4278255360 4042322160 3435973836 2863311530 4026589184 264249216 2386041968 1227133804 1838307930 3031747788 1718004394 2863267840
+4294967295 4294967295 0 4294901760 4278255360 4042322160 3435973836 2863311530 4227921920 2212497344 1662568248 1385477300 969303654 1515891370 3435921408 2863267840
+4294967295 4294967295 4294967295 4294901760 4278255360 4042322160 3435973836 2863311530 4261477376 3789603808 2576888728 1431612244 33431070 505308774 1718004394 2863267840
+.e
\ No newline at end of file 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); } |