[squeak-dev] The Trunk: Collections-ct.997.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Mar 25 19:08:43 UTC 2022
Christoph Thiede uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ct.997.mcz
==================== Summary ====================
Name: Collections-ct.997
Author: ct
Time: 25 March 2022, 8:08:33.46961 pm
UUID: e320783c-fb7c-2f4d-9ea4-fe6152d9c677
Ancestors: Collections-mt.995
Merges SparseLargeTable enumerate+tests.1.cs:
* Overrides #withIndexDo: to start from base index only
* Adds #sparseElementsAndIndicesDo: for efficient iterating over all non-default values
=============== Diff against Collections-mt.995 ===============
Item was added:
+ ----- Method: SparseLargeTable>>sparseElementsAndIndicesDo: (in category 'accessing') -----
+ sparseElementsAndIndicesDo: binaryBlock
+ "Evaluate binaryBlock for each element and index in the receiver that has a non-default value."
+
+ 1 to: self basicSize do: [:chunkIndex |
+ (self basicAt: chunkIndex) ifNotNil: [:chunk |
+ chunk withIndexDo: [:element :innerIndex |
+ element ~= defaultValue ifTrue: [
+ binaryBlock value: element value: innerIndex + base - 1 + (chunkIndex - 1 * chunkSize)]]]].!
Item was added:
+ ----- Method: SparseLargeTable>>withIndexDo: (in category 'enumerating') -----
+ withIndexDo: binaryBlock
+
+ self base to: self size do: [:index |
+ binaryBlock
+ value: (self at: index)
+ value: index].!
More information about the Squeak-dev
mailing list
|