Packagesystem.data.sets
Classpublic class TypedSet
InheritanceTypedSet Inheritance TypedCollection Inheritance Object
Implements Set

TypedCollection is a wrapper for Collection instances that ensures that only values of a specific type can be added to the wrapped collection.

Example :

     import system.data.sets.ArraySet ;
     import system.data.sets.TypedSet ;
     
     var co:ArraySet = new ArraySet(["item1", "item2"]) ;
     var ts:TypedSet = new TypedSet( String , co ) ;
     
     ts.add( "item3" ) ;
     trace( ts ) ; // {item1,item2,item3}
     
     try
     {
         ts.add( 10 ) ;
     }
     catch( e:Error )
     {
         trace( e.message ) ; // TypedSet.validate(10) is mismatch.
     }
     



Public Properties
 PropertyDefined By
 Inheritedtype : *
Indicates the type of the Typeable object.
TypedCollection
Public Methods
 MethodDefined By
  
TypedSet(type:*, s:Set)
Creates a new TypedSet instance.
TypedSet
 Inherited
add(o:*):Boolean
Inserts an element in the collection.
TypedCollection
 Inherited
clear():void
Removes all elements in the collection.
TypedCollection
  
clone():*
[override] Returns a shallow copy of this collection.
TypedSet
 Inherited
contains(o:*):Boolean
Returns true if this collection contains the specified element.
TypedCollection
 Inherited
get(key:*):*
Returns the element from this collection at the passed key index.
TypedCollection
 Inherited
indexOf(o:*, fromIndex:uint = 0):int
Returns the index of an element in the collection.
TypedCollection
 Inherited
isEmpty():Boolean
Returns true if this collection contains no elements.
TypedCollection
 Inherited
Returns an iterator over the elements in this collection.
TypedCollection
 Inherited
remove(o:*):*
Removes a single instance of the specified element from this collection, if it is present (optional operation).
TypedCollection
 Inherited
size():uint
Returns the number of elements in this collection.
TypedCollection
 Inherited
supports(value:*):Boolean
Returns true if the specific value is valid.
TypedCollection
 Inherited
toArray():Array
Returns an array containing all of the elements in this collection.
TypedCollection
 Inherited
toSource(indent:int = 0):String
Returns the source code string representation of the object.
TypedCollection
 Inherited
toString():String
Returns the String representation of the object.
TypedCollection
 Inherited
validate(value:*):void
Evaluates the specified value and throw a TypeError object if the value is not valid.
TypedCollection
Constructor Detail
TypedSet()Constructor
public function TypedSet(type:*, s:Set)

Creates a new TypedSet instance.

Parameters
type:* — the type of this Typeable object (a Class or a Function).
 
s:Set — The Collection reference of this wrapper.

Throws
ArgumentError — if the type is null or undefined.
 
TypeError — if a value in the passed-in Collection object isn't valid.
Method Detail
clone()method
override public function clone():*

Returns a shallow copy of this collection.

Returns
* — a shallow copy of this collection.