Ruleset.java
上传用户:qing5858
上传日期:2015-10-27
资源大小:6056k
文件大小:1k
源码类别:

搜索引擎

开发平台:

Java

  1. package net.javacoding.jspider.core.rule;
  2. import net.javacoding.jspider.api.model.Decision;
  3. import net.javacoding.jspider.api.model.Site;
  4. import net.javacoding.jspider.core.SpiderContext;
  5. import net.javacoding.jspider.spi.Rule;
  6. import java.net.URL;
  7. /**
  8.  * Interface of a RuleSet, a set of Rules that will be applied as a group
  9.  * on URLs.
  10.  *
  11.  * $Id: Ruleset.java,v 1.8 2003/04/03 16:24:53 vanrogu Exp $
  12.  *
  13.  * @author G黱ther Van Roey
  14.  */
  15. public interface Ruleset {
  16.     /** A general ruleset applied to all urls in the system. */
  17.     public static final int RULESET_GENERAL = 1;
  18.     /** A site-specific ruleset, only applied to urls of that site. */
  19.     public static final int RULESET_SITE = 2;
  20.     /**
  21.      * Applies the ruleset to the given URL.
  22.      * @param context context we're spidering under
  23.      * @param url the url to decide on
  24.      * @param currentSite the site currently being spidered
  25.      * @return Decision object expressing the ruleset's decision about the
  26.      * given url in the given context.
  27.      */
  28.     public Decision applyRules(SpiderContext context, Site currentSite, URL url);
  29.     /**
  30.      * Adds a rule to the ruleset.
  31.      * @param rule rule to be added
  32.      */
  33.     public void addRule(Rule rule);
  34.     /**
  35.      * Returns the type of the ruleset - GENERAL or SITE.
  36.      * @return type of the ruleset
  37.      */
  38.     public int getType ( );
  39. }