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 */ 009package es.ucm.fdi.gaia.jcolibri.extensions.recommendation.askingAndProposing; 010 011import java.util.Collection; 012 013import es.ucm.fdi.gaia.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 */ 025public class DisplayCasesIfNumberAndChangeNavigation 026{ 027 /** 028 * Navigation mode enum.<br> 029 * NBA: Navigation by Asking.<br> 030 * NBP: Navigation by Proposing.<br> 031 * @author Juan A. Recio-Garcia 032 * @version 1.0 033 * 034 */ 035 public enum NavigationMode {NBA, NBP}; 036 037 /** 038 * If the number of cases is less than max it returns true and sets the navigation mode to NbP.<br> 039 * If the number of cases is more than max it returns false and sets the navigation mode to NbA. 040 * @param max is the threshold 041 * @param cases is the working cases set 042 */ 043 public static boolean displayCasesIfNumberAndChangeNavigation(int max, Collection<CBRCase> cases) 044 { 045 if(cases.size()<max) 046 { 047 AskingAndProposingPreferenceElicitation.changeTo(NavigationMode.NBP); 048 return true; 049 } 050 else 051 { 052 AskingAndProposingPreferenceElicitation.changeTo(NavigationMode.NBA); 053 return false; 054 } 055 056 057 058 059 } 060}