Another Question
Blacktooth
bt at whitestar.soark.net
Wed Dec 22 11:41:28 UTC 1999
> >On the Class side of this attached object in the Initialize-Release
> >Category is a method called 'buildSkillReferences'.
>
> To be honest, I don't understand that method. It's much too big.
It had changed it many times, sometimes getting very close to the result
I needed, but I never got there exactly. I got frustrated, and went to
brute force mode. Things got really ugly from there.
To make a long story short, using 'removeFirst' and 'addLast' and doing
away entirely with the 'do:' solved my problem. The offending piece
of code now looks like this:
refQue := OrderedCollection new.
storage := OrderedCollection new.
tempRefs keysDo: [ :refKey |
tempDeps := OrderedCollection newFrom: (tempRefs at: refKey).
tempDeps do: [ :i | refQue add: i. ].
[ refQue isEmpty ] whileFalse:
[ temp := (refQue first).
storage addLast: temp.
(tempRefs includesKey: temp)
ifTrue: [ (tempRefs at: temp) do: [ :i | refQue addLast: i ].].
refQue removeFirst. ].
self skillReferences at: refKey put: storage asArray.
storage := OrderedCollection new.
refQue := OrderedCollection new. ].
A simple queue was all I needed.
BT
More information about the Squeak-dev
mailing list
|