comp.lang.ada
 help / color / mirror / Atom feed
From: maggiejohn@aol.com (MaggieJohn)
Subject: Re: Ada Queue
Date: 2000/04/07
Date: 2000-04-07T00:00:00+00:00	[thread overview]
Message-ID: <20000406215553.00917.00000166@ng-dh1.aol.com> (raw)
In-Reply-To: 38eca724@news.hamilton.edu

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:

<snip>

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;





  parent reply	other threads:[~2000-04-07  0:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-06  0:00 Ada Queue Joseph T.
2000-04-06  0:00 ` Ted Dennison
2000-04-06  0:00   ` Joseph T
2000-04-06  0:00     ` Ted Dennison
2000-04-06  0:00       ` Joseph T.
2000-04-07  0:00         ` Ole-Hjalmar Kristensen
2000-04-07  0:00           ` Joseph T
2000-04-07  0:00             ` Ted Dennison
2000-04-07  0:00         ` Ted Dennison
2000-04-07  0:00           ` Hyman Rosen
2000-04-06  0:00     ` Robert Dewar
2000-04-06  0:00       ` Ted Dennison
2000-04-06  0:00       ` Joseph T
2000-04-07  0:00         ` Ole-Hjalmar Kristensen
2000-04-06  0:00     ` tmoran
2000-04-08  0:00       ` tmoran
2000-04-07  0:00 ` Simon Wright
2000-04-09  0:00   ` Robert Dewar
2000-04-07  0:00 ` MaggieJohn [this message]
2000-04-07  0:00   ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox