The Trunk: Collections-nice.929.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-nice.929.mcz

commits-2
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!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-nice.929.mcz

marcel.taeumel
Hi Nicolas,

thank you for the quick response. :-)

Best,
Marcel

Am 04.03.2021 18:55:18 schrieb [hidden email] <[hidden email]>:

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!