diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-03-30 21:07:37 +0100 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-03-30 21:07:37 +0100 |
commit | 04b35ccdad6e18701ede823e333118b0b22907c2 (patch) | |
tree | 0e993a5ffee4e63c4a2a6eca137da72b2453f868 /src/jcgp/gui/population/GUINode.java | |
parent | 2bf2d3ac2c578de481ecfd545d58be73c5628996 (diff) |
Running into some issues with running the CGP loop in the background with bindings.
Diffstat (limited to 'src/jcgp/gui/population/GUINode.java')
-rw-r--r-- | src/jcgp/gui/population/GUINode.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jcgp/gui/population/GUINode.java b/src/jcgp/gui/population/GUINode.java index eeacb9e..6fc84da 100644 --- a/src/jcgp/gui/population/GUINode.java +++ b/src/jcgp/gui/population/GUINode.java @@ -14,6 +14,7 @@ import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.scene.text.TextAlignment; import jcgp.GUI; +import jcgp.gui.ChromosomePane; import jcgp.population.Connection; import jcgp.population.Input; import jcgp.population.Node; @@ -56,10 +57,10 @@ public class GUINode extends GUIGene { text.setX(-NODE_RADIUS); text.setVisible(true); - Circle[] sockets = new Circle[(int) GUI.resources.get("arity")]; + Circle[] sockets = new Circle[GUI.resources.getInt("arity")]; double angle, xPos, yPos; for (int l = 0; l < sockets.length; l++) { - angle = ((((double) (l + 1)) / ((double) ((int) GUI.resources.get("arity") + 1))) * THETA) - (THETA / 2); + angle = ((((double) (l + 1)) / ((GUI.resources.getDouble("arity") + 1))) * THETA) - (THETA / 2); xPos = -Math.cos(angle) * NODE_RADIUS; yPos = Math.sin(angle) * NODE_RADIUS; @@ -335,7 +336,7 @@ public class GUINode extends GUIGene { } else if (target instanceof GUINode) { // target and source are nodes, let's look at levels back Node t = ((GUINode) target).getGene(), s = ((GUINode) source).getGene(); - if (s.getColumn() - t.getColumn() > 0 && s.getColumn() - t.getColumn() <= (int) GUI.resources.get("levelsBack")) { + if (s.getColumn() - t.getColumn() > 0 && s.getColumn() - t.getColumn() <= GUI.resources.getInt("levelsBack")) { return true; } return false; @@ -462,4 +463,8 @@ public class GUINode extends GUIGene { lines[connectionIndex].setEndX(gene.getLayoutX() + NODE_RADIUS); lines[connectionIndex].setEndY(gene.getLayoutY()); } + + public void updateFunction() { + text.setText(node.getFunction().getName()); + } } |