Class Array

MetaClass for Falcon arrays.

class Array \ from BOM

more...

Summary

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.
merge()Merges the given array into this one.
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.

Inherited methods

add__ from BOM Overrides binary addition operand.
baseClass from BOM Returns the class item from which an object has been instantiated.
call__ from BOM Overrides call operator "self()".
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.
dec__ from BOM Overrides decrement unary prefix operand.
decpost__ from BOM Overrides decrement unary postfix operand.
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.
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.
isCallable from BOM Determines if an item is callable.
len from BOM Retreives the lenght of a collection
metaclass from BOM Returns the metaclass associated with this item.
mod__ from BOM Overrides modulo operand.
mul__ from BOM Overrides binary multiplication operand.
pow__ from BOM Overrides power operand.
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.
setIndex__ from BOM Overrides array write operator []
sub__ from BOM Overrides binary subtraction operand.
toString from BOM Coverts the object to string.
typeId from BOM Returns an integer indicating the type of this item.

Detailed description

MetaClass for Falcon arrays.

This is the class reflecting the base array classes.

Methods

NM()

Force an array to be non-method.

Array.NM( )

Returns:The This array

add()

Adds an element to this array.

Array.add( item )

itemThe item to be added.

The element will be added at the end of this array, and its size will be increased by one.

back()

Returns and eventually extracts the last element in the array.

Array.back( [remove] )

removetrue to remove the front item.
Returns:The extracted item.
Raises:
AccessErrorif the array is empty.

comp()

Appends elements to this array through a filter.

Array.comp( source, [filter] )

sourceA sequence, a range or a callable generating items.
filterA filtering function receiving one item at a time.
Returns:This array.

Please, see the description of Sequence.comp.

compact()

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.

del()

Deletes the first element matching a given item.

Array.del( item )

itemThe 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.

delAll()

Deletes all the occurrences of a given item in this array.

Array.delAll( item )

itemThe 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.

fill()

Fills the array with the given element.

Array.fill( item )

itemThe item to be replicated.
Returns:This array.

This method allows to clear a whole array, resetting all the elements to a default value.

find()

Searches for a given item in an array.

Array.find( item, [start], [end] )

itemThe array that will be searched.
startOptional first element to be searched.
endOptional 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.

first()

Returns an iterator to the head of this array.

Array.first( )

Returns:An iterator.

front()

Returns and eventually extracts the first element in the array.

Array.front( [remove] )

removetrue to remove the front item.
Returns:The extracted item.
Raises:
AccessErrorif the array is empty.

head()

Extracts the first element from this array and returns it.

Array.head( )

Returns:The extracted item.
Raises:
AccessErrorif the array is empty.

This function removes the first item from the array and returns it. If the original array is empty, AccessError is raised.

ins()

Inserts an item into this array array.

Array.ins( itempos, item )

itemposThe position where the item should be placed.
itemThe 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.

last()

Returns an iterator to the last element in this array.

Array.last( )

Returns:An iterator.

merge()

Merges the given array into this one.

Array.merge( array, [insertPos], [start], [end] )

arrayArray containing the second half of the merge, read-only
insertPosOptional position of array 1 at which to place array2
startFirst element of array to merge in this array
endLast element - 1 of array2 to merge in this array

properties()

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.

remove()

Removes one or more elements in the array.

Array.remove( itemPos, [lastItemPos] )

itemPosThe position of the item to be removed, or the first of the items to be removed.
lastItemPosThe 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.

scan()

Searches an array for an item satisfying arbitrary criteria.

Array.scan( func, [start], [end] )

funcFunction that verifies the criterion.
startOptional first element to be searched.
endOptional upper end of the range..
Returns:The position of the searched item in the array, or -1 if not found.

setProperty()

Sets a binding (as a property) in the array.

Array.setProperty( propName, value )

propNameA string representing the name of a property or a method inside the array.
valueThe property new value.
Raises:
AccessErrorIf the property can't be found.

Alters the value of the property in the given array. If the required property is not present, an AccessError is raised.

sort()

Sorts an array, possibly using an arbitrary ordering criterion.

Array.sort( [sortingFunc] )

sortingFuncA function used to compare two items.

tabField()

Returns one of the items in the array, given the field name.

Array.tabField( field )

fieldThe field name or position to be retreived.
Returns:An item in the array or the default column value.
Raises:
AccessErrorif the item is not an array.

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.

tabRow()

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:
AccessErrorif the item is not a table row (array).

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.

table()

Returns the table related with this array.

Array.table( )

Returns:The table of which this item is a row.
Raises:
AccessErrorif the item is not an array.

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.

tail()

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.


Made with faldoc 2.1.0