Stack<QueryUtils.Range> stack = new Stack<QueryUtils.Range>();
int low;
int high;
QueryUtils.Range range;
int pivot;
SyntheticSubject pivotVal = subj1;
long tmpVal;
stack.push(new QueryUtils.Range(0, arrayOfIds.length - 1));
while (stack.size() > 0) {
if (start >= end) {
range = (QueryUtils.Range) stack.pop();
start = range.start;
end = range.end;
}
if (start < end) {
// select middle
pivot = start + (end - start) / 2;
// select median of three
// if ((end - start) > 10)
// pivot = ((arrayOfIds[start] < arrayOfIds[pivot]) ?
// ((arrayOfIds[pivot] < arrayOfIds[end]) ? pivot :
// ((arrayOfIds[start] < arrayOfIds[end]) ? end : start)) :
// ((arrayOfIds[pivot] > arrayOfIds[end]) ? pivot :
// ((arrayOfIds[start] > arrayOfIds[end]) ? end : start)));
pivotVal.setObjectData(arrayOfIds[pivot], -1, null);// =
// sortingDataProvider.getComparableForId(arrayOfIds[pivot]);
low = start;
high = end;
while (low < high) {
while (comparator.compare(initSubject(subj2,
arrayOfIds[low]).getSyntheticSubject(), pivotVal
.getSyntheticSubject())/*
* sortingDataProvider.getComparableForId(arrayOfIds[low]).compareTo(pivotVal,
* nodes)
*/< 0
&& (low < end))
{
low++;
}
while (comparator.compare(initSubject(subj2,
arrayOfIds[high]).getSyntheticSubject(), pivotVal
.getSyntheticSubject())/*
* sortingDataProvider.getComparableForId(arrayOfIds[high]).compareTo(pivotVal,
* nodes)
*/> 0
&& (high > start))