public Set<HierarchyNode> getParentsFor(HierarchyNode node) { Validate.notNull(node, "Hierarchy node can't be null"); Set<HierarchyNode> parents = new LinkedHashSet<HierarchyNode>(); for (HierarchyNode n : nodes.values()) { if (n.getDependencies().contains(node.getFile())) { parents.add(n); } } return parents; }
public Hierarchy(Project project, Collection<HierarchyNode> collection) { Validate.notNull(project, "Project can't be null"); Validate.notNull(collection, "Nodes can't be null"); this.project = EntityUtils.lightweightClone(project); this.nodes = new LinkedHashMap<File, HierarchyNode>(collection.size()); for (HierarchyNode n : collection) { this.nodes.put(n.getFile(), n); } this.initNodes(); }