Class CollatedKey
java.lang.Object
dev.frostlake.executor.expressions.CollatedKey
- All Implemented Interfaces:
Comparable<CollatedKey>
A sorting, grouping or DISTINCT key that carries the collation it compares under. Wrapping the key
value — never the row's value — lets one comparator serve every key site: two texts equal under the
collation hash and compare alike, so they fall into one group and sort as one value, while the text
itself is kept verbatim for whoever reports it.
A group's REPORTED value is not this wrapper: values that tie under the collation are reported by
their binary minimum, which leastOf(java.lang.Object, java.lang.Object) settles.
-
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(CollatedKey other) booleangetText()The text this key carries.inthashCode()static ObjectWhich of two collation-equal values a group reports: the smaller by the raw text, since values that tie under the collation are still told apart by their code points.static Objectof(Object value, CollationSpec rules) The key for a value under a collation: the value itself when there is no collation, or when it is not text (a collation orders strings; everything else keeps its own order).rulesOf()The collation this key compares under.toString()static ObjectThe text behind a key, so a wrapper never reaches a result.
-
Method Details
-
of
The key for a value under a collation: the value itself when there is no collation, or when it is not text (a collation orders strings; everything else keeps its own order).- Parameters:
value- the key's valuerules- the collation it compares under, or null for none- Returns:
- the value, or a collated key wrapping it
-
unwrap
The text behind a key, so a wrapper never reaches a result.- Parameters:
value- a key value- Returns:
- its text when it is a collated key, otherwise the value unchanged
-
leastOf
Which of two collation-equal values a group reports: the smaller by the raw text, since values that tie under the collation are still told apart by their code points.- Parameters:
first- one value, or nullsecond- the other, or null- Returns:
- the one a group reports
-
getText
The text this key carries.- Returns:
- the text, verbatim
-
rulesOf
The collation this key compares under.- Returns:
- the rules
-
compareTo
- Specified by:
compareToin interfaceComparable<CollatedKey>
-
equals
-
hashCode
public int hashCode() -
toString
-