Queue/Usage: Difference between revisions

Content added Content deleted
Line 519: Line 519:
<lang oberon2>
<lang oberon2>
MODULE UseQueue;
MODULE UseQueue;
IMPORT StdLog,Queue,Boxes;
IMPORT
Queue,

Boxes,
StdLog;
PROCEDURE Do*;
PROCEDURE Do*;
VAR
VAR
q: Queue.Queue;
q: Queue.Instance;
o: Boxes.Object;
b: Boxes.Box;
BEGIN
BEGIN
q := Queue.NewQueue(6);
q := Queue.New(10);
q.Push(Boxes.NewInteger(1));
q.Push(Boxes.NewInteger(1));
q.Push(Boxes.NewInteger(2));
q.Push(Boxes.NewInteger(2));
q.Push(Boxes.NewInteger(3));
q.Push(Boxes.NewInteger(3));
o := q.Pop();
b := q.Pop();
o := q.Pop();
b := q.Pop();
q.Push(Boxes.NewInteger(4));
q.Push(Boxes.NewInteger(4));
o := q.Pop();
b := q.Pop();
o := q.Pop();
b := q.Pop();
StdLog.String("Is empty:> ");StdLog.Bool(q.IsEmpty());StdLog.Ln
q.Push(Boxes.NewInteger(5));
o := q.Pop();
StdLog.String("Is empty: ");StdLog.Bool(q.IsEmpty());StdLog.Ln
END Do;
END Do;
END UseQueue.
END UseQueue.
Line 546: Line 547:
Is empty: $TRUE
Is empty: $TRUE
</pre>
</pre>

=={{header|D}}==
=={{header|D}}==
<lang d>class LinkedQueue(T) {
<lang d>class LinkedQueue(T) {