From 9d24ea7759c58e7b1fd4b8c37acc7d16cb7e55fa Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Tue, 18 Nov 2014 19:26:18 +0000 Subject: Refactored handlers, separated into input, node and output files. Genes are less functional now, ChromosomePane will deal with hand-wired connections. --- src/jcgp/backend/population/Gene.java | 20 ++++++++++++++++++++ src/jcgp/backend/population/Input.java | 2 +- src/jcgp/backend/population/Node.java | 2 +- src/jcgp/backend/population/Output.java | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 src/jcgp/backend/population/Gene.java (limited to 'src/jcgp/backend') diff --git a/src/jcgp/backend/population/Gene.java b/src/jcgp/backend/population/Gene.java new file mode 100644 index 0000000..47c8dfd --- /dev/null +++ b/src/jcgp/backend/population/Gene.java @@ -0,0 +1,20 @@ +package jcgp.backend.population; + +/** + * TODO comment + * + * @author Eduardo Pedroni + * + */ +public abstract class Gene { + + private Object guiObject; + + public void setGUIObject(Object guiObject) { + this.guiObject = guiObject; + } + + public Object getGUIObject() { + return guiObject; + } +} diff --git a/src/jcgp/backend/population/Input.java b/src/jcgp/backend/population/Input.java index 97fe82b..7d2590b 100644 --- a/src/jcgp/backend/population/Input.java +++ b/src/jcgp/backend/population/Input.java @@ -9,7 +9,7 @@ package jcgp.backend.population; * @author Eduardo Pedroni * */ -public class Input implements Connection { +public class Input extends Gene implements Connection { private Object value; private int index; diff --git a/src/jcgp/backend/population/Node.java b/src/jcgp/backend/population/Node.java index 6696694..a9131d1 100644 --- a/src/jcgp/backend/population/Node.java +++ b/src/jcgp/backend/population/Node.java @@ -25,7 +25,7 @@ import jcgp.backend.resources.Resources; * @author Eduardo Pedroni * */ -public class Node implements Mutable, Connection { +public class Node extends Gene implements Mutable, Connection { private Function function; private Connection[] connections; diff --git a/src/jcgp/backend/population/Output.java b/src/jcgp/backend/population/Output.java index a346d4a..c87f97c 100644 --- a/src/jcgp/backend/population/Output.java +++ b/src/jcgp/backend/population/Output.java @@ -16,7 +16,7 @@ import java.util.ArrayList; * @author Eduardo Pedroni * */ -public class Output implements Mutable { +public class Output extends Gene implements Mutable { private Connection source; private Chromosome chromosome; -- cgit v1.2.3