| Package | system.data.arrays |
| Class | public dynamic class TypedArray |
| Inheritance | TypedArray ProxyArray flash.utils.Proxy |
| Implements | Typeable, Validator |
TypedArray acts like a normal array but assures that only objects of a specific type are added to the array.
Example :
import system.data.arrays.TypedArray ;
var ta:TypedArray = new TypedArray(String, ["item1", "item2", "item3"]) ;
trace ("ta : " + ta) ; // output : ta : item1,item2,item3
try
{
ta.push(2) ;
}
catch( e:Error )
{
trace( e.message ) ; // TypedArray.validate('value':2) is mismatch
}
| Property | Defined By | ||
|---|---|---|---|
| type : *
Indicates the type of the Typeable object. | TypedArray | ||
| Method | Defined By | ||
|---|---|---|---|
TypedArray(type:* = null, ... values)
Creates a new TypedArray instance. | TypedArray | ||
![]() | clear():void
Removes all elements in the array. | ProxyArray | |
clone():* [override]
Creates and returns a shallow copy of the object. | TypedArray | ||
concat(... arguments):TypedArray
Concatenates the elements specified in the parameter list with the elements of this array and returns a new array containing these element. | TypedArray | ||
![]() | isEmpty():Boolean
Indicates if the array is empty or not. | ProxyArray | |
![]() |
Returns the iterator of the object. | ProxyArray | |
push(... args):uint
Adds one or more elements to the end of this array and returns the new length of this array. | TypedArray | ||
supports(value:*):Boolean
Returns true if the specific value is valid. | TypedArray | ||
![]() | toArray():Array
Returns the Array representation of the object. | ProxyArray | |
toSource(indent:int = 0):String [override]
Returns the source representation of the object. | TypedArray | ||
![]() | toString():String
Returns the source code string representation of the object. | ProxyArray | |
unshift(... args):uint
Adds one or more elements to the beginning of an array and returns the new length of the array. | TypedArray | ||
validate(value:*):void
Evaluates the condition it checks and updates the IsValid property. | TypedArray | ||
| type | property |
type:*Indicates the type of the Typeable object.
If the type change the clear() method is invoked.
public function get type():* public function set type(value:any):void| TypedArray | () | Constructor |
public function TypedArray(type:* = null, ... values)Creates a new TypedArray instance.
Parameterstype:* (default = null) — the type of this Typeable object (a Class or a Function).
| |
... values — All values to insert in the Array, all invalid values are ignored.
|
| clone | () | method |
override public function clone():*Creates and returns a shallow copy of the object.
Returns* |
| concat | () | method |
public function concat(... arguments):TypedArrayConcatenates the elements specified in the parameter list with the elements of this array and returns a new array containing these element.
Parameters
... arguments |
TypedArray — a new array that contains the elements of this array as well as the passed-in elements.
|
| push | () | method |
public function push(... args):uintAdds one or more elements to the end of this array and returns the new length of this array.
Parameters
... args |
uint — the new length of this array
|
TypeError — If a value is invalid.
|
| supports | () | method |
public function supports(value:*):Boolean
Returns true if the specific value is valid.
Parameters
value:* |
Boolean — true if the specific value is valid.
|
| toSource | () | method |
override public function toSource(indent:int = 0):StringReturns the source representation of the object.
Parameters
indent:int (default = 0) |
String — the source representation of the object.
|
| unshift | () | method |
public function unshift(... args):uintAdds one or more elements to the beginning of an array and returns the new length of the array. The other elements in the array are moved from their original position, i, to i+1.
Example :
import system.data.arrays.TypedArray ;
var ta:TypedArray = new TypedArray( String ) ;
trace( ta.unshift( "value1", "value2" ) ) ; // 2
trace( ta ) ; // [value1,value2]
try
{
ta.unshift(1) ;
}
catch( e:Error )
{
trace( e.message ) ; // system.data.arrays.TypedArray.validate(1) is mismatch.
}
Parameters
... args |
uint |
TypeError — If a value is invalid.
|
| validate | () | method |
public function validate(value:*):voidEvaluates the condition it checks and updates the IsValid property.
Parameters
value:* |
TypeMismatchError — if the value isn't valid.
|