package com.hapticdata {
import flash.utils.ByteArray;
/**
* Adds extra methods to arrays for easier manipulation
* @class AdvArray
* @author Kyle Phillips - http://www.haptic-data.com
* @created Jun 29, 2008
*/
dynamic public class AdvArray extends Array {
public function AdvArray(...args) {
//this = this as Array;
for each(var i:* in args)
{
super.push(i);
}
//super(...args);
}
/**
* add an array to the end of the existing AdvArray
* @param a (Array) the array to append
* @return the new length of the array
*/
public function append(a:Array):uint
{
for(var i:uint=0;i0)
{
for(var j:int=0;jinc;k--)rotateBackwards();
}
return this;
}
/**
* makes a shallow copy of the current array
* Flex3 LiveDocs: In a shallow copy, if the original array has elements that are objects, only the
* references to the objects are copied rather than the objects themselves. The copy points to the same objects as the original does.
* Any changes made to the objects are reflected in both arrays.
* @return a shallow copy of the current array
*/
public function shallowCopy():Array
{
return super.concat();
}
/**
* makes a deep copy of the current array
* Flex3 LiveDocs: In a deep copy, any objects found in the original array are also copied
* so the the new array does not point to the same objects as does the original array.
* @return a deep copy of the current array
*/
public function clone():Array
{
var myBA:ByteArray = new ByteArray();
myBA.writeObject(super);
myBA.position = 0;
return(myBA.readObject());
}
}
}