Class ShortPrimitiveArrayComparator
- java.lang.Object
-
- org.apache.flink.api.common.typeutils.TypeComparator<T>
-
- org.apache.flink.api.common.typeutils.base.array.PrimitiveArrayComparator<short[],ShortComparator>
-
- org.apache.flink.api.common.typeutils.base.array.ShortPrimitiveArrayComparator
-
- All Implemented Interfaces:
Serializable
@Internal public class ShortPrimitiveArrayComparator extends PrimitiveArrayComparator<short[],ShortComparator>
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.flink.api.common.typeutils.base.array.PrimitiveArrayComparator
ascending, comparator, reference
-
-
Constructor Summary
Constructors Constructor Description ShortPrimitiveArrayComparator(boolean ascending)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(short[] first, short[] second)Compares two records in object form.TypeComparator<short[]>duplicate()Creates a copy of this class.inthash(short[] record)Computes a hash value for the given record.-
Methods inherited from class org.apache.flink.api.common.typeutils.base.array.PrimitiveArrayComparator
compareSerialized, compareToReference, equalToReference, extractKeys, getFlatComparators, getNormalizeKeyLen, invertNormalizedKey, isNormalizedKeyPrefixOnly, putNormalizedKey, readWithKeyDenormalization, setReference, supportsNormalizedKey, supportsSerializationWithKeyNormalization, writeWithKeyNormalization
-
Methods inherited from class org.apache.flink.api.common.typeutils.TypeComparator
compareAgainstReference, supportsCompareAgainstReference
-
-
-
-
Method Detail
-
hash
public int hash(short[] record)
Description copied from class:TypeComparatorComputes a hash value for the given record. The hash value should include all fields in the record relevant to the comparison.The hash code is typically not used as it is in hash tables and for partitioning, but it is further scrambled to make sure that a projection of the hash values to a lower cardinality space is as results in a rather uniform value distribution. However, any collisions produced by this method cannot be undone. While it is NOT important to create hash codes that cover the full spectrum of bits in the integer, it IS important to avoid collisions when combining two value as much as possible.
- Specified by:
hashin classTypeComparator<short[]>- Parameters:
record- The record to be hashed.- Returns:
- A hash value for the record.
- See Also:
Object.hashCode()
-
compare
public int compare(short[] first, short[] second)Description copied from class:TypeComparatorCompares two records in object form. The return value indicates the order of the two in the same way as defined byComparator.compare(Object, Object).- Specified by:
comparein classTypeComparator<short[]>- Parameters:
first- The first record.second- The second record.- Returns:
- An integer defining the oder among the objects in the same way as
Comparator.compare(Object, Object). - See Also:
Comparator.compare(Object, Object)
-
duplicate
public TypeComparator<short[]> duplicate()
Description copied from class:TypeComparatorCreates a copy of this class. The copy must be deep such that no state set in the copy affects this instance of the comparator class.- Specified by:
duplicatein classTypeComparator<short[]>- Returns:
- A deep copy of this comparator instance.
-
-