3 subtype Index_Type
is Positive range 1 .. 100;
4 type Array_Type
is array(Index_Type
) of Integer;
6 type Search_Engine
is interface
;
10 Search_Item
: in Integer;
11 Items
: in Array_Type
;
13 Result
: out Index_Type
) is abstract
16 (for all J
in Items
'Range =>
17 (for all K
in J
+ 1 .. Items
'Last => Items
(J
) <= Items
(K
))),
19 (if Found
then Search_Item
= Items
(Result
)
20 else (for all J
in Items
'Range => Items
(J
) /= Search_Item
));
22 type Binary_Search_Engine
is new Search_Engine
with null record;
25 (S
: in Binary_Search_Engine
;
26 Search_Item
: in Integer;
27 Items
: in Array_Type
;
29 Result
: out Index_Type
) is null;
31 type Forward_Search_Engine
is new Search_Engine
with null record;
34 (S
: in Forward_Search_Engine
;
35 Search_Item
: in Integer;
36 Items
: in Array_Type
;
38 Result
: out Index_Type
) is null;