[squeak-dev] The Trunk: Collections-nice.929.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Mar 4 17:55:08 UTC 2021


Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.929.mcz

==================== Summary ====================

Name: Collections-nice.929
Author: nice
Time: 4 March 2021, 6:55:05.090663 pm
UUID: 6e327843-eedc-4eeb-ba1b-0e14d4f40e56
Ancestors: Collections-nice.928

Don't hardcode Interval and LimitedPrecisionInterval so as to enable subclassing.

Note: a subclass wanting to handle limited precision bounds or increment by itself should define:

limitedPrecisionSpecies
	^self.
	
This is not the case of TextLineInterval that only ever see Integer bounds.

=============== Diff against Collections-nice.928 ===============

Item was changed:
  ----- Method: Interval class>>from:to: (in category 'instance creation') -----
  from: startInteger to: stopInteger 
  	"Answer an instance of me, starting at startNumber, ending at 
  	stopNumber, and with an interval increment of 1."
  
  	^((startInteger hasLimitedPrecision or: [stopInteger hasLimitedPrecision])
+ 		ifTrue: [self limitedPrecisionSpecies]
+ 		ifFalse: [self]) basicNew
- 		ifTrue: [LimitedPrecisionInterval]
- 		ifFalse: [Interval]) basicNew
  		setFrom: startInteger
  		to: stopInteger
  		by: 1!

Item was changed:
  ----- Method: Interval class>>from:to:by: (in category 'instance creation') -----
  from: startInteger to: stopInteger by: stepInteger 
  	"Answer an instance of me, starting at startNumber, ending at 
  	stopNumber, and with an interval increment of stepNumber."
  
  	^((startInteger hasLimitedPrecision or: [stopInteger hasLimitedPrecision or: [stepInteger hasLimitedPrecision]])
+ 		ifTrue: [self limitedPrecisionSpecies]
+ 		ifFalse: [self]) basicNew
- 		ifTrue: [LimitedPrecisionInterval]
- 		ifFalse: [Interval]) basicNew
  		setFrom: startInteger
  		to: stopInteger
  		by: stepInteger!

Item was added:
+ ----- Method: Interval class>>limitedPrecisionSpecies (in category 'instance creation') -----
+ limitedPrecisionSpecies
+ 	"Answer a class able to handle limited precision bounds or step"
+ 
+ 	^LimitedPrecisionInterval!



More information about the Squeak-dev mailing list