blob: fb3724f25bbfb5583b785237873d7b5018de7e90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package jcgp.modules.function;
/**
*
* TODO: if function set flexibility is desired (i.e. add more functions as the program runs)
* an add function method should be created
* this would lead to concurrency problems, so tread lightly!
*
*
* @author Eduardo Pedroni
*
*/
public class FunctionSet {
private Function[] functionList;
private int maxArity = 0;
private String name;
public FunctionSet(String name, Function ... functions) {
functionList = functions;
for (Function function : functionList) {
if (function.getArity() > maxArity) {
maxArity = function.getArity();
}
}
this.name = name;
}
public int getFunctionCount() {
return functionList.length;
}
public Function getFunction(int index) {
return functionList[index];
}
public int getMaxArity(){
return maxArity;
}
public String getName() {
return name;
}
}
|