package jcgp.backend.resources; import jcgp.backend.function.FunctionSet; import jcgp.backend.resources.parameters.IntegerParameter; /** * * This subclass of Resources allows modifications to be made. * A read-only cast of this class is passed to modules for safety, * and only classes with access to a JCGP instance may modify * the resources. * * @author eddy * */ public class ModifiableResources extends Resources { public ModifiableResources() { super(); } public void setValues(String filePath) { } /** * @param rows the rows to set */ public void setRows(int rows) { this.rows.set(rows); } /** * @param columns the columns to set */ public void setColumns(int columns) { this.columns.set(columns); } /** * @param inputs the inputs to set */ public void setInputs(int inputs) { this.inputs.set(inputs); } /** * @param outputs the outputs to set */ public void setOutputs(int outputs) { this.outputs.set(outputs); } /** * @param populationSize the populationSize to set */ public void setPopulationSize(int populationSize) { this.populationSize.set(populationSize); } /** * @param levelsBack the levelsBack to set */ public void setLevelsBack(int levelsBack) { this.levelsBack.set(levelsBack); } /** * @param currentGeneration the currentGeneration to set */ public void setCurrentGeneration(int currentGeneration) { this.currentGeneration.set(currentGeneration); } /** * @param generations the generations to set */ public void setGenerations(int generations) { this.generations.set(generations); } /** * @param currentRun the currentRun to set */ public void setCurrentRun(int currentRun) { this.currentRun.set(currentRun); } /** * @param runs the runs to set */ public void setRuns(int runs) { this.runs.set(runs); } /** * @param arity the arity to set */ public void setArity(int arity) { this.arity.set(arity); } /** * @param seed the seed to set */ public void setSeed(int seed) { this.seed.set(seed); } /** * @param report the report to set */ public void setReportInterval(int report) { this.reportInterval.set(report); } /** * @return the rows */ public IntegerParameter getRowsParameter() { return rows; } /** * @return the columns */ public IntegerParameter getColumnsParameter() { return columns; } /** * @return the inputs */ public IntegerParameter getInputsParameter() { return inputs; } /** * @return the outputs */ public IntegerParameter getOutputsParameter() { return outputs; } /** * @return the populationSize */ public IntegerParameter getPopulationSizeParameter() { return populationSize; } /** * @return the levelsBack */ public IntegerParameter getLevelsBackParameter() { return levelsBack; } /** * @return the currentGeneration */ public IntegerParameter getCurrentGenerationParameter() { return currentGeneration; } /** * @return the generations */ public IntegerParameter getGenerationsParameter() { return generations; } /** * @return the currentRun */ public IntegerParameter getCurrentRunParameter() { return currentRun; } /** * @return the runs */ public IntegerParameter getRunsParameter() { return runs; } /** * @return the arity */ public IntegerParameter getArityParameter() { return arity; } /** * @return the seed */ public IntegerParameter getSeedParameter() { return seed; } /** * @return the report */ public IntegerParameter getReportIntervalParameter() { return reportInterval; } public void setFunctionSet(FunctionSet functionSet) { this.functionSet = functionSet; setArity(functionSet.getMaxArity()); } public void setConsole(Console console) { this.console = console; } /* * Console functionality */ public void println(String s) { System.out.println(s); if (console != null) { console.println(s); } } public void print(String s) { System.out.print(s); if (console != null) { console.print(s); } } }