Package pyamf :: Package flex :: Class ArrayCollection

[hide private]
[frames] | no frames]

# Class ArrayCollection

source code

I represent the ActionScript 3 based class `flex.messaging.io.ArrayCollection` used in the Flex framework.

The `ArrayCollection` class is a wrapper class that exposes an Array as a collection that can be accessed and manipulated using the methods and properties of the `ICollectionView` or `IList` interfaces in the Flex framework.

See Also: ArrayCollection on Livedocs (external)

Note: This class does not implement the RemoteObject part of the documentation.

Nested Classes | [hide private]

| __amf__

Instance Methods | [hide private]

new list

__init__(self, source=None) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code

__repr__(self) repr(x) | source code

__readamf__(self, input) | source code

__writeamf__(self, output) | source code

_get_length(self) | source code

_set_length(self, length) | source code

addItem(self, item) Adds the specified item to the end of the list. | source code

addItemAt(self, item, index) Adds the item at the specified index. | source code

`mixed`.

getItemAt(self, index, prefetch=0) Gets the item at the specified index. | source code

`int`

getItemIndex(self, item) Returns the index of the item if it is in the list such that `getItemAt(index) == item`. | source code

removeAll(self) Removes all items from the list. | source code

`mixed`.

removeItemAt(self, index) Removes the item at the specified index and returns it. | source code

`mixed` or `None`.

setItemAt(self, item, index) Places the item at the specified index. | source code

`list`

toArray(self) Returns an Array that is populated in the same order as the `IList` implementation. | source code

Inherited from `list`: `__add__`, `__contains__`, `__delitem__`, `__delslice__`, `__eq__`, `__ge__`, `__getattribute__`, `__getitem__`, `__getslice__`, `__gt__`, `__hash__`, `__iadd__`, `__imul__`, `__iter__`, `__le__`, `__len__`, `__lt__`, `__mul__`, `__ne__`, `__new__`, `__reversed__`, `__rmul__`, `__setitem__`, `__setslice__`, `append`, `count`, `extend`, `index`, `insert`, `pop`, `remove`, `reverse`, `sort`

Inherited from `object`: `__delattr__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__str__`

Instance Variables | [hide private]

`int` | length [read-only] The number of items in this collection.

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, source=None)
(Constructor)

source code

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Returns: new list
Overrides: object.__init__
  (inherited documentation)

### __repr__(self)
(Representation operator)

source code

repr(x)

Overrides: object.__repr__
  (inherited documentation)

### addItem(self, item)

source code

Adds the specified item to the end of the list.

Parameters:
  - `item` (`mixed`.) - The object to add to the collection.

Since: 0.4

### addItemAt(self, item, index)

source code

Adds the item at the specified index.

Parameters:
  - `item` (`mixed`.) - The object to add to the collection.
  - `index` - The index at which to place the item.
Raises:
  - `IndexError` - If index is less than 0 or greater than the length of the list.

Since: 0.4

### getItemAt(self, index, prefetch=0)

source code

Gets the item at the specified index.

Parameters:
  - `index` (`int`) - The index in the list from which to retrieve the item.
  - `prefetch` - This param is ignored and is only here as part of the interface.
Returns: `mixed`.
  The item at index `index`.
Raises:
  - `IndexError` - if `index < 0` or `index >= length`

Since: 0.4

### getItemIndex(self, item)

source code

Returns the index of the item if it is in the list such that `getItemAt(index) == item`.

Parameters:
  - `item` (`mixed`.) - The item to find.
Returns: `int`
  The index of the item or -1 if the item is not in the list.

Since: 0.4

### removeAll(self)

source code

Removes all items from the list.

Since: 0.4

### removeItemAt(self, index)

source code

Removes the item at the specified index and returns it. Any items that were after this index are now one index earlier.

Parameters:
  - `index` - The index from which to remove the item.
Returns: `mixed`.
  The item that was removed.
Raises:
  - `IndexError` - If index is less than 0 or greater than length.

Since: 0.4

### setItemAt(self, item, index)

source code

Places the item at the specified index. If an item was already at that index the new item will replace it and it will be returned.

Parameters:
  - `item` (`mixed`.) - The new item to be placed at the specified index.
  - `index` (`int`) - The index at which to place the item.
Returns: `mixed` or `None`.
  The item that was replaced, or `None`.
Raises:
  - `IndexError` - If index is less than 0 or greater than length.

Since: 0.4

### toArray(self)

source code

Returns an Array that is populated in the same order as the `IList` implementation.

Returns: `list`
  The array.

Instance Variable Details | [hide private]

### length

[read-only] The number of items in this collection. Introduced in 0.4.

Get Method:
  _get_length(self)
Set Method:
  _set_length(self, length)