Class Dictionary

Metaclass for Falcon dictionary types.

class Dictionary \ from BOM

more...

Summary

back()Returns the last item in the dictionary.
best()Returns an iterator set to a given key, or finds the best position for its insertion.
clear()Removes all the items from this dictionary.
comp()Appends elements to this dictionary through a filter.
fill()Fills the array with the given element.
find()Returns an iterator set to a given key.
first()Returns an iterator to the head of this dictionary.
front()Returns the first item in the dictionary.
get()Retreives a value associated with the given key
keys()Returns an array containing all the keys in this dictionary.
last()Returns an iterator to the head of this dictionary.
merge()Merges a dictionary into this one.
properties()Returns all the properties in the dictionary.
remove()Removes a given key from the dictionary.
setProperty()Sets a property in dictionary based instances.
values()Extracts all the values in this dictionary.

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 dictionary types.

This class holds the methods that can be applied to Falcon dictionary items.

Methods

back()

Returns the last item in the dictionary.

Dictionary.back( [remove], [key] )

removeIf true, remove the dictionary entry too.
keyIf true, return the key instead of the value.
Returns:The last value (or key) in the dictionary.
Raises:
AccessErrorif the dictionary is empty.

best()

Returns an iterator set to a given key, or finds the best position for its insertion.

Dictionary.best( key )

keyThe key to be found.
Returns:An iterator to the best possible position.

clear()

Removes all the items from this dictionary.

Dictionary.clear( )

comp()

Appends elements to this dictionary through a filter.

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

fill()

Fills the array with the given element.

Dictionary.fill( item )

itemThe item to be replicated.
Returns:This dictionary.

This method allows to clear all the values in this dictionary, resetting all the elements to a default value.

find()

Returns an iterator set to a given key.

Dictionary.find( key )

keyThe key to be found.
Returns:An iterator to the found item, or nil if not found.

If the key is found in the dictionary, an iterator pointing to that key is returned. It is then possible to change the value of the found item, insert one item after or before the returned iterator or eventually delete the key. If the key is not found, the function returns nil.

first()

Returns an iterator to the head of this dictionary.

Dictionary.first( )

Returns:An iterator.

front()

Returns the first item in the dictionary.

Dictionary.front( [remove], [key] )

removeIf true, remove the dictionary entry too.
keyIf true, return the key instead of the value.
Returns:The first value (or key) in the dictionary.
Raises:
AccessErrorif the dictionary is empty

get()

Retreives a value associated with the given key

Dictionary.get( key )

keyThe key to be found.
Returns:The value associated with a key, or an out-of-band nil if not found.

Return the value associated with the key, if present, or one of the values if more than one key matching the given one is present. If not present, the value returned will be nil. Notice that nil may be also returned if the value associated with a given key is exactly nil. In case the key cannot be found, the returned value will be marked as OOB.

Note: This method bypassess getIndex__ override in blessed (POOP) dictionaries.

keys()

Returns an array containing all the keys in this dictionary.

Dictionary.keys( )

Returns:An array containing all the keys.

The returned keyArray contains all the keys in the dictionary. The values in the returned array are not necessarily sorted; however, they respect the internal dictionary ordering, which depends on a hashing criterion.

If the dictionary is empty, then an empty array is returned.

last()

Returns an iterator to the head of this dictionary.

Dictionary.last( )

Returns:An iterator.

merge()

Merges a dictionary into this one.

Dictionary.merge( sourceDict )

sourceDictA dictionary that will be inserted in destDict

properties()

Returns all the properties in the dictionary.

Dictionary.properties( )

Returns:An array of strings representing property names.

This method returns all the property name in this dictionary. If the dictionary is not blessed, returns an empty array.

The returned list contains all those keys that are suitable to be directly accessed as properties (that is, strings without spaces, puntaction and so on). You may use Dictionary.keys instead if you know that all the keys can be used as properties.

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 a given key from the dictionary.

Dictionary.remove( key )

keyThe key to be removed
Returns:True if the key is found and removed, false otherwise.

If the given key is found, it is removed from the dictionary, and the function returns true. If it's not found, it returns false.

setProperty()

Sets a property in dictionary based instances.

Dictionary.setProperty( propName, value )

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

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

values()

Extracts all the values in this dictionary.

Dictionary.values( )

Returns:An array containing all the values.

The returned array contains all the value in the dictionary, in the same order by which they can be accessed traversing the dictionary.

If the dictionary is empty, then an empty array is returned.


Made with faldoc 2.1.0