[ENH] Better previous changeset

Andres Valloud avalloud at exobox.com
Fri May 26 00:10:04 UTC 2000


Hi.

A minor change, makes a method smaller and drops a temp var.

Andres.

-------------- next part --------------
'From Squeak2.8alpha of 19 January 2000 [latest update: #2158] on 25 May 2000 at 5:08:05 pm'!
"Change Set:		allSubclasses
Date:			25 May 2000
Author:			Andres Valloud

Improved two methods in
ClassDescription. Changed the
implementation from recursive
(slow) to iterative (fast).

SqR 5/25/2000 16:55"!


!ClassDescription methodsFor: 'accessing class hierarchy' stamp: 'SqR 5/25/2000 17:07'!
allSubclasses
	"Answer a Set of the receiver's and the receiver's descendent's subclasses.
	SqR 5/25/2000 16:50. Muuuuuuuuuuuuuuch faster.
		ProtoObject allSubclasses is 7.7 times faster.
		Behavior allSubclasses is 5.x times faster"

	| scan scanTop |

	scan _ OrderedCollection withAll: self subclasses.
	scanTop _ 1.
	[scanTop > scan size] whileFalse:
		[
			scan addAll: (scan at: scanTop) subclasses.
			scanTop _ scanTop + 1
		].
	^scan asSet! !

!ClassDescription methodsFor: 'accessing class hierarchy' stamp: 'SqR 5/25/2000 16:54'!
withAllSubclasses
	"Answer a Set of the receiver, the receiver's descendent's, and the 
	receiver's descendent's subclasses. SqR 5/25/2000 16:53. Much faster."

	^self allSubclasses add: self; yourself! !



More information about the Squeak-dev mailing list