> De: Keith Hodges <
[hidden email]>
> Fecha: Sun, 29 Apr 2007 17:02:52 +0100
> Para: "Edgar J. De Cleene" <
[hidden email]>
> Asunto: Class comment to add to 3.10 if you want it
>
> MCDependencySorter
>
> * #orderedItems has an OrderedCollection of the item Definitions
> that have
> all of their requirements when added.
> * #required A dictionary of Sets, keyed on the 'required'
> item, the Set
> containing the items which require that item
> * #provided A set of provided items, i.e. those which might
> be required.
>
> As each item is added using #add, or #addAll, it obtains the items
> requirements, subtracting those items which it already has 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:
>
> Finally you have:
>
> * #orderedItems - the collection of items
> which should load.
> * #itemsWithMissingRequirements - the collection of items that
> will not yet load.
> * #externalRequirements - the list of requirements still
> needed after
> all the internal provisions
> are accounted for.
>
>
> Typical use (e.g. MCPackageLoader-#analyse) is to instantiate 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.