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

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

Construct an empty queue.

Murl.Queue.String new()

Returns
Murl.Queue.String

Murl.Queue.String.new(other)

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

Murl.Queue.String new(Murl.Queue.String other)

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


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.

String AddHead()

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

String AddHead(String item)

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

String AddTail()

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

String AddTail(String item)

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

Head()

Get the item at the head of the queue.

String Head()

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

Tail()

Get the item at the tail of the queue.

String Tail()

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

String DropGetHead()

Returns
String A copy of the removed item.

DropGetTail()

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

String DropGetTail()

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

String Get(Integer index)

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

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

The equal to operator.

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

Returns
Boolean = Murl.Queue.String == Murl.Queue.String