From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_40,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f32236e7e55b02e0 X-Google-Attributes: gid103376,public From: maggiejohn@aol.com (MaggieJohn) Subject: Re: Ada Queue Date: 2000/04/07 Message-ID: <20000406215553.00917.00000166@ng-dh1.aol.com>#1/1 X-Deja-AN: 607811805 References: <38eca724@news.hamilton.edu> Organization: AOL http://www.aol.com Newsgroups: comp.lang.ada X-Admin: news@aol.com Date: 2000-04-07T00:00:00+00:00 List-Id: Queue packages are usually services. Youwant the calling procedure to define and own the queue. The calling process should define the element type and the max length and stuff like that. Also - add new nodes to the head of the queue. You don't want to walk the queue every time you add a node. - Maggie From: "Joseph T." thisthat7@hotmail.com wrote: procedure Enqueue(Q: in out Queue; E : Element_type) is New_Queue : Queue; begin if Q /= null then New_Queue := Q; while Q.Rest /= null loop Q := Q.Rest; end loop; Q.Rest := new QueueNode; Q := Q.Rest; Q.Data := E; Q.Rest := null; Q := New_Queue; else Q := new QueueNode; Q.Data := E; Q.Rest := null; end if; end Enqueue;