simpledb.materialize
Class RecordComparator
java.lang.Object
simpledb.materialize.RecordComparator
- All Implemented Interfaces:
- Comparator<Scan>
public class RecordComparator
- extends Object
- implements Comparator<Scan>
A comparator for scans.
- Author:
- Edward Sciore
Constructor Summary |
RecordComparator(List<String> fields)
Creates a comparator using the specified fields,
using the ordering implied by its iterator. |
Method Summary |
int |
compare(Scan s1,
Scan s2)
Compares the current records of the two specified scans. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RecordComparator
public RecordComparator(List<String> fields)
- Creates a comparator using the specified fields,
using the ordering implied by its iterator.
- Parameters:
fields
- a list of field names
compare
public int compare(Scan s1,
Scan s2)
- Compares the current records of the two specified scans.
The sort fields are considered in turn.
When a field is encountered for which the records have
different values, those values are used as the result
of the comparison.
If the two records have the same values for all
sort fields, then the method returns 0.
- Specified by:
compare
in interface Comparator<Scan>
- Parameters:
s1
- the first scans2
- the second scan
- Returns:
- the result of comparing each scan's current record according to the field list
Copyright © 2011. All Rights Reserved.