OBJECT society IS

 PASSIVE

spec

-- Dining Philosophers - Ada 95 edition
-- 
-- Society gives unique ID's to people, and register their names.
-- 
-- Michael B. Feldman, The George Washington University, July 1995.
-- HOOD version by Pierre Dissaux, TNI, June 1998.


--  required interface : 
--   Required OPERATION : NONE
--   Required EXCEPTION : NONE
--   Required TYPE :
--     TYPE : Positive of object : standard
--     TYPE : String of object : standard
--   Required CONSTANT : NONE
--   Required DATA : NONE

--  visibility on required modules : 

package society is

  subtype Unique_DNA_Codes is Positive range 1..5;

  function get_name (
    Code : IN Unique_DNA_Codes)
     return String;

end society;

body

-- Dining Philosophers - Ada 95 edition
-- 
-- Society gives unique ID's to people, and register their names.
-- 
-- Michael B. Feldman, The George Washington University, July 1995.
-- HOOD version by Pierre Dissaux, TNI, June 1998.


--  visibility on required modules : 

--  visibility on objects required by nested operation bodies : 

package body society is

  Name_Register : array(Unique_DNA_Codes) of String(1..18) :=
    ("Philosopher #1    ",
     "Philosopher #2    ",
     "Philosopher #3    ",
     "Philosopher #4    ",
     "Philosopher #5    ");

  function get_name (
    Code : IN Unique_DNA_Codes)
     return String is
  begin
    return Name_Register(Code);
  end get_name;


end society;

END society