/** Classing{js} v1.1.0 | (c) 2014 Mostafa Samir | MIT License **/ var classing={};var _global=typeof window!="undefined"&&this===window?window:global;classing._instantiateOnce=function(){var e=false;return function(){var t=1010;if(e){throw classing.xError("000","not allowed")}else{e=true;Object.defineProperty(this,"timestamp",{get:function(){return t},set:function n(e){var r=n.caller;if(r===classing.Class||r===classing.Interface||r===classing.xStamp){t=e}}})}}}();Object.defineProperty(classing,"xTyped",{value:true,writable:false});Object.defineProperty(classing,"xNonTyped",{value:false,writable:false});Object.defineProperty(classing,"xSelf",{value:new classing._instantiateOnce,writable:false});Object.defineProperty(classing,"base",{value:null,writable:true});Object.defineProperty(_global,"xTyped",{get:function(){return classing.xTyped},set:function(e){}});Object.defineProperty(_global,"xNonTyped",{get:function(){return classing.xNonTyped},set:function(e){}});Object.defineProperty(_global,"xSelf",{get:function(){return classing.xSelf},set:function(e){}});Object.defineProperty(_global,"base",{get:function(){return classing.base},set:function(e){}});classing.xError=function(e,t){var n=new Error;n.name="xError";n.code=parseInt(e);n.message="[code="+n.code+"]:"+t;return n};Object.defineProperty(Object.prototype,"instanceOf",{value:function(e){var t=false;if(typeof e!=="object"){t=this instanceof e}if(!t){if(e.timestamp){var n=this.constructor;while(n!=="_root_"){if(n._metadata._implements[""+e.timestamp]){t=true;break}else if(n._metadata._extends===e){t=true;break}else{n=n._metadata._extends}}}}return t},enumerable:false});classing.xStamp=function(e){if(typeof e==="function"){e.timestamp=classing.xSelf.timestamp;classing.xSelf.timestamp++}};classing._xTypes=function(e,t){if(classing._xTypes.caller===classing.types){this.count=e;this.list=t}else{throw classing.xError("000","Not Allowed")}};classing.types=function(){var e=arguments.length;var t="";for(var n=0;ne){throw classing.xError("105","no overloaded instance of the function matches the argument list")}var a=n[i][o];if(!a){throw classing.xError("105","no overloaded instance of the function matches the argument list")}else{return a.apply(this,r)}};u._meta_=o;Object.defineProperty(u,"isEmpty",{get:function(){return e(true,p)},set:function(e){}})}}else{o.counts=new Array;if(s===0){throw classing.xError("101","inavlid array format")}else{for(var f=0;fe){throw classing.xError("105","no overloaded instance of the function matches the argument list");return}var s=t[r];if(!s){throw classing.xError("105","no overloaded instance of the function matches the argument list");return}else{return s.apply(this,n)}};u._meta_=o;Object.defineProperty(u,"isEmpty",{get:function(){return e(false,p)},set:function(e){}})}}return u}}}();classing.Interface=function(e){var t={};var n=classing.xSelf.timestamp;classing.xSelf.timestamp++;for(key in e){var r=e[key];if(typeof r!=="function"){throw classing.xError("401","Interfaces contain only methods")}else{if(r.isEmpty!==undefined){if(!r.isEmpty){throw classing.xError("402","an interface method cannot have any implementation")}else{r._meta_.isOverloaded=true;t[key]={accessLevel:"public",description:r._meta_}}}else{if(!classing.Abstract.isNotImplemented(r)){throw classing.xError("402","an interface method cannot have any implementation")}else{t[key]={accessLevel:"public",description:{isOverloaded:false,argsCount:r.length}}}}}}var i=new Object;Object.defineProperty(i,"components",{value:t,writable:false});Object.defineProperty(i,"isInterface",{value:true,writable:false});Object.defineProperty(i,"timestamp",{value:n,writable:false});return i};classing.xAreCompatiable=function(e,t,n){if(e.accessLevel===n){if(e.description.isOverloaded){if(t._meta_){if(e.description.isTyped===t._meta_.isTyped){if(e.description.isTyped){var r=e.description.types.length;var i=0;var s=t._meta_.types;var o=s.length;for(var u=0;u0&&!o.isAbstract){throw classing.xError("209","an abstract method must be contained in an abstract class")}c=undefined;d=undefined;var S=function(){var r=this;var i=[];var s=arguments.length;var u=0;while(u