Skip to content

Commit

Permalink
Improve code readability.
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed May 10, 2020
1 parent 971a92b commit 23282e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/Chanel/Chanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,9 @@ Chanel class >> worldMenuOn: aBuilder [

{ #category : #cleaning }
Chanel >> cleanUsing: cleaners [
| availableCleaners sortResult |
"Use topological sort to sort the cleaners to get the best effect possible with this set of cleaners."
availableCleaners := cleaners select: [ :each | each isAvailableForPharo: self minimalPharoVersion ].

sortResult := (MalTopologicalSorting nodes: availableCleaners incomingEdgesProperty: #requirements) run.

self cleanWithSelectedCleaners: (sortResult collect: #model)
self cleanWithSelectedCleaners: (MalTopologicalSorting sort: (cleaners select: [ :each | each isAvailableForPharo: self minimalPharoVersion ]) followingIncomingProperty: #requirements)
]

{ #category : #cleaning }
Expand Down
6 changes: 6 additions & 0 deletions src/Chanel/MalTopologicalSorting.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Extension { #name : #MalTopologicalSorting }

{ #category : #'*Chanel' }
MalTopologicalSorting class >> sort: nodes followingIncomingProperty: aValuable [
^ (self nodes: nodes incomingEdgesProperty: aValuable) run collect: #model
]

0 comments on commit 23282e1

Please sign in to comment.