joo.classLoader.prepare("package joo.util",[

"import joo.lang.JOObject",
"import joo.lang.Comparable",""],

"public class Arrays",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(JOObject);},

"public static function contains",function(array,element){
return array.indexOf(element)!=-1;
},

"public static function indexOfEquals",function(array,item,from){if(arguments.length<3){from=0;}
if(arguments.length<3)from=0;
var len=array.length;
var useEquals=typeof item.equals=="function"&&item.equals!==JOObject.prototype["equals"];
for(var i=(from<0)?Math.max(0,len+from):from||0;i<len;i++){
if(item===array[i]||useEquals&&item.equals(array[i]))
return i;
}
return-1;
},

"public static function containsEquals",function(array,element){
return indexOfEquals(array,element)!=-1;
},

"public static function binarySearch",function(array,element){
var left=-1;
var right=array.length;
while(right-left>1){
var mid=(left+right)>>>1;
var comparable=array[mid];
var comp=comparable.compareTo(element);
if(comp==0){
return mid;
}else if(comp<0){
left=mid;
}else{
right=mid;
}
}
return-right-1;
},

"public static function broadcast",function(array,methodName){var parameters=Array.prototype.slice.call(arguments,2);

var i=0;
switch(parameters.length){
case 0:
for(;i<array.length;++i){
array[i][methodName]();
}
break;
case 1:
for(;i<array.length;++i){
array[i][methodName](parameters[0]);
}
break;
case 2:
for(;i<array.length;++i){
array[i][methodName](parameters[0],parameters[1]);
}
break;
default:
for(;i<array.length;++i){
array[i][methodName].apply(array[i],parameters);
}
}
},

"public static function remove",function(array,s){
var i=array.indexOf(s);
if(i>=0){
array.splice(i,1);
return true;
}
return false;
},

];},["contains","indexOfEquals","containsEquals","binarySearch","broadcast","remove"]
);joo.classLoader.prepare("package joo.util",[""],
"public class RegExpUtil",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"public static function compile",function(regExpStr,options){if(arguments.length<2){options="";}
var r1=new RegExp(regExpStr,options);
if(typeof r1["compile"]!="function"){
return r1;
}else{
var r2=r1["compile"](regExpStr,options);

return typeof r2=="function"?r2:r1;
}
},

];},["compile"]
);joo.classLoader.prepare("package joo.util",[""],

"public class FunctionUtil",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"public static function invokeLater",function(fun,args){
window.setTimeout(function(){
fun.apply(null,args);
},0);
},

];},["invokeLater"]
);joo.classLoader.prepare("package joo.lang",[""],

"public class Enum",function($jooPublic,$jooPrivate){with(joo.lang)with($jooPublic)with($jooPrivate)return[

"private var",{name: undefined},
"private var",{ordinal: undefined},

"public function Enum",function(enums,name,ordinal){if(arguments.length<3){ordinal=-1;}this[$super]();
this[$name]=name;
if(arguments.length<3){

this[$ordinal]=enums.length;
enums.push(this);
}else{
enums[ordinal]=this;
this[$ordinal]=ordinal;
}
enums[name]=this;
},

"public function getOrdinal",function(){
return this[$ordinal];
},

"public function toString",function(){
return this[$name];
},

];},[]
);joo.classLoader.prepare("package joo.util",[""],

"internal class ArrayIterator",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"public function ArrayIterator",function(elements){
this[$super]();
this[$elements]=elements;
},
"public function hasNext",function(){
return this[$index]<this[$elements].length;
},
"public function next",function(){
return this[$elements][this[$index]++];
},
"private var",{elements: undefined},
"private var",{index:0},
];},[]
);joo.classLoader.prepare("package joo.util",[""],

"public interface Map",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

,

,
];},[]

);joo.classLoader.prepare("package joo.util",[

"import joo.lang.Comparable",""],

"public class Interval implements Comparable",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"public static function create",function(numberOrArrayOrInterval){
switch(numberOrArrayOrInterval){
case"number":return new Interval(numberOrArrayOrInterval,numberOrArrayOrInterval);
case"array":return new Interval(numberOrArrayOrInterval[0],numberOrArrayOrInterval[1]);
case"object":return numberOrArrayOrInterval;
}
throw"Cannot create Interval from '"+numberOrArrayOrInterval+"'.";
},

"public function Interval",function(a,b){this[$super]();
this.a=a;
this.b=b;
if(a>b){
throw"Interval: IllegalArguments "+this;
}
},

"public function contains",function(n){
return this.a<=n&&n<=this.b;
},

"public function includes",function(interval){
return this.a<=interval.a&&this.b>=interval.b;
},

"public function intersection",function(interval){
var a1=Math.max(this.a,interval.a);
var b1=Math.min(this.b,interval.b);
return a1<=b1?new Interval(a1,b1):null;
},





"public function compareTo",function(c){
return this.a>c?1:this.b<c?-1:0;
},

"public function toString",function(){
return["[",this.a,",",this.b,"]"].join("");
},

"public var",{a: undefined},
"public var",{b: undefined},
];},["create"]
);joo.classLoader.prepare("package joo.util",[

"import joo.lang.JOObject",""],

"public class GeneralHashSet extends JOObject",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"public function GeneralHashSet",function(element){
this[$super]();
this[$reset]();
if(element){
if(!this.addAll(element)){
this.add(element);
}
}
},
"public function getSize",function(){
return this[$size];
},
"public function iterator",function(){
return new GapArrayIterator(this[$elements]);
},
"private function bucketIndexOf",function(bucket,element){
var elements=this[$elements];
for(var i=0;i<this.length;++i){
if(JOObject.equal(elements[bucket[i]],element))
return i;
}
return-1;
},
"public function add",function(element){

var hashCode=JOObject.getHashCode(element);
var thisBuckets=this[$buckets];
var bucket=thisBuckets[hashCode];
if(!bucket){
bucket=thisBuckets[hashCode]=[];
}else if(this[$bucketIndexOf](bucket,element)!=-1){
return false;
}
var thisElements=this[$elements];
bucket.push(thisElements.length);
thisElements.push(element);
++this[$size];
return true;
},
"public function addAll",function(array){
var result=false;
if(array&&array.constructor===Array){
for(var i=0;i<array.length;++i){
if(this.add(array[i])){
result=true;
}
}
}
return result;
},
"public function remove",function(element){
var hashCode=JOObject.getHashCode(element);
var bucket=this[$buckets][hashCode];
if(bucket){
var index=this[$bucketIndexOf](bucket,element);
if(index!=-1){
var removeIndex=bucket.splice(index,1)[0];
this[$elements][removeIndex]=undefined;
--this[$size];
if(bucket.length==0){

delete this[$buckets][hashCode];
}


return true;
}
}
return false;
},
"private function reset",function(){
this[$buckets]={};
this[$elements]=[];
this[$size]=0;
},
"public function clear",function(){
this[$reset]();
},
"public function contains",function(element){
var bucket=this[$buckets][JOObject.getHashCode(element)];
return! !bucket&&this[$bucketIndexOf](bucket,element)!=-1;
},
"override public function toString",function(){
var definedElements;
if(this[$size]==this[$elements].length){
definedElements=this[$elements];
}else{
definedElements=[];
for(var i=this.iterator();i.hasNext();){
definedElements.push(i.next());
}
}
return"{"+definedElements.join(", ")+"}";
},
"private var",{buckets: undefined},
"private var",{elements: undefined},
"private var",{size: undefined},
];},[]
);joo.classLoader.prepare("package joo.util",[""],
"public class NumberUtil",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"private static const",{ZEROS:"0000000000"},

"public static function format",function(number,digits,fractalDigits,radix){if(arguments.length<4){if(arguments.length<3){fractalDigits=0;}radix=10;}
var result=(fractalDigits==0?Math.round(number):Math.floor(number)).toString(radix);
var zeros=digits-result.length;
if(zeros>0){
result=ZEROS.substring(0,zeros)+result;
}
if(fractalDigits>0){
result+="."+Math.round((number-Math.floor(number))*Math.pow(10,fractalDigits)).toString(radix);
}
return result;
},

"public static function sgn",function(number){
return number<0?-1:number>0?1:0;
},

];},["format","sgn"]
);joo.classLoader.prepare("package joo.lang",[

"import joo.lang.JOObject",""],

"public class JsonBuilder",function($jooPublic,$jooPrivate){with(joo.lang)with($jooPublic)with($jooPrivate)return[function(){joo.classLoader.init(JOObject);},

"internal function toJsonObject",function(obj){
if(typeof obj!="object"||obj==null)
return obj;
if(obj.constructor==Array){

var jsonArray=[];
for(var i=0;i<obj.length;++i){
jsonArray[i]=this.toJsonObject(obj[i]);
}
return jsonArray;
}
var json;
if(typeof obj.addPropertiesToJson=="function"){
var hashCode=obj.hashCode();
var ref=this[$visited][hashCode];
if(ref){
var idref=ref["$id"];
if(!idref){
idref=ref["$id"]=String(this[$idCnt]++);
}
return{"$idref":idref};
}
json=this[$visited][hashCode]={"$class":obj.constructor["$class"]["fullClassName"]};
obj.addPropertiesToJson(json,this);
return json;
}

json={};
(JOObject.prototype.addPropertiesToJson).call(obj,json,this);
return json;
},

"internal function fromJsonObject",function(json){
if(typeof json!="object"||json==null)
return json;
if(json.constructor==Array){

var array=[];
for(var i=0;i<json.length;++i){
array[i]=this.fromJsonObject(json[i]);
}
return array;
}
var refId=json["$idref"];
if(refId){
return this[$visited][refId];
}
var fullClassName=json["$class"];
if(!fullClassName){
var obj={};
JOObject.prototype.addPropertiesFromJson.call(obj,json,this);
return obj;
}
var clazz=window.eval(fullClassName);
var joobject=new clazz();
var id=json["$id"];
if(id){
this[$visited][id]=joobject;
}
joobject.addPropertiesFromJson(json,this);
return joobject;
},

"private const",{visited:function(){return({});}},
"private var",{idCnt:1},
];},[]
);joo.classLoader.prepare(






"package joo.util",[""],

"public class Base64",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"private static const",{keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},

"public static function encode",function(input){
var output=[];
input=utf8Encode(input);

for(var i=0;i<input.length;){
var chr1=input.charCodeAt(i++);
var chr2=input.charCodeAt(i++);
var chr3=input.charCodeAt(i++);

var enc1=chr1>>2;
var enc2=((chr1&3)<<4)|(chr2>>4);
var enc3=((chr2&15)<<2)|(chr3>>6);
var enc4=chr3&63;

if(isNaN(chr2)){
enc3=enc4=64;
}else if(isNaN(chr3)){
enc4=64;
}

output.push(keyStr.charAt(enc1),
keyStr.charAt(enc2),
keyStr.charAt(enc3),
keyStr.charAt(enc4));
}

return output.join("");
},

"public static function decode",function(input){
var output=[];
input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");

for(var i=0;i<input.length;){
var enc1=keyStr.indexOf(input.charAt(i++));
var enc2=keyStr.indexOf(input.charAt(i++));
var enc3=keyStr.indexOf(input.charAt(i++));
var enc4=keyStr.indexOf(input.charAt(i++));

var chr1=(enc1<<2)|(enc2>>4);
var chr2=((enc2&15)<<4)|(enc3>>2);
var chr3=((enc3&3)<<6)|enc4;

output.push(String.fromCharCode(chr1));

if(enc3!=64){
output.push(String.fromCharCode(chr2));
}
if(enc4!=64){
output.push(String.fromCharCode(chr3));
}
}
return utf8Decode(output.join(""));
},


"private static function utf8Encode",function(string){
string=string.replace(/\r\n/g,"\n");
var utftext=[];
for(var n=0;n<string.length;n++){
var c=string.charCodeAt(n);
if(c<128){
utftext.push(String.fromCharCode(c));
}else if(c<2048){
utftext.push(String.fromCharCode((c>>6)|192),
String.fromCharCode((c&63)|128));
}else{
utftext.push(String.fromCharCode((c>>12)|224),
String.fromCharCode(((c>>6)&63)|128),
String.fromCharCode((c&63)|128));
}
}
return utftext.join("");
},

"private static function utf8Decode",function(utftext){
var string=[];
for(var i=0;i<utftext.length;){
var c=utftext.charCodeAt(i++);
if(c>=128){
var c2=utftext.charCodeAt(i++);
if(c>191&&c<224){
c=((c&31)<<6)|(c2&63);
}else{
var c3=utftext.charCodeAt(i++);
c=((c&15)<<12)|((c2&63)<<6)|(c3&63);
}
}
string.push(String.fromCharCode(c));
}
return string.join("");
},

];},["encode","decode"]
);joo.classLoader.prepare(













"package joo.lang",[""],

"public interface Comparable",function($jooPublic,$jooPrivate){with(joo.lang)with($jooPublic)with($jooPrivate)return[




































,

];},[]

);joo.classLoader.prepare("package joo.util",[""],

"public class GapArrayIterator",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"public function GapArrayIterator",function(elements){
this[$super]();
this[$elements]=elements;
this[$findNext]();
},
"public function hasNext",function(){
return this[$index]<this[$elements].length;
},
"public function next",function(){
var next=this[$elements][this[$index]];
this[$findNext]();
return next;
},
"private function findNext",function(){
var thisElements=this[$elements];
for(var i=this[$index]+1;i<=thisElements.length;++i){
if(thisElements[i]!==undefined){
this[$index]=i;
return;
}
}
this[$index]=thisElements.length;
},
"private var",{elements: undefined},
"private var",{index:-1},
];},[]
);joo.classLoader.prepare("package joo.util",[""],

"public class TimedExecutor",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"public function TimedExecutor",function(handler,timeout){this[$super]();
this[$handler]=handler;
this[$timeout]=timeout;
},

"private function setTimeout",function(delay){
this[$timer]=window.setTimeout(this[$trigger],Math.max(this[$timeout]-delay,0));
},

"private bound function trigger",function(){
this[$triggerStartTime]=new Date().getTime();
var realTimeout=this[$triggerStartTime]-this[$lastTriggerStartTime];

var result=this[$handler](realTimeout,this);
this[$lastTriggerStartTime]=this[$triggerStartTime];
if(typeof result=="number"){
this[$timeout]=result;
}
if(result===false||result<0){
this[$timer]=undefined;
}else{
var duration=new Date().getTime()-this[$triggerStartTime];

this[$setTimeout](duration);
}
},

"public function getTriggerStartTime",function(){
return this[$triggerStartTime];
},

"public function getLastTriggerStartTime",function(){
return this[$lastTriggerStartTime];
},

"public function isRunning",function(){
return! !this[$timer];
},

"public function start",function(){
if(!this[$timer]){
this[$lastTriggerStartTime]=new Date().getTime();
this[$setTimeout](0);
return true;
}
return false;
},

"public function stop",function(){
if(this[$timer]){
window.clearTimeout(this[$timer]);
this[$timer]=undefined;
return true;
}
return false;
},

"public function restart",function(){
var result=this.stop();
this.start();
return result;
},

"private var",{handler: undefined},
"private var",{timeout:0},
"private var",{timer: undefined},
"private var",{triggerStartTime: undefined},
"private var",{lastTriggerStartTime: undefined},
];},[]
);joo.classLoader.prepare("package joo.util",[

"import joo.lang.JOObject",
"import joo.util.GapArrayIterator",""],

"public class HashSet extends JOObject",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"public function HashSet",function(element){
this[$super]();
this[$reset]();
if(element){
if(!this.addAll(element)){
this.add(element);
}
}
},
"public function getSize",function(){
return this[$size];
},
"public function isEmpty",function(){
return this[$size]==0;
},
"public function iterator",function(){
return new GapArrayIterator(this[$elements]);
},
"public function add",function(element){
if(typeof element=="undefined"){
throw"IllegalArgument: may not add undefined to HashSet.";
}
var hashCode=JOObject.getHashCode(element);
if(hashCode in this[$indexByHashCode]){
return false;
}
this[$indexByHashCode][hashCode]=this[$elements].length;
this[$elements].push(element);
++this[$size];
return true;
},
"public function addAll",function(array){
var result=false;
if(array&&array.constructor===Array){
for(var i=0;i<array.length;++i){
if(array[i]!==undefined){
if(this.add(array[i])){
result=true;
}
}
}
}
return result;
},
"public function pop",function(){
var thisElements=this[$elements];
for(var i=0;i<thisElements.length;++i){
if(thisElements[i]!==undefined){
var result=thisElements[i];
thisElements[i]=undefined;
--this[$size];
delete this[$indexByHashCode][JOObject.getHashCode(result)];
return result;
}
}
return undefined;
},
"public function remove",function(element){
var hashCode=JOObject.getHashCode(element);
var index=this[$indexByHashCode][hashCode];
if(typeof index=="undefined"){
return false;
}
this[$elements][index]=undefined;
--this[$size];
delete this[$indexByHashCode][hashCode];


return true;
},
"private function reset",function(){
this[$indexByHashCode]={};
this[$elements]=[];
this[$size]=0;
},
"public function clear",function(){
this[$reset]();
},
"public function contains",function(element){
return this[$indexByHashCode][JOObject.getHashCode(element)]!==undefined;
},
"private var",{indexByHashCode: undefined},
"private var",{elements: undefined},
"private var",{size: undefined},
"override public function toString",function(){
var definedElements;
if(this[$size]==this[$elements].length){
definedElements=this[$elements];
}else{
definedElements=[];
for(var i=this.iterator();i.hasNext();){
definedElements.push(i.next());
}
}
return"{"+definedElements.join(", ")+"}";
},
];},[]
);joo.classLoader.prepare("package joo.util",[

"import joo.lang.JOObject",""],

"public class PropertyAware extends JOObject",function($jooPublic,$jooPrivate){with(joo.util)with($jooPublic)with($jooPrivate)return[

"public static const",{SET:"set"},
"public static const",{GET:"get"},
"public static const",{IS:"is"},
"private static const",{PREFIX_REG_EXP:/^(get|is)[A-Z]/},

"public static function toMethodSuffix",function(prop){
return prop.charAt(0).toUpperCase()+prop.substring(1);
},
"public static function toPropertyName",function(getterName){
var match=getterName.match(PREFIX_REG_EXP);
if(match){
var prefixLength=match[1].length;
return getterName.charAt(prefixLength).toLowerCase()+getterName.substring(prefixLength+1);
}
return null;
},

"public function PropertyAware",function(props){
this[$super]();
if(props){
this.updateProperties(props);
}
},

"public function updateProperties",function(props){
setProperties(this,props);
},

"public static function setProperties",function(bean,props){
for(var prop in props){
setProperty(bean,prop,props[prop]);
}
},
"public static function toSetterName",function(prop){
return SET+toMethodSuffix(prop);
},

"public static function setProperty",function(bean,prop,value){
var propSetterName=toSetterName(prop);
if(typeof bean[propSetterName]=="function"){

bean[propSetterName](value);
}else if(prop in bean||!JOObject.isJOObject(bean)){

bean[prop]=value;
}else{

throw new Error("Unknown property "+bean+"."+prop+" set to '"+value+"'.");
}
},
"public static function getProperty",function(bean,prop){
var methodSuffix=toMethodSuffix(prop);
var propGetterName=GET+methodSuffix;
if(typeof bean[propGetterName]=="function"){

return bean[propGetterName]();
}
var boolPropGetterName=IS+methodSuffix;
if(typeof bean[boolPropGetterName]=="function"){

return bean[boolPropGetterName]();
}
return bean[prop];
},
];},["toMethodSuffix","toPropertyName","setProperties","toSetterName","setProperty","getProperty"]
);joo.classLoader.prepare("package joo.lang",[

"import joo.lang.JsonBuilder",""],

"public dynamic class JOObject",function($jooPublic,$jooPrivate){with(joo.lang)with($jooPublic)with($jooPrivate)return[

"private static var",{idCnt:0},function()

{

Array.prototype["hashCode"]=JOObject.prototype["hashCode"];
Array.prototype["equals"]=JOObject.prototype["0arrayEquals"];
},

"public static function getHashCode",function(obj){
return obj&&typeof obj.hashCode=="function"?obj.hashCode():"_"+obj;
















},

"public static function equal",function(o1,o2){
return o1===o2||o1&&typeof o1.equals=="function"&&o1.equals(o2);
},

"private function arrayEquals",function(a){
if(this.length==a.length){
for(var i=0;i<this.length;++i){
if(!equal(this[i],a[i])){
return false;
}
}
return true;
}
return false;
},

"public static function typeOf",function(obj){
var type=typeof obj;
if((type=='object'&&obj!==null)||type=='function'){
switch(obj.constructor){
case Array:return'array';
case RegExp:return'regexp';
}
if(typeof obj.length=='number'&&obj.callee){
return'arguments';
}
}
return type;
},

"public static function toJsonString",function(json){
switch(typeof json){
case"string":
return'"'+json.replace(/(["\\])/g,"\\$1")+'"';
case"object":
if(json===null){
return"null";
}
if(json.constructor==Array){
return'['+json.map(toJsonString).join(',')+']';
}
var string=[];
for(var property in json){
string.push(toJsonString(property)+':'+toJsonString(json[property]));
}
return'{'+string.join(',')+'}';
case"undefined":
return"undefined";
case"number":
if(!isFinite(json))
return"null";
}
return String(json);
},

"private static const",{JSON_REG_EXP:/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/},













"public static function fromJsonString",function(str,secure){if(arguments.length<2){secure=false;}
return((typeof str!="string")||(secure&&!JSON_REG_EXP.test(str)))?null:window.eval('('+str+')');
},

"public static function toJsonObject",function(obj){
return new JsonBuilder().toJsonObject(obj);
},

"public static function fromJsonObject",function(json){
return new JsonBuilder().fromJsonObject(json);
},

"public function hashCode",function(){
return this["0id"]||(this["0id"]="_"+(idCnt++));
},

"public function equals",function(joobject){
return this===joobject;
},

"public function toJson",function(){
return new JsonBuilder().toJsonObject(this);
},

"protected function addPropertiesToJson",function(result,jsonBuilder){
var noPredicate=typeof this.isJsonProperty!="function";
for(var property in this){
if(property!="_pcl"&&(noPredicate||this.isJsonProperty(property))){
result[property]=jsonBuilder.toJsonObject(this[property]);
}
}
},

"protected function isJsonProperty",function(property){
var value=this[property];
return typeof value!="function"&&value!==this.constructor.prototype[property];
},

"public function fromJson",function(json){
this.addPropertiesFromJson(json,new JsonBuilder());
},

"protected function addPropertiesFromJson",function(json,jsonBuilder){

for(var property in json){
if(property.charAt(0)!='$'){
this[property]=jsonBuilder.fromJsonObject(json[property]);
}
}
},

"public function toString",function(){
return this.constructor["$class"]["fullClassName"]+"@"+this.hashCode();
},

"public static function isJOObject",function(bean){
var classDeclaration=bean.constructor["$class"];
return classDeclaration&&classDeclaration["fullClassName"]=="joo.ClassDeclaration";
},

];},["getHashCode","equal","typeOf","toJsonString","fromJsonString","toJsonObject","fromJsonObject","isJOObject"]
);
