Packagecom.bourre.collection
Interfacepublic interface TypedContainer
ImplementorsAbstractLocator, Grid, Queue, Set, Stack, TypedArray

Player version: Flash Player 9.0
Language version: ActionScript 3.0

A TypedContainer allow collections and data structures to provide runtime type checking over their elements.

A typed container does not define how elements are inserted into the container, but provides convenient methods to check type of these elements and to know if the container is typed and which type the container support.

By convention, the constructor of an implementation of the TypedContainer interface will define an optional argument type such type : Class = null which let the user of the class define if the container is typed and which type the container support.

When dealing with typed and untyped container, the following rules apply :

See also

Queue.html
Set.html
Stack.html


Public Methods
 MethodDefined by
  
getType():Class
Return the class type of elements in this container.
TypedContainer
  
isTyped():Boolean
Returns true if this container perform a verification of the type of elements.
TypedContainer
  
matchType(o:*):Boolean
Verify that the passed-in object type match the current container element's type.
TypedContainer
Method detail
getType()method
public function getType():Class

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Return the class type of elements in this container.

An untyped container returns null, as the wildcard type (/code>) is not a Class and Object class doesn't fit for primitive types.

Returns
ClassClass type of the container's elements
isTyped()method 
public function isTyped():Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns true if this container perform a verification of the type of elements.

Returns
Booleantrue if this container perform a verification of the type of elements.
matchType()method 
public function matchType(o:*):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Verify that the passed-in object type match the current container element's type.

Parameters
o:*

Returns
Booleantrue if the object is elligible for this container, either false.