aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/function/FunctionSet.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/function/FunctionSet.java')
-rw-r--r--src/jcgp/function/FunctionSet.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/jcgp/function/FunctionSet.java b/src/jcgp/function/FunctionSet.java
index e2d04a0..30e1067 100644
--- a/src/jcgp/function/FunctionSet.java
+++ b/src/jcgp/function/FunctionSet.java
@@ -6,7 +6,7 @@ import java.util.ArrayList;
public class FunctionSet {
private ArrayList<Function> functionList;
- public void setFunctions(Function ... functions) {
+ public FunctionSet(Function ... functions) {
functionList = new ArrayList<Function>(functions.length);
for (int i = 0; i < functions.length; i++) {
@@ -14,13 +14,6 @@ public class FunctionSet {
}
}
- public void addFunction(Function newFunction) {
- if (functionList == null) {
- functionList = new ArrayList<Function>();
- }
- functionList.add(newFunction);
- }
-
public int getFunctionCount() {
return functionList.size();
}
@@ -28,4 +21,17 @@ public class FunctionSet {
public Function getFunction(int index) {
return functionList.get(index);
}
+
+ public int getMaxArity(){
+
+ int maxArity = 0;
+
+ for (Function function : functionList) {
+ if (function.getArity() > maxArity) {
+ maxArity = function.getArity();
+ }
+ }
+
+ return maxArity;
+ }
} \ No newline at end of file