From 0c288cc1952809294c8d70d86b9f41b04878ac2e Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Sun, 23 Mar 2014 18:05:13 +0000 Subject: Majorly refactored, node grid is fully implemented. About to attempt active path locking. --- src/jcgp/modules/function/Arithmetic.java | 105 ------------------------------ 1 file changed, 105 deletions(-) delete mode 100644 src/jcgp/modules/function/Arithmetic.java (limited to 'src/jcgp/modules/function/Arithmetic.java') diff --git a/src/jcgp/modules/function/Arithmetic.java b/src/jcgp/modules/function/Arithmetic.java deleted file mode 100644 index aa5e9bf..0000000 --- a/src/jcgp/modules/function/Arithmetic.java +++ /dev/null @@ -1,105 +0,0 @@ -package jcgp.modules.function; - -import jcgp.exceptions.InvalidArgumentsException; -import jcgp.population.Connection; - -public class Arithmetic { - - public static class Addition extends Function { - - private int arity = 2; - - @Override - public Integer run(Connection... connections) { - if (connections.length < arity) { - throw new InvalidArgumentsException("Not enough connections were given."); - } else { - Integer arg1 = ((Integer) connections[0].getValue()); - Integer arg2 = ((Integer) connections[1].getValue()); - Integer result = arg1 + arg2; - - return result; - } - } - - @Override - public int getArity() { - return arity; - } - } - - public static class Subtraction extends Function { - - private int arity = 2; - - @Override - public Integer run(Connection... connections) { - if (connections.length < arity) { - throw new InvalidArgumentsException("Not enough connections were given."); - } else { - Integer arg1 = ((Integer) connections[0].getValue()); - Integer arg2 = ((Integer) connections[1].getValue()); - Integer result = arg1 - arg2; - - return result; - } - } - - @Override - public int getArity() { - return arity; - } - } - - public static class Multiplication extends Function { - - private int arity = 2; - - @Override - public Integer run(Connection... connections) { - if (connections.length < arity) { - throw new InvalidArgumentsException("Not enough connections were given."); - } else { - Integer arg1 = ((Integer) connections[0].getValue()); - Integer arg2 = ((Integer) connections[1].getValue()); - Integer result = arg1 * arg2; - - return result; - } - } - - @Override - public int getArity() { - return arity; - } - } - - public static class Division extends Function { - - private int arity = 2; - - @Override - public Integer run(Connection... connections) { - if (connections.length < arity) { - throw new InvalidArgumentsException("Not enough connections were given."); - } else { - Integer arg1 = ((Integer) connections[0].getValue()); - Integer arg2 = ((Integer) connections[1].getValue()); - Integer result; - if (arg2 == 0) { - result = 0; - } else { - result = arg1 / arg2; - } - - return result; - } - } - - @Override - public int getArity() { - return arity; - } - } - -} -- cgit v1.2.3