SSJ
V. labo.

umontreal.iro.lecuyer.util
Class OneDimSort

java.lang.Object
  extended by umontreal.iro.lecuyer.util.OneDimSort
All Implemented Interfaces:
MultiDimSort

public class OneDimSort
extends Object
implements MultiDimSort

OneDimSort

This class implements a MultiDimSort that simply sorts the arrays according to one dimension specified in the constructor. The sort uses method java.utilArrayssort(int [], int, int) from class java.utilArrays. The dimension (dimState) of the states to be sorted may be specified. For example, it is possible to sort a 2-dimensional state by using only its first coordinate (OneDimSort(0, 2)), or only its second coordinate (OneDimSort(1, 2) or OneDimSort(1)).


Constructor Summary
OneDimSort(int sortCoordinate)
          .
OneDimSort(int sortCoordinate, int dimState)
          .
 
Method Summary
 int dimension()
          .
 int getSortCoordinate()
          .
 void sort(double[][] a)
          Sorts the entire array.
 void sort(double[][] a, int iMin, int iMax)
          Sorts the subarray of a made of the elements with indices from iMin to iMax-1.
<T extends MultiDimComparable<? super T>>
void
sort(T[] a)
          Sorts the entire array.
<T extends MultiDimComparable<? super T>>
void
sort(T[] a, int iMin, int iMax)
          Sorts the subarray of a made of the elements with indices from iMin to iMax-1.
 String toString()
          .
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OneDimSort

public OneDimSort(int sortCoordinate,
                  int dimState)
. \begin{tabb}
 Constructs a \class{OneDimSort} object that will sort states with r...
 ...e} is a value in $0 \le \texttt{sortCoordinate} < \texttt{dimState}$.
 \end{tabb}


OneDimSort

public OneDimSort(int sortCoordinate)
. \begin{tabb}
 Constructs a \class{OneDimSort} object that will sort states
 with r...
 ...a dimension comme argument plut\^ot que la derni\\lq ere coordonn\'ee.
 }
 \end{tabb}

Method Detail

sort

public <T extends MultiDimComparable<? super T>> void sort(T[] a,
                                                           int iMin,
                                                           int iMax)
Description copied from interface: MultiDimSort
Sorts the subarray of a made of the elements with indices from iMin to iMax-1.

Specified by:
sort in interface MultiDimSort
Parameters:
a - array to sort
iMin - index of first element to sort
iMax - index of last element to sort is iMax - 1

sort

public <T extends MultiDimComparable<? super T>> void sort(T[] a)
Description copied from interface: MultiDimSort
Sorts the entire array.

Specified by:
sort in interface MultiDimSort
Parameters:
a - array to sort

sort

public void sort(double[][] a,
                 int iMin,
                 int iMax)
Description copied from interface: MultiDimSort
Sorts the subarray of a made of the elements with indices from iMin to iMax-1.

Specified by:
sort in interface MultiDimSort
Parameters:
a - array to sort
iMin - index of first element to sort
iMax - index of last element to sort is iMax - 1

sort

public void sort(double[][] a)
Description copied from interface: MultiDimSort
Sorts the entire array.

Specified by:
sort in interface MultiDimSort
Parameters:
a - array to sort

getSortCoordinate

public int getSortCoordinate()
. \begin{tabb}
 Returns the coordinate used for sorting.
 \end{tabb}
coordinate used for sorting


dimension

public int dimension()
. \begin{tabb}
 Returns the dimension of the states to be sorted.
 \end{tabb}
dimension of states

Specified by:
dimension in interface MultiDimSort
Returns:
greatest dimension used for the sort

toString

public String toString()
. \begin{tabb}
 Returns a \texttt{String} containing information about this object.
 \end{tabb}
a String

Overrides:
toString in class Object

SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.