diff options
Diffstat (limited to 'src/jcgp/modules/fitness/TestCase.java')
-rw-r--r-- | src/jcgp/modules/fitness/TestCase.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/jcgp/modules/fitness/TestCase.java b/src/jcgp/modules/fitness/TestCase.java new file mode 100644 index 0000000..0cb09f1 --- /dev/null +++ b/src/jcgp/modules/fitness/TestCase.java @@ -0,0 +1,42 @@ +package jcgp.modules.fitness; + +import jcgp.exceptions.ParameterMismatchException; +import jcgp.parameters.Parameters; + +public class TestCase { + + private Object[] inputs; + private Object[] outputs; + + public TestCase(Object[] inputs, Object[] 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 Object getInput(int index) { + return inputs[index]; + } + + public Object getOutput(int index) { + return outputs[index]; + } + + public Object[] getInputs() { + return inputs; + } + + public Object[] getOutputs() { + return outputs; + } + +} |