class SupplementaryLinksScoper extends Scoper {

    @SuppressWarnings("unused")
    private static final long serialVersionUID = -3L;

    private static Logger LOGGER =
        Logger.getLogger(SupplementaryLinksScoper.class.getName());
    

    {
        setSupplementaryRule(new AcceptDecideRule());
    }
    public DecideRule getSupplementaryRule() {
        return (DecideRule) kp.get("supplementaryRule");
    }
    /**
     * DecideRules which if their final decision on a link is
     * REJECT, cause the link to be ruled out-of-scope, even
     * if it had previously been accepted by the main scope.
     */
    public void setSupplementaryRule(DecideRule rule) {
        kp.put("supplementaryRule", rule);
    }
    
    public SupplementaryLinksScoper() {
        super();
    }

    
    protected boolean shouldProcess(CrawlURI puri) {
        return puri instanceof CrawlURI;
    }
    
    
    protected void innerProcess(final CrawlURI puri) {
        CrawlURI curi = (CrawlURI)puri;
        
        // If prerequisites or no links, nothing to be done in here.
        if (curi.hasPrerequisiteUri() || curi.getOutLinks().isEmpty()) {
            return;
        }
        
//        Collection<CrawlURI> inScopeLinks = new HashSet<CrawlURI>();
        Iterator<CrawlURI> iter = curi.getOutLinks().iterator();
        while (iter.hasNext()) {
            CrawlURI cauri = iter.next();
            if (!isInScope(cauri)) {
                iter.remove();
            }
        }
//        for (CrawlURI cauri: curi.getOutCandidates()) {
//            if (isInScope(cauri)) {
//                inScopeLinks.add(cauri);
//            }
//        }
        // Replace current links collection w/ inscopeLinks.  May be
        // an empty collection.
//        curi.replaceOutlinks(inScopeLinks);
    }
    
    protected boolean isInScope(CrawlURI caUri) {<FILL_FUNCTION_BODY>}
    
    /**
     * Called when a CrawlURI is ruled out of scope.
     * @param caUri CrawlURI that is out of scope.
     */
    protected void outOfScope(CrawlURI caUri) {
        if (!LOGGER.isLoggable(Level.INFO)) {
            return;
        }
        LOGGER.info(caUri.getUURI().toString());
    }
}

        // TODO: Fix filters so work on CrawlURI.
        CrawlURI curi = (caUri instanceof CrawlURI)?
            (CrawlURI)caUri:
            new CrawlURI(caUri.getUURI());
        boolean result = false;
        DecideRule seq = getSupplementaryRule();
        if (seq.decisionFor(curi) == DecideResult.ACCEPT) {
            result = true;
            if (LOGGER.isLoggable(Level.FINER)) {
                LOGGER.finer("Accepted: " + caUri);
            }
        } else {
            outOfScope(caUri);
        }
        return result;
    
<methods>public void <init>() ,public boolean getLogToFile() ,public org.archive.crawler.reporting.CrawlerLoggerModule getLoggerModule() ,public org.archive.modules.deciderules.DecideRule getScope() ,public boolean isRunning() ,public void setLogToFile(boolean) ,public void setLoggerModule(org.archive.crawler.reporting.CrawlerLoggerModule) ,public void setScope(org.archive.modules.deciderules.DecideRule) ,public void start() ,public void stop() <variables>protected java.util.logging.Logger fileLogger,protected boolean isRunning,protected org.archive.crawler.reporting.CrawlerLoggerModule loggerModule,protected org.archive.modules.deciderules.DecideRule scope