001package es.ucm.fdi.gaia.jcolibri.method.maintenance; 002 003 004import java.util.Collection; 005 006import es.ucm.fdi.gaia.jcolibri.cbrcore.CBRCase; 007import es.ucm.fdi.gaia.jcolibri.cbrcore.CBRCaseBase; 008import es.ucm.fdi.gaia.jcolibri.method.reuse.classification.KNNClassificationConfig; 009 010/** 011 * Provides the ability to run a case base editing algorithm on 012 * a case base. 013 * 014 * @author Lisa Cummins 015 * @author Derek Bridge 016 * 18/05/07 017 */ 018public abstract class AbstractCaseBaseEditMethod { 019 020 /** 021 * Simulates a case base editing algorithm, returning the cases 022 * that would be deleted by the algorithm. 023 * @param cases The group of cases on which to perform editing. 024 * @param simConfig The similarity configuration for these cases. 025 * @return the list of cases that would be deleted by the algorithm. 026 */ 027 public abstract Collection<CBRCase> retrieveCasesToDelete(Collection<CBRCase> cases, KNNClassificationConfig simConfig); 028 029 /** 030 * Runs a case base editing algorithm on the given case base. 031 * @param caseBase The case base on which to perform editing. 032 * @param simConfig The similarity configuration for the case 033 * base. 034 */ 035 public void edit(CBRCaseBase caseBase, KNNClassificationConfig simConfig) 036 { Collection<CBRCase> casesToDelete = retrieveCasesToDelete(caseBase.getCases(), simConfig); 037 caseBase.forgetCases(casesToDelete); 038 } 039}