Skip to content

Commit 18d3bf8

Browse files
committed
removed extension method, inlined printOn
1 parent 07885b0 commit 18d3bf8

File tree

4 files changed

+14
-29
lines changed

4 files changed

+14
-29
lines changed

src/Math-FunctionFit/BlockClosure.extension.st

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Math-FunctionFit/PMAnotherGeneticOptimizer.class.st

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,12 @@ PMAnotherGeneticOptimizer >> nextGeneration [
169169
]
170170

171171
{ #category : 'printing' }
172-
PMAnotherGeneticOptimizer >> printOn1: aStream [
172+
PMAnotherGeneticOptimizer >> printOn: aStream [
173173

174174
aStream
175175
nextPutAll: self class name;
176176
nextPutAll: '( function: ';
177-
nextPutAll: originalFunction functionString
178-
]
179-
180-
{ #category : 'printing' }
181-
PMAnotherGeneticOptimizer >> printOn2: aStream [
182-
aStream
177+
nextPutAll: originalFunction compiledBlock asString;
183178
nextPutAll: ' manager: ';
184179
print: chromosomeManager;
185180
nextPutAll: ' maxIterations: ';
@@ -197,12 +192,6 @@ PMAnotherGeneticOptimizer >> printOn2: aStream [
197192
nextPut: $)
198193
]
199194

200-
{ #category : 'printing' }
201-
PMAnotherGeneticOptimizer >> printOn: aStream [
202-
self printOn1: aStream.
203-
self printOn2: aStream
204-
]
205-
206195
{ #category : 'operation' }
207196
PMAnotherGeneticOptimizer >> processRandomParents: aNumberArray [
208197
"puts the better chromosome at the first place (is eg necessary for lineCrossOver:and:)"
@@ -251,7 +240,7 @@ result :=nil
251240
PMAnotherGeneticOptimizer >> setFunction: aBlock [
252241
( aBlock respondsTo: #value:)
253242
ifFalse:[ self error: 'Function block must implement the method value:'].
254-
originalFunction :=aBlock . "necessary for subclass; do not delete that nonsense!"
243+
originalFunction := aBlock . "necessary for subclass; do not delete that nonsense!"
255244
functionBlock := aBlock.
256245
self resetBestPoints
257246
]

src/Math-FunctionFit/PMErrorOfParameterFunction.class.st

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ PMErrorOfParameterFunction class >> function: aBlock data: aCollectionOfPoints [
2323
^self new function: aBlock; data: aCollectionOfPoints; yourself
2424
]
2525

26+
{ #category : 'accessing' }
27+
PMErrorOfParameterFunction >> compiledBlock [
28+
"This method only exists for polymorphic message send"
29+
30+
^ self asString
31+
]
32+
2633
{ #category : 'accessing' }
2734
PMErrorOfParameterFunction >> data [
2835
^data
@@ -90,12 +97,6 @@ function :=aBlock .
9097
varArray :=Array new: aBlock numArgs
9198
]
9299

93-
{ #category : 'accessing' }
94-
PMErrorOfParameterFunction >> functionString [
95-
96-
^ self asString
97-
]
98-
99100
{ #category : 'initialization' }
100101
PMErrorOfParameterFunction >> initialize [
101102
super initialize .

src/Math-FunctionFit/PMGeneralFunctionFit.class.st

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,9 @@ f :=errorFunction function .
165165
{ #category : 'accessing' }
166166
PMGeneralFunctionFit >> function: aBlock [
167167
"sets the function to be fitted. the first value has to be the independent variable, further values are the parameters to be fitted. only one independent variable is allowed (if you have several independent vars or eg a function of a vector, that returns another vector, have a look at the 'spiral' example)."
168-
self resetResult.
169-
errorFunction function: aBlock
168+
169+
self resetResult.
170+
errorFunction function: aBlock
170171
]
171172

172173
{ #category : 'initialization' }
@@ -181,6 +182,7 @@ PMGeneralFunctionFit >> initialize [
181182
chromosomeManager: manager;
182183
maximumIterations: 170;
183184
yourself.
185+
184186
self errorType: #squared.
185187
verbose := false.
186188
dataTruncated := false

0 commit comments

Comments
 (0)