class BaseQueuePrecedencePolicy extends QueuePrecedencePolicy
implements HasKeyedProperties {
    private static final long serialVersionUID = 8312032856661175869L;
    
    protected KeyedProperties kp = new KeyedProperties();
    public KeyedProperties getKeyedProperties() {
        return kp;
    }
    
    {
        setBasePrecedence(3);
    }
    public int getBasePrecedence() {
        return (Integer) kp.get("basePrecedence");
    }
    /** constant precedence to assign; default is 3 (which leaves room
     * for a simple overlay to prioritize queues) */
    public void setBasePrecedence(int precedence) {
        kp.put("basePrecedence", precedence);
    }
    
    /* (non-Javadoc)
     * @see org.archive.crawler.frontier.QueuePrecedencePolicy#queueCreated(org.archive.crawler.frontier.WorkQueue)
     */
    @Override
    public void queueCreated(WorkQueue wq) {
        installProvider(wq);
    }

    /**
     * Install the appropriate provider helper object into the WorkQueue,
     * if necessary. 
     * 
     * @param wq target WorkQueue this policy will operate on
     */
    protected void installProvider(WorkQueue wq) {
        SimplePrecedenceProvider precedenceProvider = 
            new SimplePrecedenceProvider(calculatePrecedence(wq));
        wq.setPrecedenceProvider(precedenceProvider);
    }

    /**
     * Calculate the precedence value for the given queue. 
     * 
     * @param wq WorkQueue
     * @return int precedence value
     */
    protected int calculatePrecedence(WorkQueue wq) {
        return getBasePrecedence();
    }

    /* (non-Javadoc)
     * @see org.archive.crawler.frontier.QueuePrecedencePolicy#queueReevaluate(org.archive.crawler.frontier.WorkQueue)
     */
    @Override
    public void queueReevaluate(WorkQueue wq) {<FILL_FUNCTION_BODY>}
}

        PrecedenceProvider precedenceProvider =
            wq.getPrecedenceProvider();
        // TODO: consider if this fails to replace provider that is 
        // a subclass of Simple when necessary
        if(precedenceProvider instanceof SimplePrecedenceProvider) {
            // reset inside provider
            ((SimplePrecedenceProvider)precedenceProvider).setPrecedence(
                    calculatePrecedence(wq));
        } else {
            // replace provider
            installProvider(wq);
        }
    
<methods>public non-sealed void <init>() ,public abstract void queueCreated(org.archive.crawler.frontier.WorkQueue) ,public abstract void queueReevaluate(org.archive.crawler.frontier.WorkQueue) <variables>