|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--gov.sns.tools.data.SortOrdering
SortOrdering can be used in DataTable queries to order records based on their values associated with the sort ordering keys. These associated values must be comparable (i.e. their class must implement the Comparable interface). The comparison is made starting with the first key and considers successive keys as necessary until the records can be ordered or all keys are exhausted resulting in equality.
| Field Summary | |
protected java.lang.String[] |
keys
|
| Constructor Summary | |
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. |
|
| Method Summary | |
void |
addKey(java.lang.String newKey)
Add a new sort key to the end of the sort keys. |
int |
compare(GenericRecord record1,
GenericRecord record2)
Compare two records. |
int |
compare(java.lang.Object record1,
java.lang.Object record2)
Compare two records to satisfy the Comparator interface. |
java.lang.String[] |
getKeys()
Get the sort ordering keys. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
equals |
| Field Detail |
protected java.lang.String[] keys
| Constructor Detail |
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.| Method Detail |
public void addKey(java.lang.String newKey)
newKey - The new sort key.public java.lang.String[] getKeys()
public int compare(java.lang.Object record1,
java.lang.Object record2)
compare in interface java.util.Comparatorrecord1 - The first record of the comparison. Its class should be a subclass of GenericRecord.record2 - The second record of the comparison. Its class should be a subclass of GenericRecord.
java.lang.ClassCastException - if the records cannot be cast to GenericRecord.
public int compare(GenericRecord record1,
GenericRecord record2)
record1 - The first record of the comparison.record2 - The second record of the comparison.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||