aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/fitness/TestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/fitness/TestCase.java')
-rw-r--r--src/jcgp/fitness/TestCase.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/jcgp/fitness/TestCase.java b/src/jcgp/fitness/TestCase.java
new file mode 100644
index 0000000..e2bd5ed
--- /dev/null
+++ b/src/jcgp/fitness/TestCase.java
@@ -0,0 +1,41 @@
+package jcgp.fitness;
+
+import jcgp.CGP.Parameters;
+
+public class TestCase {
+
+ private int[] inputs;
+ private int[] outputs;
+
+ public TestCase(int[] inputs, int[] outputs) throws ParameterMismatchException {
+ if (inputs.length == Parameters.getInputs()) {
+ this.inputs = inputs;
+ } else {
+ throw new ParameterMismatchException();
+ }
+
+ if (outputs.length == Parameters.getOutputs()) {
+ this.outputs = outputs;
+ } else {
+ throw new ParameterMismatchException();
+ }
+
+ }
+
+ public int getInput(int index) {
+ return inputs[index];
+ }
+
+ public int getOutput(int index) {
+ return outputs[index];
+ }
+
+ public int[] getInputs() {
+ return inputs;
+ }
+
+ public int[] getOutputs() {
+ return outputs;
+ }
+
+}