Skip to content

Commit 1442262

Browse files
authored
Merge pull request #33 from HossamSaberr/master
Fix CI: Replace pointTo:do: with loops in CTAlternateArray2D
2 parents 5f4bb2b + 73c72ee commit 1442262

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Containers-Array2D/CTAlternateArray2D.class.st

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,22 @@ CTAlternateArray2D class >> width2Height3 [
3232

3333
{ #category : 'iterate' }
3434
CTAlternateArray2D >> allPositionsDo: aBlock [
35-
"Execute a Block on all the positions (points) of the receiver."
36-
self firstPosition pointTo: self dimension do: aBlock
35+
1 to: self width do: [ :x |
36+
1 to: self height do: [ :y |
37+
aBlock value: x@y ] ]
3738
]
3839

3940
{ #category : 'iterate' }
40-
CTAlternateArray2D >> allPositionsWithin: someDistance from: someOrigin [
41+
CTAlternateArray2D >> allPositionsWithin: someDistance from: someOrigin [
4142
| answer topLeft bottomRight |
4243
answer := OrderedCollection new.
4344
topLeft := someOrigin - someDistance max: self firstPosition.
4445
bottomRight := someOrigin + someDistance min: self dimension.
45-
topLeft pointTo: bottomRight do: [ :each | answer add: each ].
46+
47+
topLeft x to: bottomRight x do: [ :x |
48+
topLeft y to: bottomRight y do: [ :y |
49+
answer add: x@y ] ].
50+
4651
^ answer
4752
]
4853

0 commit comments

Comments
 (0)