aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/modules/function/FunctionSet.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/modules/function/FunctionSet.java')
-rw-r--r--src/jcgp/modules/function/FunctionSet.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/jcgp/modules/function/FunctionSet.java b/src/jcgp/modules/function/FunctionSet.java
new file mode 100644
index 0000000..8a2190a
--- /dev/null
+++ b/src/jcgp/modules/function/FunctionSet.java
@@ -0,0 +1,39 @@
+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;
+
+ public FunctionSet(Function ... functions) {
+ functionList = functions;
+
+ for (Function function : functionList) {
+ if (function.getArity() > maxArity) {
+ maxArity = function.getArity();
+ }
+ }
+
+ }
+
+ public int getFunctionCount() {
+ return functionList.length;
+ }
+
+ public Function getFunction(int index) {
+ return functionList[index];
+ }
+
+ public int getMaxArity(){
+ return maxArity;
+ }
+ } \ No newline at end of file