comp.lang.ada
 help / color / mirror / Atom feed
* Queue Structure Question (Different)
@ 1997-10-08  0:00 Domgrief
  0 siblings, 0 replies; only message in thread
From: Domgrief @ 1997-10-08  0:00 UTC (permalink / raw)



OK... because all of the other questions have been completely useless, I
will simplify my problem, again, could anybody please help?

The following procedure (display) is part of Queue.adb and calls a
procedure put_object, passing in object_type as a parameter. The
procedures' spec in Queue.ads is such:

	generic
	   with procedure put_object(object : object_type);
	procedure display(the_queue : queue); 
	-- results    : Displays the queue of objects.

And the body is:
______________________________________

procedure display(the_queue : queue) is
--   Length 10  Complexity 7   Performance O(n)
begin
   put("size =" & natural'image(number_of_objects(the_queue)) & "   :
");
   if the_queue.size > 0 then
   -- Prints the whole queue array showing the queue in it.
      if the_queue.last >= the_queue.first then        -- Queue not
wrapped.
         for i in 1..the_queue.max_size loop
            if i >= the_queue.first and i <= the_queue.last then
                put_object(the_queue.objects(i));
            else put(" - ");
            end if;
         end loop;
      else                                              -- Queue
wrapped.
         for i in 1..the_queue.max_size loop
            if i >= the_queue.first or i <= the_queue.last then
                put_object(the_queue.objects(i));
            else put(" - ");
            end if;
         end loop;
      end if;
   end if;
 
end display;
__________________________

Without giving too much away (this is, after all, an assignment), could
anyone please tell me:

a)	Where do I place the procedure put_object, and;
b)	How can I possibly implement it to display each field of a record?

As usual, all help would be greatly appreciated,
Highest regards and many thanks,
Domgrief (Nathan J)




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-10-08  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-08  0:00 Queue Structure Question (Different) Domgrief

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