Sorting functions. More...

Collaboration diagram for Sort Functions:

Classes

class  Murl::Util::CompareFunction< DataType >
 The compare functions. More...
 

Functions

template<class DataType >
void Murl::Util::QuickSort (DataType *items, UInt32 numberOfItems, SInt32(*compareFunction)(const DataType *, const DataType *))
 Quick sort items of specified type. More...
 
template<class DataType >
DataType * Murl::Util::BinarySearch (const DataType *key, DataType *items, UInt32 numberOfItems, SInt32(*compareFunction)(const DataType *, const DataType *))
 Binary search an item of specified type. More...
 
template<class DataType >
void Murl::Util::BubbleSort (DataType *items, UInt32 numberOfItems, SInt32(*compareFunction)(const DataType *, const DataType *))
 Bubble sort items of specified type. More...
 
template<class DataType >
void Murl::Util::SortArray (Array< DataType > &array, SInt32(*compareFunction)(const DataType *, const DataType *))
 Sort an array of specified type. More...
 
template<class DataType >
void Murl::Util::SortArray (Array< DataType > &array, Bool ascending)
 Sort an array of specified type. More...
 
void Murl::Util::SortUInt64Array (UInt64Array &array, Bool ascending)
 Sort a UInt64 array. More...
 
void Murl::Util::SortSInt64Array (SInt64Array &array, Bool ascending)
 Sort a SInt64 array. More...
 
void Murl::Util::SortUInt32Array (UInt32Array &array, Bool ascending)
 Sort a UInt32 array. More...
 
void Murl::Util::SortSInt32Array (SInt32Array &array, Bool ascending)
 Sort a SInt32 array. More...
 
void Murl::Util::SortRealArray (RealArray &array, Bool ascending)
 Sort a Real array. More...
 
void Murl::Util::SortDoubleArray (DoubleArray &array, Bool ascending)
 Sort a Double array. More...
 
void Murl::Util::SortStringArray (StringArray &array, Bool ascending)
 Sort a String array. More...
 

Detailed Description

Sorting functions.

Function Documentation

◆ QuickSort()

template<class DataType >
void Murl::Util::QuickSort ( DataType *  items,
UInt32  numberOfItems,
SInt32(*)(const DataType *, const DataType *)  compareFunction 
)

Quick sort items of specified type.

Template Parameters
DataTypeThe type of item to sort.
Parameters
itemsPointer to the items to sort.
numberOfItemsNumber of items to sort.
compareFunctionThe compare function for the item, see CompareFunction::Ascending and Descending method.

References Murl::System::CLib::QuickSort().

◆ BinarySearch()

template<class DataType >
DataType* Murl::Util::BinarySearch ( const DataType *  key,
DataType *  items,
UInt32  numberOfItems,
SInt32(*)(const DataType *, const DataType *)  compareFunction 
)

Binary search an item of specified type.

The items to search for are required to be sorted.

Template Parameters
DataTypeThe type of item to sort.
Parameters
keyPointer to the item to find.
itemsPointer to the items to search for.
numberOfItemsNumber of items to search for.
compareFunctionThe compare function for the item, see CompareFunction::Ascending and Descending method.
Returns
Pointer to the item found or null if the item is not found. If there are multiple elements matching key, the element returned is unspecified.

References Murl::System::CLib::BinarySearch().

◆ BubbleSort()

template<class DataType >
void Murl::Util::BubbleSort ( DataType *  items,
UInt32  numberOfItems,
SInt32(*)(const DataType *, const DataType *)  compareFunction 
)

Bubble sort items of specified type.

Template Parameters
DataTypeThe type of item to sort.
Parameters
itemsPointer to the items to sort.
numberOfItemsNumber of items to sort.
compareFunctionThe compare function for the item, see CompareFunction::Ascending and Descending method.

◆ SortArray() [1/2]

template<class DataType >
void Murl::Util::SortArray ( Array< DataType > &  array,
SInt32(*)(const DataType *, const DataType *)  compareFunction 
)

Sort an array of specified type.

The array is sorted by using the QuickSort algorithm and the compareFunction.

Parameters
arrayThe array to sort.
compareFunctionThe compare function for the item, see CompareFunction::Ascending and Descending method.

References Murl::Array< DataType >::GetCount().

Referenced by Murl::MapBase< Murl::String, SystemFontDescriptor *, Array< SystemFontDescriptor * >, StdHash< Murl::String > >::Sweep(), and Murl::IndexBase< KeyType, ObjectArray< KeyType >, HashFunc >::Sweep().

◆ SortArray() [2/2]

template<class DataType >
void Murl::Util::SortArray ( Array< DataType > &  array,
Bool  ascending 
)

Sort an array of specified type.

The array is sorted by using the QuickSort algorithm and the CompareFunction class.

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.

References Murl::Array< DataType >::GetCount(), Murl::Util::SortDoubleArray(), Murl::Util::SortRealArray(), Murl::Util::SortSInt32Array(), Murl::Util::SortSInt64Array(), Murl::Util::SortStringArray(), Murl::Util::SortUInt32Array(), and Murl::Util::SortUInt64Array().

◆ SortUInt64Array()

void Murl::Util::SortUInt64Array ( UInt64Array array,
Bool  ascending 
)

Sort a UInt64 array.

The array is sorted by using the quick sort algorithm.

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.

Referenced by Murl::Util::SortArray().

◆ SortSInt64Array()

void Murl::Util::SortSInt64Array ( SInt64Array array,
Bool  ascending 
)

Sort a SInt64 array.

The array is sorted by using the quick sort algorithm.

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.

Referenced by Murl::Util::SortArray().

◆ SortUInt32Array()

void Murl::Util::SortUInt32Array ( UInt32Array array,
Bool  ascending 
)

Sort a UInt32 array.

The array is sorted by using the quick sort algorithm.

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.

Referenced by Murl::Util::SortArray().

◆ SortSInt32Array()

void Murl::Util::SortSInt32Array ( SInt32Array array,
Bool  ascending 
)

Sort a SInt32 array.

The array is sorted by using the quick sort algorithm.

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.

Referenced by Murl::Util::SortArray().

◆ SortRealArray()

void Murl::Util::SortRealArray ( RealArray array,
Bool  ascending 
)

Sort a Real array.

The array is sorted by using the quick sort algorithm.

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.

Referenced by Murl::Util::SortArray().

◆ SortDoubleArray()

void Murl::Util::SortDoubleArray ( DoubleArray array,
Bool  ascending 
)

Sort a Double array.

The array is sorted by using the quick sort algorithm.

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.

Referenced by Murl::Util::SortArray().

◆ SortStringArray()

void Murl::Util::SortStringArray ( StringArray array,
Bool  ascending 
)

Sort a String array.

The array is sorted by using the quick sort algorithm.

Parameters
arrayThe array to sort.
ascendingtrue for ascending sort order, false for descending sort order.

Referenced by Murl::Util::SortArray().


Copyright © 2011-2018 Spraylight GmbH.