Class PackageSorter


  • public final class PackageSorter
    extends Object
    Compares two modules for order. A module is considered less than an other module if the module is a required module of the compared module. Modules are considered equal if they have no relation.

    When sorting, we match this modules position against all dependent modules until all positions are stable. Circular references are evil and are filtered during the module loading process in the package manager.

    Author:
    Thomas Morgner
    • Method Detail

      • sort

        public static void sort​(List<PackageState> modules)
        Sorts the given list of package states. The packages are sorted by their dependencies in a way so that all dependent packages are placed on lower positions than the packages which declared the dependency.
        Parameters:
        modules - the list of modules.