legacy/src/main/java/thredds/cataloggen/config/DatasetFilter.java
private boolean match(InvDataset dataset) {
    // Check whether this filter applies to the given dataset.
    if (this.getParentDatasetSource().isCollection(dataset) && !this.applyToCollectionDatasets)
      return (false);
    if ((!this.getParentDatasetSource().isCollection(dataset)) && !this.applyToAtomicDatasets)
      return (false);

    // Set the default matchPatternTarget so old versions still work.
    if (this.matchPatternTarget == null) {
      if (this.getParentDatasetSource().isCollection(dataset)) {
        this.setMatchPatternTarget("name");
      } else {
        this.setMatchPatternTarget("urlPath");
      }
    }

    if (this.type == DatasetFilter.Type.REGULAR_EXPRESSION) {
      boolean isMatch;
      if (this.getMatchPatternTarget().equals("name")) {
        java.util.regex.Matcher matcher = this.regExpPattern.matcher(dataset.getName());
        isMatch = matcher.find();
      } else if (this.getMatchPatternTarget().equals("urlPath")) {
        java.util.regex.Matcher matcher = this.regExpPattern.matcher(((InvDatasetImpl) dataset).getUrlPath());
        isMatch = matcher.find();
      } else {
        // ToDo deal with any matchPatternTarget (XPath-ish)
        isMatch = false;
      }

//      // Invert the meaning of a match (accept things that don't match).
//      if ( this.isRejectMatchingDatasets())
//      {
//        // If match, return false.
//        return( regExpMatch == null ? true : false );
//      }
//      // Don't invert (a match is a match).
//      else
//      {
      // If match, return true.
      return (isMatch);
//      }
    } else {
      System.err.println("WARNING -- DatasetFilter.accept(): unsupported type" +
              " <" + this.type.toString() + ">.");
      return (false);
      // @todo think about exceptions.
      //throw new java.lang.Exception( "DatasetFilter.accept():" +
      //  " unsupported type <" + this.type.toString() + ">.");
    }

  }
private boolean match(InvDataset dataset) {
    // Check whether this filter applies to the given dataset.
    if (this.getParentDatasetSource().isCollection(dataset) && !this.applyToCollectionDatasets)
      return (false);
    if ((!this.getParentDatasetSource().isCollection(dataset)) && !this.applyToAtomicDatasets)
      return (false);

    // Set the default matchPatternTarget so old versions still work.
    if (this.matchPatternTarget == null) {
      if (this.getParentDatasetSource().isCollection(dataset)) {
        this.setMatchPatternTarget("name");
      } else {
        this.setMatchPatternTarget("urlPath");
      }
    }

    if (this.type == DatasetFilter.Type.REGULAR_EXPRESSION) {
      boolean isMatch;
      if (this.getMatchPatternTarget().equals("name")) {
        java.util.regex.Matcher matcher = this.regExpPattern.matcher(dataset.getName());
        isMatch = matcher.find();
      } else if (this.getMatchPatternTarget().equals("urlPath")) {
        java.util.regex.Matcher matcher = this.regExpPattern.matcher(((InvDatasetImpl) dataset).getUrlPath());
        isMatch = matcher.find();
      } else {
        // ToDo deal with any matchPatternTarget (XPath-ish)
        isMatch = false;
      }

//      // Invert the meaning of a match (accept things that don't match).
//      if ( this.isRejectMatchingDatasets())
//      {
//        // If match, return false.
//        return( regExpMatch == null ? true : false );
//      }
//      // Don't invert (a match is a match).
//      else
//      {
      // If match, return true.
      return (isMatch);
//      }
    } else {
      System.err.println("WARNING -- DatasetFilter.accept(): unsupported type" +
              " <" + this.type.toString() + ">.");
      return (false);
      // @todo think about exceptions.
      //throw new java.lang.Exception( "DatasetFilter.accept():" +
      //  " unsupported type <" + this.type.toString() + ">.");
    }

  }
Test whether the given dataset matches the filter criteria.

@param dataset - the dataset to be tested.
@return true if and only if the dataset matches the filter criteria.