weka.classifiers.misc.monotone
Class MultiDimensionalSort

java.lang.Object
  extended by weka.classifiers.misc.monotone.MultiDimensionalSort

public class MultiDimensionalSort
extends java.lang.Object

Class for doing multidimensional sorting, using an array of Comparator. The goal is to sort an array topologically. If o1 and o2 are two objects of the array a, and for all valid indices i in the array c if holds that c[i].compare(o1,o2) < 0 then o1 comes before o2 in the sorted array.

A typical is the sorting of vectors in an n-dimensional space, where the ordering is determined by the product ordering.

This implementation is part of the master's thesis: "Studie en implementatie van instantie-gebaseerde algoritmen voor gesuperviseerd rangschikken", Stijn Lievens, Ghent University, 2004.

Version:
$Revision: 1.1 $
Author:
Stijn Lievens (stijn.lievens@ugent.be)

Constructor Summary
MultiDimensionalSort()
           
 
Method Summary
static void multiDimensionalSort(java.lang.Object[] a, java.util.Comparator[] c)
          Sort an array using different comparators.
static void multiDimensionalSort(java.lang.Object[] a, int fromIndex, int toIndex, java.util.Comparator[] c)
          Sort part of an array using different comparators.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiDimensionalSort

public MultiDimensionalSort()
Method Detail

multiDimensionalSort

public static void multiDimensionalSort(java.lang.Object[] a,
                                        java.util.Comparator[] c)
Sort an array using different comparators.

Parameters:
a - the array to be sorted. The sorted array is returned in the array a itself.
c - an array holding the different comparators

multiDimensionalSort

public static void multiDimensionalSort(java.lang.Object[] a,
                                        int fromIndex,
                                        int toIndex,
                                        java.util.Comparator[] c)
                                 throws java.lang.IllegalArgumentException
Sort part of an array using different comparators.

Parameters:
a - the array to be sorted, the indicated part of the array will be replaced by the sorted elements
fromIndex - index of the first element to be sorted (inclusive)
toIndex - index of the last element to be sorted (exclusive)
c - array holding the different comparators
Throws:
java.lang.IllegalArgumentException - if fromIndex > toIndex