/*
 * Copyright (C) 1999-2004 <a href="mailto:mandarax@jbdietrich.com">Jens Dietrich</a>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package org.mandarax.kernel;

import java.util.Comparator;
/**
 * Extended knowledge base class that offers additional functionality
 * to maintain the knowledge base. In particular, there are methods to
 * order clause sets either manually (move operations) or automatically
 * (comparators determining the order of clauses). <br>
 * If a comparator is set, the move operations should be disabled (do nothing). 
 * Therefore, the <code>isMoveEnabled</code> operation should return 
 * <code>getComperator()!=null</code>.
 * <strong>Warning:</strong> Note that the order of the clause sets often
 * affects the results of a query (e.g., conflict resolution by assigning
 * priorities).
 * @author <A HREF="mailto:mandarax@jbdietrich.com">Jens Dietrich</A>
 * @version 3.3.1 <9 August 2004>
 * @since 1.1
 */
public interface ExtendedKnowledgeBase extends KnowledgeBase {

    /**
     * Move a clause set down. (= assign a lower priority)
     * @param cs the respective clause set
     */
    void moveDown(ClauseSet cs);

    /**
     * Move a clause set to the button. (= assign the lowest priority)
     * @param cs the respective clause set
     */
    void moveToBottom(ClauseSet cs);

    /**
     * Move a clause set to the top. (= assign the highest priority)
     * @param cs the respective clause set
     */
    void moveToTop(ClauseSet cs);

    /**
     * Move a clause set up. (= assign a higher priority)
     * @param cs the respective clause set
     */
    void moveUp(ClauseSet cs);
    
    /**
     * Set a comperator.
     * @param comp a comparator
     */
    void setComparator(java.util.Comparator comp);
    /**
     * Get the comperator.
     * @param comp a comparator
     */
    Comparator getComparator();
    /**
     * Indicates whether the (manual) move operations are enabled.
     * @return a boolean
     */
    boolean isMoveEnabled();
    /**
     * Resort all entries. Does nothing if the comparator is null.
     */
    void resort();
    /**
     * Resort all entries for a particular key. Does nothing if the comparator is null.
     * @param key a key (a predicate)
     */
    void resort(Object key);
    
}
