All Downloads are FREE. Search and download functionalities are using the official Maven repository.

es.ucm.fdi.gaia.jcolibri.casebase.LinealCaseBase Maven / Gradle / Ivy

Go to download

jCOLIBRI is a java framework for the development of Case-Based Reasoning systems.

There is a newer version: 3.2
Show newest version
package es.ucm.fdi.gaia.jcolibri.casebase;

import java.util.Collection;

import es.ucm.fdi.gaia.jcolibri.cbrcore.CBRCase;
import es.ucm.fdi.gaia.jcolibri.cbrcore.CBRCaseBase;
import es.ucm.fdi.gaia.jcolibri.cbrcore.CaseBaseFilter;
import es.ucm.fdi.gaia.jcolibri.cbrcore.Connector;

/**
 * Basic Lineal Case Base that stores cases into a Collection.
 * This class does not includes any kind of caching mechanism. 
 * That way, if you call to learn() or forget() cases are automatically stored/removed to/from the persistence media. 
 * This will be a performance problem if you plan to learn/forget in multiple steps. This case base is unrecommended for evaluation.
 * 

* Depending on your requirements the CachedLinealCaseBase could be more suitable. * * @author Juan A. Recio-García * @see CachedLinealCaseBase * */ public class LinealCaseBase implements CBRCaseBase { private Connector connector; private Collection cases; public void init(Connector connector) { this.connector = connector; cases = this.connector.retrieveAllCases(); } /* (non-Javadoc) * @see jcolibri.cbrcore.CBRCaseBase#deInit() */ public void close() { this.connector.close(); } /* (non-Javadoc) * @see jcolibri.cbrcore.CBRCaseBase#forgetCases(java.util.Collection) */ public void forgetCases(Collection cases) {} /* (non-Javadoc) * @see jcolibri.cbrcore.CBRCaseBase#getCases() */ public Collection getCases() { return cases; } /* (non-Javadoc) * @see jcolibri.cbrcore.CBRCaseBase#getCases(jcolibri.cbrcore.CaseBaseFilter) */ public Collection getCases(CaseBaseFilter filter) {return null;} /* (non-Javadoc) * @see jcolibri.cbrcore.CBRCaseBase#learnCases(java.util.Collection) */ public void learnCases(Collection cases) { connector.storeCases(cases); this.cases.addAll(cases); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy