package jcgp.gui.population; import javafx.beans.property.SimpleObjectProperty; import javafx.scene.Group; import javafx.scene.shape.Circle; import javafx.scene.text.Text; import jcgp.backend.population.Connection; import jcgp.backend.population.Gene; import jcgp.gui.ChromosomePane; enum GUIGeneState { NEUTRAL, HOVER, INDIRECT_HOVER, ACTIVE_HOVER, LOCKED_HOVER, SOURCE, TARGET, NO_CHANGE_TARGET, FORBIDDEN_TARGET } public abstract class GUIGene extends Group { public static final double NODE_RADIUS = 30; public static final double SPACING = 15; public static final double THETA = Math.PI / 1.4; public static final double SOCKET_RADIUS = Math.sqrt(NODE_RADIUS) / 1.8; public static final double NODE_TEXT = NODE_RADIUS / 2.5; protected Text text; protected Circle mainCircle; protected SimpleObjectProperty stateProperty = new SimpleObjectProperty(GUIGeneState.NEUTRAL); protected ChromosomePane parent; protected int locked = 0; public SimpleObjectProperty stateProperty() { return stateProperty; } public void setState(GUIGeneState newState) { stateProperty.set(newState); } public void showText(boolean value) { text.setVisible(value); } public boolean isLocked() { return locked > 0; } public int getLocks() { return locked; } abstract void setLocked(boolean value); public abstract void addLocks(int value); public abstract void removeLocks(int value); public abstract void updateLines(); public abstract Gene getGene(); public abstract void setChangingConnection(Connection newConnection); public abstract Connection getChangingConnection(); public abstract void setConnections(GUIGeneState newState); public abstract void resetState(); public abstract void setConnectionLine(GUIGene gene); }