Murl Engine Lua Addon API  Version 1.0 beta
Murl.Queue.Bool

A generic queue template class for moveable objects eg. structs or fundamental data types like UInt32, Real, etc.

The Queue class works for moveable objects only, use ObjectQueue class for storing non-moveable objects.
This class is based on the NTL BiVector container, see http://www.ultimatepp.org


Table members

Functions


Murl.Queue.Bool.new()

Construct an empty queue.

Murl.Queue.Bool new()

Returns
Murl.Queue.Bool

Murl.Queue.Bool.new(other)

Construct a queue from an already existing one, performing a deep copy.

Murl.Queue.Bool new(Murl.Queue.Bool other)

Parameters
otherThe queue to copy.
Returns
Murl.Queue.Bool


Methods


GetCount()

Get the number of items in the queue.

Integer GetCount()

Returns
Integer The number of items.

IsEmpty()

Check if the queue is empty.

Boolean IsEmpty()

Returns
Boolean true if the queue is empty, false otherwise.

Clear()

Clear the queue and remove the underlying storage.

Clear()


Empty()

Empty the queue, but keep the underlying storage.

Empty()


AddHead()

Add a new item at the head of the queue. The new item entry is initialized using the value type's default constructor. The new item will be at position 0.

Boolean AddHead()

Returns
Boolean A reference to the newly created item.

AddHead(item)

Add a given item at the head of the queue. The new item entry is initialized using the given item's copy constructor. The new item will be at position 0.

Boolean AddHead(Boolean item)

Parameters
itemThe given item to be inserted at the head of the queue.
Returns
Boolean A reference to the newly created item.

AddTail()

Add a new item at the tail of the queue. The new item entry is initialized using the value type's default constructor. The new item will be at position GetCount() - 1.

Boolean AddTail()

Returns
Boolean A reference to the newly created item.

AddTail(item)

Add a given item at the tail of the queue. The new item entry is initialized using the given item's copy constructor. The new item will be at position GetCount() - 1.

Boolean AddTail(Boolean item)

Parameters
itemThe given item to be inserted at the tail of the queue.
Returns
Boolean A reference to the newly created item.

Head()

Get the item at the head of the queue.

Boolean Head()

Returns
Boolean A const reference to the item at the head of the queue.

Tail()

Get the item at the tail of the queue.

Boolean Tail()

Returns
Boolean A const reference to the item at the tail of the queue.

DropGetHead()

Drop the item from the head of the queue and get a copy of the item.

Boolean DropGetHead()

Returns
Boolean A copy of the removed item.

DropGetTail()

Drop the item from the tail of the queue and get a copy of the item.

Boolean DropGetTail()

Returns
Boolean A copy of the removed item.

DropHead()

Drop the item from the head of the queue.

DropHead()


DropHead(n)

Drop a specified number of items from the head of the queue.

DropHead(Integer n)

Parameters
nThe number of items to remove from the head.

DropTail()

Drop the item from the tail of the queue.

DropTail()


DropTail(n)

Drop a specified number of items from the tail of the queue.

DropTail(Integer n)

Parameters
nThe number of items to remove from the tail.

Get(index)

Get the item at a given position from the queue.

Boolean Get(Integer index)

Parameters
indexThe zero-based index of the item to retrieve.
Returns
Boolean A reference to the specified item.

Shrink()

Shrink the queue so that the underlying storage is only as large as necessary.

Shrink()


Reserve(n)

Reserve storage space. If the given size is less than the actual size, nothing is done.

Reserve(Integer n)

Parameters
nThe number of items the underlying storage should hold.

GetAlloc()

Get the number of actually allocated items.

Integer GetAlloc()

Returns
Integer The number of allocated items.

IsEqual(other)

Compare the queue to another one.

Boolean IsEqual(Murl.Queue.Bool other)

Parameters
otherThe queue to compare.
Returns
Boolean true if both queue have identical contents.

Swap(other)

Exchange the content of the queue with a given second one.

Murl.Queue.Bool Swap(Murl.Queue.Bool other)

Parameters
otherThe second queue.
Returns
Murl.Queue.Bool other The second queue.


Metamethods


The length operator

The length operator is denoted by the unary prefix operator #.

Returns
GetCount()

The array subscript operator.

Retrieve the item at a given position from the queue.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
Boolean = Murl.Queue.Bool [Integer index]
Assign
Murl.Queue.Bool [Integer index] = Boolean

The equal to operator.

The "equal to" comparison operator, calls IsEqual().

Returns
Boolean = Murl.Queue.Bool == Murl.Queue.Bool