diff options
Diffstat (limited to 'src/jcgp/gui/population')
-rw-r--r-- | src/jcgp/gui/population/ChromosomePane.java | 10 | ||||
-rw-r--r-- | src/jcgp/gui/population/GUINode.java | 6 | ||||
-rw-r--r-- | src/jcgp/gui/population/GUIOutput.java | 2 | ||||
-rw-r--r-- | src/jcgp/gui/population/PopulationPane.java | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/src/jcgp/gui/population/ChromosomePane.java b/src/jcgp/gui/population/ChromosomePane.java index 841c18a..1f67255 100644 --- a/src/jcgp/gui/population/ChromosomePane.java +++ b/src/jcgp/gui/population/ChromosomePane.java @@ -35,19 +35,19 @@ public class ChromosomePane extends ScrollPane { // generate the GUIGenes // inputs - guiInputs = new GUIInput[resources.getInt("inputs")]; + guiInputs = new GUIInput[resources.inputs()]; for (int i = 0; i < guiInputs.length; i++) { // make the GUI elements guiInputs[i] = new GUIInput(this, chromosome.getInput(i)); content.getChildren().addAll(guiInputs[i]); } // nodes - guiNodes = new GUINode[resources.getInt("rows")][resources.getInt("columns")]; + guiNodes = new GUINode[resources.rows()][resources.columns()]; double angle, xPos, yPos; for (int r = 0; r < guiNodes.length; r++) { for (int c = 0; c < guiNodes[r].length; c++) { // make the connection lines - Line lines[] = new Line[resources.getInt("arity")]; + Line lines[] = new Line[resources.arity()]; for (int l = 0; l < lines.length; l++) { angle = ((((double) (l + 1)) / ((double) (lines.length + 1))) * GUIGene.THETA) - (GUIGene.THETA / 2); xPos = (-Math.cos(angle) * GUIGene.NODE_RADIUS) + (((c + 1) * (2 * GUIGene.NODE_RADIUS + GUIGene.SPACING)) + GUIGene.NODE_RADIUS); @@ -64,9 +64,9 @@ public class ChromosomePane extends ScrollPane { content.getChildren().addAll(guiNodes[r]); } // outputs - guiOutputs = new GUIOutput[resources.getInt("outputs")]; + guiOutputs = new GUIOutput[resources.outputs()]; for (int i = 0; i < guiOutputs.length; i++) { - xPos = ((resources.getInt("columns") + 1) * (2 * GUIGene.NODE_RADIUS + GUIGene.SPACING)); + xPos = ((resources.columns() + 1) * (2 * GUIGene.NODE_RADIUS + GUIGene.SPACING)); yPos = (chromosome.getOutput(i).getIndex() * (2 * GUIGene.NODE_RADIUS + GUIGene.SPACING)) + GUIGene.NODE_RADIUS; // make the line Line line = new Line(xPos, yPos, xPos, yPos); diff --git a/src/jcgp/gui/population/GUINode.java b/src/jcgp/gui/population/GUINode.java index 98ba738..8e2d8a0 100644 --- a/src/jcgp/gui/population/GUINode.java +++ b/src/jcgp/gui/population/GUINode.java @@ -42,10 +42,10 @@ public class GUINode extends GUIGene { text.setText(node.getFunction().getName()); - Circle[] sockets = new Circle[GUI.resources.getInt("arity")]; + Circle[] sockets = new Circle[GUI.resources.arity()]; double angle, xPos, yPos; for (int l = 0; l < sockets.length; l++) { - angle = (((l + 1) / ((GUI.resources.getDouble("arity") + 1))) * THETA) - (THETA / 2); + angle = (((l + 1) / ((double) (GUI.resources.arity() + 1))) * THETA) - (THETA / 2); xPos = -Math.cos(angle) * NODE_RADIUS; yPos = Math.sin(angle) * NODE_RADIUS; @@ -316,7 +316,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() <= GUI.resources.getInt("levelsBack")) { + if (s.getColumn() - t.getColumn() > 0 && s.getColumn() - t.getColumn() <= GUI.resources.levelsBack()) { return true; } return false; diff --git a/src/jcgp/gui/population/GUIOutput.java b/src/jcgp/gui/population/GUIOutput.java index 4a12385..c5b889e 100644 --- a/src/jcgp/gui/population/GUIOutput.java +++ b/src/jcgp/gui/population/GUIOutput.java @@ -26,7 +26,7 @@ public class GUIOutput extends GUIGene { this.output = output; this.sourceLine = line; - relocate(((GUI.resources.getInt("columns") + 1) * (2 * NODE_RADIUS + SPACING)) + NODE_RADIUS, + relocate(((GUI.resources.columns() + 1) * (2 * NODE_RADIUS + SPACING)) + NODE_RADIUS, (output.getIndex() * (2 * NODE_RADIUS + SPACING)) + NODE_RADIUS); // set the line ends correctly diff --git a/src/jcgp/gui/population/PopulationPane.java b/src/jcgp/gui/population/PopulationPane.java index 3a83a86..5232eb5 100644 --- a/src/jcgp/gui/population/PopulationPane.java +++ b/src/jcgp/gui/population/PopulationPane.java @@ -21,7 +21,7 @@ public class PopulationPane extends TabPane { Tab tab; ChromosomePane cp; - for (int i = 0; i < resources.getInt("popSize"); i++) { + for (int i = 0; i < resources.populationSize(); i++) { cp = new ChromosomePane(population.getChromosome(i), resources); tab = new Tab("Chr " + i); tab.setContent(cp); |