aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui/population/PopulationPane.java
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-10 16:57:30 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-10 16:57:30 +0100
commitdbae5ce2e0765f229e11b692a2aba570286980f4 (patch)
tree65034a73cda532f55086d2588266323e8e827c9a /src/jcgp/gui/population/PopulationPane.java
parent260f1baaab10ab9b1db67ab587bc36adcb34494e (diff)
Added manual test case evaluation to GUI
Diffstat (limited to 'src/jcgp/gui/population/PopulationPane.java')
-rw-r--r--src/jcgp/gui/population/PopulationPane.java40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/jcgp/gui/population/PopulationPane.java b/src/jcgp/gui/population/PopulationPane.java
index 5232eb5..64b61c4 100644
--- a/src/jcgp/gui/population/PopulationPane.java
+++ b/src/jcgp/gui/population/PopulationPane.java
@@ -3,26 +3,29 @@ package jcgp.gui.population;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import jcgp.JCGP;
-import jcgp.backend.population.Population;
-import jcgp.backend.resources.Resources;
+import jcgp.backend.modules.problem.TestCaseProblem;
+import jcgp.backend.modules.problem.TestCaseProblem.TestCase;
+import jcgp.gui.GUI;
public class PopulationPane extends TabPane {
- public PopulationPane(JCGP jcgp) {
+ private GUI gui;
+
+ public PopulationPane(GUI gui) {
super();
-
+ this.gui = gui;
setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
-
- remakeTabs(jcgp.getPopulation(), jcgp.getResources());
+ remakeTabs();
}
- public void remakeTabs(Population population, Resources resources) {
+ public void remakeTabs() {
getTabs().clear();
+ JCGP jcgp = gui.getExperiment();
Tab tab;
ChromosomePane cp;
- for (int i = 0; i < resources.populationSize(); i++) {
- cp = new ChromosomePane(population.getChromosome(i), resources);
+ for (int i = 0; i < jcgp.getResources().populationSize(); i++) {
+ cp = new ChromosomePane(jcgp.getPopulation().getChromosome(i), gui);
tab = new Tab("Chr " + i);
tab.setContent(cp);
getTabs().add(tab);
@@ -46,4 +49,23 @@ public class PopulationPane extends TabPane {
((ChromosomePane) getTabs().get(i).getContent()).relockOutputs();
}
}
+
+ public void evaluateTestCase(TestCase<Object> testCase) {
+ if (gui.getExperiment().getProblem() instanceof TestCaseProblem) {
+ if (testCase.getInputs().length == gui.getExperiment().getResources().inputs()) {
+ for (int i = 0; i < getTabs().size(); i++) {
+ ((ChromosomePane) getTabs().get(i).getContent()).setInputs(testCase.getInputs());
+ }
+ } else {
+ throw new IllegalArgumentException("Test case has " + testCase.getInputs().length
+ + " inputs and chromosome has " + gui.getExperiment().getResources().inputs());
+ }
+ }
+ }
+
+ public void hideValues() {
+ for (int i = 0; i < getTabs().size(); i++) {
+ ((ChromosomePane) getTabs().get(i).getContent()).hideValues();
+ }
+ }
}