Module datarush.library
Interface RecordTokenComparator
public interface RecordTokenComparator
An object for comparing composite token values. More specifically,
collections of scalar token values can be compared.
While the interface is generically typed, using
ScalarValued,
implementations are specific to the types provided at
construction time. When used, it is expected that values
are provided in the order matching these types.
A RecordTokenComparator is useful for comparison of
key fields of a decomposed record.
-
Method Summary
Modifier and TypeMethodDescriptionintcompare()Indicates the relative ordering of two sets of values.voidsetLeftSources(ScalarValued[] sources) Binds the left-hand values of the comparator to the specified objects.voidsetRightSources(ScalarValued[] sources) Binds the right-hand values of the comparator to the specified objects.
-
Method Details
-
setLeftSources
Binds the left-hand values of the comparator to the specified objects. Comparisons will be done using the values of the objects at the time of the comparison.- Parameters:
sources- the value containers to use on the left side of comparisons
-
setRightSources
Binds the right-hand values of the comparator to the specified objects. Comparisons will be done using the values of the objects at the time of the comparison.- Parameters:
sources- the value containers to use on the right side of comparisons
-
compare
int compare()Indicates the relative ordering of two sets of values. Values are compared in a pairwise fashion between the sets, starting with the first index and progressing until a pair are found to be unequal (or all values have been compared). Each pair may be evaluated under a different ordering direction, as specified by the implementation.- Returns:
- a negative integer, zero, or a positive integer if the values of the set bound to the left operand less than, equal to, or greater than the values of the set bound to the right operand.
-