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

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.SInt32.new()

Construct an empty queue.

Murl.Queue.SInt32 new()

Returns
Murl.Queue.SInt32

Murl.Queue.SInt32.new(other)

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

Murl.Queue.SInt32 new(Murl.Queue.SInt32 other)

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


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.

Integer AddHead()

Returns
Integer 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.

Integer AddHead(Integer item)

Parameters
itemThe given item to be inserted at the head of the queue.
Returns
Integer 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.

Integer AddTail()

Returns
Integer 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.

Integer AddTail(Integer item)

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

Head()

Get the item at the head of the queue.

Integer Head()

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

Tail()

Get the item at the tail of the queue.

Integer Tail()

Returns
Integer 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.

Integer DropGetHead()

Returns
Integer A copy of the removed item.

DropGetTail()

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

Integer DropGetTail()

Returns
Integer 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.

Integer Get(Integer index)

Parameters
indexThe zero-based index of the item to retrieve.
Returns
Integer 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.SInt32 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.SInt32 Swap(Murl.Queue.SInt32 other)

Parameters
otherThe second queue.
Returns
Murl.Queue.SInt32 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
Integer = Murl.Queue.SInt32 [Integer index]
Assign
Murl.Queue.SInt32 [Integer index] = Integer

The equal to operator.

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

Returns
Boolean = Murl.Queue.SInt32 == Murl.Queue.SInt32