aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/resources/ModifiableResources.java
blob: 384196366865d7777da44ffb28d470f4f10cbd6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
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);
		}
	}
}