public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date, ResolveReport report, boolean validate) { if (md == null) { throw new NullPointerException("module descriptor must not be null"); } if (cache==null) { cache = getDefaultCache(); } if (confs.length == 1 && confs[0].equals("*")) { confs = md.getConfigurationsNames(); }  Map dependenciesMap = new HashMap(); Date reportDate = new Date(); for (int i = 0; i < confs.length; i++) { Configuration configuration = md.getConfiguration(confs[i]); if (configuration == null) { Message.error("asked configuration not found in "+md.getModuleRevisionId()+": "+confs[i]); } else { ConfigurationResolveReport confReport = null; if (report != null) { confReport = report.getConfigurationReport(confs[i]); if (confReport == null) { confReport = new ConfigurationResolveReport(this, md, confs[i], reportDate, cache); report.addReport(confs[i], confReport); } }  ResolveData data = new ResolveData(this, cache, date, confReport, validate, dependenciesMap); IvyNode node = new IvyNode(data, md, confs[i], true); node.setRootModuleConf(confs[i]); fetchDependencies(node, confs[i], false); } }    Collection dependencies = new HashSet(dependenciesMap.size()); for (Iterator iter = dependenciesMap.values().iterator(); iter.hasNext();) { IvyNode dep = (IvyNode) iter.next(); if (dep != null) { dependencies.add(dep); } } List sortedDependencies = sortNodes(dependencies); Collections.reverse(sortedDependencies);       for (ListIterator iter = sortedDependencies.listIterator(); iter.hasNext();) { IvyNode node = (IvyNode)iter.next(); if (!node.isCompletelyEvicted()) { for (int i = 0; i < confs.length; i++) { IvyNode.Caller[] callers = node.getCallers(confs[i]); boolean allEvicted = callers.length > 0; for (int j = 0; j < callers.length; j++) { if (callers[j].getModuleRevisionId().equals(md.getModuleRevisionId())) {  allEvicted = false; break; } else { IvyNode callerNode = (IvyNode)dependenciesMap.get(callers[j].getModuleRevisionId()); if (callerNode != null && !callerNode.isEvicted(confs[i])) { allEvicted = false; break; } } } if (allEvicted) { Message.verbose("all callers are evicted for "+node+": evicting too"); node.markEvicted(confs[i], null, null, null); } } } }  return (IvyNode[])sortedDependencies.toArray(new IvyNode[sortedDependencies.size()]);
public IvyNode[] getDependencies(URL ivySource, String[] confs, File cache, Date date, boolean validate) throws ParseException, IOException { return getDependencies(ModuleDescriptorParserRegistry.getInstance().parseDescriptor(this, ivySource, validate), confs, cache, date, null, validate);
    public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date, ResolveReport report, boolean validate) {        if (md == null) {            throw new NullPointerException("module descriptor must not be null");        }        if (cache==null) {  // ensure that a cache exists            cache = getDefaultCache();        }        if (confs.length == 1 && confs[0].equals("*")) {            confs = md.getConfigurationsNames();        }                Map dependenciesMap = new HashMap();        Date reportDate = new Date();        for (int i = 0; i < confs.length; i++) {            Configuration configuration = md.getConfiguration(confs[i]);            if (configuration == null) {                Message.error("asked configuration not found in "+md.getModuleRevisionId()+": "+confs[i]);            } else {                ConfigurationResolveReport confReport = null;                if (report != null) {                    confReport = report.getConfigurationReport(confs[i]);                    if (confReport == null) {                        confReport = new ConfigurationResolveReport(this, md, confs[i], reportDate, cache);                        report.addReport(confs[i], confReport);                    }                }                                ResolveData data = new ResolveData(this, cache, date, confReport, validate, dependenciesMap);                IvyNode node = new IvyNode(data, md, confs[i], true);                node.setRootModuleConf(confs[i]);                fetchDependencies(node, confs[i], false);            }        }                        // prune and reverse sort fectched dependencies         Collection dependencies = new HashSet(dependenciesMap.size()); // use a Set to avoids duplicates        for (Iterator iter = dependenciesMap.values().iterator(); iter.hasNext();) {            IvyNode dep = (IvyNode) iter.next();            if (dep != null) {                dependencies.add(dep);            }        }        List sortedDependencies = sortNodes(dependencies);        Collections.reverse(sortedDependencies);        // handle transitive eviction now:        // if a module has been evicted then all its dependencies required         // only by it should be evicted too. Since nodes are now sorted from the more dependent to         // the less one, we can traverse the list and check only the direct parent and not all        // the ancestors        for (ListIterator iter = sortedDependencies.listIterator(); iter.hasNext();) {            IvyNode node = (IvyNode)iter.next();            if (!node.isCompletelyEvicted()) {                for (int i = 0; i < confs.length; i++) {                    IvyNode.Caller[] callers = node.getCallers(confs[i]);                    boolean allEvicted = callers.length > 0;                    for (int j = 0; j < callers.length; j++) {                        if (callers[j].getModuleRevisionId().equals(md.getModuleRevisionId())) {                            // the caller is the root module itself, it can't be evicted                            allEvicted = false;                            break;                                                    } else {                            IvyNode callerNode = (IvyNode)dependenciesMap.get(callers[j].getModuleRevisionId());                                                        if (callerNode != null && !callerNode.isEvicted(confs[i])) {                                allEvicted = false;                                break;                            }                        }                    }                    if (allEvicted) {                        Message.verbose("all callers are evicted for "+node+": evicting too");                        node.markEvicted(confs[i], null, null, null);                    }                }            }        }                return (IvyNode[])sortedDependencies.toArray(new IvyNode[sortedDependencies.size()]);    }