org.planx.msd.util
Class WeakSorter

java.lang.Object
  extended by org.planx.msd.util.WeakSorter

public final class WeakSorter
extends Object

A utility class that provides various methods for weak-sorting of lists. Weak-sorting means sorting a multiset of lists according to any total order. The lists are, of course, sorted according to the same order.

Author:
Thomas Ambus

Method Summary
static
<E> void
sort(Discriminator<E> d, List<? extends List<E>> values)
          Sorts the specified lists in-place.
static
<U,E> void
sort(Discriminator<E> d, List<? extends U> values, Extractor<U,? extends List<E>,?> e)
          Sorts a multiset of lists in-place.
static
<U,E,S> List<Pair<List<E>,S>>
sortLists(Discriminator<E> d, List<? extends U> values, Extractor<U,? extends List<E>,S> e, boolean doRemoveDuplicates)
          Sorts a multiset of lists and returns a list of pairs, where the first component is a sorted list, and the second component is the corresponding original list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sortLists

public static <U,E,S> List<Pair<List<E>,S>> sortLists(Discriminator<E> d,
                                                      List<? extends U> values,
                                                      Extractor<U,? extends List<E>,S> e,
                                                      boolean doRemoveDuplicates)
Sorts a multiset of lists and returns a list of pairs, where the first component is a sorted list, and the second component is the corresponding original list. If doRemoveDuplicates is true duplicates are removed from the sorted lists. The argument discriminator must be capable of discriminating the elements contained in the lists.


sort

public static <E> void sort(Discriminator<E> d,
                            List<? extends List<E>> values)
Sorts the specified lists in-place. The provided discriminator must be capable of discriminating the elements in the lists.


sort

public static <U,E> void sort(Discriminator<E> d,
                              List<? extends U> values,
                              Extractor<U,? extends List<E>,?> e)
Sorts a multiset of lists in-place. The provided discriminator must be capable of discriminating the elements in the lists.



Copyright © 2010. All Rights Reserved.