aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui/population/ChromosomePane.java
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-05-06 14:29:37 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-05-06 14:29:37 +0100
commit8189116ea4b5db4675e31dfd04a5687d55e29262 (patch)
treec1815021452a888f8838f1628d8fb4689777e73e /src/jcgp/gui/population/ChromosomePane.java
parentaa9e74e7f67789f6353fc26e02ee8e68e40609a2 (diff)
Added javadocs, made minor changes to the comments
Diffstat (limited to 'src/jcgp/gui/population/ChromosomePane.java')
-rw-r--r--src/jcgp/gui/population/ChromosomePane.java41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/jcgp/gui/population/ChromosomePane.java b/src/jcgp/gui/population/ChromosomePane.java
index 4a47f34..d40de2e 100644
--- a/src/jcgp/gui/population/ChromosomePane.java
+++ b/src/jcgp/gui/population/ChromosomePane.java
@@ -25,6 +25,8 @@ public class ChromosomePane extends ScrollPane {
private int rows, columns;
+ private Object[] testInputs;
+
private boolean target = false;
private PopulationPane parent;
@@ -111,20 +113,21 @@ public class ChromosomePane extends ScrollPane {
target = newValue;
}
- public void updateGenes() {
+ public void updateGenes(Chromosome chr) {
for (int r = 0; r < rows; r++) {
for (int c = 0; c < columns; c++) {
+ guiNodes[r][c].setNode(chr.getNode(r, c));
guiNodes[r][c].updateLines();
guiNodes[r][c].updateText();
}
}
for (int i = 0; i < guiOutputs.length; i++) {
+ guiOutputs[i].setOutput(chr.getOutput(i));
guiOutputs[i].updateLines();
}
if (isEvaluating()) {
- evaluate(0);
+ setInputs(testInputs);
}
-
}
public void unlockOutputs() {
@@ -144,29 +147,27 @@ public class ChromosomePane extends ScrollPane {
}
public void setInputs(Object[] values) {
+ testInputs = values;
for (int i = 0; i < guiInputs.length; i++) {
guiInputs[i].setValue(values[i]);
- guiInputs[i].updateText();
}
- evaluate(0);
+ updateValues();
}
- public void evaluate(int start) {
- if (start >= 0 || start < columns) {
- for (int c = start; c < columns; c++) {
- for (int r = 0; r < rows; r++) {
- guiNodes[r][c].calculate();
- guiNodes[r][c].updateText();
- }
- }
- for (int o = 0; o < guiOutputs.length; o++) {
- guiOutputs[o].calculate();
- guiOutputs[o].updateText();
- }
- }
- }
+// public void evaluate(int start) {
+// if (start >= 0 || start < columns) {
+// for (int c = 0; c < columns; c++) {
+// for (int r = 0; r < rows; r++) {
+// guiNodes[r][c].updateText();
+// }
+// }
+// for (int o = 0; o < guiOutputs.length; o++) {
+// guiOutputs[o].updateText();
+// }
+// }
+// }
- public void hideValues() {
+ public void updateValues() {
for (int i = 0; i < guiInputs.length; i++) {
guiInputs[i].updateText();
}