class FirstNamedRobotsPolicy extends RobotsPolicy {
    
    /** list of user-agents to try; if any are allowed, a URI will be crawled */
    protected List<String> candidateUserAgents = new LinkedList<String>();
    public List<String> getCandidateUserAgents() {
        return candidateUserAgents;
    }
    public void setCandidateUserAgents(List<String> candidateUserAgents) {
        this.candidateUserAgents = candidateUserAgents;
    }
    
    /** whether to adopt the user-agent that is allowed for the fetch */
    protected boolean shouldMasquerade = true;
    public boolean getShouldMasquerade() {
        return shouldMasquerade;
    }
    public void setShouldMasquerade(boolean shouldMasquerade) {
        this.shouldMasquerade = shouldMasquerade;
    }
    
    /** whether to obey the 'nofollow' directive in an HTML META ROBOTS element */
    protected boolean obeyMetaRobotsNofollow = true; 
    public boolean isObeyMetaRobotsNofollow() {
        return obeyMetaRobotsNofollow;
    }
    public void setObeyMetaRobotsNofollow(boolean obeyMetaRobotsNofollow) {
        this.obeyMetaRobotsNofollow = obeyMetaRobotsNofollow;
    }
    
    @Override
    public boolean allows(String userAgent, CrawlURI curi, Robotstxt robotstxt) {<FILL_FUNCTION_BODY>}
    
    @Override
    public boolean obeyMetaRobotsNofollow() {
        return obeyMetaRobotsNofollow;
    }
}

        RobotsDirectives directives = robotstxt.getDirectivesFor(userAgent, false);
        if(directives!=null) {
            return directives.allows(getPathQuery(curi));
        }
        
        for(String candidate : candidateUserAgents) {
            directives = robotstxt.getDirectivesFor(candidate, false);
            if(directives!=null) {
                if(shouldMasquerade) {
                    curi.setUserAgent(candidate);
                }
                return directives.allows(getPathQuery(curi));
            }
        }
        return robotstxt.getDirectivesFor(userAgent).allows(getPathQuery(curi));
    
<methods>public non-sealed void <init>() ,public abstract boolean allows(java.lang.String, org.archive.modules.CrawlURI, org.archive.modules.net.Robotstxt) ,public java.lang.String getPathQuery(org.archive.modules.CrawlURI) ,public abstract boolean obeyMetaRobotsNofollow() <variables>public static Map<java.lang.String,org.archive.modules.net.RobotsPolicy> STANDARD_POLICIES