public class StringComparator extends Object implements Comparator<String>
This class is primarily used for comparing docnos, especially for TREC like collections. The docnos in the DocumentIndex as expected to be sorted in an order compatible with this comparator.
Sorting Algorithm:
Modifier and Type | Field and Description |
---|---|
static StringComparator |
Me
An instantiation of this class.
|
Constructor and Description |
---|
StringComparator() |
Modifier and Type | Method and Description |
---|---|
int |
compare(String s1,
String s2)
Compares two Strings, which have a number of fields that
are separated by one or more non-alphanumeric characters.
|
static int |
compareObjects(Object o1,
Object o2)
A static access method, to prevent having to instantiate a comparator
This has the same parameters, return and implementation as compare(Object,Object)
|
static int |
compareStrings(String s1,
String s2)
A static access method, to prevent having to instantiate a comparator
This has the same parameters, return and implementation as compare(Object,Object)
|
static void |
main(String[] args)
Will display the comparator value between two strings from the command line arguments.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public static final StringComparator Me
public int compare(String s1, String s2)
compare
in interface Comparator<String>
s1
- the first string object to compare.s2
- the second string object to compare.public static int compareObjects(Object o1, Object o2)
public static int compareStrings(String s1, String s2)
public static void main(String[] args)
Terrier Information Retrieval Platform4.1. Copyright © 2004-2015, University of Glasgow