Sorter
Class Comparator

java.lang.Object
  extended by Sorter.Comparator

public class Comparator
extends java.lang.Object

Class Comparator

Author:
Léo Perrin (Centrale Lyon)

Field Summary
private  MySQLbase lookBack
          The database in which previously made comparisons will be retrieved.
private  java.util.Map<java.lang.String,SplitSort> sorters
          This map must have the following structure : [ key = "axis considered", element = "instance of SplitSort in charge of sorting media along this axis" ].
 
Constructor Summary
Comparator(java.util.Map<java.lang.String,SplitSort> sorter, MySQLbase bdd)
          Creates a Comparator.
 
Method Summary
 void demandNewComparisons(java.util.List<java.lang.Integer> greater, java.util.List<java.lang.Integer> smaller, java.util.List<java.lang.String> axes)
          Returns in the parameters "greater" and "smaller" the IDs of the elements that requiere a comparison and in "axes" the axes on which the comparison must be performed.
 void endIteration()
          Performs the last part of a quicksort iteration on all of the SplitSort instances contained in "sorters".
 java.lang.Boolean notFinished()
          Returns true while the sorting is not over.
 void sortIteration()
          Performs the first part of a quicksort iteration on all of the SplitSort instances contained in "sorters".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sorters

private java.util.Map<java.lang.String,SplitSort> sorters
This map must have the following structure : [ key = "axis considered", element = "instance of SplitSort in charge of sorting media along this axis" ].


lookBack

private MySQLbase lookBack
The database in which previously made comparisons will be retrieved.

Constructor Detail

Comparator

public Comparator(java.util.Map<java.lang.String,SplitSort> sorter,
                  MySQLbase bdd)
Creates a Comparator. The map should have the following structure : [ key = "axis considered", element = "instance of SplitSort in charge of sorting media along this axis" ] ; bdd is the instance of myDataBase.MyDataBase that will be used.

Parameters:
sorter - This map contains as keys the what is to be mesured and as elements the SplitSort in charge of sorting it.
bdd - The database that will be used as the "lookBack" attribute.
Method Detail

notFinished

public java.lang.Boolean notFinished()
Returns true while the sorting is not over. It equals false only if SplitSort.notFinished() is false for all the SplitSorts in "sorters".


sortIteration

public void sortIteration()
Performs the first part of a quicksort iteration on all of the SplitSort instances contained in "sorters".


endIteration

public void endIteration()
Performs the last part of a quicksort iteration on all of the SplitSort instances contained in "sorters".


demandNewComparisons

public void demandNewComparisons(java.util.List<java.lang.Integer> greater,
                                 java.util.List<java.lang.Integer> smaller,
                                 java.util.List<java.lang.String> axes)
Returns in the parameters "greater" and "smaller" the IDs of the elements that requiere a comparison and in "axes" the axes on which the comparison must be performed.

Parameters:
greater - All the media to be compared to the pivots in the several pending quicksorts.
smaller - The pivots corresponding to the several pending quicksorts.