es.ucm.fdi.gaia.jcolibri.method.retrieve.RetrievalResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jCOLIBRI Show documentation
Show all versions of jCOLIBRI Show documentation
jCOLIBRI is a java framework for the development of Case-Based Reasoning systems.
/**
* RetrievalResult.java
* jCOLIBRI2 framework.
* @author Juan A. Recio-Garc�a.
* GAIA - Group for Artificial Intelligence Applications
* http://gaia.fdi.ucm.es
* 03/01/2007
*/
package es.ucm.fdi.gaia.jcolibri.method.retrieve;
import es.ucm.fdi.gaia.jcolibri.cbrcore.CBRCase;
/**
* Stores the retrieval information. It contais a pair.
* @author Juan A. Recio-Garcia
* @version 2.0
*/
public class RetrievalResult implements Comparable {
/** Constant used to retrieve all the cases in the retrieval methods. */
public static final int RETRIEVE_ALL = Integer.MAX_VALUE;
private CBRCase _case;
private double eval;
/**
* Constructor
* @param _case retrieved
* @param eval is the similiarty with the query
*/
public RetrievalResult(CBRCase _case, Double eval)
{
this._case = _case;
this.eval = eval;
}
/**
* @return Returns the _case.
*/
public CBRCase get_case() {
return _case;
}
/**
* @param _case The _case to set.
*/
public void set_case(CBRCase _case) {
this._case = _case;
}
/**
* @return Returns the eval.
*/
public double getEval() {
return eval;
}
/**
* @param eval The eval to set.
*/
public void setEval(double eval) {
this.eval = eval;
}
public String toString()
{
return _case + " -> "+ eval;
}
public int compareTo(RetrievalResult o) {
if(!(o instanceof RetrievalResult))
return 0;
RetrievalResult other = (RetrievalResult) o;
if(other.getEval()< eval)
return -1;
else if(other.getEval() > eval)
return 1;
else
return 0;
}
}