aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/population
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-07 15:58:30 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-07 15:58:30 +0100
commit226365bd6a0f56143ffbce7379857ff3e126fbaf (patch)
tree4582b16a5519c94b121a369104157859dc97cba1 /src/jcgp/backend/population
parent67ace66f66ffaa00e1bd1495c0d406c801e59c5c (diff)
Refactoring resources for (hopefully) the last time
Diffstat (limited to 'src/jcgp/backend/population')
-rw-r--r--src/jcgp/backend/population/Chromosome.java4
-rw-r--r--src/jcgp/backend/population/Connection.java2
-rw-r--r--src/jcgp/backend/population/Input.java4
-rw-r--r--src/jcgp/backend/population/Node.java4
-rw-r--r--src/jcgp/backend/population/Output.java10
5 files changed, 11 insertions, 13 deletions
diff --git a/src/jcgp/backend/population/Chromosome.java b/src/jcgp/backend/population/Chromosome.java
index d438375..bbada14 100644
--- a/src/jcgp/backend/population/Chromosome.java
+++ b/src/jcgp/backend/population/Chromosome.java
@@ -318,7 +318,7 @@ public class Chromosome {
for (int c = 0; c < (resources.getInt("columns")); c++) {
System.out.print("N: (" + r + ", " + c + ") ");
for (int i = 0; i < arity; i++) {
- System.out.print("C" + i + ": (" + nodes[r][c].getConnection(i).getDescription() + ") ");
+ System.out.print("C" + i + ": (" + nodes[r][c].getConnection(i).toString() + ") ");
}
System.out.print("F: " + nodes[r][c].getFunction().getName() + "\t");
}
@@ -326,7 +326,7 @@ public class Chromosome {
}
for (int o = 0; o < (resources.getInt("outputs")); o++) {
- System.out.print("o: " + o + " (" + outputs[o].getSource().getDescription() + ")\t");
+ System.out.print("o: " + o + " (" + outputs[o].getSource().toString() + ")\t");
}
}
diff --git a/src/jcgp/backend/population/Connection.java b/src/jcgp/backend/population/Connection.java
index ea4f10f..cd0f5ce 100644
--- a/src/jcgp/backend/population/Connection.java
+++ b/src/jcgp/backend/population/Connection.java
@@ -3,7 +3,5 @@ package jcgp.backend.population;
public interface Connection {
public Object getValue();
-
- public String getDescription();
}
diff --git a/src/jcgp/backend/population/Input.java b/src/jcgp/backend/population/Input.java
index 83fba07..2661f8c 100644
--- a/src/jcgp/backend/population/Input.java
+++ b/src/jcgp/backend/population/Input.java
@@ -23,7 +23,7 @@ public class Input extends Gene implements Connection {
}
@Override
- public String getDescription() {
- return "i: " + index;
+ public String toString() {
+ return "Input " + index;
}
}
diff --git a/src/jcgp/backend/population/Node.java b/src/jcgp/backend/population/Node.java
index 6960ded..87a2f99 100644
--- a/src/jcgp/backend/population/Node.java
+++ b/src/jcgp/backend/population/Node.java
@@ -106,7 +106,7 @@ public class Node extends Gene implements MutableElement, Connection {
}
@Override
- public String getDescription() {
- return "n: " + row + ", " + column;
+ public String toString() {
+ return "Node [" + row + ", " + column + "]";
}
}
diff --git a/src/jcgp/backend/population/Output.java b/src/jcgp/backend/population/Output.java
index aa94ab6..d876951 100644
--- a/src/jcgp/backend/population/Output.java
+++ b/src/jcgp/backend/population/Output.java
@@ -11,7 +11,6 @@ public class Output extends Gene implements MutableElement {
public Output(Chromosome chromosome, int index) {
this.chromosome = chromosome;
this.index = index;
- //this.source = new SimpleObjectProperty<Connection>();
}
public Object calculate() {
@@ -32,10 +31,6 @@ public class Output extends Gene implements MutableElement {
public Connection getSource() {
return source;
}
-
-// public SimpleObjectProperty<Connection> sourceProperty() {
-// return source;
-// }
public void getActiveNodes(ArrayList<Node> activeNodes) {
if (source instanceof Node) {
@@ -66,4 +61,9 @@ public class Output extends Gene implements MutableElement {
}
return false;
}
+
+ @Override
+ public String toString() {
+ return "Output " + index;
+ }
}