001    /**
002     * DisplayCasesIfNumberAndChangeNavigation.java
003     * jCOLIBRI2 framework. 
004     * @author Juan A. Recio-García.
005     * GAIA - Group for Artificial Intelligence Applications
006     * http://gaia.fdi.ucm.es
007     * 05/11/2007
008     */
009    package jcolibri.extensions.recommendation.askingAndProposing;
010    
011    import java.util.Collection;
012    
013    import jcolibri.cbrcore.CBRCase;
014    
015    /**
016     * Method that implements the display condition for the Expert Clerk system.<br>
017     * See recommender 8 for details.<br>
018     * If the number of cases is less than a threshold it returns true and sets the navigation mode to NbP.<br>
019     * If the number of cases is more than a threshold it returns false and sets the navigation mode to NbA.
020     * 
021     * @author Juan A. Recio-Garcia
022     * @author Developed at University College Cork (Ireland) in collaboration with Derek Bridge.
023     * @version 1.0
024     * @see jcolibri.test.recommenders.rec8.Houses8
025     */
026    public class DisplayCasesIfNumberAndChangeNavigation
027    {
028        /**
029         * Navigation mode enum.<br>
030         * NBA: Navigation by Asking.<br>
031         * NBP: Navigation by Proposing.<br>
032         * @author Juan A. Recio-Garcia
033         * @version 1.0
034         *
035         */
036        public enum NavigationMode {NBA, NBP}; 
037        
038        /**
039         * If the number of cases is less than max it returns true and sets the navigation mode to NbP.<br>
040         * If the number of cases is more than max it returns false and sets the navigation mode to NbA.
041         * @param max is the threshold
042         * @param cases is the working cases set
043         */
044        public static boolean displayCasesIfNumberAndChangeNavigation(int max, Collection<CBRCase> cases)
045        {
046            if(cases.size()<max)
047            {
048                AskingAndProposingPreferenceElicitation.changeTo(NavigationMode.NBP);
049                return true;
050            }
051            else
052            {
053                AskingAndProposingPreferenceElicitation.changeTo(NavigationMode.NBA);
054                return false;
055            }
056            
057            
058    
059                
060        }
061    }