| Package | org.as3collections |
| Class | public class TypedCollection |
| Inheritance | TypedCollection Object |
| Implements | ICollection, org.as3coreaddendum.system.ITypeable |
| Subclasses | TypedList, TypedQueue |
TypedCollection works as a wrapper for a collection.
Since ActionScript 3.0 does not support typed arrays, TypedCollection is a way to create typed collections.
It stores the wrapCollection constructor's argument internally.
So every method call to this class is forwarded to the wrappedCollection object.
The methods that need to be checked for the type of the elements are previously validated with the validateType or validateCollection method before forward the call.
If the type of an element requested to be added to this collection is incompatible with the type of the collection a org.as3coreaddendum.errors.ClassCastError is thrown.
The calls that are forwarded to the wrappedCollection returns the return of the wrappedCollection call.
The TypedCollection.type setter is not supported and will thrown an UnsupportedOperationError if used.
| Property | Defined By | ||
|---|---|---|---|
| allEquatable : Boolean [read-only]
Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable. | TypedCollection | ||
| type : *
Defines the acceptable type of the elements by this collection. | TypedCollection | ||
| Method | Defined By | ||
|---|---|---|---|
TypedCollection(wrapCollection:ICollection, type:*)
Constructor, creates a new TypedCollection object. | TypedCollection | ||
add(element:*):Boolean
The element is validated with the validateType method to be forwarded to wrappedCollection.add. | TypedCollection | ||
addAll(collection:ICollection):Boolean
The collection is validated with the validateCollection method to be forwarded to wrappedCollection.addAll. | TypedCollection | ||
clear():void
Forwards the call to wrappedCollection.clear. | TypedCollection | ||
clone():*
Creates and return a new TypedCollection object with the clone of the wrappedCollection object. | TypedCollection | ||
contains(o:*):Boolean
Forwards the call to wrappedCollection.contains. | TypedCollection | ||
containsAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.containsAll. | TypedCollection | ||
equals(other:*):Boolean
This method first checks if other argument is a TypedCollection. | TypedCollection | ||
isEmpty():Boolean
Forwards the call to wrappedCollection.isEmpty. | TypedCollection | ||
Forwards the call to wrappedCollection.iterator. | TypedCollection | ||
remove(o:*):Boolean
Forwards the call to wrappedCollection.remove. | TypedCollection | ||
removeAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.removeAll. | TypedCollection | ||
retainAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.retainAll. | TypedCollection | ||
size():int
Forwards the call to wrappedCollection.size. | TypedCollection | ||
toArray():Array
Forwards the call to wrappedCollection.toArray. | TypedCollection | ||
toString():String
Returns the string representation of this instance. | TypedCollection | ||
| allEquatable | property |
allEquatable:Boolean [read-only]
Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable.
public function get allEquatable():Boolean| type | property |
type:*Defines the acceptable type of the elements by this collection.
The setter is not supported and will thrown an UnsupportedOperationError if used.
public function get type():* public function set type(value:any):void| TypedCollection | () | Constructor |
public function TypedCollection(wrapCollection:ICollection, type:*)
Constructor, creates a new TypedCollection object.
wrapCollection:ICollection — the target collection to wrap.
| |
type:* — the type of the elements allowed by this collection.
|
ArgumentError — if the wrapCollection argument is null.
| |
ArgumentError — if the type argument is null.
| |
org.as3coreaddendum.errors:ClassCastError — if the types of one or more elements in the wrapCollection argument are incompatible with the type argument.
|
| add | () | method |
public function add(element:*):Boolean
The element is validated with the validateType method to be forwarded to wrappedCollection.add.
Parameters
element:* — the element to forward to wrappedCollection.add.
|
Boolean — the return of the call wrappedCollection.add.
|
org.as3coreaddendum.errors:ClassCastError — if the type of the element is incompatible with the type of this collection.
|
| addAll | () | method |
public function addAll(collection:ICollection):Boolean
The collection is validated with the validateCollection method to be forwarded to wrappedCollection.addAll.
Parameters
collection:ICollection — the collection to forward to wrappedCollection.addAll.
|
Boolean — the return of the call wrappedCollection.addAll.
|
org.as3coreaddendum.errors:ClassCastError — if the types of one or more elements in the collection argument are incompatible with the type of this collection.
|
| clear | () | method |
public function clear():void
Forwards the call to wrappedCollection.clear.
| clone | () | method |
public function clone():*
Creates and return a new TypedCollection object with the clone of the wrappedCollection object.
* — a new TypedCollection object with the clone of the wrappedCollection object.
|
| contains | () | method |
public function contains(o:*):Boolean
Forwards the call to wrappedCollection.contains.
Parameters
o:* |
Boolean — the return of the call wrappedCollection.contains.
|
| containsAll | () | method |
public function containsAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.containsAll.
Parameters
collection:ICollection |
Boolean — the return of the call wrappedCollection.containsAll.
|
| equals | () | method |
public function equals(other:*):Boolean
This method first checks if other argument is a TypedCollection.
If not it returns false. If true it checks the type property of both lists.
If they are different it returns false.
Otherwise it uses CollectionUtil.equalNotConsideringOrder method to perform equality, sending this list and other argument.
Parameters
other:* — the object to be compared for equality.
|
Boolean — true if the arbitrary evaluation considers the objects equal.
|
See also
| isEmpty | () | method |
public function isEmpty():Boolean
Forwards the call to wrappedCollection.isEmpty.
Boolean — the return of the call wrappedCollection.isEmpty.
|
| iterator | () | method |
public function iterator():IIterator
Forwards the call to wrappedCollection.iterator.
IIterator — the return of the call wrappedCollection.iterator.
|
| remove | () | method |
public function remove(o:*):Boolean
Forwards the call to wrappedCollection.remove.
Parameters
o:* |
Boolean — the return of the call wrappedCollection.remove.
|
| removeAll | () | method |
public function removeAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.removeAll.
Parameters
collection:ICollection |
Boolean — the return of the call wrappedCollection.removeAll.
|
| retainAll | () | method |
public function retainAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.retainAll.
Parameters
collection:ICollection |
Boolean — the return of the call wrappedCollection.retainAll.
|
| size | () | method |
public function size():int
Forwards the call to wrappedCollection.size.
int — the return of the call wrappedCollection.size.
|
| toArray | () | method |
public function toArray():Array
Forwards the call to wrappedCollection.toArray.
Array — the return of the call wrappedCollection.toArray.
|
| toString | () | method |
public function toString():StringReturns the string representation of this instance.
This method uses CollectionUtil.toString method.
String — the string representation of this instance.
|