Murl Engine Lua Addon API  Version 1.0 beta
Murl.Array.GraphIController

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

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


Table members

Functions


Murl.Array.GraphIController.new()

Construct an empty array.

Murl.Array.GraphIController new()

Returns
Murl.Array.GraphIController

Murl.Array.GraphIController.new(other)

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

Murl.Array.GraphIController new(Murl.Array.GraphIController other)

Parameters
otherThe array to copy.
Returns
Murl.Array.GraphIController


Methods


Clear()

Clear the array and remove the underlying storage.

Clear()


Empty()

Empty the array, but keep the underlying storage.

Empty()


Shrink()

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

Shrink()


Trim(n)

Reduce the array to a given number of items.

Boolean Trim(Integer n)

Parameters
nThe new number of items in the array, must be smaller than the current item count.
Returns
Boolean true if successful.

Drop(n)

Reduce the array by removing a given number of items from the end.

Boolean Drop(Integer n)

Parameters
nThe number of items to remove from the end.
Returns
Boolean true if successful.

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.

SetCount(n)

Set the actual number of items in the array. If the given number is smaller than the current size, the array is trimmed, and existing items beyond the new size are destroyed. If the given number is higher, new items are initialized via the value type's default constructor. If the given number is also higher than the underlying storage's capacity, the storage is enlarged to hold exactly the requested number of items.

Boolean SetCount(Integer n)

Parameters
nThe new number of items in the array.
Returns
Boolean true if successful.

SetCountAndReserve(n)

Set the actual number of items in the array and reserve extra storage space. If the given number is smaller than the current size, the array is trimmed, and existing items beyond the new size are destroyed. If the given number is higher, new items are initialized via the value type's default constructor. If the given number is also higher than the underlying storage's capacity, the storage is enlarged and some extra capacity is added.

Boolean SetCountAndReserve(Integer n)

Parameters
nThe new number of items in the array.
Returns
Boolean true if successful.

Swap(index1, index2)

Swap two array items.

Swap(Integer index1, Integer index2)

Parameters
index1The index of the first item.
index2The index of the second item.

Swap(other)

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

Murl.Array.GraphIController Swap(Murl.Array.GraphIController other)

Parameters
otherThe second array.
Returns
Murl.Array.GraphIController other The second array.

Add(other)

Add a given array of items at the end of the array. The new item entries are initialized using the original items' copy constructors.

Boolean Add(Murl.Array.GraphIController other)

Parameters
otherThe given item array to be inserted.
Returns
Boolean true if successful.

Add(other, offset, count)

Add a subset of given array of items at the end of the array. The new item entries are initialized using the original items' copy constructors.

Boolean Add(Murl.Array.GraphIController other, Integer offset, Integer count)

Parameters
otherThe given source item array.
offsetThe index into the source array specifying the first item to copy.
countThe number of source array items to copy.
Returns
Boolean true if successful.

AddN(count)

Add a given number of new items at the end of the array. The new item entries are initialized using the value type's default constructor.

AddN(Integer count)

Parameters
countThe number of new items to be inserted at the end of the array.

Insert(index, other)

Insert a given array of items at a given position. The new item entries are initialized using the original items' copy constructors.

Boolean Insert(Integer index, Murl.Array.GraphIController other)

Parameters
indexthe zero-based index where the new items should be inserted.
otherThe given item array to be inserted.
Returns
Boolean true if successful.

Insert(index, other, offset, count)

Insert a subset of given array of items at a given position. The new item entries are initialized using the original items' copy constructors.

Boolean Insert(Integer index, Murl.Array.GraphIController other, Integer offset, Integer count)

Parameters
indexthe zero-based index where the new items should be inserted.
otherThe given source item array.
offsetThe index into the source array specifying the first item to copy.
countThe number of source array items to copy.
Returns
Boolean true if successful.

InsertN(index, count)

Insert a given number of new items at a given position. The new item entries are initialized using the value type's default constructor.

Boolean InsertN(Integer index, Integer count)

Parameters
indexthe zero-based index where the new items should be inserted.
countThe number of new items to be inserted.
Returns
Boolean true if successful.

Remove(index, count)

Remove (and destroy) a number of items at a given position.

Boolean Remove(Integer index, Integer count)

Parameters
indexThe zero-based index from where to remove the items.
countThe number of items to remove.
Returns
Boolean true if successful.

Remove(sortedIndices)

Remove (and destroy) a number of items at given positions.

Remove(Murl.Array.SInt32 sortedIndices)

Parameters
sortedIndicesA sorted array of indices where to remove the items.

GetCount()

Get the number of items in the array.

Integer GetCount()

Returns
Integer The number of items.

GetCountUInt32()

Get the number of items in the array.

Integer GetCountUInt32()

Returns
Integer The number of items.

IsEmpty()

Check if the array is empty.

Boolean IsEmpty()

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

GetAlloc()

Get the number of actually allocated items.

Integer GetAlloc()

Returns
Integer The number of allocated items.

IsEqual(other)

Compare the array to another one.

Boolean IsEqual(Murl.Array.GraphIController other)

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

IsIndexValid(index)

Check if a given index is a valid index.

Boolean IsIndexValid(Integer index)

Parameters
indexThe index to check.
Returns
Boolean true if index >= 0 and index < GetCount().

GetByteSize()

Get the number of bytes of the underlying raw array.

Integer GetByteSize()

Returns
Integer The number of bytes of the underlying raw array.

ReAllocMove(numAlloc)

ReAllocMove(Integer numAlloc)



Metamethods


The length operator

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

Returns
GetCount()

The equal to operator.

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

Returns
Boolean = Murl.Array.GraphIController == Murl.Array.GraphIController