Package pyamf :: Module codec :: Class IndexedCollection
[hide private]
[frames] | no frames]

Class IndexedCollection

source code


Store references to objects and provides an api to query references.

All reference checks are done using the builtin id function unless use_hash is specified as True where the slower but more flexible hash builtin is used.


Note: All attributes on the instance are private, use the apis only.

Instance Methods [hide private]
 
__init__(self, use_hash=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
clear(self)
Clears the collection.
source code
 
getByReference(self, ref)
Returns an object based on the supplied reference.
source code
 
getReferenceTo(self, obj)
Returns a reference to obj if it is contained within this index.
source code
 
append(self, obj)
Appends obj to this index.
source code
 
__eq__(self, other) source code
 
__len__(self) source code
 
__getitem__(self, idx) source code
 
__contains__(self, obj) source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, use_hash=False)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

getByReference(self, ref)

source code 

Returns an object based on the supplied reference. The ref should be an int.

If the reference is not found, None will be returned.

getReferenceTo(self, obj)

source code 

Returns a reference to obj if it is contained within this index.

If the object is not contained within the collection, -1 will be returned.

Parameters:
  • obj - The object to find the reference to.
Returns:
An int representing the reference or -1 is the object is not contained within the collection.

append(self, obj)

source code 

Appends obj to this index.

Returns:
The reference to obj in this index.

Note: Uniqueness is not checked

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)