/**
   * Checks if the given artifact matches the module descriptor.
   *
   * @param artifact the artifact to match.
   * @return <code>true</code> if the module descriptor matches the given artifact, <code>false
   *     </code> otherwise.
   */
  public MatchContext match(final Artifact artifact) {
    final MatchContext includesContext = cludes(includes, artifact);
    final MatchContext excludesContext = cludes(excludes, artifact);

    final boolean result = (includesContext.isMatched() && !excludesContext.isMatched());
    if (includesContext.isMatched()) {
      return new DelegationMatchContext(result, includesContext);
    } else {
      return new SingleMatchContext(result);
    }
  }
 private MatchContext cludes(final List<ArtifactClusion> clusions, final Artifact artifact) {
   if (clusions != null) {
     for (final ArtifactClusion clusion : clusions) {
       final MatchContext matchContext = clusion.matches(artifact);
       if (matchContext.isMatched()) {
         return matchContext;
       }
     }
   }
   return new SingleMatchContext(false);
 }