|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSorter.SplitSort
public class SplitSort
Class SplitSort
Field Summary | |
---|---|
private java.util.List<java.lang.Boolean> |
comparisons
Contains true at the rank k if the k^th element of "greater" IS actually greater than that of "smaller" : this.comparisons.get(k) = ( this.greater.get(k) > this.smaller.get(k) ), where ">" does NOT correspond to a comparison between integers but to the one performed by the turkers. |
private java.util.List<java.lang.Integer> |
greater
Contains all the elements that are to be compared with their corresponding pivot. |
private java.lang.Integer |
minimalSize
An array of a length smaller than minimalSize will not be sorted. |
private java.lang.Integer |
numberOfElements
The number of elements contained in the initial array to sort. |
private java.util.List<java.lang.Integer> |
smaller
Contains all the pivots used in the current iteration of the quicksort. |
private java.util.List<java.lang.Integer[]> |
sorted
Contains the elements to be sorted in a list of arrays. |
Constructor Summary | |
---|---|
SplitSort(java.lang.Integer[] init,
java.lang.Integer min)
Creates an instance of SplitSort. |
Method Summary | |
---|---|
void |
addComparisons(java.lang.Integer[] tab)
Add the comparisons necessary to perform a quicksort on the array "tab" to the attributes "greater" and "smaller". |
void |
display()
Prints the content of "sorted" on the screen, using brackets [] to separate each array. |
void |
endIteration(java.util.List<java.lang.Boolean> comparisons)
Performs the end of the quicksort iteration on all of the arrays contained in the attribute list "sorted". |
java.util.List<java.lang.Boolean> |
getComparisons()
Get the value of comparisons Contains true at the rank k if the k^th element of "greater" IS actually greater than that of "smaller" : this.comparisons.get(k) = ( this.greater.get(k) > this.smaller.get(k) ), where ">" does NOT correspond to a comparison between integers but to the one performed by the turkers. |
java.lang.Integer[] |
getFinalResult()
Returns the content of sorted transferred in a simple array. |
java.util.List<java.lang.Integer> |
getGreater()
Get the value of greater Contains all the elements that are to be compared with their corresponding pivot. |
java.util.List<java.lang.Integer> |
getSmaller()
Get the value of smaller Contains all the pivots used in the current iteration of the quicksort. |
int |
insertion(int rank)
Delete the array A at the "rank" rank in "sorted" and inserts arrays in it corresponding to the arrays of those "smaller than the pivot", the pivot and those "bigger than the pivot" contained in A. |
void |
iteration()
Performs the first part of an iteration of the quicksort on all the arrays contained in "sorted", which means choosing a pivot in each one and generating all of the comparisons necessary to go further. |
java.lang.Boolean |
notFinished()
Returns true if the number of elements contained in successive arrays containing less than this.minimalSize elements equals the number of elements to be sorted. |
void |
setComparisons(java.util.List<java.lang.Boolean> newVar)
Set the value of comparisons Contains true at the rank k if the k^th element of "greater" IS actually greater than that of "smaller" : this.comparisons.get(k) = ( this.greater.get(k) > this.smaller.get(k) ), where ">" does NOT correspond to a comparison between integers but to the one performed by the turkers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.List<java.lang.Integer> greater
private java.util.List<java.lang.Integer> smaller
private java.util.List<java.lang.Integer[]> sorted
private java.util.List<java.lang.Boolean> comparisons
private java.lang.Integer numberOfElements
private java.lang.Integer minimalSize
Constructor Detail |
---|
public SplitSort(java.lang.Integer[] init, java.lang.Integer min)
min
- An Integer representing the minimal size of the arrays to be sorted.init
- An array containing the id (Integers) of the elements to
sort.Method Detail |
---|
public java.lang.Boolean notFinished()
public void iteration()
public void addComparisons(java.lang.Integer[] tab)
tab
- The array that will go through an iteration of quicksort
(using a pivot).public void endIteration(java.util.List<java.lang.Boolean> comparisons)
comparisons
- public int insertion(int rank)
rank
- The array at the "rank" rank in the list "sorted" will be
split in several parts.
public java.lang.Integer[] getFinalResult()
public void display()
public java.util.List<java.lang.Integer> getGreater()
public java.util.List<java.lang.Integer> getSmaller()
public void setComparisons(java.util.List<java.lang.Boolean> newVar)
newVar
- the new value of comparisonspublic java.util.List<java.lang.Boolean> getComparisons()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |