com.indexdata.torus2.query
Class RecordComparator
java.lang.Object
com.indexdata.torus2.query.RecordComparator
- All Implemented Interfaces:
- Comparator<Record>
public class RecordComparator
- extends Object
- implements Comparator<Record>
Comparator, based on criteria from provided CQLSortNode.
Compares XML documents and is used for sorting XML documents in
ascending or descending order by given Elements in the documents.
Comparison is based on the text content of the Elements
If the field to sort by is not found in one of the documents
under comparison, the comparison will be done using the empty string.
If there are multiple elements with the same name, the first
occurrence will be used for comparison.
The comparator supports multiple sort fields but only the modifiers
sort order (default ascending) and locale (default is the systems default).
Sorting will be character based (numeric sorting not supported).
- Author:
- Niels Erik
Method Summary |
int |
compare(Record rec1,
Record rec2)
Will compare two documents based on alphabetical comparison of the content of the specified fields
using the given sort order and locale if any. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RecordComparator
public RecordComparator(org.z3950.zing.cql.CQLSortNode cqlSortNode,
String... layerNames)
compare
public int compare(Record rec1,
Record rec2)
- Will compare two documents based on alphabetical comparison of the content of the specified fields
using the given sort order and locale if any.
- Specified by:
compare
in interface Comparator<Record>
Copyright © 2008-2013 Index Data. All Rights Reserved.