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