aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/modules/function/BitwiseLogic.java
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-03-23 18:05:13 +0000
committerEduardo Pedroni <ep625@york.ac.uk>2014-03-23 18:05:13 +0000
commit0c288cc1952809294c8d70d86b9f41b04878ac2e (patch)
treeef9671b711fe665a3156594663c083595861a4e6 /src/jcgp/modules/function/BitwiseLogic.java
parentd3527a63e12c0e5288f1e7d2e2dc18e61d16b760 (diff)
Majorly refactored, node grid is fully implemented. About to attempt active path locking.
Diffstat (limited to 'src/jcgp/modules/function/BitwiseLogic.java')
-rw-r--r--src/jcgp/modules/function/BitwiseLogic.java163
1 files changed, 0 insertions, 163 deletions
diff --git a/src/jcgp/modules/function/BitwiseLogic.java b/src/jcgp/modules/function/BitwiseLogic.java
deleted file mode 100644
index c8452e6..0000000
--- a/src/jcgp/modules/function/BitwiseLogic.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package jcgp.modules.function;
-
-import jcgp.exceptions.InvalidArgumentsException;
-import jcgp.population.Connection;
-
-public class BitwiseLogic {
-
- public static class And extends Function {
- private int arity = 2;
-
- @Override
- public Object run(Connection... connections) {
- if (connections.length < arity) {
- throw new InvalidArgumentsException("Not enough connections were given.");
- } else {
- int arg1 = ((int) connections[0].getValue());
- int arg2 = ((int) connections[1].getValue());
- int result = arg1 & arg2;
-
- return result;
- }
- }
-
- @Override
- public int getArity() {
- return arity;
- }
- }
-
- public static class Or extends Function {
- private int arity = 2;
-
- @Override
- public Object run(Connection... connections) {
- if (connections.length < arity) {
- throw new InvalidArgumentsException("Not enough connections were given.");
- } else {
- int arg1 = ((int) connections[0].getValue());
- int arg2 = ((int) connections[1].getValue());
- int result = arg1 | arg2;
-
- return result;
- }
- }
-
- @Override
- public int getArity() {
- return arity;
- }
- }
-
- public static class Not extends Function {
- private int arity = 1;
-
- @Override
- public Object run(Connection... connections) {
- if (connections.length < arity) {
- throw new InvalidArgumentsException("Not enough connections were given.");
- } else {
- int arg1 = ((int) connections[0].getValue());
- int result = ~arg1;
-
- return result;
- }
- }
-
- @Override
- public int getArity() {
- return arity;
- }
- }
-
- public static class Xor extends Function {
- private int arity = 2;
-
- @Override
- public Object run(Connection... connections) {
- if (connections.length < arity) {
- throw new InvalidArgumentsException("Not enough connections were given.");
- } else {
- int arg1 = ((int) connections[0].getValue());
- int arg2 = ((int) connections[1].getValue());
- int result = arg1 ^ arg2;
-
- return result;
- }
- }
-
- @Override
- public int getArity() {
- return arity;
- }
- }
-
- public static class Nand extends Function {
- private int arity = 2;
-
- @Override
- public Object run(Connection... connections) {
- if (connections.length < arity) {
- throw new InvalidArgumentsException("Not enough connections were given.");
- } else {
- int arg1 = ((int) connections[0].getValue());
- int arg2 = ((int) connections[1].getValue());
- int result = arg1 & arg2;
-
- return ~result;
- }
- }
-
- @Override
- public int getArity() {
- return arity;
- }
- }
-
- public static class Nor extends Function {
- private int arity = 2;
-
- @Override
- public Object run(Connection... connections) {
- if (connections.length < arity) {
- throw new InvalidArgumentsException("Not enough connections were given.");
- } else {
- int arg1 = ((int) connections[0].getValue());
- int arg2 = ((int) connections[1].getValue());
- int result = arg1 | arg2;
-
- return ~result;
- }
- }
-
- @Override
- public int getArity() {
- return arity;
- }
- }
-
- public static class Xnor extends Function {
- private int arity = 2;
-
- @Override
- public Object run(Connection... connections) {
- if (connections.length < arity) {
- throw new InvalidArgumentsException("Not enough connections were given.");
- } else {
- int arg1 = ((int) connections[0].getValue());
- int arg2 = ((int) connections[1].getValue());
- int result = arg1 ^ arg2;
-
- return ~result;
- }
- }
-
- @Override
- public int getArity() {
- return arity;
- }
- }
-
-
-
-}