From f499d6f1e4d4ac73a4b9fcc42d3ab9281e4f5265 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Wed, 29 Apr 2020 21:09:46 +1000 Subject: Removed Key_Vector helper function, moved Node_Array type inside package --- src/directed_graphs.adb | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) (limited to 'src/directed_graphs.adb') diff --git a/src/directed_graphs.adb b/src/directed_graphs.adb index 3914137..7641d75 100644 --- a/src/directed_graphs.adb +++ b/src/directed_graphs.adb @@ -10,20 +10,6 @@ package body Directed_Graphs is - generic - type Base_Type is private; - type Ignore_Element is private; - with package Key_Maps is new Ada.Containers.Ordered_Maps - (Key_Type => Base_Type, - Element_Type => Ignore_Element, - others => <>); - with package Type_Vectors is new Ada.Containers.Vectors - (Index_Type => Positive, - Element_Type => Base_Type); - function Key_Vector - (My_Map : in Key_Maps.Map) - return Type_Vectors.Vector; - generic type Base_Type is private; type Array_Type is array (Positive range <>) of Base_Type; @@ -1444,24 +1430,6 @@ package body Directed_Graphs is - ---------------- - -- Key_Vector -- - ---------------- - - function Key_Vector - (My_Map : in Key_Maps.Map) - return Type_Vectors.Vector is - begin - return My_Vector : Type_Vectors.Vector do - for C in My_Map.Iterate loop - My_Vector.Append (Key_Maps.Key (C)); - end loop; - end return; - end Key_Vector; - - - - ----------- -- Label -- ----------- @@ -1865,9 +1833,12 @@ package body Directed_Graphs is return Node_Array is function V2A is new Vector_To_Array (Node_Type, Node_Array, Node_Vectors); - function Keys is new Key_Vector (Node_Type, Node_Vectors.Vector, Node_Maps, Node_Vectors); + Result : Node_Vectors.Vector; begin - return V2A (Keys (Container.Connections)); + for C in Container.Connections.Iterate loop + Result.Append (Node_Maps.Key (C)); + end loop; + return V2A (Result); end Nodes; function Nodes -- cgit