Constructors

Methods

Collection class

Collection

 

implements ICollection

 

Overview

Author

Adobe [http://www.adobe.com]
Ported to AS3 by Matt Przybylski [http://www.reintroducing.com]

Version

1.1

Description

A base class for storing strongly typed Value Objects.

Constructors

 

Collection

Usage

public function Collection($name:String):void

Description

Helper class used to manage a collection of objects. This class is similar to the Java Collection interface. Developers can extend this class to create new Collection types that provide additional functionality such as ordering and sorting.

Parameters

$name
the name of the Collection.

Methods

 

getName

Usage

public function getName():String

Description

Gets the name of the Collection.

Returns

String the name of the Collection.
 

addItem

Usage

public function addItem($item:*):Boolean

Description

Adds a new item to the end of the Collection.

Parameters

$item
* to be added to the Collection. If item is null it will not be added to the Collection.

Returns

Boolean true if the Collection was changed as a result of the operation.
 

addItemAt

Usage

public function addItemAt($index:int, $item:*):void

Description

Adds a new item at the specified index in the Collection.

Parameters

$index
position to add the specified item in
$item
* to be added to the Collection.

Returns

Nothing
 

removeItem

Usage

public function removeItem($item:*):Boolean

Description

Removes a single item from the Collection. Returns false if item is not found.

Parameters

$item
reference to Collection item to be removed from Collection.

Returns

Boolean true if item is found and successfully removed. False if item is not found.
 

clear

Usage

public function clear():void

Description

Removes all items from the Collection.

Returns

Nothing
 

contains

Usage

public function contains($item:*):Boolean

Description

Returns true if this Collection contains the specified item.

Parameters

$item
* whose presence in this collection is to be tested.

Returns

Boolean true if this collection contains the specified item.
 

getItemAt

Usage

public function getItemAt($index:int):*

Description

Returns an item within the Collection using it's index.

Parameters

$index
location of item within the Collection.

Returns

reference to item.
 

getIterator

Usage

public function getIterator():Iterator

Description

Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee).

Returns

Iterator object that is used to iterate through the collection.
 

getLength

Usage

public function getLength():int

Description

Returns the current length

Returns

int value reflecting the number of items in this Collection.
 

isEmpty

Usage

public function isEmpty():Boolean

Description

Returns true if the Collection is empty.

Returns

Boolean true if Collection is empty.
 

output

Usage

public function output():void

Description

Traces the Value Objects of the Collection to the Output panel.

Returns

Nothing