Package org.jfree.base.modules
Class PackageSorter
java.lang.Object
org.jfree.base.modules.PackageSorter
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
An Internal wrapper class which collects additional information on the given module. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ArrayList
collectSubsystemModules
(Module childMod, HashMap moduleMap) Collects all directly dependent subsystems.private static boolean
isBaseModule
(Module mod, ModuleInfo mi) Checks, whether a module is a base module of an given module.private static int
searchModulePosition
(PackageSorter.SortModule smodule, HashMap moduleMap) Computes the new module position.static void
Sorts the given list of package states.
-
Constructor Details
-
PackageSorter
private PackageSorter()DefaultConstructor.
-
-
Method Details
-
sort
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.
-
searchModulePosition
Computes the new module position. This position is computed according to the dependent modules and subsystems. The returned position will be higher than the highest dependent module position.- Parameters:
smodule
- the sort module for that we compute the new positon.moduleMap
- the map with all modules.- Returns:
- the new positon.
-
isBaseModule
Checks, whether a module is a base module of an given module.- Parameters:
mod
- the module which to checkmi
- the module info of the suspected base module.- Returns:
- true, if the given module info describes a base module of the given module, false otherwise.
-
collectSubsystemModules
Collects all directly dependent subsystems.- Parameters:
childMod
- the module which to checkmoduleMap
- the map of all other modules, keyed by module class.- Returns:
- the list of all dependent subsystems.
-