diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-05-04 19:23:52 +0100 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-05-04 19:23:52 +0100 |
commit | aa9e74e7f67789f6353fc26e02ee8e68e40609a2 (patch) | |
tree | 3ad4ed8a0717a9983775a38b0cc8d9a10c01302a /src/jcgp/backend/population/MutableElement.java | |
parent | c4fc7e307caf03c93c4203aff8960ffcb3ca8737 (diff) |
Added more comments, minor refactorings
Diffstat (limited to 'src/jcgp/backend/population/MutableElement.java')
-rw-r--r-- | src/jcgp/backend/population/MutableElement.java | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/src/jcgp/backend/population/MutableElement.java b/src/jcgp/backend/population/MutableElement.java index 8548e63..33f3890 100644 --- a/src/jcgp/backend/population/MutableElement.java +++ b/src/jcgp/backend/population/MutableElement.java @@ -1,5 +1,19 @@ package jcgp.backend.population; +/** + * {@code MutableElement} declares the expected behaviour of any + * part of a chromosome that is mutable, more specifically + * nodes or outputs. Inputs are not mutable since they don't have + * connections or functions. + * <br><br> + * This interface provides a way to deal with mutable elements + * generically without having to specify whether they are nodes + * or outputs. In this way a random mutable element can be picked and + * dealt with more easily, facilitating mutations. + * + * @author Eduardo Pedroni + * + */ public interface MutableElement { /** @@ -7,28 +21,33 @@ public interface MutableElement { * Implementing classes may choose to ignore the given index (such as in the * case of outputs, which only have one connection). * - * @param index - * @param newConnection + * @param index the connection index to set. + * @param newConnection the chromosome element to connect to. */ public void setConnection(int index, Connection newConnection); /** - * This method returns true if and only if:</br> - * - the elements being compared are not the same instance;</br> - * - the connections of the compared elements are not the same instance;</br> - * - the elements have the same function (in the case of Node);</br> - * - the grid position of the elements themselves are the same;</br> - * - the grid position of all equivalent connections are the same;</br></br> + * Asserts if the specified element is a copy of the elements + * this is called on.<br> + * This method returns true if and only if: + * <ul> + * <li>the elements being compared are not the same instance;</li> + * <li>the connections of the compared elements are not the same instance;</li> + * <li>the elements have the same function (in the case of Node);</li> + * <li>the grid position of the elements themselves are the same;</li> + * <li>the grid position of all equivalent connections are the same;</li> + * </ul> + * <br><br> + * The relationship computed by this method is: + * <ul> + * <li>symmetric: a.copyOf(b) == b.copyOf(a);</li> + * <li>not reflexive: a.copyOf(a) returns false;</li> + * <li>not transitive: if a.copyOf(b) is true and b.copyOf(c) is true, a.copyOf(c) is + * not necessarily true since it is possible that a == c.</li> * - * The relationship computed by this method is:</br> - * - symmetric: a.copyOf(b) == b.copyOf(a);</br> - * - not reflexive: a.copyOf(a) returns false;</br> - * - not transitive: if a.copyOf(b) is true and b.copyOf(c) is true, a.copyOf(c) is - * not necessarily true since it is possible that a == c.</br> - * - * @param m - * @return + * @param element the mutable element to compare to. + * @return true if {@code element} is a copy of this element. */ - boolean copyOf(MutableElement m); + boolean copyOf(MutableElement element); } |