From 4b561d99f9c871e5874721592984cb427d6cbe36 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 24 Apr 2020 18:56:16 +1000 Subject: Skeleton of package body --- src/ada-containers-directed_graphs.adb | 1374 ++++++++++++++++++++++++++++++++ src/ada-containers-directed_graphs.ads | 2 +- 2 files changed, 1375 insertions(+), 1 deletion(-) create mode 100644 src/ada-containers-directed_graphs.adb (limited to 'src') diff --git a/src/ada-containers-directed_graphs.adb b/src/ada-containers-directed_graphs.adb new file mode 100644 index 0000000..51728dd --- /dev/null +++ b/src/ada-containers-directed_graphs.adb @@ -0,0 +1,1374 @@ + + +package body Ada.Containers.Directed_Graphs is + + + pragma Warnings (Off, "variable ""Busy*"" is not referenced"); + pragma Warnings (Off, "variable ""Lock*"" is not referenced"); + -- See comment in Ada.Containers.Helpers + + + + + --------- + -- "=" -- + --------- + + overriding function "=" + (Left, Right : in Graph) + return Boolean is + begin + return False; + end "="; + + + + + ------------ + -- Adjust -- + ------------ + + procedure Adjust + (Container : in out Graph) is + begin + null; + end Adjust; + + + + + ------------ + -- Append -- + ------------ + + procedure Append + (Container : in out Graph; + Position : out Cursor) is + begin + null; + end Append; + + procedure Append + (Container : in out Graph; + Label : in Node_Label_Type; + Position : out Cursor) is + begin + null; + end Append; + + + + + ------------------ + -- Append_Label -- + ------------------ + + procedure Append_Label + (Container : in out Graph; + Node : in Node_Type; + Label : in Node_Label_Type) is + begin + null; + end Append_Label; + + procedure Append_Label + (Position : in out Cursor; + Label : in Node_Label_Type) is + begin + null; + end Append_Label; + + procedure Append_Label + (Container : in out Graph; + Edge : in Edge_Type; + Label : in Edge_Label_Type) is + begin + null; + end Append_Label; + + + + + ------------ + -- Assign -- + ------------ + + procedure Assign + (Target : in out Graph; + Source : in Graph) is + begin + null; + end Assign; + + + + + -------------- + -- Children -- + -------------- + + function Children + (Container : in Graph; + Node : in Node_Type) + return Node_Array is + begin + return (others => False); + end Children; + + function Children + (Position : in Cursor) + return Node_Array is + begin + return (others => False); + end Children; + + + + + ----------- + -- Clear -- + ----------- + + procedure Clear + (Container : in out Graph) is + begin + null; + end Clear; + + + + + ------------------ + -- Clear_Labels -- + ------------------ + + procedure Clear_Labels + (Container : in out Graph) is + begin + null; + end Clear_Labels; + + + + + ------------------------------ + -- Constant_Label_Reference -- + ------------------------------ + + function Constant_Label_Reference + (Container : in Graph; + Node : in Node_Type) + return Node_Label_Constant_Reference is + begin + return R : Node_Label_Constant_Reference := + (Element => null, + Control => (Ada.Finalization.Controlled with null)); + end Constant_Label_Reference; + + function Constant_Label_Reference + (Position : in Cursor) + return Node_Label_Constant_Reference is + begin + return R : Node_Label_Constant_Reference := + (Element => null; + Control => (Ada.Finalization.Controlled with null)); + end Constant_Label_Reference; + + function Constant_Label_Reference + (Container : in Graph; + Edge : in Edge_Type) + return Edge_Label_Constant_Reference is + begin + return R : Edge_Label_Constant_Reference := + (Element => null; + Control => (Ada.Finalization.Controlled with null)); + end Constant_Label_Reference; + + + + + -------------- + -- Contains -- + -------------- + + function Contains + (Container : in Graph; + Node : in Node_Type) + return Boolean is + begin + return False; + end Contains; + + function Contains + (Container : in Graph; + Node : in Node_Type; + Label : in Node_Label_Type) + return Boolean is + begin + return False; + end Contains; + + function Contains + (Container : in Graph; + Edge : in Edge_Type) + return Boolean is + begin + return False; + end Contains; + + function Contains + (Container : in Graph; + Edge : in Edge_Type; + Label : in Edge_Label_Type) + return Boolean is + begin + return False; + end Contains; + + + + + -------------------------- + -- Contains_In_Subgraph -- + -------------------------- + + function Contains_In_Subgraph + (Position : in Cursor; + Node : in Node_Type) + return Boolean is + begin + return False; + end Contains_In_Subgraph; + + function Contains_In_Subgraph + (Position : in Cursor; + Node : in Node_Type; + Label : in Node_Label_Type) + return Boolean is + begin + return False; + end Contains_In_Subgraph; + + function Contains_In_Subgraph + (Position : in Cursor; + Edge : in Edge_Type) + return Boolean is + begin + return False; + end Contains_In_Subgraph; + + function Contains_In_Subgraph + (Position : in Cursor; + Edge : in Edge_Type; + Label : in Edge_Label_Type) + return Boolean is + begin + return False; + end Contains_In_Subgraph; + + + + + -------------------- + -- Contains_Label -- + -------------------- + + function Contains_Label + (Container : in Graph; + Label : in Node_Label_Type) + return Boolean is + begin + return False; + end Contains_Label; + + function Contains_Label + (Container : in Graph; + Label : in Edge_Label_Type) + return Boolean is + begin + return False; + end Contains_Label; + + + + + -------------------------------- + -- Contains_Label_In_Subgraph -- + -------------------------------- + + function Contains_Label_In_Subgraph + (Position : in Cursor; + Label : in Node_Label_Type) + return Boolean is + begin + return False; + end Contains_Label_In_Subgraph; + + function Contains_Label_In_Subgraph + (Position : in Cursor; + Label : in Edge_Label_Type) + return Boolean is + begin + return False; + end Contains_Label_In_Subgraph; + + + + + ------------- + -- Context -- + ------------- + + procedure Context + (Container : in Graph; + Node : in Node_Type; + Parents : out Node_Array; + Children : out Node_Array) is + begin + null; + end Context; + + procedure Context + (Position : in Cursor; + Parents : out Node_Array; + Children : out Node_Array) is + begin + null; + end Context; + + + + + ---------- + -- Copy -- + ---------- + + function Copy + (Source : in Graph) + return Graph is + begin + return Empty_Graph; + end Copy; + + + + + ------------ + -- Degree -- + ------------ + + function Degree + (Container : in Graph; + Node : in Node_Type) + return Count_Type is + begin + return Count_Type'First; + end Degree; + + function Degree + (Position : in Cursor) + return Count_Type is + begin + return Count_Type'First; + end Degree; + + + + + ------------ + -- Delete -- + ------------ + + procedure Delete + (Container : in out Graph; + Node : in Node_Type) is + begin + null; + end Delete; + + procedure Delete + (Position : in out Cursor) is + begin + null; + end Delete; + + procedure Delete + (Container : in out Graph; + Nodes : in Node_Array) is + begin + null; + end Delete; + + procedure Delete + (Container : in out Graph; + Edge : in Edge_Type) is + begin + null; + end Delete; + + procedure Delete + (Container : in out Graph; + Edges : in Edge_Array) is + begin + null; + end Delete; + + + + + ------------------ + -- Delete_Label -- + ------------------ + + procedure Delete_Label + (Container : in out Graph; + Node : in Node_Type) is + begin + null; + end Delete_Label; + + procedure Delete_Label + (Position : in out Cursor) is + begin + null; + end Delete_Label; + + procedure Delete_Label + (Container : in out Graph; + Edge : in Edge_Type) is + begin + null; + end Delete_Label; + + + + + --------------------- + -- Delete_Subgraph -- + --------------------- + + procedure Delete_Subgraph + (Position : in out Cursor) is + begin + null; + end Delete_Subgraph; + + + + + ---------------- + -- Edge_Count -- + ---------------- + + function Edge_Count + (Container : in Graph) + return Count_Type is + begin + return Count_Type'First; + end Edge_Count; + + + + + ----------- + -- Edges -- + ----------- + + function Edges + (Container : in Graph) + return Edge_Array is + begin + return (others => False); + end Edges; + + + + + -------------- + -- Finalize -- + -------------- + + procedure Finalize + (Container : in out Graph) is + begin + null; + end Finalize; + + procedure Finalize + (Object : in out Iterator) is + begin + null; + end Finalize; + + procedure Finalize + (Object : in out Subgraph_Iterator) is + begin + null; + end Finalize; + + + + + ---------- + -- Find -- + ---------- + + function Find + (Container : in Graph; + Label : in Node_Label_Type) + return Node_Array is + begin + return (others => False); + end Find; + + function Find + (Container : in Graph; + Label : in Edge_Label_Type) + return Edge_Array is + begin + return (others => False); + end Find; + + + + + ---------------------- + -- Find_In_Subgraph -- + ---------------------- + + function Find_In_Subgraph + (Position : in Cursor; + Label : in Node_Label_Type) + return Node_Array is + begin + return (others => False); + end Find_In_Subgraph; + + function Find_In_Subgraph + (Position : in Cursor; + Label : in Edge_Label_Type) + return Edge_Array is + begin + return (others => False); + end Find_In_Subgraph; + + + + + ----------- + -- First -- + ----------- + + function First + (Container : in Graph) + return Cursor is + begin + return No_Element; + end First; + + function First + (Object : in Iterator) + return Cursor is + begin + return No_Element; + end First; + + function First + (Object : in Subgraph_Iterator) + return Cursor is + begin + return No_Element; + end First; + + + + + -------------- + -- Has_Edge -- + -------------- + + function Has_Edge + (Container : in Graph; + Parent, Child : in Node_Type) + return Boolean is + begin + return False; + end Has_Edge; + + function Has_Edge + (Parent, Child : in Cursor) + return Boolean is + begin + return False; + end Has_Edge; + + + + + ----------------- + -- Has_Element -- + ----------------- + + function Has_Element + (Position : in Cursor) + return Boolean is + begin + return False; + end Has_Element; + + + + + --------------- + -- Has_Label -- + --------------- + + function Has_Label + (Container : in Graph; + Node : in Node_Type) + return Boolean is + begin + return False; + end Has_Label; + + function Has_Label + (Position : in Cursor) + return Boolean is + begin + return False; + end Has_Label; + + function Has_Label + (Container : in Graph; + Edge : in Edge_Type) + return Boolean is + begin + return False; + end Has_Label; + + + + + ---------------------- + -- Has_Labeled_Edge -- + ---------------------- + + function Has_Labeled_Edge + (Container : in Graph; + Parent, Child : Node_Type) + return Boolean is + begin + return False; + end Has_Labeled_Edge; + + function Has_Labeled_Edge + (Parent, Child : in Cursor) + return Boolean is + begin + return False; + end Has_Labeled_Edge; + + + + + ------------------ + -- Has_Neighbor -- + ------------------ + + function Has_Neighbor + (Container : in Graph; + Left, Right : in Node_Type) + return Boolean is + begin + return False; + end Has_Neighbor; + + function Has_Neighbor + (Left, Right : in Cursor) + return Boolean is + begin + return False; + end Has_Neighbor; + + + + + ------------- + -- Inbound -- + ------------- + + function Inbound + (Container : in Graph; + Node : in Node_Type) + return Edge_Array is + begin + return (others => False); + end Inbound; + + function Inbound + (Position : in Cursor) + return Edge_Array is + begin + return (others => False); + end Inbound; + + + + + -------------- + -- Indegree -- + -------------- + + function Indegree + (Container : in Graph; + Node : in Node_Type) + return Count_Type is + begin + return Count_Type'First; + end Indegree; + + function Indegree + (Position : in Cursor) + return Count_Type is + begin + return Count_Type'First; + end Indegree; + + + + + ------------ + -- Insert -- + ------------ + + procedure Insert + (Container : in out Graph; + Node : in Node_Type) is + begin + null; + end Insert; + + procedure Insert + (Container : in out Graph; + Node : in Node_Type; + Label : in Node_Label_Type) is + begin + null; + end Insert; + + procedure Insert + (Container : in out Graph; + Nodes : in Node_Array) is + begin + null; + end Insert; + + procedure Insert + (Container : in out Graph; + Edge : in Edge_Type) is + begin + null; + end Insert; + + procedure Insert + (Container : in out Graph; + Edge : in Edge_Type; + Label : in Edge_Label_Type) is + begin + null; + end Insert; + + procedure Insert + (Container : in out Graph; + Edges : in Edge_Array) is + begin + null; + end Insert; + + + + + -------------- + -- Is_Empty -- + -------------- + + function Is_Empty + (Container : in Graph) + return Boolean is + begin + return True; + end Is_Empty; + + + + + ------------- + -- Iterate -- + ------------- + + function Iterate + (Container : in Graph) + return Graph_Iterator_Interfaces.Reversible_Iterator'Class is + begin + return It : Iterator := + (Ada.Finalization.Limited_Controlled with + Container => null, + Node => Extended_Node_Type'First); + end Iterate; + + + + + ---------------------- + -- Iterate_Subgraph -- + ---------------------- + + function Iterate_Subgraph + (Container : in Graph; + Position : in Cursor) + return Graph_Iterator_Interfaces.Forward_Iterator'Class is + begin + return It : Subgraph_Iterator := + (Ada.Finalization.Limited_Controlled with + Container => null, + Root_Node => Node_Type'First, + Visited => Node_Vectors.Empty_Vector, + Current => Extended_Node_Type'First); + end Iterate_Subgraph; + + + + + ----------- + -- Label -- + ----------- + + function Label + (Container : in Graph; + Node : in Node_Type) + return Node_Label_Type is + begin + return Node_Label_Type'(others => <>); + end Label; + + function Label + (Position : in Cursor) + return Node_Label_Type is + begin + return Node_Label_Type'(others => <>); + end Label; + + function Label + (Container : in Graph; + Edge : in Edge_Type) + return Edge_Label_Type is + begin + return Edge_Label_Type'(others => <>); + end Label; + + + + + --------------------- + -- Label_Reference -- + --------------------- + + function Label_Reference + (Container : in Graph; + Node : in Node_Type) + return Node_Label_Reference is + begin + return R : Node_Label_Reference := + (Element => null; + Control => (Ada.Finalization.Controlled with null)); + end Label_Reference; + + function Label_Reference + (Position : in Cursor) + return Node_Label_Reference is + begin + return R : Node_Label_Reference := + (Element => null; + Control => (Ada.Finalization.Controlled with null)); + end Label_Reference; + + function Label_Reference + (Container : in Graph; + Edge : in Edge_Type) + return Edge_Label_Reference is + begin + return R : Edge_Label_Reference := + (Element => null; + Control => (Ada.Finalization.Controlled with null)); + end Label_Reference; + + + + + --------------------- + -- Labeled_Context -- + --------------------- + + procedure Labeled_Context + (Container : in Graph; + Node : in Node_Type; + Parents : out Node_Array; + Children : out Node_Array; + Label : out Node_Label_Type) is + begin + null; + end Labeled_Context; + + procedure Labeled_Context + (Position : in Cursor; + Parents : out Node_Array; + Children : out Node_Array; + Label : out Node_Label_Type) is + begin + null; + end Labeled_Context; + + + + + ---------- + -- Last -- + ---------- + + function Last + (Container : in Graph) + return Cursor is + begin + return No_Element; + end Last; + + function Last + (Object : in Iterator) + return Cursor is + begin + return No_Element; + end Last; + + + + + ---------- + -- Move -- + ---------- + + procedure Move + (Target, Source : in out Graph) is + begin + null; + end Move; + + + + + --------------- + -- Neighbors -- + --------------- + + function Neighbors + (Container : in Graph; + Node : in Node_Type) + return Node_Array is + begin + return (others => False); + end Neighbors; + + function Neighbors + (Position : in Cursor) + return Node_Array is + begin + return (others => False); + end Neighbors; + + + + + ---------- + -- Next -- + ---------- + + function Next + (Position : in Cursor) + return Cursor is + begin + return No_Element; + end Next; + + procedure Next + (Position : in out Cursor) is + begin + null; + end Next; + + function Next + (Object : in Iterator; + Position : in Cursor) + return Cursor is + begin + return No_Element; + end Next; + + function Next + (Object : in Subgraph_Iterator; + Position : in Cursor) + return Cursor is + begin + return No_Element; + end Next; + + + + + ---------------- + -- Node_Count -- + ---------------- + + function Node_Count + (Container : in Graph) + return Count_Type is + begin + return Count_Type'First; + end Node_Count; + + + + + ---------------- + -- Node_Range -- + ---------------- + + procedure Node_Range + (Container : in Graph; + Minimum : out Node; + Maximum : out Node) is + begin + null; + end Node_Range; + + + + + ----------- + -- Nodes -- + ----------- + + function Nodes + (Container : in Graph) + return Node_Array is + begin + return (others => False); + end Nodes; + + + + + -------------- + -- Outbound -- + -------------- + + function Outbound + (Container : in Graph; + Node : in Node_Type) + return Edge_Array is + begin + return (others => False); + end Outbound; + + function Outbound + (Position : in Cursor) + return Edge_Array is + begin + return (others => False); + end Outbound; + + + + + --------------- + -- Outdegree -- + --------------- + + function Outdegree + (Container : in Graph; + Node : in Node_Type) + return Count_Type is + begin + return Count_Type'First; + end Outdegree; + + function Outdegree + (Position : in Cursor) + return Count_Type is + begin + return Count_Type'First; + end Outdegree; + + + + + ------------- + -- Parents -- + ------------- + + function Parents + (Container : in Graph; + Node : in Node_Type) + return Node_Array is + begin + return (others => False); + end Parents; + + function Parents + (Position : in Cursor) + return Node_Array is + begin + return (others => False); + end Parents; + + + + + -------------- + -- Previous -- + -------------- + + function Previous + (Position : in Cursor) + return Cursor is + begin + return No_Element; + end Previous; + + procedure Previous + (Position : in out Cursor) is + begin + null; + end Previous; + + function Previous + (Object : in Iterator; + Position : in Cursor) + return Cursor is + begin + return No_Element; + end Previous; + + + + + ---------- + -- Read -- + ---------- + + procedure Read + (Stream : not null access Streams.Root_Stream_Type'Class; + Container : out Graph) is + begin + null; + end Read; + + procedure Read + (Stream : not null access Streams.Root_Stream_Type'Class; + Position : out Cursor) is + begin + null; + end Read; + + procedure Read + (Stream : not null access Streams.Root_Stream_Type'Class; + Item : out Node_Label_Constant_Reference) is + begin + null; + end Read; + + procedure Read + (Stream : not null access Streams.Root_Stream_Type'Class; + Item : out Node_Label_Reference) is + begin + null; + end Read; + + procedure Read + (Stream : not null access Streams.Root_Stream_Type'Class; + Item : out Edge_Label_Constant_Reference) is + begin + null; + end Read; + + procedure Read + (Stream : not null access Streams.Root_Stream_Type'Class; + Item : out Edge_Label_Reference) is + begin + null; + end Read; + + + + + ------------------- + -- Replace_Label -- + ------------------- + + procedure Replace_Label + (Container : in out Graph; + Node : in Node_Type; + Label : in Node_Label_Type) is + begin + null; + end Replace_Label; + + procedure Replace_Label + (Position : in out Cursor; + Label : in Node_Label_Type) is + begin + null; + end Replace_Label; + + procedure Replace_Label + (Container : in out Graph; + Edge : in Edge_Type; + Label : in Edge_Label_Type) is + begin + null; + end Replace_Label; + + + + + ---------- + -- Swap -- + ---------- + + procedure Swap + (Container : in out Graph; + Left, Right : in Node_Type) is + begin + null; + end Swap; + + procedure Swap + (Left, Right : in out Cursor) is + begin + null; + end Swap; + + + + + --------------- + -- To_Cursor -- + --------------- + + function To_Cursor + (Container : in Graph; + Node : in Node_Type) + return Cursor; + + + + + -------------- + -- To_Graph -- + -------------- + + function To_Graph + (Nodes : in Node_Array; + Edges : in Edge_Array) + return Graph is + begin + return Empty_Graph; + end To_Graph; + + + + + ------------- + -- To_Hash -- + ------------- + + function To_Hash + (Node : in Node_Type) + return Hash_Type is + begin + return Hash_Type'First; + end To_Hash; + + function To_Hash + (Edge : in Edge_Type) + return Hash_Type is + begin + return Hash_Type'First; + end To_Hash; + + + + + ------------------ + -- Unused_Nodes -- + ------------------ + + function Unused_Nodes + (Container : in Graph; + Count : in Positive := 1) + return Node_Array is + begin + return (others => False); + end Unused_Nodes; + + + + + ----------- + -- Write -- + ----------- + + procedure Write + (Stream : not null access Streams.Root_Stream_Type'Class; + Container : in Graph) is + begin + null; + end Write; + + procedure Write + (Stream : not null access Streams.Root_Stream_Type'Class; + Position : in Cursor) is + begin + null; + end Write; + + procedure Write + (Stream : not null access Streams.Root_Stream_Type'Class; + Item : in Node_Label_Constant_Reference) is + begin + null; + end Write; + + procedure Write + (Stream : not null access Streams.Root_Stream_Type'Class; + Item : in Node_Label_Reference) is + begin + null; + end Write; + + procedure Write + (Stream : not null access Streams.Root_Stream_Type'Class; + Item : in Edge_Label_Constant_Reference) is + begin + null; + end Write; + + procedure Write + (Stream : not null access Streams.Root_Stream_Type'Class; + Item : in Edge_Label_Reference) is + begin + null; + end Write; + + +end Ada.Containers.Directed_Graphs; + + diff --git a/src/ada-containers-directed_graphs.ads b/src/ada-containers-directed_graphs.ads index 83ab249..f248bd6 100644 --- a/src/ada-containers-directed_graphs.ads +++ b/src/ada-containers-directed_graphs.ads @@ -784,7 +784,7 @@ private overriding function Next (Object : in Subgraph_Iterator; - Position : in Subgraph_Iterator) + Position : in Cursor) return Cursor; -- cgit