Posted By

alejandromb on 12/20/09


Tagged

set collection as3 actionscript3 adt


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tspitzr


AS3 | ArraySet


 / Published in: ActionScript 3
 

URL: http://www.kirikacode.com

  1. package kc.tda {
  2. import kc.api.ICollection;
  3.  
  4. [Event( name="add", type="kc.events.CollectionEvent" )]
  5. [Event( name="addAll", type="kc.events.CollectionEvent" )]
  6. [Event( name="clear", type="kc.events.CollectionEvent" )]
  7. [Event( name="remove", type="kc.events.CollectionEvent" )]
  8. [Event( name="removeAll", type="kc.events.CollectionEvent" )]
  9. [Event( name="retain", type="kc.events.CollectionEvent" )]
  10.  
  11. public class ArraySet extends ArrayCollection implements ICollection {
  12.  
  13. // @constructor
  14.  
  15. public function ArraySet( capacity:int = undefined, expandableCapacity:Boolean = false, loadFactor:Number = NaN ) {
  16.  
  17. super( capacity, expandableCapacity, loadFactor );
  18.  
  19. }
  20.  
  21. // @override
  22.  
  23. override public function add( value:* ):Boolean {
  24. return ( contains( value ) == ArrayCollection.NOT_FOUND )
  25. ? super.add( value )
  26. : false;
  27. }
  28.  
  29. }
  30.  
  31. }

Report this snippet  

You need to login to post a comment.