    1   /* $Id: FetchStatusNotMatchesRegExpDecideRule.java 4649 2006-09-25 17:16:55Z paul_jack $
    2   *
    3   * Created on Sep 4, 2006
    4   *
    5   * Copyright (C) 2006 Olaf Freyer.
    6   *
    7   * This file is part of the Heritrix web crawler (crawler.archive.org).
    8   *
    9   * Heritrix is free software; you can redistribute it and/or modify
    10  * it under the terms of the GNU Lesser Public License as published by
    11  * the Free Software Foundation; either version 2.1 of the License, or
    12  * any later version.
    13  *
    14  * Heritrix is distributed in the hope that it will be useful,
    15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17  * GNU Lesser Public License for more details.
    18  *
    19  * You should have received a copy of the GNU Lesser Public License
    20  * along with Heritrix; if not, write to the Free Software
    21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    22  */
    23  package org.archive.crawler.deciderules;
    24
    25
    26  public class FetchStatusNotMatchesRegExpDecideRule
    27  extends FetchStatusMatchesRegExpDecideRule {
    28
    29      private static final long serialVersionUID = -2220182698344063577L;
    30  //    private  final Logger logger = Logger.getLogger(this.getClass().getName());
    31
    32      /***
    33       * Usual constructor.
    34       * @param name
    35       */
    36      public FetchStatusNotMatchesRegExpDecideRule(String name) {
    37          super(name);
    38          setDescription("FetchStatusNotMatchesRegExpDecideRule. Applies " +
    39              "configured decision to any URI that has a fetch status *not* " +
    40              "matching the given regular expression.");
    41      }
    42
    43      /***
    44       * Evaluate whether given object's FetchStatus does not match
    45       * configured regexp (by reversing the superclass's answer).
    46       *
    47       * @param object Object to make decision about.
    48       * @return true if the regexp is not matched
    49       */
    50      protected boolean evaluate(Object object) {
    51          return ! super.evaluate(object);
    52      }
    53  }