OSDN Git Service

2007-09-21 Olivier Hainque <hainque@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-crbtgo.adb
index b0b7ca0..4afce91 100644 (file)
@@ -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- --
 -- 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;
 
@@ -695,7 +698,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
    ------------------
 
    procedure Generic_Read
-     (Stream : access Root_Stream_Type'Class;
+     (Stream : not null access Root_Stream_Type'Class;
       Tree   : in out Tree_Type)
    is
       N : Count_Type'Base;
@@ -773,7 +776,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
    -------------------
 
    procedure Generic_Write
-     (Stream : access Root_Stream_Type'Class;
+     (Stream : not null access Root_Stream_Type'Class;
       Tree   : Tree_Type)
    is
       procedure Process (Node : 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);