Queue - mfichman/jogo GitHub Wiki

Implementation of an array-based FIFO queue (uses a circular buffer that resizes when the queue is full).

@init(capacity Int)

Creates a new queue with capacity for 'capacity' elements. The queue will resize beyond 'capacity' elements if necessary; the capacity is just a hint to the implementation.

@destroy()

Releases memory used by the queue.

enq(element :a)

Adds an element at the end of the queue.

deq() :a

Removes and returns the element at the head of the queue.

first?() :a

Returns the first element in the queue.

last?() :a

Returns the last element in the queue.

empty?() Bool

Returns true if the queue is empty.

iter() QueueIter[:a]

count?() Int

No comment

capacity?() Int

No comment

front?() Int

No comment

back?() Int

No comment