Set<RefClass> (RefPackage aPackage, RefClass classToProcess) { final Set<RefClass> out = new HashSet<>(); final Set<RefClass> dependencies = DependencyUtils.calculateDependenciesForClass(classToProcess); for (RefClass dependency : dependencies) { if (packageContainsClass(aPackage, dependency)) { out.add(dependency); } } final Set<RefClass> dependents = DependencyUtils.calculateDependentsForClass(classToProcess); for (RefClass dependent : dependents) { if (packageContainsClass(aPackage, dependent)) { out.add(dependent); } } return out; }