[Pkg] Sake : Sake-Core-kph.81.mcz
squeak-dev-noreply at lists.squeakfoundation.org
squeak-dev-noreply at lists.squeakfoundation.org
Sat Dec 13 00:06:18 UTC 2008
A new version of Sake-Core was added to project Sake :
http://www.squeaksource.com/Sake/Sake-Core-kph.81.mcz
==================== Summary ====================
Name: Sake-Core-kph.81
Author: kph
Time: 13 December 2008, 12:06:16 am
UUID: 4dcc5e23-771a-4276-8ad9-cf657a4c198c
Ancestors: Sake-Core-kph.80
use sort on { } asTask
=============== Diff against Sake-Core-kph.80 ===============
Item was changed:
----- Method: SakeTask>>sort (in category 'as yet unclassified') -----
sort
"if your top level is a collection of tasks we presort them"
actionBlock ifNotNil: [ self error: 'no need to presort' ].
+ actionBlock := self allPriorTasksInOrder.
- actionBlock := self withAllPriorTasksInOrder.
priors := nil.
^ self!
Item was added:
+ ----- Method: SakeTask>>allPriorTasksOn:down: (in category 'ordering algorithm') -----
+ allPriorTasksOn: aCollection down: downstream
+ "recusively add to collection of all the dependant tasks "
+
+
+ self priorTasks do: [ :task |
+ (downstream includes: task) ifTrue: [ self error: 'loop' ].
+ aCollection add: task.
+ task allPriorTasksOn: aCollection down: ((downstream copy) add: task; yourself).
+ ].
+
+ ^ aCollection
+ !
Item was added:
+ ----- Method: SakeTask>>allPriorTasksInOrder (in category 'ordering algorithm') -----
+ allPriorTasksInOrder
+ "return a collection of the dependent tasks such that when possible any dependencies of a task are ordered before that task"
+ "The present algorithm is simple but slow..."
+
+ | remainingTasks orderedTasks tasksToAdd |
+
+ remainingTasks := self allPriorTasksOn: Set new down: Set new.
+
+ orderedTasks := OrderedCollection new.
+
+ "each time through this loop, add to orderedTasks any tasks whose dependencies are not in remainingTasks"
+ [ tasksToAdd := remainingTasks select: [ :t | t priorTasks noneSatisfy: [ :dep | (remainingTasks like: dep) ~= nil ] ].
+ tasksToAdd isEmpty not
+ ] whileTrue: [
+ orderedTasks addAll: tasksToAdd.
+ remainingTasks := remainingTasks difference: tasksToAdd ].
+
+ orderedTasks addAll: remainingTasks.
+
+ ^orderedTasks
+
+ !
Item was removed:
- ----- Method: SakeTask>>withAllPriorTasksInOrder (in category 'ordering algorithm') -----
- withAllPriorTasksInOrder
- "return a collection of the dependent tasks such that when possible any dependencies of a task are ordered before that task"
- "The present algorithm is simple but slow..."
-
- | remainingTasks orderedTasks tasksToAdd |
-
- remainingTasks := self withAllPriorTasksOn: Set new down: Set new.
-
- orderedTasks := OrderedCollection new.
-
- "each time through this loop, add to orderedTasks any tasks whose dependencies are not in remainingTasks"
- [ tasksToAdd := remainingTasks select: [ :t | t priorTasks noneSatisfy: [ :dep | (remainingTasks like: dep) ~= nil ] ].
- tasksToAdd isEmpty not
- ] whileTrue: [
- orderedTasks addAll: tasksToAdd.
- remainingTasks := remainingTasks difference: tasksToAdd ].
-
- orderedTasks addAll: remainingTasks.
-
- ^orderedTasks
-
- !
Item was removed:
- ----- Method: SakeTask>>privateRunAllOrdered (in category 'as yet unclassified') -----
- privateRunAllOrdered
-
- "we ensure that we obtain the task to run from the overall set of tasks"
- | tasks tasksSet |
-
- tasks := self withAllPriorTasksInOrder.
-
- tasksSet := tasks asSet.
-
- tasks do: [ :each |
-
- each runLevel: runLevel.
- each privateRun: tasksSet .
-
- ].
-
- ^ result!
Item was removed:
- ----- Method: SakeTask>>withAllPriorTasksOn:down: (in category 'ordering algorithm') -----
- withAllPriorTasksOn: aCollection down: downstream
- "recusively add to collection of all the dependant tasks "
- | ds |
- aCollection add: self.
-
- (downstream includes: self) ifTrue: [ self error: 'loop' ].
-
- (ds := downstream copy) add: self.
-
- self priorTasks do: [ :task |
- task withAllPriorTasksOn: aCollection down: ds.
- ].
-
- ^ aCollection
- !
More information about the Packages
mailing list