diff options
Diffstat (limited to 'src/jcgp/backend/modules/problem/TestCaseProblem.java')
-rw-r--r-- | src/jcgp/backend/modules/problem/TestCaseProblem.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/jcgp/backend/modules/problem/TestCaseProblem.java b/src/jcgp/backend/modules/problem/TestCaseProblem.java index c11fab4..69c078d 100644 --- a/src/jcgp/backend/modules/problem/TestCaseProblem.java +++ b/src/jcgp/backend/modules/problem/TestCaseProblem.java @@ -30,7 +30,7 @@ public abstract class TestCaseProblem<T> extends Problem { * contains arrays of inputs and outputs and associated getters. * * @author Eduardo Pedroni - * @param <U> + * @param <U> the data type of the test case. */ public static class TestCase<U> { private U[] inputs; @@ -80,7 +80,6 @@ public abstract class TestCaseProblem<T> extends Problem { } protected ObservableList<TestCase<T>> testCases; - protected Resources resources; /** * Creates a new TestCaseProblem object. @@ -88,8 +87,7 @@ public abstract class TestCaseProblem<T> extends Problem { * @param resources a reference to the experiment's resources. */ public TestCaseProblem(Resources resources) { - super(); - this.resources = resources; + super(resources); testCases = FXCollections.observableArrayList(); } @@ -139,12 +137,12 @@ public abstract class TestCaseProblem<T> extends Problem { public final void addTestCase(String[] inputs, String[] outputs) { TestCase<T> testCase = parseTestCase(inputs, outputs); - if (testCase.getInputs().length != resources.inputs()) { + if (testCase.getInputs().length != getResources().inputs()) { throw new IllegalArgumentException("Received test case with " + testCase.getInputs().length + - " inputs but need exactly " + resources.inputs()); - } else if (testCase.getOutputs().length != resources.outputs()) { + " inputs but need exactly " + getResources().inputs()); + } else if (testCase.getOutputs().length != getResources().outputs()) { throw new IllegalArgumentException("Received test case with " + testCase.getOutputs().length + - " outputs but need exactly " + resources.outputs()); + " outputs but need exactly " + getResources().outputs()); } else { this.testCases.add(testCase); maxFitness.set(getMaxFitness()); |