diff options
Diffstat (limited to 'src/jcgp')
| -rw-r--r-- | src/jcgp/backend/function/Function.java | 2 | ||||
| -rw-r--r-- | src/jcgp/backend/modules/Module.java | 4 | ||||
| -rw-r--r-- | src/jcgp/backend/modules/mutator/PointMutator.java | 2 | ||||
| -rw-r--r-- | src/jcgp/backend/modules/problem/Problem.java | 3 | ||||
| -rw-r--r-- | src/jcgp/backend/modules/problem/TestCaseProblem.java | 2 | ||||
| -rw-r--r-- | src/jcgp/backend/resources/ModifiableResources.java | 2 | ||||
| -rw-r--r-- | src/jcgp/gui/console/ConsolePane.java | 1 | ||||
| -rw-r--r-- | src/jcgp/gui/population/ChromosomePane.java | 11 | ||||
| -rw-r--r-- | src/jcgp/gui/population/FunctionSelector.java | 8 | ||||
| -rw-r--r-- | src/jcgp/gui/settings/SettingsPane.java | 16 | 
10 files changed, 33 insertions, 18 deletions
diff --git a/src/jcgp/backend/function/Function.java b/src/jcgp/backend/function/Function.java index f277228..3124e66 100644 --- a/src/jcgp/backend/function/Function.java +++ b/src/jcgp/backend/function/Function.java @@ -14,7 +14,7 @@ public abstract class Function {  	/**  	 * Executes the function.  	 *  -	 * @param args the function arguments. +	 * @param arguments the function arguments.  	 * @return the function result.  	 */  	public abstract Object run(Object... arguments); diff --git a/src/jcgp/backend/modules/Module.java b/src/jcgp/backend/modules/Module.java index a4d36c1..5dea93e 100644 --- a/src/jcgp/backend/modules/Module.java +++ b/src/jcgp/backend/modules/Module.java @@ -48,7 +48,7 @@ public abstract class Module {  	 *   	 * @return a list of generic parameters exposed by the module.  	 */ -	public final ArrayList<Parameter<?>> getLocalParameters() { +	public ArrayList<Parameter<?>> getLocalParameters() {  		return localParameters;  	} @@ -62,7 +62,7 @@ public abstract class Module {  	 *   	 * @param newParameters the parameter(s) to add to the list.  	 */ -	protected final void registerParameters(Parameter<?>... newParameters) { +	protected void registerParameters(Parameter<?>... newParameters) {  		for (int i = 0; i < newParameters.length; i++) {  			if (!localParameters.contains(newParameters[i])) {  				localParameters.add(newParameters[i]); diff --git a/src/jcgp/backend/modules/mutator/PointMutator.java b/src/jcgp/backend/modules/mutator/PointMutator.java index 6ba3e10..dd7aa7b 100644 --- a/src/jcgp/backend/modules/mutator/PointMutator.java +++ b/src/jcgp/backend/modules/mutator/PointMutator.java @@ -41,7 +41,7 @@ public abstract class PointMutator extends Mutator {  			// choose a random mutable  			Mutable mutable = chromosome.getRandomMutable(); -			if (report.get()) getResources().report("[Mutator] Mutation " + i + " selected " + mutable); +			if (report.get()) getResources().reportln("[Mutator] Mutation " + i + " selected " + mutable);  			// mutate a random gene  			mutable.mutate(); diff --git a/src/jcgp/backend/modules/problem/Problem.java b/src/jcgp/backend/modules/problem/Problem.java index 6785733..453e3a1 100644 --- a/src/jcgp/backend/modules/problem/Problem.java +++ b/src/jcgp/backend/modules/problem/Problem.java @@ -48,7 +48,7 @@ public abstract class Problem extends Module {  	 *  	 * @param resources a reference to the experiment's resources.  	 */ -	public Problem(Resources resources) { +	protected Problem(Resources resources) {  		super(resources);  		maxFitness = new DoubleMonitor(0, "Max fitness"); @@ -72,7 +72,6 @@ public abstract class Problem extends Module {  	 * if a GUI is in use.  	 *   	 * @param population the population to be evaluated. -	 * @param resources parameters and utilities for optional reference.  	 */  	public abstract void evaluate(Population population); diff --git a/src/jcgp/backend/modules/problem/TestCaseProblem.java b/src/jcgp/backend/modules/problem/TestCaseProblem.java index 964860c..82eb91a 100644 --- a/src/jcgp/backend/modules/problem/TestCaseProblem.java +++ b/src/jcgp/backend/modules/problem/TestCaseProblem.java @@ -71,7 +71,7 @@ public abstract class TestCaseProblem<T> extends Problem {  	 *   	 * @param resources a reference to the experiment's resources.  	 */ -	public TestCaseProblem(Resources resources) { +	protected TestCaseProblem(Resources resources) {  		super(resources);  		testCases = FXCollections.observableArrayList();  	} diff --git a/src/jcgp/backend/resources/ModifiableResources.java b/src/jcgp/backend/resources/ModifiableResources.java index 2b0c039..0588c05 100644 --- a/src/jcgp/backend/resources/ModifiableResources.java +++ b/src/jcgp/backend/resources/ModifiableResources.java @@ -304,7 +304,7 @@ public class ModifiableResources extends Resources {  				if (newValue.intValue() <= 0) {  					status = ParameterStatus.INVALID;  					status.setDetails("Levels back must be at least 1."); -				} else if (newValue.intValue() > columns.get()) { +				} else if (newValue.intValue() > columns()) {  					status = ParameterStatus.INVALID;  					status.setDetails("Levels back must be less than or equal to the number of columns.");  				} else { diff --git a/src/jcgp/gui/console/ConsolePane.java b/src/jcgp/gui/console/ConsolePane.java index c4cfc21..1e07b7d 100644 --- a/src/jcgp/gui/console/ConsolePane.java +++ b/src/jcgp/gui/console/ConsolePane.java @@ -37,7 +37,6 @@ public class ConsolePane extends AnchorPane implements Console {  	public ConsolePane() {  		super();  		textArea.setEditable(false); -		  		/*  		 * This nasty hack is needed because the default TextArea ContextMenu is not  		 * in the public API, making it impossible to override it with a custom one. diff --git a/src/jcgp/gui/population/ChromosomePane.java b/src/jcgp/gui/population/ChromosomePane.java index d9154fc..1e04c37 100644 --- a/src/jcgp/gui/population/ChromosomePane.java +++ b/src/jcgp/gui/population/ChromosomePane.java @@ -12,6 +12,15 @@ import jcgp.backend.population.Node;  import jcgp.backend.resources.Resources;  import jcgp.gui.GUI; +/** + * This extension of {@code ScrollPane} contains a series of + * nodes, inputs and outputs spread across a grid. It also contains + * all of the connection lines overlaid over the nodes, inputs and outputs. + *  + *  + * @author Eduardo Pedroni + * + */  public class ChromosomePane extends ScrollPane {  	private GUINode[][] guiNodes; @@ -169,7 +178,7 @@ public class ChromosomePane extends ScrollPane {  	}  	/** -	 * @return the evaluating +	 * @return the evaluating attribute.  	 */  	public boolean isEvaluating() {  		return parent.isEvaluating(); diff --git a/src/jcgp/gui/population/FunctionSelector.java b/src/jcgp/gui/population/FunctionSelector.java index 69d0d31..0e6c6bb 100644 --- a/src/jcgp/gui/population/FunctionSelector.java +++ b/src/jcgp/gui/population/FunctionSelector.java @@ -7,6 +7,14 @@ import javafx.scene.layout.VBox;  import jcgp.backend.function.FunctionSet;  import jcgp.gui.GUI; +/** + * A menu class, exposes all of the allowed functions + * when called by a node, so that the node function can be changed. + *  + *  + * @author Eduardo Pedroni + * + */  public class FunctionSelector extends VBox {  	private GUINode target; diff --git a/src/jcgp/gui/settings/SettingsPane.java b/src/jcgp/gui/settings/SettingsPane.java index c0939e9..c59244b 100644 --- a/src/jcgp/gui/settings/SettingsPane.java +++ b/src/jcgp/gui/settings/SettingsPane.java @@ -157,25 +157,25 @@ public class SettingsPane extends AnchorPane {  		header.setFont(Font.font("Arial", 14));  		header.setUnderline(true); -		final ComboBox<EvolutionaryStrategy> eaCBox = new ComboBox<EvolutionaryStrategy>(); -		eaCBox.getItems().addAll(jcgp.getEvolutionaryStrategies()); -		eaCBox.getSelectionModel().select(jcgp.getEvolutionaryStrategy()); -		eaCBox.prefWidthProperty().bind(mainContainer.widthProperty()); +		final ComboBox<EvolutionaryStrategy> esCBox = new ComboBox<EvolutionaryStrategy>(); +		esCBox.getItems().addAll(jcgp.getEvolutionaryStrategies()); +		esCBox.getSelectionModel().select(jcgp.getEvolutionaryStrategy()); +		esCBox.prefWidthProperty().bind(mainContainer.widthProperty());  		final VBox eaParameters = new VBox(2);  		refreshParameters(jcgp.getEvolutionaryStrategy().getLocalParameters(), eaParameters); -		eaCBox.setOnAction(new EventHandler<ActionEvent>() { +		esCBox.setOnAction(new EventHandler<ActionEvent>() {  			@Override  			public void handle(ActionEvent event) { -				jcgp.setEvolutionaryStrategy(eaCBox.getSelectionModel().getSelectedIndex()); -				refreshParameters(eaCBox.getSelectionModel().getSelectedItem().getLocalParameters(), eaParameters); +				jcgp.setEvolutionaryStrategy(esCBox.getSelectionModel().getSelectedIndex()); +				refreshParameters(esCBox.getSelectionModel().getSelectedItem().getLocalParameters(), eaParameters);  				gui.flushConsole();  			}  		}); -		eaPane.getChildren().addAll(header, eaCBox, eaParameters);	 +		eaPane.getChildren().addAll(header, esCBox, eaParameters);	  		mainContainer.getChildren().add(eaPane);  	}  | 
