001 /** 002 * TabuList.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 * 21/11/2007 008 */ 009 package jcolibri.extensions.recommendation.tabuList; 010 011 import java.util.ArrayList; 012 import java.util.Collection; 013 014 import jcolibri.cbrcore.CBRCase; 015 016 /** 017 * Implements a list of tabu items. 018 * Tabu items already were presented to the user so the must not presented again. 019 * @author Juan A. Recio-Garcia 020 * @author Developed at University College Cork (Ireland) in collaboration with Derek Bridge. 021 * @version 1.0 022 * 023 */ 024 public class TabuList 025 { 026 private static ArrayList<CBRCase> tabu = new ArrayList<CBRCase>(); 027 028 /** 029 * Removes cases from the tabu list. 030 * @param cases to remove 031 * @return updated tabu list. 032 */ 033 public static Collection<CBRCase> removeTabuList(Collection<CBRCase> cases) 034 { 035 ArrayList<CBRCase> newList = new ArrayList<CBRCase>(cases); 036 newList.removeAll(tabu); 037 return newList; 038 } 039 040 /** 041 * Adds cases to the tabu list. 042 * @param tabuCases to add 043 */ 044 public static void updateTabuList(Collection<CBRCase> tabuCases) 045 { 046 tabu.addAll(tabuCases); 047 } 048 }