#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 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
#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 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.