Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Monticello Technical
Last updated at 3:41 pm UTC on 8 April 2017

MCDependencySorter


As each item is added using #add, or #addAll, it collates its requirements, subtracting those items listed as #provided. Items with all of their requirements are added to the #orderedItems. In doing so each of those items is added to the #provided set. When adding to the provided set, a check is made in the #required items to see if the newly provided item is required. If so, it is cleared out of the required list and those items that were waiting for that requirement are then added via #add:/#addAll:

At the end you are left with

Typical use (e.g. MCPackageLoader-#analyse) is to instanciate via #items, which adds all of the items and sorts them as they are added. Then calling #addExternalProvisions: with the set of class keys avalable in the image. This gives the ready to load result.

The #sortItems: instanciation method sorts the items as above, it assumes that all of the #externalProvisions are available so as to get the complete sorted order. This is used when writing the definitions.