diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-04-07 10:04:05 +0100 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-04-07 10:04:05 +0100 |
commit | 67ace66f66ffaa00e1bd1495c0d406c801e59c5c (patch) | |
tree | 337da2ab9bbd5eb41a0a6eafbf783340240bcffe /src/jcgp/backend/resources | |
parent | efee474689b37f43897b8572cec4e3669874b0d4 (diff) |
Refactored problem types
Diffstat (limited to 'src/jcgp/backend/resources')
-rw-r--r-- | src/jcgp/backend/resources/ModifiableResources.java | 5 | ||||
-rw-r--r-- | src/jcgp/backend/resources/Resources.java | 20 |
2 files changed, 6 insertions, 19 deletions
diff --git a/src/jcgp/backend/resources/ModifiableResources.java b/src/jcgp/backend/resources/ModifiableResources.java index 3e6b55e..90c2f03 100644 --- a/src/jcgp/backend/resources/ModifiableResources.java +++ b/src/jcgp/backend/resources/ModifiableResources.java @@ -1,5 +1,6 @@ package jcgp.backend.resources; +import jcgp.backend.function.FunctionSet; import jcgp.backend.resources.parameters.BooleanParameter; import jcgp.backend.resources.parameters.DoubleParameter; import jcgp.backend.resources.parameters.IntegerParameter; @@ -30,8 +31,8 @@ public class ModifiableResources extends Resources { } } - public void setFunctionSet(int index) { - functionSet = functionSets[index]; + public void setFunctionSet(FunctionSet functionSet) { + this.functionSet = functionSet; set("arity", functionSet.getMaxArity()); } diff --git a/src/jcgp/backend/resources/Resources.java b/src/jcgp/backend/resources/Resources.java index c1c3e4c..d1f396a 100644 --- a/src/jcgp/backend/resources/Resources.java +++ b/src/jcgp/backend/resources/Resources.java @@ -5,11 +5,8 @@ import java.util.Random; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; -import jcgp.backend.function.BitwiseLogic; -import jcgp.backend.function.BooleanLogic; import jcgp.backend.function.Function; import jcgp.backend.function.FunctionSet; -import jcgp.backend.function.IntegerArithmetic; import jcgp.backend.resources.parameters.BooleanParameter; import jcgp.backend.resources.parameters.DoubleParameter; import jcgp.backend.resources.parameters.IntegerParameter; @@ -30,12 +27,7 @@ public class Resources { protected Random numberGenerator = new Random(); - // function sets - protected FunctionSet[] functionSets = new FunctionSet[] { - new IntegerArithmetic(), - new BitwiseLogic(), - new BooleanLogic() }; - protected FunctionSet functionSet = functionSets[0]; + protected FunctionSet functionSet; // GUI console protected Console console; @@ -202,7 +194,8 @@ public class Resources { } }); - parameters.put("arity", new IntegerParameter(functionSet.getMaxArity(), "Max arity", true, false) { + //parameters.put("arity", new IntegerParameter(functionSet.getMaxArity(), "Max arity", true, false) { + parameters.put("arity", new IntegerParameter(0, "Max arity", true, false) { @Override public void validate(int newValue) { // blank @@ -267,13 +260,6 @@ public class Resources { } /** - * @return the functionSets - */ - public FunctionSet[] getFunctionSets() { - return functionSets; - } - - /** * @return the functionSet */ public FunctionSet getFunctionSet() { |