/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: SortingIterator.java,v 1.2.4.1 2005/09/06 10:23:32 pvedula Exp $
*/
/**
* @author Jacek Ambroziak
* @author Santiago Pericas-Geertsen
* @author Morten Jorgensen
*/
}
public int next() {
}
try {
_free = 0;
// gather all nodes from the source iterator
}
// now sort the records
_current = 0;
return this;
}
catch (Exception e) {
return this;
}
}
public int getPosition() {
}
public int getLast() {
return _free;
}
public void setMark() {
}
public void gotoMark() {
}
/**
* Clone a <code>SortingIterator</code> by cloning its source
* iterator and then sharing the factory and the array of
* <code>NodeSortRecords</code>.
*/
try {
clone.setRestartable(false);
}
catch (CloneNotSupportedException e) {
e.toString());
return null;
}
}
}
}
private void quicksort(int p, int r) {
while (p < r) {
final int q = partition(p, r);
quicksort(p, q);
p = q + 1;
}
}
private int partition(int p, int r) {
int i = p - 1;
int j = r + 1;
while (true) {
if (i < j) {
final NodeSortRecord t = _data[i];
_data[j] = t;
}
else {
return(j);
}
}
}
}