// Class: openfl._Vector.ObjectVector

var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this

$global.Object.defineProperty(exports, "__esModule", {value: true});

var __map_reserved = {};

// Imports

var $hxClasses = require("./../../hxClasses_stub").default;
var $import = require("./../../import_stub").default;
function openfl__$Vector_IVector() {return require("./../../openfl/_Vector/IVector");}
function js_Boot() {return require("./../../js/Boot");}
function HxOverrides() {return require("./../../HxOverrides");}

// Constructor

var ObjectVector = function(length,fixed,array) {
	if(array == null) {
		array = [];
	}
	this.__array = array;
	if(length != null) {
		this.set_length(length);
	}
	this.fixed = fixed == true;
}

// Meta

ObjectVector.__name__ = ["openfl","_Vector","ObjectVector"];
ObjectVector.__interfaces__ = [(openfl__$Vector_IVector().default)];
ObjectVector.prototype = {
	concat: function(a) {
		if(a == null) {
			return new ObjectVector(null,null,this.__array.slice());
		} else {
			return new ObjectVector(null,null,this.__array.concat(((js_Boot().default).__cast(a , ObjectVector)).__array));
		}
	},
	copy: function() {
		return new ObjectVector(null,null,this.__array.slice());
	},
	get: function(index) {
		return this.__array[index];
	},
	indexOf: function(x,from) {
		if(from == null) {
			from = 0;
		}
		var _g1 = from;
		var _g = this.__array.length;
		while(_g1 < _g) {
			var i = _g1++;
			if(this.__array[i] == x) {
				return i;
			}
		}
		return -1;
	},
	insertAt: function(index,element) {
		if(!this.fixed || index < this.__array.length) {
			this.__array.splice(index,0,element);
		}
	},
	iterator: function() {
		return (HxOverrides().default).iter(this.__array);
	},
	join: function(sep) {
		if(sep == null) {
			sep = ",";
		}
		return this.__array.join(sep);
	},
	lastIndexOf: function(x,from) {
		if(from == null) {
			from = 0;
		}
		var i = this.__array.length - 1;
		while(i >= from) {
			if(this.__array[i] == x) {
				return i;
			}
			--i;
		}
		return -1;
	},
	pop: function() {
		if(!this.fixed) {
			return this.__array.pop();
		} else {
			return null;
		}
	},
	push: function(x) {
		if(!this.fixed) {
			return this.__array.push(x);
		} else {
			return this.__array.length;
		}
	},
	removeAt: function(index) {
		if(!this.fixed || index < this.__array.length) {
			return this.__array.splice(index,1)[0];
		}
		return null;
	},
	reverse: function() {
		this.__array.reverse();
		return this;
	},
	set: function(index,value) {
		if(!this.fixed || index < this.__array.length) {
			return this.__array[index] = value;
		} else {
			return value;
		}
	},
	shift: function() {
		if(!this.fixed) {
			return this.__array.shift();
		} else {
			return null;
		}
	},
	slice: function(startIndex,endIndex) {
		if(endIndex == null) {
			endIndex = 16777215;
		}
		if(startIndex == null) {
			startIndex = 0;
		}
		return new ObjectVector(null,null,this.__array.slice(startIndex,endIndex));
	},
	sort: function(f) {
		this.__array.sort(f);
	},
	splice: function(pos,len) {
		return new ObjectVector(null,null,this.__array.splice(pos,len));
	},
	toJSON: function() {
		return this.__array;
	},
	toString: function() {
		if(this.__array != null) {
			return this.__array.toString();
		} else {
			return null;
		}
	},
	unshift: function(x) {
		if(!this.fixed) {
			this.__array.unshift(x);
		}
	},
	get_length: function() {
		return this.__array.length;
	},
	set_length: function(value) {
		if(!this.fixed) {
			var currentLength = this.__array.length;
			if(value < 0) {
				value = 0;
			}
			if(value > currentLength) {
				var _g1 = currentLength;
				var _g = value;
				while(_g1 < _g) {
					var i = _g1++;
					this.__array.push(null);
				}
			} else {
				while(this.__array.length > value) this.__array.pop();
			}
		}
		return this.__array.length;
	}
};
ObjectVector.prototype.__class__ = $hxClasses["openfl._Vector.ObjectVector"] = ObjectVector;

// Init



// Statics




// Export

exports.default = ObjectVector;