1.2.13Class Object

Object (class instance) type basic object model metaclass.

Class Object from \
                 BOM( )
Methods
applyApplies the values in a dictionary to the corresponding properties.
attributesReturns a dictionary containing annotation attributes of the given object.
compAppends elements to this object through a filter.
getPropertyReturns the value of a property in an object.
getStateReturn the current state of an object.
mcompAppends elements to this object through a filter.
mfcompAppends elements to this object through a filter.
propertiesReturns all the properties in the object.
retrieveGets the values stored in the properties of this object.
setPropertySets the value of a proprety in this object
setStateChange the current active state of an object.
Methods inherited from class BOM
__addOverrides binary addition operand.
__callOverrides call operator "self()".
__decOverrides decrement unary prefix operand.
__decpostOverrides decrement unary postfix operand.
__divOverrides binary division operand.
__getIndexOverrides array access operator []
__incOverrides increment unary prefix operand.
__incpostOverrides increment unary postifx operand.
__modOverrides modulo operand.
__mulOverrides binary multiplication operand.
__powOverrides power operand.
__setIndexOverrides array write operator []
__subOverrides binary subtraction operand.
baseClassReturns the class item from which an object has been instantiated.
boundDetermines if an item is bound or not.
classNameReturns the name of the class an instance is instantiated from.
clonePerforms a deep copy of the item.
comparePerforms a lexicographical comparison.
derivedFromChecks if this item has a given parent.
describeReturns the deep contents of an item on a string representation.
isCallableDetermines if an item is callable.
lenRetrieves the length of a collection
metaclassReturns the metaclass associated with this item.
ptrReturns a raw memory pointer out of this data (as an integer).
serializeSerialize the item on a stream for persistent storage.
toStringCoverts the object to string.
typeIdReturns an integer indicating the type of this item.

Methods

apply

Applies the values in a dictionary to the corresponding properties.

Object.apply( dict )
dict A "stamp" dictionary, or a sequence of named values.
ReturnThis same object.
Raise
AccessError if some property listed in the dictionary is not defined.

This method applies a "stamp" on this object. The idea is that of copying the contents of all the items in the dictionary into the properties of this object. Dictionaries are more flexible than objects, at times they are preferred for i.e. network operations and key/value databases. With this method, you can transfer data from a dictionary in an object with a single VM step, paying just the cost of the copy; in other words, sparing the VM operations needed for looping over the dictionary and searching dynamically the required properties.

Note: Non-string keys in dict are simply skipped.

See also: Object.

attributes

Returns a dictionary containing annotation attributes of the given object.

Object.attributes()
ReturnNil if the object has no attributes, or a string-indexed dictionary.

If the object is a class instance, this method will return the attributes of the generator class.

See also: attributes.

comp

Appends elements to this object through a filter.

Object.comp( source, [filter] )
source One sequence, range or callable generating items.
filter A filtering function receiving one item at a time.
ReturnThis object.

This method extracts one item at a time from the source, and calls repeatedly the append method of this object.

Please, see the description of Sequence.comp.

See also: Sequence.

getProperty

Returns the value of a property in an object.

Object.getProperty( propName )
propName A string representing the name of a property or a method inside the object.
Returnthe property
Raise
AccessError if the property can't be found.

An item representing the property is returned. The returned value is actually a copy of the property; assigning a new value to it won't have any effect on the original object.

If the property is a method, a callable method item is returned. If the property is not found, an error of class RangeError is raised.

getState

Return the current state of an object.

Object.getState()
ReturnA string representing the current state of an object, or nil if the object is stateless.

This function returns the current state in which an object is operating.

mcomp

Appends elements to this object through a filter.

Object.mcomp( ... )
... One or more sequences, ranges or callables generating items.
ReturnThis object.

This method sends the data generated from multiple comprehension, to the append method of this object.

Please, see the description of Sequence.comp.

See also: Sequence.

mfcomp

Appends elements to this object through a filter.

Object.mfcomp( filter, ... )
filter A filter function receiving each element before its insertion, or nil.
... One or more sequences, ranges or callables generating items.
ReturnThis object.

This method performs a filtered multiple comprehension and and calls repeatedly the append method of this object, passing the output of the filter function to it each time. If the filter function returns an oob(1), the step is skipped and the append method is not called.

Please, see the description of Sequence.comp.

See also: Sequence.

properties

Returns all the properties in the object.

Object.properties()
ReturnAn array of strings representing property names.

This method returns all the properties in this object.

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.

Note: Subclasses are seen as properties, so they will returned in the list too.

retrieve

Gets the values stored in the properties of this object.

Object.retrieve( [dict] )
dict A "stamp" dictionary.
ReturnA dictionary containing the contents of each property (stored as a key in the dictionary).
Raise
AccessError if some property listed in the dictionary is not defined.

This method takes all the data values stored in the properties of this object (ignoring methods), and places them in a dictionary. Property names are used as keys under which to store flat copies of the property values.

If a dict parameter is passed, this method will take only the properties stored as keys, and eventually raise an AccessError if some of them are not found.

Otherwise, a new dictionary will be filled with all the properties in this object.

Note: In case of repeated activity, the same dictionary can be used to fetch new values to spare memory and CPU.

See also: Object.

setProperty

Sets the value of a proprety in this object

Object.setProperty( propName, value )
propName A string representing the name of a property or a method inside the object.
value The property new value.
Raise
AccessError If the property can't be found.

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

setState

Change the current active state of an object.

Object.setState( nstate )
nstate The new state into which the object is moved.
ReturnReturn value of the leave -> enter sequence, if any, or nil
Raise
CodeError if the state is not part of the object state.

This method changes the state of the object, applying a new set of function described in the state section.

Made with http://www.falconpl.org