summaryrefslogtreecommitdiff
path: root/gcc/ada/a-crbtgo.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 18:13:22 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 18:13:22 +0000
commitd9e74e050bd1ae08f4be72f63784a42c0973a94a (patch)
tree1a5cb845f084a8360d6f2bc2dd674427a1a51b02 /gcc/ada/a-crbtgo.adb
parentad67c992e9102a7a00351747f46956e56b6f0c3f (diff)
downloadgcc-d9e74e050bd1ae08f4be72f63784a42c0973a94a.tar.gz
2006-10-31 Matt Heaney <heaney@adacore.com>
* a-crbtgo.ads: Commented each subprogram * a-crbtgo.adb: Added reference to book from which algorithms were adapted. * a-crbtgk.ads, a-crbtgk.adb (Generic_Insert_Post): pass flag to indicate which child. (Generic_Conditional_Insert): changed parameter name from "Success" to "Inserted". (Generic_Unconditional_Insert_With_Hint): improved algorithm * a-coorse.adb (Replace_Element): changed parameter name in call to conditional insert operation. * a-convec.adb, a-coinve.adb (Insert): removed obsolete comment * a-cohama.adb (Iterate): manipulate busy-bit here, instead of in Generic_Iteration * a-ciorse.adb (Replace_Element): changed parameter name in call to conditional insert operation. * a-cihama.adb (Iterate): manipulate busy-bit here, instead of in Generic_Iteration. * a-cidlli.ads, a-cidlli.adb (Splice): Position param is now mode in instead of mode inout. * a-chtgop.adb (Adjust): modified comments to reflect current AI-302 draft (Generic_Read): preserve existing buckets array if possible (Generic_Write): don't send buckets array length anymore * a-cdlili.ads, a-cdlili.adb (Splice): Position param is now mode in instead of mode inout. * a-cihase.adb (Difference): iterate over smaller of Tgt and Src sets (Iterate): manipulate busy-bit here, instead of in Generic_Iteration * a-cohase.adb (Difference): iterate over smaller of Tgt and Src sets (Iterate): manipulate busy-bit here, instead of in Generic_Iteration (Replace_Element): local operation is now an instantiation * a-chtgke.ads, a-chtgke.adb (Generic_Conditional_Insert): manually check current length. (Generic_Replace_Element): new operation git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118324 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-crbtgo.adb')
-rw-r--r--gcc/ada/a-crbtgo.adb41
1 files changed, 14 insertions, 27 deletions
diff --git a/gcc/ada/a-crbtgo.adb b/gcc/ada/a-crbtgo.adb
index b0b7ca09bc6..a9f63942fe1 100644
--- a/gcc/ada/a-crbtgo.adb
+++ b/gcc/ada/a-crbtgo.adb
@@ -9,10 +9,6 @@
-- --
-- Copyright (C) 2004-2006, Free Software Foundation, Inc. --
-- --
--- This specification is derived from the Ada Reference Manual for use with --
--- GNAT. The copyright notice above, and the license provisions that follow --
--- apply solely to the contents of the part following the private keyword. --
--- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
@@ -34,6 +30,13 @@
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
+-- The references below to "CLR" refer to the following book, from which
+-- several of the algorithms here were adapted:
+-- Introduction to Algorithms
+-- by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
+-- Publisher: The MIT Press (June 18, 1990)
+-- ISBN: 0262031418
+
with System; use type System.Address;
package body Ada.Containers.Red_Black_Trees.Generic_Operations is
@@ -141,7 +144,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
procedure Delete_Fixup (Tree : in out Tree_Type; Node : Node_Access) is
- -- CLR p274 ???
+ -- CLR p274
X : Node_Access := Node;
W : Node_Access;
@@ -237,7 +240,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
(Tree : in out Tree_Type;
Node : Node_Access)
is
- -- CLR p273 ???
+ -- CLR p273
X, Y : Node_Access;
@@ -804,7 +807,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
procedure Left_Rotate (Tree : in out Tree_Type; X : Node_Access) is
- -- CLR p266 ???
+ -- CLR p266
Y : constant Node_Access := Right (X);
pragma Assert (Y /= null);
@@ -837,7 +840,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
function Max (Node : Node_Access) return Node_Access is
- -- CLR p248 ???
+ -- CLR p248
X : Node_Access := Node;
Y : Node_Access;
@@ -860,7 +863,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
function Min (Node : Node_Access) return Node_Access is
- -- CLR p248 ???
+ -- CLR p248
X : Node_Access := Node;
Y : Node_Access;
@@ -883,7 +886,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
function Next (Node : Node_Access) return Node_Access is
begin
- -- CLR p249 ???
+ -- CLR p249
if Node = null then
return null;
@@ -905,14 +908,6 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
Y := Parent (Y);
end loop;
- -- Why is this code commented out ???
-
--- if Right (X) /= Y then
--- return Y;
--- else
--- return X;
--- end if;
-
return Y;
end;
end Next;
@@ -943,14 +938,6 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
Y := Parent (Y);
end loop;
- -- Why is this code commented out ???
-
--- if Left (X) /= Y then
--- return Y;
--- else
--- return X;
--- end if;
-
return Y;
end;
end Previous;
@@ -963,7 +950,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
(Tree : in out Tree_Type;
Node : Node_Access)
is
- -- CLR p.268 ???
+ -- CLR p.268
X : Node_Access := Node;
pragma Assert (X /= null);