Exemple #1
0
  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;
  }