*/
HashMap<String, ModuleRequiredCheck> required = new HashMap();
Iterator<Map.Entry<String, ModuleInfo>> it = removedModules.entrySet().iterator();
while (it.hasNext() == true) {
Map.Entry<String, ModuleInfo> entry = it.next();
ModuleInfo info = entry.getValue();
required.put(info.getName(), new ModuleRequiredCheck(info));
}
/*
* Fetch a map of installed modules. Loop through each and add as
* requirements to the modules if they are being asked to be removed.
*/
Map<String, Module> present = this.getInstalledModules();
Iterator<Map.Entry<String, Module>> it2 = present.entrySet().iterator();
while (it2.hasNext() == true) {
/*
* Fetch the map of modules that this module requires
*/
Map.Entry<String, Module> entry = it2.next();
String moduleName = entry.getKey();
Module module = entry.getValue();
ModuleInfo info = module.getInfo();
ModuleRequires requirements = module.getRequires();
/*
* Loop through each of the requirements of the module and add it
* to the ModuleRequiredCheck, if it exists. (If it does exist, it
* means we are checking to see if the module is still required and
* we want to flag it with this module).
*/
for (ModuleInfo infoRequires : requirements.getRequires()) {
ModuleRequiredCheck check = required.get(infoRequires.getName());
if (check != null) {
check.addRequiresModuleInfo(info);
}
}
}
/*
* Next we need to loop through and see which modules are no longer
* required. When a module is no longer required, we should add it to
* the map of satisfied modules and also remove it from all of the
* other module requirement checks. We continue checking until we can
* find no more additional modules that are no longer requires.
*/
boolean found = true;
while (found == true) {
found = false;
Iterator<Map.Entry<String, ModuleRequiredCheck>> it4 = required.entrySet().iterator();
while (it4.hasNext() == true) {
Map.Entry<String, ModuleRequiredCheck> entry = it4.next();
/*
* If the module is no longer required, then...
*/
if (entry.getValue().isRequired() == false) {
/* Add it to the 'satified map' */
ModuleInfo moduleInfo = entry.getValue().getCheckedModuleInfo();
satisfied.put(moduleInfo.getName(), moduleInfo);
/* Remove it from the dependency map using the iterator */
it4.remove();
/*