/*
recursive function to get a dependencie Set which is ordered so that no depencies exist to a later on entry
@return Set with all the dependencies.
330529
function getAllDependencies(allVariables, currentKey, dependencies = new Set()) {

    if (!allVariables[currentKey].dependencies.length) {

        dependencies.add(`${currentKey}: ${allVariables[currentKey].value}`);
        return Array.from(dependencies);
    } else {

        allVariables[currentKey].dependencies.forEach(dependecy => {
            getAllDependencies(allVariables, dependecy, dependencies).forEach(newDependency => dependencies.add(newDependency));
        });

        dependencies.add(`${currentKey}: ${allVariables[currentKey].value}`);
        return Array.from(dependencies);
    }
}
568975
public List<DependencyStructure> getAllDependencies() {
    List<DependencyStructure> deps = Lists.newArrayList();
    if (!isTerminal()) {
      deps.addAll(left.getAllDependencies());
      deps.addAll(right.getAllDependencies());
    }
    deps.addAll(dependencies);
    return deps;
  }
767391
public final Set<String> getBundleDependencies() {
		final Set<String> bundles = new TreeSet<>();
		updateBundleList(bundles);
		return bundles;
	}
851962
function next_dependency(){
		foreach( $this->dependencies as $path => $done ){
			if( ! $done ){
				$this->dependencies[$path] = 1;
				return $path;
			}
		}
		// none
		return null;
	}
903515
private static Set<DependencyDescriptor> getDependenciesTransitively(String scope, ResolvedDependency parent) {
        Stack<ResolvedDependency> stack = new Stack<>();
        stack.push(parent);
        Set<DependencyDescriptor> dependencies = new HashSet<>();
        while (!stack.empty()) {
            ResolvedDependency rd = stack.pop();
            // Skip the parent's artifacts.
            if (rd != parent) {
                rd.getModuleArtifacts().forEach(a -> dependencies.add(asDescriptor(scope, a)));
            }
            rd.getChildren().forEach(d -> {
                if (!stack.contains(d)) {
                    stack.add(d);
                }
            });
        }
        return dependencies;
    }
753282
public Set<URI> getNonTopicrefReferenceSet() {
        final Set<URI> res = new HashSet<>(nonTopicrefReferenceSet);
        res.removeAll(normalProcessingRoleSet);
        res.removeAll(resourceOnlySet);
        return res;
    }
1245625
public Map<String,Set<String>> getDependencies() {
        Map<String,Set<String>> new_deps = new HashMap<String,Set<String>>();
        if (explicitPackages == null) return new_deps;
        for (Name pkg : explicitPackages) {
            Set<Name> set = deps.get(pkg);
            if (set != null) {
                Set<String> new_set = new_deps.get(pkg.toString());
                if (new_set == null) {
                    new_set = new HashSet<String>();
                    // Modules beware....
                    new_deps.put(":"+pkg.toString(), new_set);
                }
                for (Name d : set) {
                    new_set.add(":"+d.toString());
                }
            }
        }
        return new_deps;
    }
86613
public static Set<Dependency> getAllDependencies(final Module module) {
        final Set<Dependency> dependencies = new HashSet<Dependency>();
        dependencies.addAll(module.getDependencies());

        for(final Module submodule: module.getSubmodules()){
            dependencies.addAll(getAllDependencies(submodule));
        }

        return dependencies;
    }
583109
function () {
		var that = this,
				independent, 
				dependencyNotRequired;
		
		promiseIndependent = this.saveFixturesFromArray(independentFixtures);
		promiseDelayedDependency = this.saveFixturesFromArray(delayedDependencyFixtures);
		
		promise = Q.all([ promiseIndependent, promiseDelayedDependency ])
			.then(function(models) {
				return that.saveFixturesFromArray(requiredDependencyFixtures);
			});
		
		return promise;
	}
559916
public Set<ClassModel> getAllClassDependencies() {
		HashSet<ClassModel> result = new HashSet<>();
		ClassModel.getAllClassDependencies(result, this);
		return result;
	}
227093
public DependencyId[] getDependencyIds(){
		DependencyId[] depIds = new DependencyId[configEntry.dependencyIds.length];
		for ( int i=0; i<configEntry.dependencyIds.length; i++ ){
			depIds[i] = new DependencyId(configEntry.dependencyIds[i]);
		}
		return depIds;
	}
433585
private void getAllDependents(Set<PathEntry> result, String name) {
        Set<String> depNames = dependenctRelativePaths.get(name);
        if (depNames == null) {
            return;
        }
        for (String dep : depNames) {
            PathEntry entry = pathEntries.get(dep);
            if (entry != null) {
                result.add(entry);
                getAllDependents(result, dep);
            }
        }
    }
225914
@Override
  public Set<Map.Entry<K, V>> entrySet() {
    if (lazyEntrySet == null) {
      lazyEntrySet = new EntrySet();
    }
    return lazyEntrySet;
  }
1083107
public Set<Dependency> asSet(boolean withChildren) {
        if (withChildren) {
            Set<Dependency> dependencySet = new HashSet<>();
            List<Dependency> dependencyList = asList(false);

            dependencySet.addAll(dependencyList);
            for (Dependency dependency : dependencyList) {
                if (dependency.isInternal()) {
                    dependencySet.addAll(dependency.getDependencies().asSet());
                }
            }

            return dependencySet;
        } else {
            return new HashSet<>(list);
        }
    }
719356
function orderByDependencies(packages) {
  const packageDependencyGraph = pkg =>
    R.pipe(
      allDeps,
      R.map(dependencyName => [dependencyName, pkg.name]),
    )(pkg)

  // :: Array<Package> -> Array<Array<string, string>>
  const dependencyGraph = R.chain(packageDependencyGraph)

  // :: Package -> bool
  const hasNoDependencies = ({ dependencies }) => dependencies.length === 0

  // :: Array<Package>
  const packagesWithNoDependencies = R.pipe(
    R.filter(hasNoDependencies),
    R.map(R.prop('name')),
  )(packages)

  // :: string -> Package
  const findPackageByName = R.map(name =>
    R.find(R.propEq('name', name), packages),
  )

  return R.pipe(
    dependencyGraph,
    toposort,
    R.without(packagesWithNoDependencies),
    R.concat(packagesWithNoDependencies),
    findPackageByName,
  )(packages)
}
251896
@Override
    @SuppressWarnings("ReferenceEquality")
    protected boolean evaluateDependencies(final Dependency dependency, final Dependency nextDependency, final Set<Dependency> dependenciesToRemove) {
        Dependency main;
        //CSOFF: InnerAssignment
        if ((main = getMainGemspecDependency(dependency, nextDependency)) != null) {
            if (main == dependency) {
                mergeDependencies(dependency, nextDependency, dependenciesToRemove);
            } else {
                mergeDependencies(nextDependency, dependency, dependenciesToRemove);
                return true; //since we merged into the next dependency - skip forward to the next in mainIterator
            }
        } else if ((main = getMainSwiftDependency(dependency, nextDependency)) != null) {
            if (main == dependency) {
                mergeDependencies(dependency, nextDependency, dependenciesToRemove);
            } else {
                mergeDependencies(nextDependency, dependency, dependenciesToRemove);
                return true; //since we merged into the next dependency - skip forward to the next in mainIterator
            }
        } else if ((main = getMainAndroidDependency(dependency, nextDependency)) != null) {
            if (main == dependency) {
                mergeDependencies(dependency, nextDependency, dependenciesToRemove);
            } else {
                mergeDependencies(nextDependency, dependency, dependenciesToRemove);
                return true; //since we merged into the next dependency - skip forward to the next in mainIterator
            }
        } else if ((main = getMainDotnetDependency(dependency, nextDependency)) != null) {
            if (main == dependency) {
                mergeDependencies(dependency, nextDependency, dependenciesToRemove);
            } else {
                mergeDependencies(nextDependency, dependency, dependenciesToRemove);
                return true; //since we merged into the next dependency - skip forward to the next in mainIterator
            }
        }
        //CSON: InnerAssignment
        return false;
    }
1192872
public String prettyDependencies() {
        StringBuilder b = new StringBuilder();
        b.append(id()).append('\n');
        for (Iterator<Script> ite = dependencies.iterator(); ite.hasNext(); ) {
            Script n = ite.next();
            prettyDependencies(b, !ite.hasNext(), 0, n);
        }
        return b.toString();
    }