001package es.ucm.fdi.gaia.jcolibri.cbrcore;
002
003import java.util.Collection;
004
005import es.ucm.fdi.gaia.jcolibri.exception.InitializingException;
006
007/**
008 * This interface defines the methods that at least any Case Base must implement
009 * to be transparently used by the framework.
010 * <p>
011 * A Case Base is the in-memory organization of the cases. 
012 * Cases are read from the persistence media an loaded into an implementation of this interface.
013 * 
014 * Further implementations will provide cache mechanisms, optimized organizations, etc.
015 * 
016 * @author Juan A. Recio-GarcĂ­a
017 */
018public interface CBRCaseBase {
019
020    /**
021     * Initializes the case base. This methods recibes the connector that manages the persistence media.
022     *
023     */
024    void init(Connector connector) throws InitializingException;
025
026    /**
027     * DeInitializes the case base.
028     *
029     */
030    void close();
031
032        /**
033         * Returns all the cases available on this case base
034         * 
035         * @return all the cases available on this case base
036         */
037        Collection<CBRCase> getCases();
038        
039        
040    /**
041     * Returns some cases depending on the filter
042     * @param filter a case base filter
043     * @return a collection of cases
044     */
045    Collection<CBRCase> getCases(CaseBaseFilter filter);
046
047
048        /**
049         * Adds a collection of new CBRCase objects to the current case base
050         * 
051         * @param cases to be added
052         */
053        void learnCases(Collection<CBRCase> cases);
054
055        /**
056         * Removes a collection of new CBRCase objects to the current case base
057         * 
058         * @param cases to be removed
059         */
060        void forgetCases(Collection<CBRCase> cases);
061}