private void processFilterNodeFromLeaf(ModuleDescriptor node, Set toKeep, Map moduleIdMap) {
for (Iterator iter = moduleIdMap.values().iterator(); iter.hasNext();) {
ModuleDescriptor md = (ModuleDescriptor) iter.next();
DependencyDescriptor[] deps = md.getDependencies();
for (int i = 0; i < deps.length; i++) {
ModuleId id = deps[i].getDependencyId();
if (node.getModuleRevisionId().getModuleId().equals(id) && !toKeep.contains(md)) {
toKeep.add(md);
if (!getOnlydirectdep()) {
processFilterNodeFromLeaf(md, toKeep, moduleIdMap);
}