diff options
author | Eduardo Pedroni <e.pedroni91@gmail.com> | 2014-11-24 11:30:21 +0000 |
---|---|---|
committer | Eduardo Pedroni <e.pedroni91@gmail.com> | 2014-11-24 11:30:21 +0000 |
commit | a00b13c12e6fd9f91ee156d5db96e02853d2e410 (patch) | |
tree | aa681814e520cc4060d0eae0f8b1f60a1159d6f7 /src/jcgp/gui/population/GUIGene.java | |
parent | 3f17c598a374e46200f3b2a73ef4f1f82f734a2e (diff) |
Fixed formatting, removed commented out code, added comments to handlers and locking stuff.
Diffstat (limited to 'src/jcgp/gui/population/GUIGene.java')
-rw-r--r-- | src/jcgp/gui/population/GUIGene.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/jcgp/gui/population/GUIGene.java b/src/jcgp/gui/population/GUIGene.java index 02b87e7..f0fd568 100644 --- a/src/jcgp/gui/population/GUIGene.java +++ b/src/jcgp/gui/population/GUIGene.java @@ -14,7 +14,14 @@ import jcgp.gui.constants.Constants; * <br><br> * In practice, this is subclass of {@code javafx.scene.Group} containing a {@code Circle} * object and a {@code Text} object. Subclasses may add further elements to the group, for - * instance to display connection input and output sockets. + * instance to display connection input and output sockets. + * <br><br> + * Genes also contain a locked property. When locked, some gene states behave slightly + * differently. This is used so genes remain highlighted even in the neutral state. The + * gene lock is in fact recursive; a gene can be locked multiple times and only unlocking + * it as many times will actually revert it back to its unlocked state. This allows multiple + * pathways to lock the same gene independently without affecting each other; the gene remains + * locked until no pathways are locking it. * * @author Eduardo Pedroni * @@ -55,6 +62,10 @@ public abstract class GUIGene extends Group { private Text text; private Circle mainCircle; + /** + * Recursive lock; lock == 0 means unlocked, lock > 0 means locked. + * Accessing using {@code setLock(...)}. + */ private int lock = 0; /** @@ -134,10 +145,21 @@ public abstract class GUIGene extends Group { */ protected abstract void setLinesVisible(boolean value); + /** + * @return true if the gene is locked, false otherwise. + */ public boolean isLocked() { return lock > 0; } + /** + * Locks or unlocks the gene once. Locked genes + * behave slightly differently in some states. + * <br> + * Unlocking an already unlocked gene does nothing. + * + * @param value true to lock, false to unlock; + */ public void setLock(boolean value) { if (value) { lock++; |