public class SortOrdering extends java.lang.Object implements java.util.Comparator<KeyedRecord>
Modifier and Type | Field and Description |
---|---|
protected java.lang.String[] |
_keys |
Constructor and Description |
---|
SortOrdering()
Empty constructor with now sort keys specified.
|
SortOrdering(java.lang.String key)
Constructor with a single sort key.
|
SortOrdering(java.lang.String[] newKeys)
Constructor with an array of sort keys.
|
Modifier and Type | Method and Description |
---|---|
SortOrdering |
addKey(java.lang.String newKey)
Add a new sort key to the end of the sort keys.
|
int |
compare(KeyedRecord record1,
KeyedRecord record2)
Compare two records.
|
java.lang.String[] |
getKeys()
Get the sort ordering keys.
|
public SortOrdering()
public SortOrdering(java.lang.String key)
key
- The lone key used for sorting.public SortOrdering(java.lang.String[] newKeys)
newKeys
- The array of keys used for the sort ordering.public SortOrdering addKey(java.lang.String newKey)
newKey
- The new sort key.public java.lang.String[] getKeys()
public int compare(KeyedRecord record1, KeyedRecord record2)
compare
in interface java.util.Comparator<KeyedRecord>
record1
- The first record of the comparison.record2
- The second record of the comparison.