diff options
author | Jed Barber <jjbarber@y7mail.com> | 2020-04-29 21:09:46 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2020-04-29 21:09:46 +1000 |
commit | f499d6f1e4d4ac73a4b9fcc42d3ab9281e4f5265 (patch) | |
tree | 2b7bdcfe9741fa7e06cad2b897d8617b3308463c /src/directed_graphs.adb | |
parent | 933970ba647117d0c5fe1f4d6c6e66429c2e3ce2 (diff) |
Removed Key_Vector helper function, moved Node_Array type inside package
Diffstat (limited to 'src/directed_graphs.adb')
-rw-r--r-- | src/directed_graphs.adb | 39 |
1 files changed, 5 insertions, 34 deletions
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 @@ -12,20 +12,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; with package Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, @@ -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 |