001 /** 002 * FilterConfig.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 * 28/10/2007 008 */ 009 package jcolibri.method.retrieve.FilterBasedRetrieval; 010 011 import java.util.Collection; 012 import java.util.HashMap; 013 014 import jcolibri.cbrcore.Attribute; 015 import jcolibri.method.retrieve.FilterBasedRetrieval.predicates.FilterPredicate; 016 017 /** 018 * Configuration object for the FilterBasedRetrievalMethod. 019 * It contains a Map with pairs <Attribute,Predicate>. 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 */ 025 public class FilterConfig 026 { 027 private HashMap<Attribute,FilterPredicate> config; 028 029 /** 030 * Creates the FilterConfig object 031 */ 032 public FilterConfig() 033 { 034 config = new HashMap<Attribute,FilterPredicate>(); 035 } 036 037 /** 038 * Adds a new predicate 039 * @param attribute that the predicate is associated to 040 * @param predicate for the attribute 041 */ 042 public void addPredicate(Attribute attribute, FilterPredicate predicate) 043 { 044 config.put(attribute, predicate); 045 } 046 047 /** 048 * Gets the predicate for a given attribute 049 * @param attribute of the predicated 050 */ 051 public FilterPredicate getPredicate(Attribute attribute) 052 { 053 return config.get(attribute); 054 } 055 056 /** 057 * Returns a list of attributres that have a predicate defined. 058 */ 059 public Collection<Attribute> getDefinedAttributes() 060 { 061 return config.keySet(); 062 } 063 }