Home Index classes Index static functions Index enumerations Index structure types

{Sorting|_functions_and_object}


CLASS {Sorting|_functions_and_object} , UNTESTED :



A class to sort arrays and to compare variables of different data types. Using generic data type {?} allows to reduce code to a single function which can handle variables of the most of data types in one (INTEGER, REAL, BYTE or STRING).


IMPORT : {System_functions} .



------------------------ 'when Obj inherited from {Sorting} is a parameter'

 

METHOD Data_sort ( INT Count|_items_to_sort )



------------------------------------------------------- 'sort simple array'

      

FUNCTION Sort_int|eger_array_qsort_not_recursive (
     
INT A|rray_to_sort [*] )



FUNCTION Sort_int_dec|ending_qsort_not_recursive (
     
INT A|rray_to_sort [*] )



FUNCTION Sort_real|_array_qsort_not_recursive (
     
REAL A|rray_to_sort [*] )



FUNCTION Sort_real_desc|ending_array_qsort_not_recursive (
     
REAL A|rray_to_sort [*] )



FUNCTION Sort_str|ing_array_qsort_not_recursive (
     
STR A|rray_to_sort [*] )



FUNCTION Sort_str_desc|ending_array_qsort_not_recursive (
     
STR A|rray_to_sort [*] )



----------------------------------------- 'maximum, minimum of two numbers'

        

FUNCTION IMax|imum_of_two_integer_values (
     
INT A|_operand ,
     
INT B|_operand ) ==> INT , DEPRECATED('Min')



FUNCTION IMin|imum_of_two_values (
     
INT A|_operand ,
     
INT B|_operand ) ==> INT , DEPRECATED('Max')



FUNCTION Max|imum_of_two_values (
     
INT,REAL,STR A|_operand ,
     
INT,REAL,STR B|_operand ) ==> INT,REAL,STR



FUNCTION Min|imum_of_two_values (
     
INT,REAL,STR A|_operand ,
     
INT,REAL,STR B|_operand ) ==> INT,REAL,STR



FUNCTION Index_of_min|imal_in_array (
     
INT,REAL,STR A|rray_to_search_in [*] ) ==> INT



FUNCTION Index_of_max|imal_in_array (
     
INT,REAL,STR A|rray_to_search_in [*] ) ==> INT



FUNCTION Find_min|imal_value_in_array (
     
INT,REAL,STR A|rray_to_search_in [*] ) ==> INT,REAL,STR



FUNCTION Find_max|imal_value_in_array (
     
INT,REAL,STR A|rray_to_search_in [*] ) ==> INT,REAL,STR



---------------------------------------------------------------- 'restrict'

 

FUNCTION Restrict|_by_range (
     
INT,REAL Value|_to_restrict ,
     
INT,REAL Range1|_side ,
     
INT,REAL Range2|_side ) ==> INT,REAL


END