com.jalios.jcms
Class QueryResultSet.ScoreComparator
java.lang.Object
  
com.jalios.jcms.QueryResultSet.ScoreComparator
- All Implemented Interfaces: 
 - Comparator
 
- Enclosing class:
 - QueryResultSet
 
public static class QueryResultSet.ScoreComparator
- extends Object
- implements Comparator
  
This Comparator compares two Objects using a score
 retrieved from a map of Object to float. 
 If two Storable have the same score, a "parent" compararator is used, default
 "parent" comparator is MdateComparator. 
 
 Note: because a high score must be first, it behaves in the opposite
 way of what Comparator says see the
 compare(Object, Object) method.
- Since:
 
  - jcms-5.5.0
 
- Version:
 
  - $Revision: 23896 $
 
- Author:
 
  - Olivier Jaquemet 
 
 
| 
Method Summary | 
 int | 
compare(Object o1,
        Object o2)
 
          Compare two Object using their score from the QueryResulSet. | 
 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
 
QueryResultSet.ScoreComparator
public QueryResultSet.ScoreComparator(QueryResultSet resultSet,
                                      Comparator parentComparator)
- Initialize a 
ScoreComparator using the given parent
 Comparator, if null, default with MdateComparator.
- Parameters:
 resultSet - the QueryResultSet from which to retrieve 
        score of each Publication.parentComparator - the Comparator to use when score of
        compared Object are identical.
 
compare
public int compare(Object o1,
                   Object o2)
- Compare two Object using their score from the QueryResulSet.
 If score are equals, use the parent Comparator.
- Specified by:
 compare in interface Comparator
 
- Returns:
 - 1 when o1 has a lower score than o2, -1 when has o1 higher
         score than o2 and returns parentComparator.compare value when
         scores are equals.
 
 
 
Copyright © 2001-2010 Jalios SA. All Rights Reserved.