Package csb :: Package core :: Class CollectionContainer

[frames] | no frames]

# Class CollectionContainer

source code

             object --+
                      |
        AbstractIndexer --+
                          |
    BaseCollectionContainer --+
                              |
                             CollectionContainer

Known Subclasses:
  - bio.hmm.HMMLayersCollection
  - , bio.structure.ChainResiduesCollection
  - , bio.structure.DisorderedAtom
  - , bio.structure.EnsembleModelsCollection
  - , bio.structure.SecondaryStructure
  - , bio.structure.TorsionAnglesCollection
  - , statistics.samplers.mc.Trajectory

Write-enabled Collection Container. New items can be added using a public `append` method. Subclasses may also override the internal `_update` to expose it to the clients.

Instance Methods

__init__(self, items=None, type=None, start_index=0) x.__init__(...) initializes x; see help(type(x)) for signature | source code

int

append(self, item) Append a new item to the collection. | source code

Inherited from `BaseCollectionContainer`: `__bool__`, `__contains__`, `__getitem__`, `__iter__`, `__len__`, `__nonzero__`, `__repr__` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `BaseCollectionContainer`: `last_index`, `length`, `start_index` Inherited from `object`: `__class__`

Method Details

### __init__(self, items=None, type=None, start_index=0)
(Constructor)

source code

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

Parameters:
  - `items` - initialization list
  - `type` - if defined, makes the container type-safe
  - `start_index` - the index of the zero element
Overrides: object.__init__
  (inherited documentation)

### append(self, item)

source code

Append a new item to the collection.

Parameters:
  - `item` - the new item to append
Returns: int
  the index of the new element
Raises:
  - `TypeError` - when the container is type-safe and item has an incorrect type