### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >

# 57. `collection` — Tools for handling collections of elements belonging to multiple parts.

This module defines the Collection class.

`Classes defined in module collection`

class `collection.``Collection`

  A collection is a set of (int,int) tuples.

  The first part of the tuple has a limited number of values and are used as the keys in a dict. The second part can have a lot of different values and is implemented as an integer array with unique values. This is e.g. used to identify a set of individual parts of one or more OpenGL actors.

  `add`(data, key=-1)

    Add new data to the collection.

    data can be a 2d array with (key,val) tuples or a 1-d array of values. In the latter case, the key has to be specified separately, or a default value will be used.

  `set`(data, key=-1)

    Set the collection to the specified data.

    This is equivalent to clearing the corresponding keys before adding.

  `remove`(data, key=-1)

    Remove data from the collection.

  `has_key`(key)

    Check whether the collection has an entry for the key.

  `get`(key, default=[])

    Return item with given key or default.

  `keys`()

    Return a sorted array with the keys

  `items`()

    Return a zipped list of keys and values.

`Functions defined in module collection`

### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >