com.espertech.esper.util
Class MultiKeyComparator

java.lang.Object
  extended by com.espertech.esper.util.MultiKeyComparator
All Implemented Interfaces:
MetaDefItem, java.io.Serializable, java.util.Comparator<MultiKeyUntyped>

public final class MultiKeyComparator
extends java.lang.Object
implements java.util.Comparator<MultiKeyUntyped>, MetaDefItem, java.io.Serializable

A comparator on multikeys. The multikeys must contain the same number of values.

See Also:
Serialized Form

Constructor Summary
MultiKeyComparator(boolean[] isDescendingValues)
          Ctor.
 
Method Summary
 int compare(MultiKeyUntyped firstValues, MultiKeyUntyped secondValues)
           
protected static int compareValues(java.lang.Object valueOne, java.lang.Object valueTwo, boolean isDescending)
          Compares two nullable values.
static int compareValuesCollated(java.lang.Object valueOne, java.lang.Object valueTwo, boolean isDescending, java.text.Collator collator)
          Compares two nullable values using Collator, for use with string-typed values.
 
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
 

Constructor Detail

MultiKeyComparator

public MultiKeyComparator(boolean[] isDescendingValues)
Ctor.

Parameters:
isDescendingValues - - each value is true if the corresponding (same index) entry in the multi-keys is to be sorted in descending order. The multikeys to be compared must have the same number of values as this array.
Method Detail

compare

public final int compare(MultiKeyUntyped firstValues,
                         MultiKeyUntyped secondValues)
Specified by:
compare in interface java.util.Comparator<MultiKeyUntyped>

compareValues

protected static int compareValues(java.lang.Object valueOne,
                                   java.lang.Object valueTwo,
                                   boolean isDescending)
Compares two nullable values.

Parameters:
valueOne - first value to compare
valueTwo - second value to compare
isDescending - true for descending
Returns:
compare result

compareValuesCollated

public static int compareValuesCollated(java.lang.Object valueOne,
                                        java.lang.Object valueTwo,
                                        boolean isDescending,
                                        java.text.Collator collator)
Compares two nullable values using Collator, for use with string-typed values.

Parameters:
valueOne - first value to compare
valueTwo - second value to compare
isDescending - true for descending
collator - the Collator for comparing
Returns:
compare result

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com