001/** 002 * CriticalUserChoice.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 * 31/10/2007 008 */ 009package es.ucm.fdi.gaia.jcolibri.extensions.recommendation.navigationByProposing; 010 011import java.util.ArrayList; 012import java.util.Collection; 013import java.util.List; 014 015import es.ucm.fdi.gaia.jcolibri.cbrcore.CBRCase; 016import es.ucm.fdi.gaia.jcolibri.extensions.recommendation.casesDisplay.UserChoice; 017import es.ucm.fdi.gaia.jcolibri.method.retrieve.FilterBasedRetrieval.FilterConfig; 018 019/** 020 * Extends the UserChoice object to store critiques (CritiqueOptions) about the 021 * selected case (that in the next converstaion cycle is the query). 022 * 023 * @author Juan A. Recio-Garcia 024 * @author Developed at University College Cork (Ireland) in collaboration with Derek Bridge. 025 * @version 1.0 026 * @see CriticalUserChoice 027 */ 028public class CriticalUserChoice extends UserChoice 029{ 030 031 private List<CritiqueOption> critiques = null; 032 033 public CriticalUserChoice() 034 { 035 super(UserChoice.REFINE_QUERY, null); 036 critiques = new ArrayList<CritiqueOption>(); 037 } 038 039 /** 040 * Creates an object with the user choice, critiques 041 * @param choice contains a value from UserChoice: QUIT, BUY or REFINE_QUERY. 042 * If the value is REFINE_QUERY, the critiquedCase parameter contains the new query 043 * to edit. 044 * @param critiques to the new query 045 * @param critiquedCase is the new query/case thas was critiqued. This parameter is only 046 * used if the "choice" parameter contains REFINE_QUERY. 047 */ 048 public CriticalUserChoice(int choice, List<CritiqueOption> critiques, CBRCase critiquedCase) 049 { 050 super(choice, critiquedCase); 051 this.critiques = critiques; 052 } 053 054 /** 055 * Returns the critiques 056 */ 057 public Collection<CritiqueOption> getCritiques() 058 { 059 return this.critiques; 060 } 061 062 /** 063 * Gets the FilterConfig object used by the FilterBasedRetrieval method that 064 * is obtained from the critiques. 065 */ 066 public FilterConfig getFilterConfig() 067 { 068 FilterConfig fc = new FilterConfig(); 069 for(CritiqueOption critique: critiques) 070 fc.addPredicate(critique.getAttribute(), critique.getPredicate()); 071 return fc; 072 } 073 074}