Packagetwaver
Interfacepublic interface ICollection
Implementors Collection

This class wraps an object collection which is represents a group of objects. This collection is able to manage any kind objects, it provides methods to add, remove, clear objects, visit objects. Objects in this collection can be duplicatable are decided by "duplicatable" property.



Public Properties
 PropertyDefined By
  count : int
[read-only] Get the total object count of this collection.
ICollection
  duplicatable : Boolean
Get the flag value indicates that whether objects contain in this collection can be duplicatable.
ICollection
Public Methods
 MethodDefined By
  
addAll(collection:ICollection):void
Add all objects of given collection into this collection.
ICollection
  
addItem(item:*):void
Add an object item into this collection.
ICollection
  
addItemAt(item:*, index:int):void
Add an object item into this collection at the specified index location.
ICollection
  
clear():void
Clear all items of this collection.
ICollection
  
contains(item:*):Boolean
Check whether this collection contains the specified object.
ICollection
  
forEach(callbackFunction:Function):void
Iterates all data of this collection by specified call back function.
ICollection
  
forEachReverse(callbackFunction:Function):void
Iterates all data of this collection by specified call back function in the reversed order.
ICollection
  
getItemAt(index:int):*
Get the object at the specified location from this collection.
ICollection
  
getItemIndex(item:*):int
Get the specified object item's index, if this collection contains it.
ICollection
  
removeItem(item:*):int
Remove the specified object from this collection.
ICollection
  
removeItemAt(index:int):*
Remove the item at the specified location.
ICollection
  
setItemAt(item:*, index:int):*
Set the object at the specified location with the specified new item object.
ICollection
  
sort(sortFunction:Function = null):ICollection
ICollection
  
toArray():Array
Get all objects in this collection with an Array.
ICollection
  
toCollection(filterFunction:Function):ICollection
ICollection
  
toString():String
ICollection
Property Detail
countproperty
count:int  [read-only]

Get the total object count of this collection.


Implementation
    public function get count():int
duplicatableproperty 
duplicatable:Boolean

Get the flag value indicates that whether objects contain in this collection can be duplicatable.


Implementation
    public function get duplicatable():Boolean
    public function set duplicatable(value:Boolean):void
Method Detail
addAll()method
public function addAll(collection:ICollection):void

Add all objects of given collection into this collection.

Parameters

collection:ICollection — the collection that to be added into this collection.

addItem()method 
public function addItem(item:*):void

Add an object item into this collection.

Parameters

item:* — the item to be added.

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

Add an object item into this collection at the specified index location.

Parameters

item:* — the object item to be added into this collection.
 
index:int — the index location this item should added.

clear()method 
public function clear():void

Clear all items of this collection. All objects will be removed.

contains()method 
public function contains(item:*):Boolean

Check whether this collection contains the specified object.

Parameters

item:* — the object to be checked.

Returns
Boolean — true if contains this item, false otherwise.
forEach()method 
public function forEach(callbackFunction:Function):void

Iterates all data of this collection by specified call back function.

Parameters

callbackFunction:Function — the call back function used to iterate all items contained by this collection.

forEachReverse()method 
public function forEachReverse(callbackFunction:Function):void

Iterates all data of this collection by specified call back function in the reversed order.

Parameters

callbackFunction:Function — the call back function used to iterate items contained by this collection.

getItemAt()method 
public function getItemAt(index:int):*

Get the object at the specified location from this collection.

Parameters

index:int — the index location that need to get.

Returns
* — the object item at the specified index location.
getItemIndex()method 
public function getItemIndex(item:*):int

Get the specified object item's index, if this collection contains it.

Parameters

item:* — an object item to be checked.

Returns
int — the index location of the specified item. If this item does not contained in this collection, return -1.
removeItem()method 
public function removeItem(item:*):int

Remove the specified object from this collection.

Parameters

item:* — the object to be removed

Returns
int — index location of the removed item.
removeItemAt()method 
public function removeItemAt(index:int):*

Remove the item at the specified location.

Parameters

index:int — the index location where the object need to remove

Returns
* — the object that removed.
setItemAt()method 
public function setItemAt(item:*, index:int):*

Set the object at the specified location with the specified new item object.

Parameters

item:* — the new object value of this location.
 
index:int — the location that need to set.

Returns
* — the old object value.
sort()method 
public function sort(sortFunction:Function = null):ICollection

Parameters

sortFunction:Function (default = null)

Returns
ICollection
toArray()method 
public function toArray():Array

Get all objects in this collection with an Array.

Returns
Array — an Array object that contains all data of this collection.
toCollection()method 
public function toCollection(filterFunction:Function):ICollection

Parameters

filterFunction:Function

Returns
ICollection
toString()method 
public function toString():String

Returns
String