From 67ace66f66ffaa00e1bd1495c0d406c801e59c5c Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Mon, 7 Apr 2014 10:04:05 +0100 Subject: Refactored problem types --- src/jcgp/backend/resources/ModifiableResources.java | 5 +++-- src/jcgp/backend/resources/Resources.java | 20 +++----------------- 2 files changed, 6 insertions(+), 19 deletions(-) (limited to 'src/jcgp/backend/resources') 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 @@ -266,13 +259,6 @@ public class Resources { return functionSet.getAllowedFunction(index); } - /** - * @return the functionSets - */ - public FunctionSet[] getFunctionSets() { - return functionSets; - } - /** * @return the functionSet */ -- cgit v1.2.3