for(String rootModuleId : toLoad.keySet()) {
Set<Version> versions = toLoad.get(rootModuleId);
for(Version version : versions) {
String ver = version.getId();
Map<String, String> metadata = version.getMetadata();
ModuleDependency md = deps.get(rootModuleId).get(ver);
Set<Module> modules = new HashSet<Module>();
Queue<ModuleDependency> depends = new LinkedList<ModuleDependency>();
depends.add(md);
while (!depends.isEmpty()) {
ModuleDependency d = depends.poll();
modules.add(new Module(d.getId(), d.getVersion()));
depends.addAll(d.getDependencies());
}
entries.add(new ImportEntry(rootModuleId, ver, metadata, modules, in));
}
}