From 73c72eed5e854546ca5080ae2ce7ded9e4b93ffb Mon Sep 17 00:00:00 2001 From: HossamSaberr Date: Tue, 10 Mar 2026 06:05:16 +0200 Subject: [PATCH] ix CI: Replace pointTo:do: with loops in CTAlternateArray2D --- src/Containers-Array2D/CTAlternateArray2D.class.st | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Containers-Array2D/CTAlternateArray2D.class.st b/src/Containers-Array2D/CTAlternateArray2D.class.st index 42ccfd4..7f8a477 100644 --- a/src/Containers-Array2D/CTAlternateArray2D.class.st +++ b/src/Containers-Array2D/CTAlternateArray2D.class.st @@ -32,17 +32,22 @@ CTAlternateArray2D class >> width2Height3 [ { #category : 'iterate' } CTAlternateArray2D >> allPositionsDo: aBlock [ - "Execute a Block on all the positions (points) of the receiver." - self firstPosition pointTo: self dimension do: aBlock + 1 to: self width do: [ :x | + 1 to: self height do: [ :y | + aBlock value: x@y ] ] ] { #category : 'iterate' } -CTAlternateArray2D >> allPositionsWithin: someDistance from: someOrigin [ +CTAlternateArray2D >> allPositionsWithin: someDistance from: someOrigin [ | answer topLeft bottomRight | answer := OrderedCollection new. topLeft := someOrigin - someDistance max: self firstPosition. bottomRight := someOrigin + someDistance min: self dimension. - topLeft pointTo: bottomRight do: [ :each | answer add: each ]. + + topLeft x to: bottomRight x do: [ :x | + topLeft y to: bottomRight y do: [ :y | + answer add: x@y ] ]. + ^ answer ]