[TOC]

org.apache.nutch.urlfilter.api

Class RegexRule


public abstract class RegexRule
extends Object

A generic regular expression rule.

  • Author:
  • Jérôme Charron

Constructor Summary

Constructors Modifier Constructor and Description protected RegexRule(boolean sign, String regex) Constructs a new regular expression rule.

Method Summary

Methods Modifier and Type Method and Description protected boolean accept() Return if this rule is used for filtering-in or out. protected abstract boolean match(String url) Checks if a url matches this rule.

-    

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

-  

RegexRule

protected RegexRule(boolean sign,
         String regex)

Constructs a new regular expression rule.

  - Parameters:
  - <code>sign</code> - specifies if this rule must filter-in or filter-out. A <code>true</code> value means that any url matching this rule must be accepted, a <code>false</code> value means that any url matching this rule must be rejected.
  - <code>regex</code> - is the regular expression used for matching (see [<code>match(String)</code>](../../../../../org/apache/nutch/urlfilter/api/RegexRule.html#match(java.lang.String)) method).       

Method Detail

-  

accept

protected boolean accept()

Return if this rule is used for filtering-in or out.

  - Returns:
  - <code>true</code> if any url matching this rule must be accepted, otherwise <code>false</code>.       
-  

match

protected abstract boolean match(String url)

Checks if a url matches this rule.

  - Parameters:
  - <code>url</code> - is the url to check. 
  - Returns:
  - <code>true</code> if the specified url matches this rule, otherwise <code>false</code>.      

Copyright © 2014 The Apache Software Foundation