text
stringlengths
0
234
-- Same as Table_Implicitly_Created
when Value =>
String_Value : Unbounded_String;
end case;
end record;
procedure Free is new Ada.Unchecked_Deallocation
(Node_Record, Node_Record_Access);
function Create_Node (Rec : Node_Record_Access) return Node;
-- Wrap a value record in a value. This resets its ref-count to 1.
-----------------
-- Create_Node --
-----------------
function Create_Node (Rec : Node_Record_Access) return Node is
begin
return Result : Node do
Rec.Ref_Count := 1;
Result.Value := Rec;
end return;
end Create_Node;
-------------
-- Is_Null --
-------------
function Is_Null (This : Node) return Boolean is
begin
return This.Value = null;
end Is_Null;
----------
-- Kind --
----------
function Kind (This : Node) return Any_Node_Kind is
begin
return This.Value.Kind;
end Kind;
------------
-- Equals --
------------
function Equals (Left, Right : Node) return Boolean is
begin
-- If Left and Right refer to the same document, they are obviously
-- equivalent (X is equivalent to X). If they don't have the same kind,
-- they are obviously not equivalent.
if Left = Right then
return True;
elsif Left.Kind /= Right.Kind then
return False;
end if;
case Left.Kind is
when Map =>
declare
Left_Keys : constant Key_Array := Left.Keys;
Right_Keys : constant Key_Array := Right.Keys;
begin
if Left_Keys /= Right_Keys then
return False;
end if;
for K of Left_Keys loop
if not Equals (Left.Get (K), Right.Get (K)) then
return False;
end if;
end loop;
Function Definition: procedure Comp_Stats_Unit_test is
Function Body: Values: CompStats_Statistics.Values_Array(1..20);
Values2 : CompStats_Statistics.Values_Array(1..10);
procedure Test_Get_Count (Values : CompStats_Statistics.Values_Array) is
Result : INTEGER;
begin
Put("Get_Count : ");
Result := Get_Count(Values);
if Result = 20 then
Put("True");
else
Put(" False - ");
Put(Result);
end if;
New_Line;
end Test_Get_Count;
procedure Test_Get_Minimum (Values : CompStats_Statistics.Values_Array) is