Sorting functions. More...
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()
void Murl::Util::QuickSort | ( | DataType * | items, |
UInt32 | numberOfItems, | ||
SInt32(*)(const DataType *, const DataType *) | compareFunction | ||
) |
Quick sort items of specified type.
- Template Parameters
-
DataType The type of item to sort.
- Parameters
-
items Pointer to the items to sort. numberOfItems Number of items to sort. compareFunction The compare function for the item, see CompareFunction::Ascending and Descending method.
References Murl::System::CLib::QuickSort().
◆ BinarySearch()
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
-
DataType The type of item to sort.
- Parameters
-
key Pointer to the item to find. items Pointer to the items to search for. numberOfItems Number of items to search for. compareFunction The 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()
void Murl::Util::BubbleSort | ( | DataType * | items, |
UInt32 | numberOfItems, | ||
SInt32(*)(const DataType *, const DataType *) | compareFunction | ||
) |
Bubble sort items of specified type.
- Template Parameters
-
DataType The type of item to sort.
- Parameters
-
items Pointer to the items to sort. numberOfItems Number of items to sort. compareFunction The compare function for the item, see CompareFunction::Ascending and Descending method.
◆ SortArray() [1/2]
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
-
array The array to sort. compareFunction The compare function for the item, see CompareFunction::Ascending and Descending method.
References Murl::Array< DataType >::GetCount().
Referenced by Murl::IndexBase< KeyType, ArrayType, HashFunc >::Sweep(), and Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Sweep().
◆ SortArray() [2/2]
Sort an array of specified type.
The array is sorted by using the QuickSort algorithm and the CompareFunction class.
- Parameters
-
array The array to sort. ascending true for ascending sort order, false for descending sort order.
References Murl::Array< DataType >::GetCount().
◆ SortUInt64Array()
void Murl::Util::SortUInt64Array | ( | UInt64Array & | array, |
Bool | ascending | ||
) |
Sort a UInt64 array.
The array is sorted by using the quick sort algorithm.
- Parameters
-
array The array to sort. ascending true for ascending sort order, false for descending sort order.
◆ SortSInt64Array()
void Murl::Util::SortSInt64Array | ( | SInt64Array & | array, |
Bool | ascending | ||
) |
Sort a SInt64 array.
The array is sorted by using the quick sort algorithm.
- Parameters
-
array The array to sort. ascending true for ascending sort order, false for descending sort order.
◆ SortUInt32Array()
void Murl::Util::SortUInt32Array | ( | UInt32Array & | array, |
Bool | ascending | ||
) |
Sort a UInt32 array.
The array is sorted by using the quick sort algorithm.
- Parameters
-
array The array to sort. ascending true for ascending sort order, false for descending sort order.
◆ SortSInt32Array()
void Murl::Util::SortSInt32Array | ( | SInt32Array & | array, |
Bool | ascending | ||
) |
Sort a SInt32 array.
The array is sorted by using the quick sort algorithm.
- Parameters
-
array The array to sort. ascending true for ascending sort order, false for descending sort order.
◆ SortRealArray()
Sort a Real array.
The array is sorted by using the quick sort algorithm.
- Parameters
-
array The array to sort. ascending true for ascending sort order, false for descending sort order.
◆ SortDoubleArray()
void Murl::Util::SortDoubleArray | ( | DoubleArray & | array, |
Bool | ascending | ||
) |
Sort a Double array.
The array is sorted by using the quick sort algorithm.
- Parameters
-
array The array to sort. ascending true for ascending sort order, false for descending sort order.
◆ SortStringArray()
void Murl::Util::SortStringArray | ( | StringArray & | array, |
Bool | ascending | ||
) |
Sort a String array.
The array is sorted by using the quick sort algorithm.
- Parameters
-
array The array to sort. ascending true for ascending sort order, false for descending sort order.