|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsorter.Comparator
public class Comparator
Uses several instances of SplitSort
, one for each axis considered, to sort media.
The aim of this class is to manage a SplitSort instance for each axis considered and to ask for all comparisons necessary at a time, i.e to "group" them in order to limit the number of jobs uploaded as well as allowing a treatment of the results requiring a lot of data to be processed at the same time.
A lot of its methods are simply calls to their equivalent for each SplitSort instance in the
Comparator.sorters
attribute.
Field Summary | |
---|---|
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 ]. |
private MySQLbase |
sqlBase
The MySQLbase database from which comparisons will be retrieved. |
Constructor Summary | |
---|---|
Comparator(java.util.Map<java.lang.String,SplitSort> sorter)
Creates a Comparator instance using the SplitSorts contained in the sorter map. |
|
Comparator(java.util.Map<java.lang.String,SplitSort> sorter,
MySQLbase bdd)
Creates a Comparator instance using the SplitSorts contained in the sorter map and links it with a MySQLbase instance. |
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)
Asks for unknown comparisons by modifying the value of its parameters greater, smaller and axes. |
void |
display()
Displays the current state of the sort using SplitSort.display() . |
void |
endIteration()
Performs the last part of a quicksort iteration. |
java.util.Map<java.lang.String,java.util.List<java.lang.Integer[]>> |
getCurrentState()
Returns the current state of the sort, i.e a Map indexed by the axes and containing the sorted attribute of each SplitSort contained in sorters. |
java.util.Map<java.lang.String,SplitSort> |
getSplitSorts()
Returns the sorters attribute. |
java.lang.Boolean |
notFinished()
Returns true while the sorting is not over. |
void |
sortIteration()
Performs the first part of a quicksort iteration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Map<java.lang.String,SplitSort> sorters
private MySQLbase sqlBase
MySQLbase
database from which comparisons will be retrieved.
Constructor Detail |
---|
public Comparator(java.util.Map<java.lang.String,SplitSort> sorter, MySQLbase bdd)
MySQLbase
instance.
Both of the attributes of this class are set when this constructor is called.
sorter
- This map should have the following structure : [ key = axis considered,
element = instance of SplitSort in charge of sorting media along this axis ].bdd
- The database that will be used as the "sqlBase" attribute.public Comparator(java.util.Map<java.lang.String,SplitSort> sorter)
This constructor sets the value the sorter attribute, but not that of the MySQLbase ! Be careful therefore not to do anything requiring it with such an instance.
sorter
- This map should have the following structure : [ key = axis considered,
element = instance of SplitSort in charge of sorting media along this axis ].Method Detail |
---|
public java.lang.Boolean notFinished()
It equals false only if SplitSort.notFinished( )
is false for all the SplitSorts in sorters,
in which case quicksort iterations must stop.
public void sortIteration()
All of the SplitSort instances contained in "sorters" are asked to perform the first step of a quicksort iteration.
public void endIteration()
All of the SplitSort instances contained in sorters are asked to perform the last step of a quicksort iteration.
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 identifiers of the elements that require a comparison and are alleged to be respectively greater and smaller and, in axes, the axes along which the comparison must be performed.
greater
- All the media to be compared to the pivots in the several pending quicksorts.smaller
- The pivots corresponding to the several pending quicksorts.axes
- The axes along which comparisons must be performed.public void display()
SplitSort.display()
.
public java.util.Map<java.lang.String,SplitSort> getSplitSorts()
public java.util.Map<java.lang.String,java.util.List<java.lang.Integer[]>> getCurrentState()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |