public static Set<ProjectRef> targets(final Collection<ProjectRelationship<?>> relationships) { final Set<ProjectRef> results = new HashSet<ProjectRef>(); for (final ProjectRelationship<?> rel : relationships) { results.add(rel.getTarget()); } return results; }
public static Set<ProjectVersionRef> declarers( final Collection<ProjectRelationship<?>> relationships) { final Set<ProjectVersionRef> results = new HashSet<ProjectVersionRef>(); for (final ProjectRelationship<?> rel : relationships) { results.add(rel.getDeclaring()); } return results; }
public static void filter( final Set<ProjectRelationship<?>> rels, final RelationshipType... types) { if (rels == null || rels.isEmpty()) { return; } if (types == null || types.length < 1) { return; } Arrays.sort(types); for (final Iterator<ProjectRelationship<?>> iterator = rels.iterator(); iterator.hasNext(); ) { final ProjectRelationship<?> rel = iterator.next(); if (Arrays.binarySearch(types, rel.getType()) < 0) { iterator.remove(); } } }
public final boolean accept(final ProjectRelationship<?> rel) { if (types.contains(rel.getType())) { final boolean accepted = doAccept(rel); if (accepted) { // logger.info( "ACCEPT relationship: %s. Type is in: %s, and was accepted in // second-level analysis", rel, // types ); } else { // logger.info( "REJECT relationship: %s. Type is in: %s but was rejected by // second-level analysis.", rel, // types ); } return accepted; } // else // { // logger.info( "REJECT relationship: %s. Type is not in: %s", rel, types ); // } return false; }