jcolibri.method.maintenance
Class QueryResult
java.lang.Object
jcolibri.method.maintenance.QueryResult
- All Implemented Interfaces:
- java.lang.Comparable
- Direct Known Subclasses:
- CaseResult
public class QueryResult
- extends java.lang.Object
- implements java.lang.Comparable
Stores the query result information. It contains a pair.
The result is some double value related to the query.
- Author:
- Lisa Cummins
Method Summary |
int |
compareTo(java.lang.Object o)
Returns the result of comparing this object to
the given object. |
CBRQuery |
getCase()
Returns the case. |
double |
getResult()
Returns the result. |
void |
setCase(CBRCase _case)
Set the given case to be the query case
associated with this pair. |
void |
setEval(double result)
Set the given result to be the result
associated with this pair. |
static java.util.List |
sortResults(boolean ascending,
java.util.List<QueryResult> toSort)
Sorts the given list of CaseResults in the given order and
returns the sorted list. |
java.lang.String |
toString()
Returns a String representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_case
protected CBRQuery _case
result
protected double result
QueryResult
public QueryResult(CBRQuery _case,
double result)
- Sets up a pair.
- Parameters:
_case
- The query case to be storedresult
- The result associated with this case.
getCase
public CBRQuery getCase()
- Returns the case.
- Returns:
- the case.
setCase
public void setCase(CBRCase _case)
- Set the given case to be the query case
associated with this pair.
- Parameters:
_case
- The case to set.
getResult
public double getResult()
- Returns the result.
- Returns:
- the result.
setEval
public void setEval(double result)
- Set the given result to be the result
associated with this pair.
- Parameters:
result
- The result to set.
toString
public java.lang.String toString()
- Returns a String representation of this object.
- Overrides:
toString
in class java.lang.Object
- Returns:
- a String representation of this object.
compareTo
public int compareTo(java.lang.Object o)
- Returns the result of comparing this object to
the given object.
This returns 0 if the object is not of the same class
as this object, -1 if the result of this object
is less than the result of the given object, 0 if
the result of this object is equal to the result of the
given object and 1 if the result of this object is
greater than the result of the given object.
- Specified by:
compareTo
in interface java.lang.Comparable
- Returns:
- the result of comparing this object to
the given object.
sortResults
public static java.util.List sortResults(boolean ascending,
java.util.List<QueryResult> toSort)
- Sorts the given list of CaseResults in the given order and
returns the sorted list.
- Parameters:
ascending
- The order in which to sort the elements.toSort
- The list of CaseResults to sort.
- Returns:
- the sorted list.