aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/population/Input.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/backend/population/Input.java')
-rw-r--r--src/jcgp/backend/population/Input.java36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/jcgp/backend/population/Input.java b/src/jcgp/backend/population/Input.java
index 2661f8c..97fe82b 100644
--- a/src/jcgp/backend/population/Input.java
+++ b/src/jcgp/backend/population/Input.java
@@ -1,27 +1,51 @@
package jcgp.backend.population;
-public class Input extends Gene implements Connection {
+/**
+ * This is a chromosome input. Inputs are a special
+ * type of connection which simply return a set value.
+ * They do not have connections and instead provide a
+ * starting point for the chromosome's active paths.
+ *
+ * @author Eduardo Pedroni
+ *
+ */
+public class Input implements Connection {
- private Object value = 0;
+ private Object value;
private int index;
+ /**
+ * Initialises a new input with the current index.
+ *
+ * @param index the index of the new input.
+ */
public Input(int index) {
this.index = index;
}
+ /**
+ * Sets this input's value. The new value
+ * will now be returned by this input's
+ * {@code getValue()} method.
+ *
+ * @param newValue the value to set.
+ */
public void setValue(Object newValue) {
value = newValue;
}
+ /**
+ * @return the input's index.
+ */
+ public int getIndex() {
+ return index;
+ }
+
@Override
public Object getValue() {
return value;
}
- public int getIndex() {
- return index;
- }
-
@Override
public String toString() {
return "Input " + index;