Created
April 13, 2010 20:42
-
-
Save robertpenner/365059 to your computer and use it in GitHub Desktop.
Vector classes decompiled from Flash 10 playerglobal.swc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
dynamic final class Vector$object { | |
function Vector$object(length:uint=0, fixed:Boolean=false){ | |
super(); | |
this.length = length; | |
this.fixed = fixed; | |
} | |
private function _shift(){ | |
if (this.fixed){ | |
Error.throwError(RangeError, 1126); | |
}; | |
if (this.length == 0){ | |
return (undefined); | |
}; | |
var _local1:* = this[0]; | |
this._spliceHelper(0, 0, 1, null, 0); | |
return (_local1); | |
} | |
AS3 function reverse():Vector$object{ | |
this._reverse(); | |
return (this); | |
} | |
AS3 native function unshift(... _args):uint; | |
private function clamp(val:Number, len:uint):uint{ | |
var _local3:uint; | |
if (val < 0){ | |
if ((val + len) < 0){ | |
_local3 = 0; | |
} else { | |
_local3 = uint((val + len)); | |
}; | |
} else { | |
if (val > len){ | |
_local3 = this.length; | |
} else { | |
if (val != val){ | |
_local3 = 0; | |
} else { | |
_local3 = uint(val); | |
}; | |
}; | |
}; | |
return (_local3); | |
} | |
public native function set length(value:uint); | |
AS3 function indexOf(value:Object, from:Number=0):Number{ | |
var _local3:uint = this.clamp(from, this.length); | |
var _local4:uint = _local3; | |
var _local5:uint = this.length; | |
while (_local4 < _local5) { | |
if (this[_local4] === value){ | |
return (_local4); | |
}; | |
_local4++; | |
}; | |
return (-1); | |
} | |
AS3 native function pop(); | |
AS3 function slice(start:Number=0, end:Number=2147483647):Vector$object{ | |
return (this._slice(start, end)); | |
} | |
private function _slice(start:Number=0, end:Number=2147483647){ | |
var _local3:uint = this.clamp(start, this.length); | |
var _local4:uint = this.clamp(end, this.length); | |
var _local5:* = this.newThisType(); | |
_local5._spliceHelper(0, (_local4 - _local3), 0, this, _local3); | |
return (_local5); | |
} | |
AS3 function concat(... _args):Vector$object{ | |
return (this._concat(_args)); | |
} | |
public native function get fixed():Boolean; | |
private native function _filter(callback:Function, thisObject); | |
AS3 native function push(... _args):uint; | |
AS3 function every(checker:Function, thisObj:Object=null):Boolean{ | |
return (_every(this, checker, ((thisObj is Object)) ? thisObj : null)); | |
} | |
AS3 function map(mapper:Function, thisObj:Object=null){ | |
this._map(mapper, ((thisObj is Object)) ? thisObj : null); | |
} | |
private native function _map(callback:Function, thisObject); | |
AS3 function sort(comparefn):Vector$object{ | |
var _local2:Array = [comparefn]; | |
_sort(this, _local2); | |
return (this); | |
} | |
private function _splice(start, deleteCount, items:Array){ | |
var _local4:uint = this.clamp(start, this.length); | |
var _local5:uint = this.clamp(deleteCount, (this.length - _local4)); | |
var _local6:* = this.newThisType(); | |
_local6._spliceHelper(0, _local5, 0, this, _local4); | |
this._spliceHelper(_local4, items.length, _local5, items, 0); | |
return (_local6); | |
} | |
private native function _reverse():void; | |
AS3 function shift(){ | |
return (this._shift()); | |
} | |
public native function get length():uint; | |
public native function set fixed(f:Boolean); | |
private native function _spliceHelper(insertpoint:uint, insertcount:uint, deleteCount:uint, args:Object, offset:int):void; | |
AS3 function join(separator:String=","):String{ | |
var _local5:uint; | |
var _local2:uint = this.length; | |
var _local3:String = ""; | |
var _local4:int; | |
if (_local2 > 0){ | |
while (true) { | |
_local5 = _local4; | |
_local3 = (_local3 + this[_local5]); | |
++_local4; | |
_local5 = _local4; | |
if (_local5 == _local2){ | |
break; | |
}; | |
_local3 = (_local3 + separator); | |
}; | |
}; | |
return (_local3); | |
} | |
AS3 function lastIndexOf(value:Object, from:Number=2147483647):Number{ | |
var _local3:uint = this.clamp(from, this.length); | |
if (_local3 == this.length){ | |
_local3--; | |
}; | |
var _local4:int = _local3; | |
while (_local4 >= 0) { | |
if (this[_local4] === value){ | |
return (_local4); | |
}; | |
_local4--; | |
}; | |
return (-1); | |
} | |
AS3 function toString():String{ | |
return (this.join()); | |
} | |
AS3 function toLocaleString():String{ | |
var _local5:*; | |
var limit:uint = this.length; | |
var _local2:String = ","; | |
var _local3:String = ""; | |
var _local4:uint; | |
if (limit > 0){ | |
while (true) { | |
_local5 = this[_local4]; | |
if (((!((_local5 === undefined))) && (!((_local5 === null))))){ | |
_local3 = (_local3 + _local5.toLocaleString()); | |
}; | |
++_local4; | |
if (_local4 == limit){ | |
break; | |
}; | |
_local3 = (_local3 + _local2); | |
}; | |
}; | |
return (_local3); | |
} | |
AS3 function forEach(eacher:Function, thisObj:Object=null):void{ | |
_forEach(this, eacher, ((thisObj is Object)) ? thisObj : null); | |
} | |
private function _concat(items:Array){ | |
var _local5:*; | |
var _local2:* = this.newThisType(); | |
_local2._spliceHelper(0, this.length, 0, this, 0); | |
var _local3:uint; | |
var _local4:* = items.length; | |
while (_local3 < _local4) { | |
_local5 = castToThisType(items[_local3]); | |
_local2._spliceHelper(this.length, _local5.length, 0, _local5, 0); | |
_local3++; | |
}; | |
return (_local2); | |
} | |
private native function set type(t:Object):void; | |
private function newThisType(length:uint=0):Vector$object{ | |
var _local2:Vector$object = new Vector.<this.type>(length); | |
return (_local2); | |
} | |
private native function get type():Object; | |
AS3 function some(checker, thisObj:Object=null):Boolean{ | |
return (_some(this, checker, ((thisObj is Object)) ? thisObj : null)); | |
} | |
AS3 function splice(start:Number, deleteCount:Number, ... _args):Vector$object{ | |
return (this._splice(start, deleteCount, _args)); | |
} | |
AS3 function filter(checker:Function, thisObj:Object=null):Vector$object{ | |
return (this._filter(checker, thisObj)); | |
} | |
private static function castToThisType(item):Vector$object{ | |
return (item); | |
} | |
private static native function _forEach(o, callback:Function, thisObject):void; | |
private static native function _every(o, callback:Function, thisObject):Boolean; | |
private static native function _some(o, callback:Function, thisObject):Boolean; | |
private static native function _sort(o, args:Array); | |
prototype.toString = function (){ | |
return (castToThisType(this).toString()); | |
}; | |
prototype.toLocaleString = function (){ | |
return (castToThisType(this).toLocaleString()); | |
}; | |
prototype.join = function (separator=undefined){ | |
return (castToThisType(this).join(((separator == undefined)) ? "," : String(separator))); | |
}; | |
prototype.concat = function (... _args){ | |
return (castToThisType(this)._concat(_args)); | |
}; | |
prototype.every = function (checker, thisObj=undefined):Boolean{ | |
return (_every(castToThisType(this), checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.filter = function (checker, thisObj=undefined){ | |
return (castToThisType(this)._filter(checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.forEach = function (eacher, thisObj=undefined){ | |
_forEach(castToThisType(this), eacher, ((thisObj is Object)) ? thisObj : null); | |
}; | |
prototype.indexOf = function (value, from=undefined){ | |
return (castToThisType(this).indexOf(value, Number(from))); | |
}; | |
prototype.lastIndexOf = function (value, from=undefined){ | |
return (castToThisType(this).lastIndexOf(value, ((from == undefined)) ? Infinity : Number(from))); | |
}; | |
prototype.map = function (mapper, thisObj=undefined){ | |
return (castToThisType(this)._map(mapper, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.pop = function (){ | |
return (castToThisType(this).pop()); | |
}; | |
prototype.push = function (... _args){ | |
return (castToThisType(this).push.apply(castToThisType(this), _args)); | |
}; | |
prototype.reverse = function (){ | |
return (castToThisType(this).reverse()); | |
}; | |
prototype.shift = function (){ | |
return (castToThisType(this).shift()); | |
}; | |
prototype.slice = function (start=undefined, end=undefined){ | |
return (castToThisType(this)._slice(((start == undefined)) ? 0 : Number(start), ((end == undefined)) ? 2147483647 : Number(end))); | |
}; | |
prototype.some = function (checker, thisObj=undefined):Boolean{ | |
return (_some(castToThisType(this), checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.sort = function (comparefn){ | |
var _local2:Array = [comparefn]; | |
return (_sort(castToThisType(this), _local2)); | |
}; | |
prototype.splice = function (start, deleteCount, ... _args){ | |
return (castToThisType(this)._splice(Number(start), Number(deleteCount), _args)); | |
}; | |
prototype.unshift = function (... _args){ | |
return (castToThisType(this).unshift.apply(this, _args)); | |
}; | |
_dontEnumPrototype(prototype); | |
} | |
dynamic final class Vector$double { | |
function Vector$double(length:uint=0, fixed:Boolean=false){ | |
super(); | |
this.length = length; | |
this.fixed = fixed; | |
} | |
AS3 function shift():Number{ | |
return (this._shift()); | |
} | |
private function _shift(){ | |
if (this.fixed){ | |
Error.throwError(RangeError, 1126); | |
}; | |
if (this.length == 0){ | |
return (undefined); | |
}; | |
var _local1:* = this[0]; | |
this._spliceHelper(0, 0, 1, null, 0); | |
return (_local1); | |
} | |
AS3 function reverse():Vector$double{ | |
this._reverse(); | |
return (this); | |
} | |
AS3 native function unshift(... _args):uint; | |
public native function set length(value:uint); | |
AS3 function indexOf(value:Number, from:Number=0):Number{ | |
var _local3:uint = this.clamp(from, this.length); | |
var _local4:uint = _local3; | |
var _local5:uint = this.length; | |
while (_local4 < _local5) { | |
if (this[_local4] === value){ | |
return (_local4); | |
}; | |
_local4++; | |
}; | |
return (-1); | |
} | |
AS3 native function pop():Number; | |
AS3 function slice(start:Number=0, end:Number=2147483647):Vector$double{ | |
return (this._slice(start, end)); | |
} | |
private function _slice(start:Number=0, end:Number=2147483647){ | |
var _local3:uint = this.clamp(start, this.length); | |
var _local4:uint = this.clamp(end, this.length); | |
var _local5:* = newThisType(); | |
_local5._spliceHelper(0, (_local4 - _local3), 0, this, _local3); | |
return (_local5); | |
} | |
AS3 function concat(... _args):Vector$double{ | |
return (this._concat(_args)); | |
} | |
AS3 function some(checker, thisObj:Object=null):Boolean{ | |
return (_some(this, checker, ((thisObj is Object)) ? thisObj : null)); | |
} | |
private native function _filter(callback:Function, thisObject); | |
AS3 native function push(... _args):uint; | |
AS3 function every(checker:Function, thisObj:Object=null):Boolean{ | |
return (_every(this, checker, ((thisObj is Object)) ? thisObj : null)); | |
} | |
AS3 function map(mapper:Function, thisObj:Object=null){ | |
this._map(mapper, ((thisObj is Object)) ? thisObj : null); | |
} | |
private native function _map(callback:Function, thisObject); | |
AS3 function sort(comparefn):Vector$double{ | |
var _local2:Array = [comparefn]; | |
_sort(this, _local2); | |
return (this); | |
} | |
private function _splice(start, deleteCount, items:Array){ | |
var _local4:uint = this.clamp(start, this.length); | |
var _local5:uint = this.clamp(deleteCount, (this.length - _local4)); | |
var _local6:* = newThisType(); | |
_local6._spliceHelper(0, _local5, 0, this, _local4); | |
this._spliceHelper(_local4, items.length, _local5, items, 0); | |
return (_local6); | |
} | |
private native function _reverse():void; | |
public native function get length():uint; | |
public native function set fixed(f:Boolean); | |
private native function _spliceHelper(insertpoint:uint, insertcount:uint, deleteCount:uint, args:Object, offset:int):void; | |
AS3 function forEach(eacher:Function, thisObj:Object=null):void{ | |
_forEach(this, eacher, ((thisObj is Object)) ? thisObj : null); | |
} | |
AS3 function lastIndexOf(value:Number, from:Number=2147483647):Number{ | |
var _local3:uint = this.clamp(from, this.length); | |
if (_local3 == this.length){ | |
_local3--; | |
}; | |
var _local4:int = _local3; | |
while (_local4 >= 0) { | |
if (this[_local4] === value){ | |
return (_local4); | |
}; | |
_local4--; | |
}; | |
return (-1); | |
} | |
AS3 function toString():String{ | |
return (this.join()); | |
} | |
AS3 function toLocaleString():String{ | |
var _local5:*; | |
var limit:uint = this.length; | |
var _local2:String = ","; | |
var _local3:String = ""; | |
var _local4:uint; | |
if (limit > 0){ | |
while (true) { | |
_local5 = this[_local4]; | |
if (((!((_local5 === undefined))) && (!((_local5 === null))))){ | |
_local3 = (_local3 + _local5.toLocaleString()); | |
}; | |
++_local4; | |
if (_local4 == limit){ | |
break; | |
}; | |
_local3 = (_local3 + _local2); | |
}; | |
}; | |
return (_local3); | |
} | |
AS3 function join(separator:String=","):String{ | |
var _local5:uint; | |
var _local2:uint = this.length; | |
var _local3:String = ""; | |
var _local4:int; | |
if (_local2 > 0){ | |
while (true) { | |
_local5 = _local4; | |
_local3 = (_local3 + this[_local5]); | |
++_local4; | |
_local5 = _local4; | |
if (_local5 == _local2){ | |
break; | |
}; | |
_local3 = (_local3 + separator); | |
}; | |
}; | |
return (_local3); | |
} | |
private function _concat(items:Array){ | |
var _local5:*; | |
var _local2:* = newThisType(); | |
_local2._spliceHelper(0, this.length, 0, this, 0); | |
var _local3:uint; | |
var _local4:* = items.length; | |
while (_local3 < _local4) { | |
_local5 = castToThisType(items[_local3]); | |
_local2._spliceHelper(this.length, _local5.length, 0, _local5, 0); | |
_local3++; | |
}; | |
return (_local2); | |
} | |
public native function get fixed():Boolean; | |
AS3 function filter(checker:Function, thisObj:Object=null):Vector$double{ | |
return (this._filter(checker, thisObj)); | |
} | |
private function clamp(val:Number, len:uint):uint{ | |
var _local3:uint; | |
if (val < 0){ | |
if ((val + len) < 0){ | |
_local3 = 0; | |
} else { | |
_local3 = uint((val + len)); | |
}; | |
} else { | |
if (val > len){ | |
_local3 = this.length; | |
} else { | |
if (val != val){ | |
_local3 = 0; | |
} else { | |
_local3 = uint(val); | |
}; | |
}; | |
}; | |
return (_local3); | |
} | |
AS3 function splice(start:Number, deleteCount:Number, ... _args):Vector$double{ | |
return (this._splice(start, deleteCount, _args)); | |
} | |
private static function castToThisType(item):Vector$double{ | |
return (item); | |
} | |
private static native function _some(o, callback:Function, thisObject):Boolean; | |
private static function newThisType(length:uint=0):Vector$double{ | |
return (new Vector$double(length)); | |
} | |
private static native function _forEach(o, callback:Function, thisObject):void; | |
private static native function _every(o, callback:Function, thisObject):Boolean; | |
private static native function _sort(o, args:Array); | |
prototype.toString = function (){ | |
return (castToThisType(this).toString()); | |
}; | |
prototype.toLocaleString = function (){ | |
return (castToThisType(this).toLocaleString()); | |
}; | |
prototype.join = function (separator=undefined){ | |
return (castToThisType(this).join(((separator == undefined)) ? "," : String(separator))); | |
}; | |
prototype.concat = function (... _args){ | |
return (castToThisType(this)._concat(_args)); | |
}; | |
prototype.every = function (checker, thisObj=undefined):Boolean{ | |
return (_every(castToThisType(this), checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.filter = function (checker, thisObj=undefined){ | |
return (castToThisType(this)._filter(checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.forEach = function (eacher, thisObj=undefined){ | |
_forEach(castToThisType(this), eacher, ((thisObj is Object)) ? thisObj : null); | |
}; | |
prototype.indexOf = function (value, from=undefined){ | |
return (castToThisType(this).indexOf(value, Number(from))); | |
}; | |
prototype.lastIndexOf = function (value, from=undefined){ | |
return (castToThisType(this).lastIndexOf(value, ((from == undefined)) ? Infinity : Number(from))); | |
}; | |
prototype.map = function (mapper, thisObj=undefined){ | |
return (castToThisType(this)._map(mapper, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.pop = function (){ | |
return (castToThisType(this).pop()); | |
}; | |
prototype.push = function (... _args){ | |
return (castToThisType(this).push.apply(castToThisType(this), _args)); | |
}; | |
prototype.reverse = function (){ | |
return (castToThisType(this).reverse()); | |
}; | |
prototype.shift = function (){ | |
return (castToThisType(this).shift()); | |
}; | |
prototype.slice = function (start=undefined, end=undefined){ | |
return (castToThisType(this)._slice(((start == undefined)) ? 0 : Number(start), ((end == undefined)) ? 2147483647 : Number(end))); | |
}; | |
prototype.some = function (checker, thisObj=undefined):Boolean{ | |
return (_some(castToThisType(this), checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.sort = function (comparefn){ | |
var _local2:Array = [comparefn]; | |
return (_sort(castToThisType(this), _local2)); | |
}; | |
prototype.splice = function (start, deleteCount, ... _args){ | |
return (castToThisType(this)._splice(Number(start), Number(deleteCount), _args)); | |
}; | |
prototype.unshift = function (... _args){ | |
return (castToThisType(this).unshift.apply(this, _args)); | |
}; | |
_dontEnumPrototype(prototype); | |
} | |
dynamic final class Vector$int { | |
function Vector$int(length:uint=0, fixed:Boolean=false){ | |
super(); | |
this.length = length; | |
this.fixed = fixed; | |
} | |
AS3 function shift():int{ | |
return (this._shift()); | |
} | |
private function _shift(){ | |
if (this.fixed){ | |
Error.throwError(RangeError, 1126); | |
}; | |
if (this.length == 0){ | |
return (undefined); | |
}; | |
var _local1:* = this[0]; | |
this._spliceHelper(0, 0, 1, null, 0); | |
return (_local1); | |
} | |
AS3 function reverse():Vector$int{ | |
this._reverse(); | |
return (this); | |
} | |
AS3 native function unshift(... _args):uint; | |
public native function set length(value:uint); | |
AS3 function indexOf(value:int, from:Number=0):Number{ | |
var _local3:uint = this.clamp(from, this.length); | |
var _local4:uint = _local3; | |
var _local5:uint = this.length; | |
while (_local4 < _local5) { | |
if (this[_local4] === value){ | |
return (_local4); | |
}; | |
_local4++; | |
}; | |
return (-1); | |
} | |
AS3 native function pop():int; | |
AS3 function slice(start:Number=0, end:Number=2147483647):Vector$int{ | |
return (this._slice(start, end)); | |
} | |
private function _slice(start:Number=0, end:Number=2147483647){ | |
var _local3:uint = this.clamp(start, this.length); | |
var _local4:uint = this.clamp(end, this.length); | |
var _local5:* = newThisType(); | |
_local5._spliceHelper(0, (_local4 - _local3), 0, this, _local3); | |
return (_local5); | |
} | |
AS3 function concat(... _args):Vector$int{ | |
return (this._concat(_args)); | |
} | |
AS3 function some(checker, thisObj:Object=null):Boolean{ | |
return (_some(this, checker, ((thisObj is Object)) ? thisObj : null)); | |
} | |
private native function _filter(callback:Function, thisObject); | |
AS3 native function push(... _args):uint; | |
AS3 function every(checker:Function, thisObj:Object=null):Boolean{ | |
return (_every(this, checker, ((thisObj is Object)) ? thisObj : null)); | |
} | |
AS3 function map(mapper:Function, thisObj:Object=null){ | |
this._map(mapper, ((thisObj is Object)) ? thisObj : null); | |
} | |
private native function _map(callback:Function, thisObject); | |
AS3 function sort(comparefn):Vector$int{ | |
var _local2:Array = [comparefn]; | |
_sort(this, _local2); | |
return (this); | |
} | |
private function _splice(start, deleteCount, items:Array){ | |
var _local4:uint = this.clamp(start, this.length); | |
var _local5:uint = this.clamp(deleteCount, (this.length - _local4)); | |
var _local6:* = newThisType(); | |
_local6._spliceHelper(0, _local5, 0, this, _local4); | |
this._spliceHelper(_local4, items.length, _local5, items, 0); | |
return (_local6); | |
} | |
private native function _reverse():void; | |
public native function get length():uint; | |
public native function set fixed(f:Boolean); | |
private native function _spliceHelper(insertpoint:uint, insertcount:uint, deleteCount:uint, args:Object, offset:int):void; | |
AS3 function forEach(eacher:Function, thisObj:Object=null):void{ | |
_forEach(this, eacher, ((thisObj is Object)) ? thisObj : null); | |
} | |
AS3 function lastIndexOf(value:int, from:Number=2147483647):Number{ | |
var _local3:uint = this.clamp(from, this.length); | |
if (_local3 == this.length){ | |
_local3--; | |
}; | |
var _local4:int = _local3; | |
while (_local4 >= 0) { | |
if (this[_local4] === value){ | |
return (_local4); | |
}; | |
_local4--; | |
}; | |
return (-1); | |
} | |
AS3 function toString():String{ | |
return (this.join()); | |
} | |
AS3 function toLocaleString():String{ | |
var _local5:*; | |
var limit:uint = this.length; | |
var _local2:String = ","; | |
var _local3:String = ""; | |
var _local4:uint; | |
if (limit > 0){ | |
while (true) { | |
_local5 = this[_local4]; | |
if (((!((_local5 === undefined))) && (!((_local5 === null))))){ | |
_local3 = (_local3 + _local5.toLocaleString()); | |
}; | |
++_local4; | |
if (_local4 == limit){ | |
break; | |
}; | |
_local3 = (_local3 + _local2); | |
}; | |
}; | |
return (_local3); | |
} | |
AS3 function join(separator:String=","):String{ | |
var _local5:uint; | |
var _local2:uint = this.length; | |
var _local3:String = ""; | |
var _local4:int; | |
if (_local2 > 0){ | |
while (true) { | |
_local5 = _local4; | |
_local3 = (_local3 + this[_local5]); | |
++_local4; | |
_local5 = _local4; | |
if (_local5 == _local2){ | |
break; | |
}; | |
_local3 = (_local3 + separator); | |
}; | |
}; | |
return (_local3); | |
} | |
private function _concat(items:Array){ | |
var _local5:*; | |
var _local2:* = newThisType(); | |
_local2._spliceHelper(0, this.length, 0, this, 0); | |
var _local3:uint; | |
var _local4:* = items.length; | |
while (_local3 < _local4) { | |
_local5 = castToThisType(items[_local3]); | |
_local2._spliceHelper(this.length, _local5.length, 0, _local5, 0); | |
_local3++; | |
}; | |
return (_local2); | |
} | |
public native function get fixed():Boolean; | |
AS3 function filter(checker:Function, thisObj:Object=null):Vector$int{ | |
return (this._filter(checker, thisObj)); | |
} | |
private function clamp(val:Number, len:uint):uint{ | |
var _local3:uint; | |
if (val < 0){ | |
if ((val + len) < 0){ | |
_local3 = 0; | |
} else { | |
_local3 = uint((val + len)); | |
}; | |
} else { | |
if (val > len){ | |
_local3 = this.length; | |
} else { | |
if (val != val){ | |
_local3 = 0; | |
} else { | |
_local3 = uint(val); | |
}; | |
}; | |
}; | |
return (_local3); | |
} | |
AS3 function splice(start:Number, deleteCount:Number, ... _args):Vector$int{ | |
return (this._splice(start, deleteCount, _args)); | |
} | |
private static function castToThisType(item):Vector$int{ | |
return (item); | |
} | |
private static native function _some(o, callback:Function, thisObject):Boolean; | |
private static function newThisType(length:uint=0):Vector$int{ | |
return (new Vector$int(length)); | |
} | |
private static native function _forEach(o, callback:Function, thisObject):void; | |
private static native function _every(o, callback:Function, thisObject):Boolean; | |
private static native function _sort(o, args:Array); | |
prototype.toString = function (){ | |
return (castToThisType(this).toString()); | |
}; | |
prototype.toLocaleString = function (){ | |
return (castToThisType(this).toLocaleString()); | |
}; | |
prototype.join = function (separator=undefined){ | |
return (castToThisType(this).join(((separator == undefined)) ? "," : String(separator))); | |
}; | |
prototype.concat = function (... _args){ | |
return (castToThisType(this)._concat(_args)); | |
}; | |
prototype.every = function (checker, thisObj=undefined):Boolean{ | |
return (_every(castToThisType(this), checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.filter = function (checker, thisObj=undefined){ | |
return (castToThisType(this)._filter(checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.forEach = function (eacher, thisObj=undefined){ | |
_forEach(castToThisType(this), eacher, ((thisObj is Object)) ? thisObj : null); | |
}; | |
prototype.indexOf = function (value, from=undefined){ | |
return (castToThisType(this).indexOf(value, Number(from))); | |
}; | |
prototype.lastIndexOf = function (value, from=undefined){ | |
return (castToThisType(this).lastIndexOf(value, ((from == undefined)) ? Infinity : Number(from))); | |
}; | |
prototype.map = function (mapper, thisObj=undefined){ | |
return (castToThisType(this)._map(mapper, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.pop = function (){ | |
return (castToThisType(this).pop()); | |
}; | |
prototype.push = function (... _args){ | |
return (castToThisType(this).push.apply(castToThisType(this), _args)); | |
}; | |
prototype.reverse = function (){ | |
return (castToThisType(this).reverse()); | |
}; | |
prototype.shift = function (){ | |
return (castToThisType(this).shift()); | |
}; | |
prototype.slice = function (start=undefined, end=undefined){ | |
return (castToThisType(this)._slice(((start == undefined)) ? 0 : Number(start), ((end == undefined)) ? 2147483647 : Number(end))); | |
}; | |
prototype.some = function (checker, thisObj=undefined):Boolean{ | |
return (_some(castToThisType(this), checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.sort = function (comparefn){ | |
var _local2:Array = [comparefn]; | |
return (_sort(castToThisType(this), _local2)); | |
}; | |
prototype.splice = function (start, deleteCount, ... _args){ | |
return (castToThisType(this)._splice(Number(start), Number(deleteCount), _args)); | |
}; | |
prototype.unshift = function (... _args){ | |
return (castToThisType(this).unshift.apply(this, _args)); | |
}; | |
_dontEnumPrototype(prototype); | |
} | |
dynamic final class Vector$uint { | |
function Vector$uint(length:uint=0, fixed:Boolean=false){ | |
super(); | |
this.length = length; | |
this.fixed = fixed; | |
} | |
AS3 function shift():uint{ | |
return (this._shift()); | |
} | |
private function _shift(){ | |
if (this.fixed){ | |
Error.throwError(RangeError, 1126); | |
}; | |
if (this.length == 0){ | |
return (undefined); | |
}; | |
var _local1:* = this[0]; | |
this._spliceHelper(0, 0, 1, null, 0); | |
return (_local1); | |
} | |
AS3 function reverse():Vector$uint{ | |
this._reverse(); | |
return (this); | |
} | |
AS3 native function unshift(... _args):uint; | |
public native function set length(value:uint); | |
AS3 function indexOf(value:uint, from:Number=0):Number{ | |
var _local3:uint = this.clamp(from, this.length); | |
var _local4:uint = _local3; | |
var _local5:uint = this.length; | |
while (_local4 < _local5) { | |
if (this[_local4] === value){ | |
return (_local4); | |
}; | |
_local4++; | |
}; | |
return (-1); | |
} | |
AS3 native function pop():uint; | |
AS3 function slice(start:Number=0, end:Number=2147483647):Vector$uint{ | |
return (this._slice(start, end)); | |
} | |
private function _slice(start:Number=0, end:Number=2147483647){ | |
var _local3:uint = this.clamp(start, this.length); | |
var _local4:uint = this.clamp(end, this.length); | |
var _local5:* = newThisType(); | |
_local5._spliceHelper(0, (_local4 - _local3), 0, this, _local3); | |
return (_local5); | |
} | |
AS3 function concat(... _args):Vector$uint{ | |
return (this._concat(_args)); | |
} | |
AS3 function some(checker, thisObj:Object=null):Boolean{ | |
return (_some(this, checker, ((thisObj is Object)) ? thisObj : null)); | |
} | |
private native function _filter(callback:Function, thisObject); | |
AS3 native function push(... _args):uint; | |
AS3 function every(checker:Function, thisObj:Object=null):Boolean{ | |
return (_every(this, checker, ((thisObj is Object)) ? thisObj : null)); | |
} | |
AS3 function map(mapper:Function, thisObj:Object=null){ | |
this._map(mapper, ((thisObj is Object)) ? thisObj : null); | |
} | |
private native function _map(callback:Function, thisObject); | |
AS3 function sort(comparefn):Vector$uint{ | |
var _local2:Array = [comparefn]; | |
_sort(this, _local2); | |
return (this); | |
} | |
private function _splice(start, deleteCount, items:Array){ | |
var _local4:uint = this.clamp(start, this.length); | |
var _local5:uint = this.clamp(deleteCount, (this.length - _local4)); | |
var _local6:* = newThisType(); | |
_local6._spliceHelper(0, _local5, 0, this, _local4); | |
this._spliceHelper(_local4, items.length, _local5, items, 0); | |
return (_local6); | |
} | |
private native function _reverse():void; | |
public native function get length():uint; | |
public native function set fixed(f:Boolean); | |
private native function _spliceHelper(insertpoint:uint, insertcount:uint, deleteCount:uint, args:Object, offset:int):void; | |
AS3 function forEach(eacher:Function, thisObj:Object=null):void{ | |
_forEach(this, eacher, ((thisObj is Object)) ? thisObj : null); | |
} | |
AS3 function lastIndexOf(value:uint, from:Number=2147483647):Number{ | |
var _local3:uint = this.clamp(from, this.length); | |
if (_local3 == this.length){ | |
_local3--; | |
}; | |
var _local4:int = _local3; | |
while (_local4 >= 0) { | |
if (this[_local4] === value){ | |
return (_local4); | |
}; | |
_local4--; | |
}; | |
return (-1); | |
} | |
AS3 function toString():String{ | |
return (this.join()); | |
} | |
AS3 function toLocaleString():String{ | |
var _local5:*; | |
var limit:uint = this.length; | |
var _local2:String = ","; | |
var _local3:String = ""; | |
var _local4:uint; | |
if (limit > 0){ | |
while (true) { | |
_local5 = this[_local4]; | |
if (((!((_local5 === undefined))) && (!((_local5 === null))))){ | |
_local3 = (_local3 + _local5.toLocaleString()); | |
}; | |
++_local4; | |
if (_local4 == limit){ | |
break; | |
}; | |
_local3 = (_local3 + _local2); | |
}; | |
}; | |
return (_local3); | |
} | |
AS3 function join(separator:String=","):String{ | |
var _local5:uint; | |
var _local2:uint = this.length; | |
var _local3:String = ""; | |
var _local4:int; | |
if (_local2 > 0){ | |
while (true) { | |
_local5 = _local4; | |
_local3 = (_local3 + this[_local5]); | |
++_local4; | |
_local5 = _local4; | |
if (_local5 == _local2){ | |
break; | |
}; | |
_local3 = (_local3 + separator); | |
}; | |
}; | |
return (_local3); | |
} | |
private function _concat(items:Array){ | |
var _local5:*; | |
var _local2:* = newThisType(); | |
_local2._spliceHelper(0, this.length, 0, this, 0); | |
var _local3:uint; | |
var _local4:* = items.length; | |
while (_local3 < _local4) { | |
_local5 = castToThisType(items[_local3]); | |
_local2._spliceHelper(this.length, _local5.length, 0, _local5, 0); | |
_local3++; | |
}; | |
return (_local2); | |
} | |
public native function get fixed():Boolean; | |
AS3 function filter(checker:Function, thisObj:Object=null):Vector$uint{ | |
return (this._filter(checker, thisObj)); | |
} | |
private function clamp(val:Number, len:uint):uint{ | |
var _local3:uint; | |
if (val < 0){ | |
if ((val + len) < 0){ | |
_local3 = 0; | |
} else { | |
_local3 = uint((val + len)); | |
}; | |
} else { | |
if (val > len){ | |
_local3 = this.length; | |
} else { | |
if (val != val){ | |
_local3 = 0; | |
} else { | |
_local3 = uint(val); | |
}; | |
}; | |
}; | |
return (_local3); | |
} | |
AS3 function splice(start:Number, deleteCount:Number, ... _args):Vector$uint{ | |
return (this._splice(start, deleteCount, _args)); | |
} | |
private static function castToThisType(item):Vector$uint{ | |
return (item); | |
} | |
private static native function _some(o, callback:Function, thisObject):Boolean; | |
private static function newThisType(length:uint=0):Vector$uint{ | |
return (new Vector$uint(length)); | |
} | |
private static native function _forEach(o, callback:Function, thisObject):void; | |
private static native function _every(o, callback:Function, thisObject):Boolean; | |
private static native function _sort(o, args:Array); | |
prototype.toString = function (){ | |
return (castToThisType(this).toString()); | |
}; | |
prototype.toLocaleString = function (){ | |
return (castToThisType(this).toLocaleString()); | |
}; | |
prototype.join = function (separator=undefined){ | |
return (castToThisType(this).join(((separator == undefined)) ? "," : String(separator))); | |
}; | |
prototype.concat = function (... _args){ | |
return (castToThisType(this)._concat(_args)); | |
}; | |
prototype.every = function (checker, thisObj=undefined):Boolean{ | |
return (_every(castToThisType(this), checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.filter = function (checker, thisObj=undefined){ | |
return (castToThisType(this)._filter(checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.forEach = function (eacher, thisObj=undefined){ | |
_forEach(castToThisType(this), eacher, ((thisObj is Object)) ? thisObj : null); | |
}; | |
prototype.indexOf = function (value, from=undefined){ | |
return (castToThisType(this).indexOf(value, Number(from))); | |
}; | |
prototype.lastIndexOf = function (value, from=undefined){ | |
return (castToThisType(this).lastIndexOf(value, ((from == undefined)) ? Infinity : Number(from))); | |
}; | |
prototype.map = function (mapper, thisObj=undefined){ | |
return (castToThisType(this)._map(mapper, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.pop = function (){ | |
return (castToThisType(this).pop()); | |
}; | |
prototype.push = function (... _args){ | |
return (castToThisType(this).push.apply(castToThisType(this), _args)); | |
}; | |
prototype.reverse = function (){ | |
return (castToThisType(this).reverse()); | |
}; | |
prototype.shift = function (){ | |
return (castToThisType(this).shift()); | |
}; | |
prototype.slice = function (start=undefined, end=undefined){ | |
return (castToThisType(this)._slice(((start == undefined)) ? 0 : Number(start), ((end == undefined)) ? 2147483647 : Number(end))); | |
}; | |
prototype.some = function (checker, thisObj=undefined):Boolean{ | |
return (_some(castToThisType(this), checker, ((thisObj is Object)) ? thisObj : null)); | |
}; | |
prototype.sort = function (comparefn){ | |
var _local2:Array = [comparefn]; | |
return (_sort(castToThisType(this), _local2)); | |
}; | |
prototype.splice = function (start, deleteCount, ... _args){ | |
return (castToThisType(this)._splice(Number(start), Number(deleteCount), _args)); | |
}; | |
prototype.unshift = function (... _args){ | |
return (castToThisType(this).unshift.apply(this, _args)); | |
}; | |
_dontEnumPrototype(prototype); | |
} | |
}//package |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment