annotate gcc/ada/libgnat/a-rbtgso.ads @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT LIBRARY COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_SET_OPERATIONS --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 2004-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- This unit was originally developed by Matthew J Heaney. --
kono
parents:
diff changeset
28 ------------------------------------------------------------------------------
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 -- Tree_Type is used to implement ordered containers. This package declares
kono
parents:
diff changeset
31 -- set-based tree operations.
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 with Ada.Containers.Red_Black_Trees.Generic_Operations;
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 generic
kono
parents:
diff changeset
36 with package Tree_Operations is new Generic_Operations (<>);
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 use Tree_Operations.Tree_Types, Tree_Operations.Tree_Types.Implementation;
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 with procedure Insert_With_Hint
kono
parents:
diff changeset
41 (Dst_Tree : in out Tree_Type;
kono
parents:
diff changeset
42 Dst_Hint : Node_Access;
kono
parents:
diff changeset
43 Src_Node : Node_Access;
kono
parents:
diff changeset
44 Dst_Node : out Node_Access);
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 with function Copy_Tree (Source_Root : Node_Access)
kono
parents:
diff changeset
47 return Node_Access;
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 with procedure Delete_Tree (X : in out Node_Access);
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 with function Is_Less (Left, Right : Node_Access) return Boolean;
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 with procedure Free (X : in out Node_Access);
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 package Ada.Containers.Red_Black_Trees.Generic_Set_Operations is
kono
parents:
diff changeset
56 pragma Pure;
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 procedure Union (Target : in out Tree_Type; Source : Tree_Type);
kono
parents:
diff changeset
59 -- Attempts to insert each element of Source in Target. If Target is
kono
parents:
diff changeset
60 -- busy then Program_Error is raised. We say "attempts" here because
kono
parents:
diff changeset
61 -- if these are unique-element sets, then the insertion should fail
kono
parents:
diff changeset
62 -- (not insert a new item) when the insertion item from Source is
kono
parents:
diff changeset
63 -- equivalent to an item already in Target. If these are multisets
kono
parents:
diff changeset
64 -- then of course the attempt should always succeed.
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 function Union (Left, Right : Tree_Type) return Tree_Type;
kono
parents:
diff changeset
67 -- Makes a copy of Left, and attempts to insert each element of
kono
parents:
diff changeset
68 -- Right into the copy, then returns the copy.
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 procedure Intersection (Target : in out Tree_Type; Source : Tree_Type);
kono
parents:
diff changeset
71 -- Removes elements from Target that are not equivalent to items in
kono
parents:
diff changeset
72 -- Source. If Target is busy then Program_Error is raised.
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 function Intersection (Left, Right : Tree_Type) return Tree_Type;
kono
parents:
diff changeset
75 -- Returns a set comprising all the items in Left equivalent to items in
kono
parents:
diff changeset
76 -- Right.
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 procedure Difference (Target : in out Tree_Type; Source : Tree_Type);
kono
parents:
diff changeset
79 -- Removes elements from Target that are equivalent to items in Source. If
kono
parents:
diff changeset
80 -- Target is busy then Program_Error is raised.
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 function Difference (Left, Right : Tree_Type) return Tree_Type;
kono
parents:
diff changeset
83 -- Returns a set comprising all the items in Left not equivalent to items
kono
parents:
diff changeset
84 -- in Right.
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 procedure Symmetric_Difference
kono
parents:
diff changeset
87 (Target : in out Tree_Type;
kono
parents:
diff changeset
88 Source : Tree_Type);
kono
parents:
diff changeset
89 -- Removes from Target elements that are equivalent to items in Source, and
kono
parents:
diff changeset
90 -- inserts into Target items from Source not equivalent elements in
kono
parents:
diff changeset
91 -- Target. If Target is busy then Program_Error is raised.
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 function Symmetric_Difference (Left, Right : Tree_Type) return Tree_Type;
kono
parents:
diff changeset
94 -- Returns a set comprising the union of the elements in Left not
kono
parents:
diff changeset
95 -- equivalent to items in Right, and the elements in Right not equivalent
kono
parents:
diff changeset
96 -- to items in Left.
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 function Is_Subset (Subset : Tree_Type; Of_Set : Tree_Type) return Boolean;
kono
parents:
diff changeset
99 -- Returns False if Subset contains at least one element not equivalent to
kono
parents:
diff changeset
100 -- any item in Of_Set; returns True otherwise.
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 function Overlap (Left, Right : Tree_Type) return Boolean;
kono
parents:
diff changeset
103 -- Returns True if at least one element of Left is equivalent to an item in
kono
parents:
diff changeset
104 -- Right; returns False otherwise.
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 end Ada.Containers.Red_Black_Trees.Generic_Set_Operations;