------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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;