MetaClass for Falcon arrays.
class Array \ from BOM
NM() | Force an array to be non-method. |
add() | Adds an element to this array. |
back() | Returns and eventually extracts the last element in the array. |
comp() | Appends elements to this array through a filter. |
compact() | Reduces the memory used by an array. |
del() | Deletes the first element matching a given item. |
delAll() | Deletes all the occurrences of a given item in this array. |
fill() | Fills the array with the given element. |
find() | Searches for a given item in an array. |
first() | Returns an iterator to the head of this array. |
front() | Returns and eventually extracts the first element in the array. |
head() | Extracts the first element from this array and returns it. |
ins() | Inserts an item into this array array. |
last() | Returns an iterator to the last element in this array. |
mcomp() | Appends multiple elements to this array. |
merge() | Merges the given array into this one. |
mfcomp() | Appends multiple elements to this array through a filter. |
properties() | Returns an array of properties (bindings) in the array. |
remove() | Removes one or more elements in the array. |
scan() | Searches an array for an item satisfying arbitrary criteria. |
setProperty() | Sets a binding (as a property) in the array. |
sort() | Sorts an array, possibly using an arbitrary ordering criterion. |
tabField() | Returns one of the items in the array, given the field name. |
tabRow() | Returns the row ID of this element. |
table() | Returns the table related with this array. |
tail() | Extracts the last element of an array and returns it. |
__add from BOM | Overrides binary addition operand. |
__call from BOM | Overrides call operator "self()". |
__dec from BOM | Overrides decrement unary prefix operand. |
__decpost from BOM | Overrides decrement unary postfix operand. |
__div from BOM | Overrides binary division operand. |
__getIndex from BOM | Overrides array access operator [] |
__inc from BOM | Overrides increment unary prefix operand. |
__incpost from BOM | Overrides increment unary postifx operand. |
__mod from BOM | Overrides modulo operand. |
__mul from BOM | Overrides binary multiplication operand. |
__pow from BOM | Overrides power operand. |
__setIndex from BOM | Overrides array write operator [] |
__sub from BOM | Overrides binary subtraction operand. |
baseClass from BOM | Returns the class item from which an object has been instantiated. |
bound from BOM | Determines if an item is bound or not. |
className from BOM | Returns the name of the class an instance is instantiated from. |
clone from BOM | Performs a deep copy of the item. |
compare from BOM | Performs a lexicographical comparison. |
derivedFrom from BOM | Checks if this item has a given parent. |
describe from BOM | Returns the deep contents of an item on a string representation. |
isCallable from BOM | Determines if an item is callable. |
len from BOM | Retrieves the length of a collection |
metaclass from BOM | Returns the metaclass associated with this item. |
ptr from BOM | Returns a raw memory pointer out of this data (as an integer). |
serialize from BOM | Serialize the item on a stream for persistent storage. |
toString from BOM | Coverts the object to string. |
typeId from BOM | Returns an integer indicating the type of this item. |
class Array \ from BOM
MetaClass for Falcon arrays.
This is the class reflecting the base array classes.
Force an array to be non-method.
Array.NM( )
Returns: | The This array |
Adds an element to this array.
Array.add( item )
item | The item to be added. |
The element will be added at the end of this array, and its size will be increased by one.
Returns and eventually extracts the last element in the array.
Array.back( [remove] )
remove | true to remove the front item. | ||
Returns: | The extracted item. | ||
Raises: |
|
Appends elements to this array through a filter.
Array.comp( source, [filter] )
source | A sequence, a range or a callable generating items. |
filter | A filtering function receiving one item at a time. |
Returns: | This array. |
Please, see the description of Sequence.comp.
Reduces the memory used by an array.
Array.compact( )
Returns: | Itself |
Normally, array operations, as insertions, additions and so on cause the array to grow to accommodate items that may come in the future. also, reducing the size of an array doesn't automatically dispose of the memory held by the array to store its elements.
This method grants that the memory used by the array is strictly the memory needed to store its data.
Deletes the first element matching a given item.
Array.del( item )
item | The item that must be deleted. |
Returns: | true if at least one item has been removed, false otherwise. |
The function scans the array searching for an item that is considered equal to the given one. If such an item can be found, it is removed and the function returns true. If the item cannot be found, false is returned.
Only the first item matching the given one will be deleted.
Deletes all the occurrences of a given item in this array.
Array.delAll( item )
item | The item that must be deleted. |
Returns: | true if at least one item has been removed, false otherwise. |
This function removes all the elements in this array that are considered equivalent to the given item. If one or more elements have been found and deleted, the function will return true, else it will return false.
Fills the array with the given element.
Array.fill( item )
item | The item to be replicated. |
Returns: | This array. |
This method allows to clear a whole array, resetting all the elements to a default value.
Searches for a given item in an array.
Array.find( item, [start], [end] )
item | The array that will be searched. |
start | Optional first element to be searched. |
end | Optional last element +1 to be searched. |
Returns: | The position of the searched item in the array, or -1 if not found. |
This function searches the array for a given item (or for an item considered equivalent to the given one). If that item is found, the item position is returned, else -1 is returned.
An optional range may be specified to limit the search in the interval start included, end excluded.
Returns an iterator to the head of this array.
Array.first( )
Returns: | An iterator. |
Returns and eventually extracts the first element in the array.
Array.front( [remove] )
remove | true to remove the front item. | ||
Returns: | The extracted item. | ||
Raises: |
|
Extracts the first element from this array and returns it.
Array.head( )
Returns: | The extracted item. | ||
Raises: |
|
This function removes the first item from the array and returns it. If the original array is empty, AccessError is raised.
Inserts an item into this array array.
Array.ins( itempos, item )
itempos | The position where the item should be placed. |
item | The item to be inserted. |
The item is inserted before the given position. If pos is 0, the item is inserted in the very first position, while if it's equal to the array length, it is appended at the array tail.
Returns an iterator to the last element in this array.
Array.last( )
Returns: | An iterator. |
Appends multiple elements to this array.
Array.mcomp( ... )
... | One or more sequences or item generators. |
Returns: | This array. |
Please, see the description of Sequence.mcomp.
Merges the given array into this one.
Array.merge( array, [insertPos], [start], [end] )
array | Array containing the second half of the merge, read-only |
insertPos | Optional position of array 1 at which to place array2 |
start | First element of array to merge in this array |
end | Last element - 1 of array2 to merge in this array |
Appends multiple elements to this array through a filter.
Array.mfcomp( filter, ... )
filter | A filter function receiving each element before its insertion, or nil. |
... | One or more sequences or item generators. |
Returns: | This array. |
Please, see the description of Sequence.mfcomp.
Returns an array of properties (bindings) in the array.
Array.properties( )
Returns: | An array with 0 or more strings. |
This methods returns all the properties in the given array, which represents the list of array bindings. If the array has no bindings, this method returns an empty array.
The property list includes properties that refer to any kind of data, including functions (that is, methods), but it doesn't include properties in the metaclass of this item (FBOM properties).
The returned list is ordered by UNICODE value of the property names.
Removes one or more elements in the array.
Array.remove( itemPos, [lastItemPos] )
itemPos | The position of the item to be removed, or the first of the items to be removed. |
lastItemPos | The last item to be removed, in range semantic. |
Remove one item or a range of items. The size of the array is shortened accordingly. The semantic of lastItemPos is the same as ranged access to the array.
Searches an array for an item satisfying arbitrary criteria.
Array.scan( func, [start], [end] )
func | Function that verifies the criterion. |
start | Optional first element to be searched. |
end | Optional upper end of the range.. |
Returns: | The position of the searched item in the array, or -1 if not found. |
Sets a binding (as a property) in the array.
Array.setProperty( propName, value )
propName | A string representing the name of a property or a method inside the array. | ||
value | The property new value. | ||
Raises: |
|
Alters the value of the property in the given array. If the required property is not present, an AccessError is raised.
Sorts an array, possibly using an arbitrary ordering criterion.
Array.sort( [sortingFunc] )
sortingFunc | A function used to compare two items. |
Returns one of the items in the array, given the field name.
Array.tabField( field )
field | The field name or position to be retreived. | ||
Returns: | An item in the array or the default column value. | ||
Raises: |
|
If this item is an array and is part of a table, the field with the given name or ID (number) is searched in the table definition, and if found, it is returned. If the coresponding item in the array is nil, then the table column data (default data) is returned instead, unless the item is also an OOB item. In that case, nil is returned and the default column value is ignored.
Returns the row ID of this element.
Array.tabRow( )
Returns: | A number indicating the position of this row in the table, or nil if this item is an array, but it's not stored in a table. | ||
Raises: |
|
This method returns the position of this element in a table.
This number gets valorized only after a Table.get or Table.find method call, so that it is possible to know what index had this element in the owning table. If the table is changed by inserting or removing a row, the number returned by this function becomes meaningless.
Returns the table related with this array.
Array.table( )
Returns: | The table of which this item is a row. | ||
Raises: |
|
This array method retreives the table that is related with the item, provided the item is an array being part of a table.
In case the item is an array, but it doesn't belong to any table, nil is returned.
Extracts the last element of an array and returns it.
Array.tail( )
Returns: | The extracted item. |
This function removes the last item of the array and returns it. If the original array is empty, AccessError is raised.