//**************************************************************************** //Copyright (C) 2005 www.flashshe.com //author:jackyshe //**************************************************************************** class com.flashshe.ArrayList{ public function ArrayList(a:Array) { if(a != undefined) items = a; else items = new Array(); } //------------------------------------------------------------------------------ public function addItem( item:Object ):Boolean { if ( item == null ) return false; items.push( item ); return true; } //------------------------------------------------------------------------------ public function addItemAt(index:Number, value:Object):Void { if (indexlength) { trace("Cannot add an item past the end of the DataProvider"); return; } } //------------------------------------------------------------------------------ public function addItemsAt(index:Number, newItems:Array):Void { if (indexlength) { trace("Cannot add an item past the end of the DataProvider"); return; } } //------------------------------------------------------------------------------ public function replaceItemAt(index:Number, itemObj:Object):Void { if (index<0 || index>=length) { return; } items[index] = itemObj; } //------------------------------------------------------------------------------ public function removeAll():Void { items = new Array(); } //------------------------------------------------------------------------------ public function contains(item:Object):Boolean { return ( getItemIndex( item ) > -1 ); } //------------------------------------------------------------------------------ public function getItemAt(index:Number):Object { return ( items[ index ] ); } //------------------------------------------------------------------------------ public function isEmpty():Boolean { return ( items.length == 0 ); } //------------------------------------------------------------------------------ public function removeItem( item:Object ):Boolean { var itemIndex:Number = getItemIndex( item ); if ( itemIndex < 0 ) return false; items.splice( itemIndex, 1 ); return true; } //------------------------------------------------------------------------------ public function removeItemsAt(index:Number, len:Number):Boolean { if (indexlength) { trace("Cannot add an item past the end of the DataProvider"); return; } } //------------------------------------------------------------------------------ public function toArray() : Array { return items; } //------------------------------------------------------------------------------ public function getItemIndex( item:Object ):Number { for ( var i=0; i