![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
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
Construct an empty array.
Murl.Array.GraphIController new()
Construct an array from an already existing one, performing a deep copy.
Murl.Array.GraphIController new(Murl.Array.GraphIController other)
other | The array to copy. |
Clear the array and remove the underlying storage.
Clear()
Empty the array, but keep the underlying storage.
Empty()
Shrink the array so that the underlying storage is only as large as necessary.
Shrink()
Reduce the array to a given number of items.
n | The new number of items in the array, must be smaller than the current item count. |
Reduce the array by removing a given number of items from the end.
n | The number of items to remove from the end. |
Reserve storage space. If the given size is less than the actual size, nothing is done.
Reserve(Integer n)
n | The number of items the underlying storage should hold. |
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.
n | The new number of items in the array. |
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)
n | The new number of items in the array. |
Swap two array items.
Swap(Integer index1, Integer index2)
index1 | The index of the first item. |
index2 | The index of the second item. |
Exchange the content of the array with a given second one.
Murl.Array.GraphIController Swap(Murl.Array.GraphIController other)
other | The second array. |
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)
other | The given item array to be inserted. |
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)
other | The given source item array. |
offset | The index into the source array specifying the first item to copy. |
count | The number of source array items to copy. |
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)
count | The number of new items to be inserted at the end of the array. |
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)
index | the zero-based index where the new items should be inserted. |
other | The given item array to be inserted. |
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)
index | the zero-based index where the new items should be inserted. |
other | The given source item array. |
offset | The index into the source array specifying the first item to copy. |
count | The number of source array items to copy. |
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)
index | the zero-based index where the new items should be inserted. |
count | The number of new items to be inserted. |
Remove (and destroy) a number of items at a given position.
Boolean Remove(Integer index, Integer count)
index | The zero-based index from where to remove the items. |
count | The number of items to remove. |
Remove (and destroy) a number of items at given positions.
Remove(Murl.Array.SInt32 sortedIndices)
sortedIndices | A sorted array of indices where to remove the items. |
Get the number of items in the array.
Integer GetCount()
Check if the array is empty.
Boolean IsEmpty()
Get the number of actually allocated items.
Integer GetAlloc()
Compare the array to another one.
Boolean IsEqual(Murl.Array.GraphIController other)
other | The array to compare. |
Check if a given index is a valid index.
Boolean IsIndexValid(Integer index)
index | The index to check. |
Get the number of bytes of the underlying raw array.
Integer GetByteSize()
The length operator is denoted by the unary prefix operator #.
The "equal to" comparison operator, calls IsEqual().