The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Sort


Unit: SDL_replist
Class: TRLData
Declaration: [1] procedure Sort (PrimCol, SecCol: longint; Ascending: boolean);
[2] procedure Sort (PrimCol, SecCol: longint; AscendPrim, AscendSec: boolean);

The method Sort sorts the rows of the TRLData structure according to the strings in column PrimCol. In the case of equal elements in column PrimCol the elements of column SecCol are used as a secondary sorting key. SecCol may be set to negative values in order to suppress secondary sorting.

In version [1] the order of primary sorting is determined by the parameter Ascending, the secodary sorting is always in ascending direction. Version [2] of the method provides the option to specify the sorting order of both the primary and the secondary column independently (parameters AscendPrim and AscendSec).

The sorting is performed by a modified bubble sort (CombSort), which has been reported to be comparable in speed to QuickSort (see also R.Box, S. Lacey, BYTE magazine, April 1991).

The sorting process triggers the OnPercentDone event in order to be able to provide feedback to the user during time consuming sort tasks.



Last Update: 2023-Dec-14