org.openstreetmap.osmosis.core.sort.v0_6
Class StackableComparator<T>

java.lang.Object
  extended by org.openstreetmap.osmosis.core.sort.v0_6.StackableComparator<T>
Type Parameters:
T - The type of data to be compared.
All Implemented Interfaces:
java.util.Comparator<T>

public class StackableComparator<T>
extends java.lang.Object
implements java.util.Comparator<T>

A comparator implementation that allows multiple comparators to be combined together. It invokes each comparator in order, and returns the first non-zero result. If all comparators return 0, the result is 0.


Constructor Summary
StackableComparator(java.util.List<java.util.Comparator<T>> comparators)
          Creates a new instance.
 
Method Summary
 int compare(T o1, T o2)
          
 
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

StackableComparator

public StackableComparator(java.util.List<java.util.Comparator<T>> comparators)
Creates a new instance.

Parameters:
comparators - The comparators to use for comparisons.
Method Detail

compare

public int compare(T o1,
                   T o2)

Specified by:
compare in interface java.util.Comparator<T>