diff options
Diffstat (limited to 'src/jcgp/function/FunctionSet.java')
-rw-r--r-- | src/jcgp/function/FunctionSet.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/jcgp/function/FunctionSet.java b/src/jcgp/function/FunctionSet.java new file mode 100644 index 0000000..e2d04a0 --- /dev/null +++ b/src/jcgp/function/FunctionSet.java @@ -0,0 +1,31 @@ +package jcgp.function; + +import java.util.ArrayList; + + +public class FunctionSet { + private ArrayList<Function> functionList; + + public void setFunctions(Function ... functions) { + functionList = new ArrayList<Function>(functions.length); + + for (int i = 0; i < functions.length; i++) { + functionList.add(functions[i]); + } + } + + public void addFunction(Function newFunction) { + if (functionList == null) { + functionList = new ArrayList<Function>(); + } + functionList.add(newFunction); + } + + public int getFunctionCount() { + return functionList.size(); + } + + public Function getFunction(int index) { + return functionList.get(index); + } + }
\ No newline at end of file |