------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- This Ada package was automatically generated by the software engineering --tool Platypus -- see http://cassoulet.univ-brest.fr/mme -- -- Any modification of this file will be lost. -- Please see the "platypus" directory instead : it contains the Cheddar's -- model and its meta-model. ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a free real time scheduling tool. -- This program provides services to automatically check temporal constraints -- of real time tasks. -- -- Copyright (C) 2002-2009 Frank Singhoff -- Cheddar is developed by the LISYC Team, University of Brest -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- Contact : cheddar@listes.univ-brest.fr -- To post to this mailing list, you must be subscribed -- (see http//beru.univ-brest.fr/~singhoff/cheddar for details) -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with primitive_xml_strings; use primitive_xml_strings; with Unbounded_Strings; use Unbounded_Strings; use Unbounded_Strings.Unbounded_String_List_Package; package body Generic_Graph.extended is procedure Initialize (obj : in out Graph_Ptr) is begin obj := new Graph; Initialize (obj.all.Nodes); Initialize (obj.all.Edges); end Initialize; procedure Initialize (obj : in out Generic_Node_Ptr) is begin obj := new Generic_Node; Initialize (obj); obj.all.Id := Empty_String; end Initialize; procedure Initialize (obj : in out Generic_Edge_Ptr) is begin obj := new Generic_Edge; Initialize (obj); obj.all.Id := Empty_String; obj.all.Node_1 := Empty_String; obj.all.Node_2 := Empty_String; end Initialize; procedure Add_Generic_Node (obj : in out Graph; N : in Generic_Node_Ptr; succeed : out Boolean) is begin if not (Element_In_List (N, obj.Nodes)) then Add (obj.Nodes, N); succeed := True; else succeed := False; end if; end Add_Generic_Node; procedure Add_Generic_Node (obj : in out Graph_Ptr; N : in Generic_Node_Ptr; succeed : out Boolean) is begin if not (Element_In_List (N, obj.all.Nodes)) then Add (obj.all.Nodes, N); succeed := True; else succeed := False; end if; end Add_Generic_Node; procedure Add_Generic_Edge (obj : in out Graph; E : in Generic_Edge_Ptr; succeed : out Boolean) is begin if not (Element_In_List (E, obj.Edges)) then Add (obj.Edges, E); succeed := True; else succeed := False; end if; end Add_Generic_Edge; procedure Add_Generic_Edge (obj : in out Graph_Ptr; E : in Generic_Edge_Ptr; succeed : out Boolean) is begin if not (Element_In_List (E, obj.Edges)) then Add (obj.all.Edges, E); succeed := True; else succeed := False; end if; end Add_Generic_Edge; function Edge_In_Graph (obj : in Generic_Edge_Ptr; G : in Graph) return Boolean is E_Iterator : Edge_Lists_Iterator; current_edge : Generic_Edge_Ptr; res : Boolean; begin res := False; Reset_Head_Iterator (G.Edges, E_Iterator); if not Is_Empty (G.Edges) then Current_Element (G.Edges, current_edge, E_Iterator); while (not Is_Tail_Element (G.Edges, E_Iterator)) and not (current_edge.Id = obj.all.Id) loop Next_Element (G.Edges, E_Iterator); Current_Element (G.Edges, current_edge, E_Iterator); end loop; else return res; end if; if (current_edge.Id = obj.all.Id) then res := True; else res := False; end if; return res; end Edge_In_Graph; function Edge_In_Graph (obj : in Generic_Edge_Ptr; G_Ptr : in Graph_Ptr) return Boolean is E_Iterator : Edge_Lists_Iterator; current_edge : Generic_Edge_Ptr; res : Boolean; begin res := False; Reset_Head_Iterator (G_Ptr.all.Edges, E_Iterator); if not Is_Empty (G_Ptr.all.Edges) then Current_Element (G_Ptr.all.Edges, current_edge, E_Iterator); while (not Is_Tail_Element (G_Ptr.all.Edges, E_Iterator)) and not (current_edge.Id = obj.all.Id) loop Next_Element (G_Ptr.all.Edges, E_Iterator); Current_Element (G_Ptr.all.Edges, current_edge, E_Iterator); end loop; else return res; end if; if (current_edge.Id = obj.all.Id) then res := True; else res := False; end if; return res; end Edge_In_Graph; function Node_In_Graph (obj : in Generic_Node_Ptr; G : in Graph) return Boolean is N_Iterator : Node_Lists_Iterator; current_node : Generic_Node_Ptr; res : Boolean; begin res := False; Reset_Head_Iterator (G.Nodes, N_Iterator); if not Is_Empty (G.Nodes) then Current_Element (G.Nodes, current_node, N_Iterator); while (not Is_Tail_Element (G.Nodes, N_Iterator)) and not (current_node.Id = obj.all.Id) loop Next_Element (G.Nodes, N_Iterator); Current_Element (G.Nodes, current_node, N_Iterator); end loop; else return res; end if; if (current_node.Id = obj.all.Id) then res := True; else res := False; end if; return res; end Node_In_Graph; function Node_In_Graph (obj : in Generic_Node_Ptr; G_Ptr : in Graph_Ptr) return Boolean is N_Iterator : Node_Lists_Iterator; current_node : Generic_Node_Ptr; res : Boolean; begin res := False; Reset_Head_Iterator (G_Ptr.all.Nodes, N_Iterator); if not Is_Empty (G_Ptr.all.Nodes) then Current_Element (G_Ptr.all.Nodes, current_node, N_Iterator); while (not Is_Tail_Element (G_Ptr.all.Nodes, N_Iterator)) and not (current_node.Id = obj.all.Id) loop Next_Element (G_Ptr.all.Nodes, N_Iterator); Current_Element (G_Ptr.all.Nodes, current_node, N_Iterator); end loop; else return res; end if; if (current_node.Id = obj.all.Id) then res := True; else res := False; end if; return res; end Node_In_Graph; end Generic_Graph.Extended;