net.sourceforge.nite.util
Class SearchResultIDComparator

java.lang.Object
  extended by net.sourceforge.nite.util.SearchResultIDComparator
All Implemented Interfaces:
java.util.Comparator

public class SearchResultIDComparator
extends java.lang.Object
implements java.util.Comparator

This implements the comparator and orders search results alphanumerically by ID. Normally called like this:
private Engine searchEngine = new net.sourceforge.nite.search.Engine();
reslist = searchEngine.search(nom, "($a segment)");
reslist.remove(0);
Collections.sort(reslist, new SearchResultIDComparator());

The first element of a search result list is always a list of variable names and that's why we normally remove it before passing to the Comparator. Note that this comparator does traverse along the result and into any subqueries to distinguish results where the first element is the same.

Author:
Jonathan Kilgour, UEdin

Constructor Summary
SearchResultIDComparator()
           
 
Method Summary
 int compare(java.lang.Object obj, java.lang.Object obj1)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

SearchResultIDComparator

public SearchResultIDComparator()
Method Detail

compare

public int compare(java.lang.Object obj,
                   java.lang.Object obj1)
Specified by:
compare in interface java.util.Comparator