* _Loader.packageClasspath ("org.eclipse.swt", "...", true);
* _Loader.packageClasspath ("java", "...", true);
*
* which is not recommended. But _Loader should try to adjust orders
* which requires "java" to be declared before normal _Loader
* #packageClasspath call before that line! And later that line
* should never initialize "java/package.js" again!
*/
var isPkgDeclared = (isIndex && map["@" + pkg]);
if (mode == 0 && isIndex && !map["@java"] && pkg.indexOf ("java") != 0 && needPackage("java")) {
_Loader.loadPackage("java", fSuccess ? function(_package){_Loader.loadPackageClasspath(pkg, base, isIndex, fSuccess, 1)} : null);
if (fSuccess)
return;
}
if (pkg instanceof Array) {
unwrapArray(pkg);
if (fSuccess) {
if (pt < pkg.length)
_Loader.loadPackageClasspath(pkg[pt], base, isIndex, function(_loadPackageClassPath){_Loader.loadPackageClasspath(pkg, base, isIndex, fSuccess, 1, pt + 1)}, 1);
else
fSuccess();
} else {
for (var i = 0; i < pkg.length; i++)
_Loader.loadPackageClasspath(pkg[i], base, isIndex, null);
}
return;
}
switch (pkg) {
case "java.*":
pkg = "java";
// fall through
case "java":
if (base) {
// support ajax for default
var key = "@net.sf.j2s.ajax";
if (!map[key])
map[key] = base;
key = "@net.sf.j2s";
if (!map[key])
map[key] = base;
}
break;
case "swt":
pkg = "org.eclipse.swt";
break;
case "ajax":
pkg = "net.sf.j2s.ajax";
break;
case "j2s":
pkg = "net.sf.j2s";
break;
default:
if (pkg.lastIndexOf(".*") == pkg.length - 2)
pkg = pkg.substring(0, pkg.length - 2);
break;
}
if (base) // critical for multiple applets
map["@" + pkg] = base;
if (isIndex && !isPkgDeclared && !window[pkg + ".registered"]) {
//pkgRefCount++;
if (pkg == "java")
pkg = "core" // JSmol -- moves java/package.js to core/package.js
_Loader.loadClass(pkg + ".package", function () {
//if (--pkgRefCount == 0)
//runtimeLoaded();
//fSuccess && fSuccess();
}, true, true, 1);
return;
}
fSuccess && fSuccess();
};
/**
* BH: allows user/developer to load classes even though wrapping and Google
* Closure Compiler has not been run on the class.
*
*
*
*/
Clazz.loadClass = function (name, onLoaded, async) {
if (!self.Class) {
Class = Clazz;
Class.forName = Clazz.forName;
// maybe more here
}
if (!name)
return null;
if (!async)
return Clazz.load(name);
_Loader.loadClass(name, function() {
var cl = Clazz.allClasses[name];
cl && cl.$load$ && cl.$load$();
onLoaded(cl);
}, true, async, 1);
return true;
}
/**
* Load the given class ant its related classes.
*/
/* public */
_Loader.loadClass = _Loader.prototype.loadClass = function (name, onLoaded, forced, async, mode) {
mode || (mode = 0); // BH: not implemented
(async == null) && (async = false);
if (typeof onLoaded == "boolean")
return evalType(name);
//System.out.println("loadClass " + name)
var path = _Loader.getClasspathFor(name);
lastLoaded = name;
Clazz.ClassFilesLoaded.push(name.replace(/\./g,"/") + ".js");
Clazz.loadScript(path);//(n, n.path, n.requiredBy, false, onLoaded ? function(_loadClass){ isLoadingEntryClass = bSave; onLoaded()}: null);
}
/* private */
_Loader.loadPackage = function(pkg, fSuccess) {
fSuccess || (fSuccess = null);
window[pkg + ".registered"] = false;
_Loader.loadPackageClasspath(pkg,
(_Loader.J2SLibBase || (_Loader.J2SLibBase = (_Loader.getJ2SLibBase() || "j2s/"))),
true, fSuccess);
};
/**
* Register classes to a given *.z.js path, so only a single *.z.js is loaded
* for all those classes.
*/
/* public */
_Loader.jarClasspath = function (jar, clazzes) {
if (!(clazzes instanceof Array))
clazzes = [clazzes];
unwrapArray(clazzes);
if (J2S._debugCore)
jar = jar.replace(/\.z\./, ".")
for (var i = clazzes.length; --i >= 0;) {
clazzes[i] = clazzes[i].replace(/\//g,".").replace(/\.js$/g,"")
classpathMap["#" + clazzes[i]] = jar;
}
classpathMap["$" + jar] = clazzes;
};
_Loader.setClasspathFor = function(clazzes) {
// Clazz._Loader.setClasspathFor("edu/colorado/phet/idealgas/model/PressureSensingBox.ChangeListener");
if (!(clazzes instanceof Array))
clazzes = [clazzes];
for (var i = clazzes.length; --i >= 0;) {
path = clazzes[i];
var jar = _Loader.getJ2SLibBase() + path.split(".")[0]+".js";
path = path.replace(/\//g,".");
classpathMap["#" + path] = jar;
var a = classpathMap["$" + jar] || (classpathMap["$" + jar] = []);
a.push(path);
}
}
/**
* Usually be used in .../package.js. All given packages will be registered
* to the same classpath of given prefix package.
*/
/* public */
_Loader.registerPackages = function (prefix, pkgs) {
//_Loader.checkInteractive ();
var base = _Loader.getClasspathFor (prefix + ".*", true);
for (var i = 0; i < pkgs.length; i++) {
if (window["Clazz"]) {
Clazz.newPackage(prefix + "." + pkgs[i]);
}
_Loader.loadPackageClasspath (prefix + "." + pkgs[i], base);
}
};
/**
* Return the *.js path of the given class. Maybe the class is contained
* in a *.z.js jar file.
* @param clazz Given class that the path is to be calculated for. May
* be java.package, or java.lang.String
* @param forRoot Optional argument, if true, the return path will be root
* of the given classs' package root path.
* @param ext Optional argument, if given, it will replace the default ".js"
* extension.
*/
/* public */
_Loader.getClasspathFor = function (clazz, forRoot, ext) {
var path = classpathMap["#" + clazz];
if (!path || forRoot || ext) {
var base;
var idx;
if (path) {
clazz = clazz.replace(/\./g, "/");
if ((idx = path.lastIndexOf(clazz)) >= 0
|| (idx = clazz.lastIndexOf("/")) >= 0
&& (idx = path.lastIndexOf(clazz.substring(0, idx))) >= 0)
base = path.substring(0, idx);
} else {
idx = clazz.length + 2;
while ((idx = clazz.lastIndexOf(".", idx - 2)) >= 0)
if ((base = classpathMap["@" + clazz.substring(0, idx)]))
break;
if (!forRoot)
clazz = clazz.replace (/\./g, "/");
}
if (base == null) {
var bins = "binaryFolders";
base = (window["Clazz"] && Clazz[bins] && Clazz[bins].length ? Clazz[bins][0]
: _Loader[bins] && _Loader[bins].length ? _Loader[bins][0]
: "j2s");
}
path = (base.lastIndexOf("/") == base.length - 1 ? base : base + "/") + (forRoot ? ""
: clazz.lastIndexOf("/*") == clazz.length - 2 ? clazz.substring(0, idx + 1)
: clazz + (!ext ? ".js" : ext.charAt(0) != '.' ? "." + ext : ext));
}
return path;//_Loader.multipleSites(path);
};
/**
* page-customizable callbacks
*
*/
/* public */
_Loader.onScriptLoading = function (file){Clazz._quiet || System.out.println("Classloader.onscriptloading " + file);};
/* public */
_Loader.onScriptLoaded = function (file, isError, data){};
/* public */
_Loader.onScriptInitialized = function (file){}; // not implemented
/* public */
_Loader.onScriptCompleted = function (file){}; // not implemented
/* public */
_Loader.onClassUnloaded = function (clazz){}; // not implemented
/* private */
var isClassExcluded = function (clazz) {
return excludeClassMap["@" + clazz];
};
/* Used to keep ignored classes */
/* private */
var excludeClassMap = {};
Clazz._lastEvalError = null;
/* private */
var evaluate = function(file, js) {
try {
eval(js + ";//# sourceURL="+file);
} catch (e) {
var s = "[Java2Script] The required class file \n\n" + file + (js.indexOf("data: no") ?
"\nwas not found.\n"
: "\ncould not be loaded. Script error: " + e.message + " \n\ndata:\n\n" + js) + "\n\n"
+ (e.stack ? e.stack : Clazz._getStackTrace());
Clazz._lastEvalError = s;
if (Clazz._isQuiet)
return;
Clazz.alert(s);
throw e;
}
}
Clazz._4Name = function(clazzName, applet, state, asClazz, initialize, isQuiet) {
if (clazzName.indexOf("[") == 0)
return getArrayClass(clazzName);
if (clazzName.indexOf(".") < 0)
clazzName = "java.lang." + clazzName;
var isok = Clazz._isClassDefined(clazzName);
if (isok && asClazz) {
var cl1 = Clazz.allClasses[clazzName];
cl1.$clinit$ && cl1.$clinit$();
return cl1;
}
if (!isok) {
var name2 = null;
if (clazzName.indexOf("$") >= 0) {
// BH we allow Java's java.swing.JTable.$BooleanRenderer as a stand-in for java.swing.JTable.BooleanRenderer
// when the static nested class is created using declareType
name2 = clazzName.replace(/\$/g,".");
if (Clazz._isClassDefined(name2)) {
clazzName = name2;
} else {
name2 = null;
}
}
if (name2 == null) {
var f = (J2S._isAsync && applet ? applet._restoreState(clazzName, state) : null);
if (f == 1)
return null; // must be already being created
if (_Loader.setLoadingMode(f ? _Loader.MODE_SCRIPT : "xhr.sync")) {
_Loader.loadClass(clazzName, f, false, true, 1);
return null; // this will surely throw an error, but that is OK
}
//alert ("Using Java reflection: " + clazzName + " for " + applet._id + " \n"+ Clazz._getStackTrace());
_Loader.loadClass(clazzName);
}
}
var cl = evalType(clazzName);
if (!cl){
if (isQuiet || Clazz._isQuiet)
return null;
alert(clazzName + " could not be loaded");
doDebugger();
}
Clazz.allClasses[clazzName] = cl;
if (initialize !== false)
cl.$clinit$ && cl.$clinit$();
return (asClazz ? cl : Clazz.getClass(cl));
};
/**
* BH: possibly useful for debugging
*/
Clazz.currentPath= "";
Clazz.loadScript = function(file) {
Clazz.currentPath = file;
//loadedScripts[file] = true;
// also remove from queue
//removeArrayItem(classQueue, file);
var file0 = file;
if (Clazz._debugging) {
file = file.replace(/\.z\.js/,".js");
}
var data = "";
try{
_Loader.onScriptLoading(file);
data = J2S.getFileData(file);
evaluate(file, data);
_Loader.onScriptLoaded(file, null, data);
}catch(e) {
_Loader.onScriptLoaded(file, e, data);
var s = ""+e;
if (data.indexOf("Error") >= 0)
s = data;
if (s.indexOf("missing ] after element list")>= 0)
s = "File not found";
if (file.indexOf("/j2s/core/") >= 0) {
System.out.println(s + " loading " + file);
} else {
alert(s + " loading file " + file + "\n\n" + e.stack);
doDebugger()
}
}
}
/**
* Used in package
/* public */
var runtimeKeyClass = _Loader.runtimeKeyClass = "java.lang.String";
/* private */
var J2sLibBase;
/**
* Return J2SLib base path from existed SCRIPT src attribute.
*/
/* public */
_Loader.getJ2SLibBase = function () {
var o = window["j2s.lib"];
return (o ? o.base + (o.alias == "." ? "" : (o.alias ? o.alias : (o.version ? o.version : "1.0.0")) + "/") : null);
};
/**
* Indicate whether _Loader is loading script synchronously or
* asynchronously.
*/
/* private */
var isAsynchronousLoading = true;
/* private */
var isUsingXMLHttpRequest = false;
/* private */
var loadingTimeLag = -1;
_Loader.MODE_SCRIPT = 4;
_Loader.MODE_XHR = 2;
_Loader.MODE_SYNC = 1;
/**
* String mode:
* asynchronous modes:
* async(...).script, async(...).xhr, async(...).xmlhttprequest,
* script.async(...), xhr.async(...), xmlhttprequest.async(...),
* script
*
* synchronous modes:
* sync(...).xhr, sync(...).xmlhttprequest,
* xhr.sync(...), xmlhttprequest.sync(...),
* xmlhttprequest, xhr
*
* Integer mode:
* Script 4; XHR 2; SYNC bit 1;
*/
/* public */
_Loader.setLoadingMode = function (mode, timeLag) {
var async = true;
var ajax = true;
if (typeof mode == "string") {
mode = mode.toLowerCase();
if (mode.indexOf("script") >= 0)
ajax = false;
else
async = (mode.indexOf("async") >=0);
async = false; // BH
} else {
if (mode & _Loader.MODE_SCRIPT)
ajax = false;
else
async = !(mode & _Loader.MODE_SYNC);
}
isUsingXMLHttpRequest = ajax;
isAsynchronousLoading = async;
loadingTimeLag = (async && timeLag >= 0 ? timeLag: -1);
return async;
};
/*
* Load those key *.z.js. This *.z.js will be surely loaded before other
* queued *.js.
*/
/* public */
_Loader.loadZJar = function (zjarPath, keyClass) {
// used only by package.js for core.z.js
var f = null;
var isArr = (keyClass instanceof Array);
if (isArr)
keyClass = keyClass[keyClass.length - 1];
// else
// f = (keyClass == runtimeKeyClass ? runtimeLoaded : null);
_Loader.jarClasspath(zjarPath, isArr ? keyClass : [keyClass]);
// BH note: runtimeKeyClass is java.lang.String
_Loader.loadClass(keyClass, null, true);
};
Clazz.binaryFolders = _Loader.binaryFolders = [ _Loader.getJ2SLibBase() ];
})(Clazz, Clazz._Loader);
//}
/******************************************************************************
* Copyright (c) 2007 java2script.org and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Zhou Renjian - initial API and implementation
*****************************************************************************/
/*******
* @author zhou renjian
* @create Jan 11, 2007
*******/
Clazz._LoaderProgressMonitor = {};
;(function(CLPM, J2S) {
var fadeOutTimer = null;
var fadeAlpha = 0;
var monitorEl = null;
var lastScrollTop = 0;
var bindingParent = null;
CLPM.DEFAULT_OPACITY = (J2S && J2S._j2sLoadMonitorOpacity ? J2S._j2sLoadMonitorOpacity : 55);
/* public */
CLPM.hideMonitor = function () {
monitorEl.style.display = "none";
}
/* public */
CLPM.showStatus = function (msg, fading) {
if (!monitorEl) {
createHandle ();
if (!attached) {
attached = true;
//Clazz.addEvent (window, "unload", cleanup);
// window.attachEvent ("onunload", cleanup);
}
}
clearChildren(monitorEl);
if (msg == null) {
if (fading) {
fadeOut();
} else {
CLPM.hideMonitor();
}
return;
}
monitorEl.appendChild(document.createTextNode ("" + msg));
if (monitorEl.style.display == "none") {
monitorEl.style.display = "";
}
setAlpha(CLPM.DEFAULT_OPACITY);
var offTop = getFixedOffsetTop();
if (lastScrollTop != offTop) {
lastScrollTop = offTop;
monitorEl.style.bottom = (lastScrollTop + 4) + "px";
}
if (fading) {
fadeOut();
}
};
/* private static */
var clearChildren = function (el) {
if (!el)
return;
for (var i = el.childNodes.length; --i >= 0;) {
var child = el.childNodes[i];
if (!child)
continue;
if (child.childNodes && child.childNodes.length)
clearChildren (child);
try {
el.removeChild (child);
} catch (e) {};
}
};
/* private */
var setAlpha = function (alpha) {
if (fadeOutTimer && alpha == CLPM.DEFAULT_OPACITY) {
window.clearTimeout (fadeOutTimer);
fadeOutTimer = null;
}
fadeAlpha = alpha;
//monitorEl.style.filter = "Alpha(Opacity=" + alpha + ")";
monitorEl.style.opacity = alpha / 100.0;
};
/* private */
var hidingOnMouseOver = function () {
CLPM.hideMonitor();
};
/* private */
var attached = false;
/* private */
var cleanup = function () {
//if (monitorEl) {
// monitorEl.onmouseover = null;
//}
monitorEl = null;
bindingParent = null;
//Clazz.removeEvent (window, "unload", cleanup);
//window.detachEvent ("onunload", cleanup);
attached = false;
};
/* private */
var createHandle = function () {
var div = document.createElement ("DIV");
div.id = "_Loader-status";
div.style.cssText = "position:absolute;bottom:4px;left:4px;padding:2px 8px;"
+ "z-index:" + (window["j2s.lib"].monitorZIndex || 10000) + ";background-color:#8e0000;color:yellow;"
+ "font-family:Arial, sans-serif;font-size:10pt;white-space:nowrap;";
div.onmouseover = hidingOnMouseOver;
monitorEl = div;
if (bindingParent) {
bindingParent.appendChild(div);
} else {
document.body.appendChild(div);
}
return div;
};
/* private */
var fadeOut = function () {
if (monitorEl.style.display == "none") return;
if (fadeAlpha == CLPM.DEFAULT_OPACITY) {
fadeOutTimer = window.setTimeout(function () {
fadeOut();
}, 750);
fadeAlpha -= 5;
} else if (fadeAlpha - 10 >= 0) {
setAlpha(fadeAlpha - 10);
fadeOutTimer = window.setTimeout(function () {
fadeOut();
}, 40);
} else {
monitorEl.style.display = "none";
}
};
/* private */
var getFixedOffsetTop = function (){
if (bindingParent) {
var b = bindingParent;
return b.scrollTop;
}
var dua = navigator.userAgent;
var b = document.body;
var p = b.parentNode;
var pcHeight = p.clientHeight;
var bcScrollTop = b.scrollTop + b.offsetTop;
var pcScrollTop = p.scrollTop + p.offsetTop;
return (dua.indexOf("Opera") < 0 && document.all ? (pcHeight == 0 ? bcScrollTop : pcScrollTop)
: dua.indexOf("Gecko") < 0 ? (pcHeight == p.offsetHeight
&& pcHeight == p.scrollHeight ? bcScrollTop : pcScrollTop) : bcScrollTop);
};
/* not used in Jmol
if (window["ClazzLoader"]) {
_Loader.onScriptLoading = function(file) {
CLPM.showStatus("Loading " + file + "...");
};
_Loader.onScriptLoaded = function(file, isError) {
CLPM.showStatus(file + (isError ? " loading failed." : " loaded."), true);
};
_Loader.onGlobalLoaded = function(file) {
CLPM.showStatus("Application loaded.", true);
};
_Loader.onClassUnloaded = function(clazz) {
CLPM.showStatus("Class " + clazz + " is unloaded.", true);
};
}
*/
})(Clazz._LoaderProgressMonitor, J2S);
//}
/******************************************************************************
* Copyright (c) 2007 java2script.org and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Zhou Renjian - initial API and implementation
*****************************************************************************/
/*******
* @author zhou renjian
* @create Nov 5, 2005
*******/
Clazz.Console = {};
;(function(Con) {
/**
* Setting maxTotalLines to -1 will not limit the console result
*/
Con.maxTotalLines = 10000;
Con.setMaxTotalLines = function (lines) {
Con.maxTotalLines = (lines > 0 ? lines : 999999);
}
Con.maxLatency = 40;
Con.setMaxLatency = function (latency) {
Con.maxLatency = (latency > 0 ? latency : 40);
};
Con.pinning = false;
Con.enablePinning = function (enabled) {
Con.pinning = enabled;
};
Con.linesCount = 0;
Con.metLineBreak = false;
/*
* Give an extension point so external script can create and bind the console
* themself.
*
* TODO: provide more template of binding console window to browser.
*/
/* protected */
Con.createConsoleWindow = function (parentEl) {
var console = document.createElement ("DIV");
console.style.cssText = "font-family:monospace, Arial, sans-serif;";
document.body.appendChild (console);
return console;
};
var c160 = String.fromCharCode(160); //nbsp;
c160 += c160+c160+c160;
Con.consoleOutput = function (s, color) {
var o = window["j2s.lib"];
var con = (o && o.console);
if (!con) {
return false; // BH this just means we have turned off all console action
}
if (con == window.console) {
if (color == "red")
con.err(s);
else
con.log(s);
return;
}
if (con && typeof con == "string")
con = document.getElementById(con)
if (Con.linesCount > Con.maxTotalLines) {
for (var i = 0; i < Con.linesCount - Con.maxTotalLines; i++) {
if (con && con.childNodes.length > 0) {
con.removeChild (con.childNodes[0]);
}
}
Con.linesCount = Con.maxTotalLines;
}
var willMeetLineBreak = false;
s = (typeof s == "undefined" ? "" : s == null ? "null" : "" + s);
s = s.replace (/\t/g, c160);
if (s.length > 0)
switch (s.charAt(s.length - 1)) {
case '\n':
case '\r':
s = (s.length > 1 ? s.substring (0, s.length - (s.charAt(s.length - 2) == '\r' ? 2 : 1)) : "");
willMeetLineBreak = true;
break;
}
var lines = null;
s = s.replace (/\t/g, c160);
lines = s.split(/\r\n|\r|\n/g);
for (var i = 0, last = lines.length - 1; i <= last; i++) {
var lastLineEl = null;
if (Con.metLineBreak || Con.linesCount == 0
|| con.childNodes.length < 1) {
lastLineEl = document.createElement ("DIV");
con.appendChild (lastLineEl);
lastLineEl.style.whiteSpace = "nowrap";
Con.linesCount++;
} else {
try {
lastLineEl = con.childNodes[con.childNodes.length - 1];
} catch (e) {
lastLineEl = document.createElement ("DIV");
con.appendChild (lastLineEl);
lastLineEl.style.whiteSpace = "nowrap";
Con.linesCount++;
}
}
var el = document.createElement ("SPAN");
lastLineEl.appendChild (el);
el.style.whiteSpace = "nowrap";
if (color)
el.style.color = color;
var l = lines[i]
if (l.length == 0)
l = c160;
el.appendChild(document.createTextNode(l));
if (!Con.pinning)
con.scrollTop += 100;
Con.metLineBreak = (i != last || willMeetLineBreak);
}
var cssClazzName = con.parentNode.className;
if (!Con.pinning && cssClazzName
&& cssClazzName.indexOf ("composite") != -1) {
con.parentNode.scrollTop = con.parentNode.scrollHeight;
}
Con.lastOutputTime = new Date ().getTime ();
};
/*
* Clear all contents inside the console.
*/
/* public */
Con.clear = function () {
try {
Con.metLineBreak = true;
var o = window["j2s.lib"];
var console = o && o.console;
if (!console || !(console = document.getElementById (console)))
return;
console.innerHTML = "";
Con.linesCount = 0;
} catch(e){};
};
/* public */
Clazz.alert = function (s) {
Con.consoleOutput (s + "\r\n");
};
})(Clazz.Console);
Clazz._setDeclared("java.lang.System",
java.lang.System = System = {
props : null, //new java.util.Properties (),
$props : {},
arraycopy$O$I$O$I$I : function (src, srcPos, dest, destPos, length) {
if (src !== dest || srcPos > destPos) {
for (var i = length; --i >= 0;)
dest[destPos++] = src[srcPos++];
} else {
destPos += length;
srcPos += length;
for (var i = length; --i >= 0;)
src[--destPos] = src[--srcPos];
}
},
currentTimeMillis$ : function () {
return new Date ().getTime ();
},
exit$ : function() {
swingjs.JSToolkit && swingjs.JSToolkit.exit$()
},
gc$ : function() {}, // bh
getProperties$ : function () {
return System.props;
},
getProperty$S$S : function (key, def) {
if (System.props)
return System.props.getProperty$S$S (key, def);
var v = System.$props[key];
if (typeof v != "undefined")
return v;
if (key.indexOf(".") > 0) {
v = null;
switch (key) {
case "java.awt.printerjob":
v = "swingjs.JSPrinterJob";
break;
case "java.class.version":
v = "50";
break;
case "user.home":
v = "https://.";
break;
case "java.vendor":
v = "SwingJS/OpenJDK";
break;
case "java.version":
v = "1.6-1.8";
break;
case "file.separator":
case "path.separator":
v = "/";
break;
case "line.separator":
v = (navigator.userAgent.indexOf("Windows") >= 0 ? "\r\n" : "\n");
break;
case "os.name":
case "os.version":
v = navigator.userAgent;
break;
case "javax.xml.datatype.DatatypeFactory":
v = "org.apache.xerces.jaxp.datatype";
break;
case "javax.xml.bind.JAXBContextFactory":
v = "swingjs.xml.JSJAXBContextFactory";
break;
}
if (v)
return System.$props[key] = v;
}
return (arguments.length == 1 ? null : def == null ? key : def); // BH
},
getSecurityManager$ : function() { return null }, // bh
identityHashCode$O : function(obj){return obj==null ? 0 : obj._$hashcode || (obj._$hashcode = ++hashCode)},
lineSeparator$ : function() { return '\n' }, // bh
nanoTime$: function() {
return Math.round(window.performance.now() * 1e6)
},
setProperties$java_util_Properties : function (props) {
System.props = props;
},
setProperty$S$S : function (key, val) {
if (!System.props)
return System.$props[key] = val; // BH
System.props.setProperty (key, val);
}
});
;(function(Con, Sys) {
Sys.getProperty$S = Sys.getProperty$S$S;
Sys.exit$I = Sys.exit$;
Sys.out = new Clazz._O ();
Sys.out.__CLASS_NAME__ = "java.io.PrintStream";
Sys.out.print = Sys.out.print$O = Sys.out.print$Z = Sys.out.print$I = Sys.out.println$J = Sys.out.print$S = Sys.out.print$C = Sys.out.print = function (s) {
Con.consoleOutput (s);
};
Sys.out.printf = Sys.out.printf$S$OA = Sys.out.format = Sys.out.format$S$OA = function (f, args) {
Sys.out.print(String.format$S$OA.apply(null, arguments));
}
Sys.out.flush$ = function() {}
Sys.out.println = Sys.out.println$ = Sys.out.println$O = Sys.out.println$Z = Sys.out.println$I = Sys.out.println$J = Sys.out.println$S = Sys.out.println$C = function(s) {
s = (typeof s == "undefined" ? "" : "" + s);
if (Clazz._nooutput || Clazz._traceFilter && s.indexOf(Clazz._traceFilter) < 0) return;
if (!Clazz._traceFilter && Clazz._traceOutput && s && (s.indexOf(Clazz._traceOutput) >= 0 || '"' + s + '"' == Clazz._traceOutput)) {
alert(s + "\n\n" + Clazz._getStackTrace());
doDebugger();
}
Con.consoleOutput(typeof s == "undefined" ? "\r\n" : s == null ? s = "null\r\n" : s + "\r\n");
};
Sys.out.println$F = Sys.out.println$D = function(f) {var s = "" + f; Sys.out.println(s.indexOf(".") < 0 && s.indexOf("Inf") < 0 ? s + ".0" : s)};
Sys.out.write$BA$I$I = function (buf, offset, len) {
Sys.out.print(String.instantialize(buf).substring(offset, offset+len));
};
Sys.err = new Clazz._O ();
Sys.err.__CLASS_NAME__ = "java.io.PrintStream";
Sys.err.print = Sys.err.print$S = function (s) {
Con.consoleOutput (s, "red");
};
Sys.err.printf = Sys.err.printf$S$OA = Sys.err.format = Sys.err.format$S$OA = Sys.err.format = function (f, args) {
Sys.out.print(String.format$S$OA.apply(null, arguments));
}
Sys.err.println = Sys.err.println$O = Sys.err.println$Z = Sys.err.println$I = Sys.err.println$S = Sys.err.println$C = Sys.err.println = function (s) {
if (Clazz._traceOutput && s && ("" + s).indexOf(Clazz._traceOutput) >= 0) {
alert(s + "\n\n" + Clazz._getStackTrace());
doDebugger();
}
Con.consoleOutput (typeof s == "undefined" ? "\r\n" : s == null ? s = "null\r\n" : s + "\r\n", "red");
};
Sys.err.println$F = Sys.err.println$D = function(f) {var s = "" + f; Sys.err.println(s.indexOf(".") < 0 && s.indexOf("Inf") < 0 ? s + ".0" : s)};
Sys.err.write$BA$I$I = function (buf, offset, len) {
Sys.err.print(String.instantialize(buf).substring(offset, offset+len));
};
Sys.err.flush$ = function() {}
})(Clazz.Console, System);
Clazz._Loader.registerPackages("java", [ "io", "lang", "lang.reflect", "util" ]);
if (!window["java.registered"])
window["java.registered"] = false;
(function (ClazzLoader) {
if (window["java.packaged"]) return;
window["java.packaged"] = true;
}) (Clazz._Loader);
window["java.registered"] = true;
///////////////// special definitions of standard Java class methods ///////////
var C$, m$ = Clazz.newMeth;
Clazz._setDeclared("java.lang.Math", java.lang.Math = Math);
Math.rint || (Math.rint = function(a) {
var b;
return Math.round(a) + ((b = a % 1) != 0.5 && b != -0.5 ? 0 : (b = Math.round(a % 2)) > 0 ? b - 2 : b);
});
Math.log10||(Math.log10=function(a){return Math.log(a)/Math.E});
Math.hypot||(Math.hypot=function(x,y){return Math.sqrt(Math.pow(x,2)+Math.pow(y,2))});
Math.toDegrees||(Math.toDegrees=function(angrad){return angrad*180.0/Math.PI;});
Math.toRadians||(Math.toRadians=function(angdeg){return angdeg/180.0*Math.PI});
Math.copySign||(Math.copySign=function(mag,sign){return((sign>0?1:-1)*Math.abs(mag))});
//could use Math.sign(), but this was used to preserve cross-brower compatability (not in Internet Explorer)
Math.signum||(Math.signum=function(d){return(d==0.0||isNaN(d))?d:d < 0 ? -1 : 1});
Math.scalb||(Math.scalb=function(d,scaleFactor){return d*Math.pow(2,scaleFactor)});
//var
a64 = null, a32 = null, i32 = null, i64 = null;
Math.nextAfter||
(Math.nextAfter=function(start,direction){
if (isNaN(start) || isNaN(direction))
return NaN;
if (direction == start)
return start;
if (start == Double.MAX_VALUE && direction == Double.POSITIVE_INFINITY)
return Double.POSITIVE_INFINITY;
if (start == -Double.MAX_VALUE && direction == Double.NEGATIVE_INFINITY)
return Double.NEGATIVE_INFINITY;
if (start == Double.POSITIVE_INFINITY && direction == Double.NEGATIVE_INFINITY)
return Double.MAX_VALUE;
if (start == Double.NEGATIVE_INFINITY && direction == Double.POSITIVE_INFINITY)
return -Double.MAX_VALUE;
if (start == 0)
return (direction > 0 ? Double.MIN_VALUE : -Double.MIN_VALUE);
if (!a64) {
a64 = new Float64Array(1);
i64 = new Uint32Array(a64.buffer);
}
a64[0] = start;
var i0 = i64[0];
var i1 = i64[1];
var carry;
if ((direction > start) == (start >= 0)) {
i64[0]++;
carry = (i64[0] == 0 ? 1 : 0);
} else {
i64[0]--;
carry = (i64[0] == 4294967295 ? -1 : 0);
}
if (carry)
i64[1]+=carry;
return a64[0];
});
Math.nextAfter$D$D = Math.nextAfter;
Math.nextAfter$F$D =function(start,direction){
if (isNaN(start) || isNaN(direction))
return NaN;
if (direction == start)
return start;
if (start == Float.MAX_VALUE && direction == Float.POSITIVE_INFINITY)
return Float.POSITIVE_INFINITY;
if (start == -Float.MAX_VALUE && direction == Float.NEGATIVE_INFINITY)
return Float.NEGATIVE_INFINITY;
if (start == Float.POSITIVE_INFINITY && direction == Float.NEGATIVE_INFINITY)
return Float.MAX_VALUE;
if (start == Float.NEGATIVE_INFINITY && direction == Float.POSITIVE_INFINITY)
return -Float.MAX_VALUE;
if (start == 0 && direction < 0)
return -Float.MIN_VALUE;
if (start == 0)
return (direction > 0 ? Float.MIN_VALUE : -Float.MIN_VALUE);
if (!i32) {
a32 = new Float32Array(1);
i32 = new Int32Array(a32.buffer);
}
a32[0] = start;
i32[0] += ((direction > start) == (start >= 0) ? 1 : -1);
return a32[0];
};
Math.nextUp||(Math.nextUp=function(d){ return Math.nextAfter(d, Double.POSITIVE_INFINITY); });
Math.nextUP$D=Math.nextUp;
Math.nextUp$F = function(f){ return Math.nextAfter$F$D(f, Double.NEGATIVE_INFINITY); };
Math.nextDown||(Math.nextDown=function(d){ return Math.nextAfter(d, Double.NEGATIVE_INFINITY); });
Math.nextDown$D=Math.nextDown;
Math.nextDown$F = function(f){ return Math.nextAfter$F$D(f, Double.NEGATIVE_INFINITY); };
Math.ulp||(Math.ulp=function(d){
if (isNaN(d)) {
return Double.NaN;
}
if (isInfinite(d)) {
return Double.POSITIVE_INFINITY;
}
if (d == Double.MAX_VALUE || d == -Double.MAX_VALUE) {
return Math.pow(2, 971);
}
return Math.nextUp(Math.abs(d));
});
Math.ulp$D = Math.ulp;
Math.ulp$F = function(f){
if (isNaN(f)) {
return Float.NaN;
}
if (isInfinite(f)) {
return Float.POSITIVE_INFINITY;
}
if (f == Float.MAX_VALUE || f == -Float.MAX_VALUE) {
return Math.pow(2, 104);
}
return Math.nextUp$F(Math.abs(f));
};
Math.getExponent = Math.getExponent$D = function(d) {
if (!a64) {
a64 = new Float64Array(1);
i64 = new Uint32Array(a64.buffer);
}
a64[0] = d;
return ((i64[1] & 0x7ff00000) >> 20) - 1023;
};
Math.getExponent$F=function(f){
return ((Float.floatToRawIntBits$F(f) & 0x7f800000) >> 23) - 127;
}
Math.IEEEremainder||(Math.IEEEremainder=function (x, y) {
if (Double.isNaN$D(x) || Double.isNaN$D(y) || Double.isInfinite$D(x) || y == 0)
return NaN;
if (!Double.isInfinite$D(x) && Double.isInfinite$D(y))
return x;
var modxy = x % y;
if (modxy == 0) return modxy;
var rem = modxy - Math.abs(y) * Math.signum(x);
if (Math.abs(rem) == Math.abs(modxy)) {
var div = x / y;
return (Math.abs(Math.round(div)) > Math.abs(div) ? rem : modxy);
}
return (Math.abs(rem) < Math.abs(modxy) ? rem : modxy);
});
Clazz._setDeclared("java.lang.Number", java.lang.Number=Number);
Number.prototype._numberToString=Number.prototype.toString;
extendObject(Array, EXT_NO_HASHCODE);
extendObject(Number, EXT_NO_HASHCODE);
Number.__CLASS_NAME__="Number";
addInterface(Number,java.io.Serializable);
//extendPrototype(Number, true, false);
Number.prototype.compareTo$ = Number.prototype.compareTo$Number = Number.prototype.compareTo$TT = function(x) { var a = this.valueOf(), b = x.valueOf(); return (a < b ? -1 : a == b ? 0 : 1) };
var $b$ = new Int8Array(1);
var $s$ = new Int16Array(1);
var $i$ = new Int32Array(1);
// short forms, for the actual numbers in JavaScript
m$(Number,["byteValue"],function(){return ($b$[0] = this, $b$[0]);});
m$(Number,["shortValue"],function(){return ($s$[0] = this, $s$[0]);});
m$(Number,["intValue"],function(){return ($i$[0] = this, $i$[0]);});
m$(Number,["longValue"],function(){return (this|0);});
// Object values
m$(Number,["byteValue$"],function(){return this.valueOf().byteValue();});
m$(Number,["shortValue$"],function(){return this.valueOf().shortValue();});
m$(Number,["intValue$"],function(){return this.valueOf().intValue();});
m$(Number,["longValue$"],function(){return this.valueOf().longValue();});
m$(Number,["floatValue$", "doubleValue$", "hashCode$"],function(){return this.valueOf();});
Clazz._setDeclared("java.lang.Integer", java.lang.Integer=Integer=function(){
if (typeof arguments[0] != "object")this.c$(arguments[0]);
});
var primTypes = {};
var setJ2STypeclass = function(cl, type, paramCode) {
// TODO -- should be a proper Java.lang.Class
primTypes[paramCode] = cl;
cl.TYPE = {
isPrimitive: function() { return true },
type:type,
__PARAMCODE:paramCode,
__PRIMITIVE:1 // referenced in java.lang.Class
};
cl.TYPE.toString = cl.TYPE.getName$ = cl.TYPE.getTypeName$
= cl.TYPE.getCanonicalName$ = cl.TYPE.getSimpleName$ = function() {return type}
}
var decorateAsNumber = function (clazz, qClazzName, type, PARAMCODE) {
clazz.prototype.valueOf=function(){return 0;};
clazz.prototype.__VAL0__ = 1;
finalizeClazz(clazz, qClazzName, null, 0, true);
extendPrototype(clazz, true, true);
setSuperclass(clazz, Number);
addInterface(clazz, Comparable);
setJ2STypeclass(clazz, type, PARAMCODE);
return clazz;
};
decorateAsNumber(Integer, "Integer", "int", "I");
Integer.toString=Integer.toString$I=Integer.toString$I$I=Integer.prototype.toString=function(i,radix){
switch(arguments.length) {
case 2:
return i.toString(radix);
case 1:
return "" +i;
case 0:
return (this===Integer ? "class java.lang.Integer" : ""+this.valueOf());
}
};
m$(Integer, ["c$", "c$$S", "c$$I"], function(v){
v == null && (v = 0);
if (typeof v != "number")
v = Integer.parseIntRadix$S$I(v, 10);
v = v.intValue();
this.valueOf=function(){return v;};
}, 1);
Integer.MIN_VALUE=Integer.prototype.MIN_VALUE=-0x80000000;
Integer.MAX_VALUE=Integer.prototype.MAX_VALUE=0x7fffffff;
//Integer.TYPE=Integer.prototype.TYPE=Integer;
m$(Integer,"highestOneBit$I",
function(i) {
i |= (i >> 1);
i |= (i >> 2);
i |= (i >> 4);
i |= (i >> 8);
i |= (i >> 16);
return i - (i >>> 1);
}, 1);
m$(Integer,"lowestOneBit$I",
function(i) { return i & -i;}, 1);
m$(Integer,"rotateLeft$I$I",
function(i, distance) { return (i << distance) | (i >>> -distance); }, 1);
m$(Integer,"rotateRight$I$I",
function(i, distance) { return (i >>> distance) | (i << -distance); }, 1);
m$(Integer,"reverse$I",
function(i) {
i = (i & 0x55555555) << 1 | (i >>> 1) & 0x55555555;
i = (i & 0x33333333) << 2 | (i >>> 2) & 0x33333333;
i = (i & 0x0f0f0f0f) << 4 | (i >>> 4) & 0x0f0f0f0f;
i = (i << 24) | ((i & 0xff00) << 8) |
((i >>> 8) & 0xff00) | (i >>> 24);
return i;}, 1);
Integer.reverseBytes = m$(Integer,"reverseBytes$I",
function(i) {
return ((i >>> 24) ) |
((i >> 8) & 0xFF00) |
((i << 8) & 0xFF0000) |
((i << 24));
}, 1);
m$(Integer,"signum$I", function(i){ return i < 0 ? -1 : i > 0 ? 1 : 0; }, 1);
m$(Integer,"bitCount$I",
function(i) {
i = i - ((i >>> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
i = (i + (i >>> 4)) & 0x0f0f0f0f;
i = i + (i >>> 8);
i = i + (i >>> 16);
return i & 0x3f;
}, 1);
m$(Integer,"numberOfLeadingZeros$I",
function(i) {
if (i == 0) return 32;
var n = 1;
if (i >>> 16 == 0) { n += 16; i <<= 16; }
if (i >>> 24 == 0) { n += 8; i <<= 8; }
if (i >>> 28 == 0) { n += 4; i <<= 4; }
if (i >>> 30 == 0) { n += 2; i <<= 2; }
n -= i >>> 31;
return n;
}, 1);
m$(Integer,"numberOfTrailingZeros$I",
function(i) {
if (i == 0) return 32;
var n = 31;
var y = i <<16; if (y != 0) { n = n -16; i = y; }
y = i << 8; if (y != 0) { n = n - 8; i = y; }
y = i << 4; if (y != 0) { n = n - 4; i = y; }
y = i << 2; if (y != 0) { n = n - 2; i = y; }
return n - ((i << 1) >>> 31);
}, 1);
var radixChar = "0123456789abcdefghijklmnopqrstuvwxyz";
m$(Integer,"parseIntRadix$S$I",
function(s,radix){
var v = parseInt(s, radix);
if (isNaN(v)){
throw Clazz.new_(NumberFormatException.c$$S, ["parsing " + s + " radix " + radix]);
}
return v;
}, 1);
m$(Integer,["parseInt$S","parseInt$S$I"],
function(s,radix){
return Integer.parseIntRadix$S$I(s, radix || 10);
}, 1);
m$(Integer,["valueOf$S","valueOf$I"],
function(s, radix){
return Clazz.new_(Integer.c$, [s]);
}, 1);
m$(Integer,["valueOf$S$I"],
function(s, radix){
return Integer.parseIntRadix$S$I(s, radix || 10);
}, 1);
m$(Integer,"equals$O",
function(s){
return (s instanceof Integer) && s.valueOf()==this.valueOf();
});
Integer.toHexString$I=function(d){
if (d < 0) {
var b = d & 0xFFFFFF;
var c = ((d>>24)&0xFF);
return c._numberToString(16) + (b = "000000" + b._numberToString(16)).substring(b.length - 6);
}
return d._numberToString(16);
};
Integer.toOctalString$I=function(d){return d._numberToString(8);};
Integer.toBinaryString$I=function(d){return d._numberToString(2);};
m$(Integer,"decodeRaw$S", function(n){
if (n.indexOf(".") >= 0)n = "";
var i = (n.startsWith("-") ? 1 : 0);
n = n.replace(/\#/, "0x").toLowerCase();
var radix=(n.startsWith("0x", i) ? 16 : n.startsWith("0", i) ? 8 : 10);
// The general problem with parseInt is that is not strict -- ParseInt("10whatever") == 10.
// Number is strict, but Number("055") does not work, though ParseInt("055", 8) does.
// need to make sure negative numbers are negative
if (n == "")
return NaN
n = Number(n) & 0xFFFFFFFF;
return (radix == 8 ? parseInt(n, 8) : n);
}, 1);
m$(Integer,"decode$S", function(n){
if (isNaN(n = Integer.decodeRaw$S(n)) || n < Integer.MIN_VALUE|| n > Integer.MAX_VALUE)
throw Clazz.new_(NumberFormatException.c$$S,["Invalid Integer"]);
return Clazz.new_(Integer.c$, [n]);
}, 1);
m$(Integer,"hashCode$",
function(){
return this.valueOf();
});
// Note that Long is problematic in JavaScript
Clazz._setDeclared("java.lang.Long", java.lang.Long=Long=function(){
if (typeof arguments[0] != "object")this.c$(arguments[0]);
});
decorateAsNumber(Long, "Long", "long", "L");
Long.toString=Long.toString$J=Long.toString$J$I = Long.prototype.toString=function(i, radix){
switch(arguments.length) {
case 2:
return i.toString(radix);
case 1:
return "" +i;
case 0:
return (this===Long ? "class java.lang.Long" : ""+this.valueOf());
}
};
m$(Long, ["c$", "c$$S", "c$$J"], function(v){
v == null && (v = 0);
v = (typeof v == "number" ? Math.round(v) : Integer.parseIntRadix$S$I(v, 10));
this.valueOf=function(){return v;};
}, 1);
//Long.MIN_VALUE=Long.prototype.MIN_VALUE=-0x8000000000000000;
//Long.MAX_VALUE=Long.prototype.MAX_VALUE=0x7fffffffffffffff;
//Long.TYPE=Long.prototype.TYPE=Long;
m$(Long,["parseLong$S", "parseLong$S$I"],
function(s,radix){
return Integer.parseIntRadix$S$I(s, radix || 10);
}, 1);
m$(Long,["valueOf$S","valueOf$J","valueOf$S$I"],
function(s, radix){
return Clazz.new_(Long.c$, [s, radix||10]);
}, 1);
m$(Long,"equals$O",
function(s){
return (s instanceof Long) && s.valueOf()==this.valueOf();
}, 1);
Long.toHexString$J=function(i){
return i.toString(16);
};
Long.toOctalString$J=function(i){
return i.toString(8);
};
Long.toBinaryString$J=function(i){
return i.toString(2);
};
m$(Long,"decode$S",
function(n){
if (isNaN(n = Integer.decodeRaw$S(n)))
throw Clazz.new_(NumberFormatException.c$$S, ["Invalid Long"]);
return Clazz.new_(Long.c$, [n]);
}, 1);
Long.sum$J$J = Integer.sum$I$I;
m$(Long,"signum$J", function(i){ return i < 0 ? -1 : i > 0 ? 1 : 0; }, 1);
Clazz._setDeclared("java.lang.Short", java.lang.Short = Short = function(){
if (typeof arguments[0] != "object")this.c$(arguments[0]);
});
decorateAsNumber(Short, "Short", "short", "H");
m$(Short, ["c$", "c$$S", "c$$H"],
function (v,radix) {
v == null && (v = 0);
if (typeof v != "number")
v = Integer.parseIntRadix$S$I(v, radix||10);
v = v.shortValue();
this.valueOf = function () {return v;};
}, 1);
Short.toString = Short.toString$H = Short.toString$H$I = Short.prototype.toString = function (i,radix) {
switch(arguments.length) {
case 2:
return i.toString(radix);
case 1:
return "" +i;
case 0:
return (this===Short ? "class java.lang.Short" : ""+this.valueOf());
}
};
Short.MIN_VALUE = Short.prototype.MIN_VALUE = -32768;
Short.MAX_VALUE = Short.prototype.MAX_VALUE = 32767;
//Short.TYPE = Short.prototype.TYPE = Short;
m$(Short, "parseShortRadix$S$I",function (s, radix) {
return Integer.parseIntRadix$S$I(s, radix).shortValue();
}, 1);
m$(Short, "parseShort$S",function (s) {
return Short.parseShortRadix$S$I(s, 10);
}, 1);
m$(Short, ["valueOf$S","valueOf$H","valueOf$S$I"],
function (s,radix) {
return Clazz.new_(Short.c$, [s,radix||10]);
}, 1);
m$(Short, "equals$O",
function (s) {
return (s instanceof Short) && s.valueOf() == this.valueOf();
});
Short.toHexString$H = function (i) {
return i.toString(16);
};
Short.toOctalString$H = function (i) {
return i.toString(8);
};
Short.toBinaryString$H = function (i) {
return i.toString (2);
};
m$(Short, "decode$S",
function(n){
if (isNaN(n = Integer.decodeRaw$S(n)) || n < -32768|| n > 32767)
throw Clazz.new_(NumberFormatException.c$$S, ["Invalid Short"]);
return Clazz.new_(Short.c$, [n]);
}, 1);
Clazz._setDeclared("java.lang.Byte", java.lang.Byte=Byte=function(){
if (typeof arguments[0] != "object")this.c$(arguments[0]);
});
decorateAsNumber(Byte,"Byte", "byte", "B");
m$(Byte, ["c$", "c$$S", "c$$B"], function(v,radix){
if (typeof v != "number")
v = Integer.parseIntRadix$S$I(v, radix||10);
v = v.byteValue();
this.valueOf=function(){return v;};
this.byteValue = function(){return v};
}, 1);
Byte.toString=Byte.toString$B=Byte.toString$B$I=Byte.prototype.toString=function(i,radix){
switch(arguments.length) {
case 2:
return i.toString(radix);
case 1:
return "" +i;
case 0:
return (this===Byte ? "class java.lang.Byte" : ""+this.valueOf());
}
};
Byte.serialVersionUID=Byte.prototype.serialVersionUID=-7183698231559129828;
Byte.MIN_VALUE=Byte.prototype.MIN_VALUE=-128;
Byte.MAX_VALUE=Byte.prototype.MAX_VALUE=127;
Byte.SIZE=Byte.prototype.SIZE=8;
//Byte.TYPE=Byte.prototype.TYPE=Byte;
m$(Byte,"parseByteRadix$S$I",
function(s,radix){
return Integer.parseIntRadix$S$I(s, radix).byteValue$();
}, 1);
m$(Byte,"parseByte$S",
function(s){
return Byte.parseByteRadix$S$I(s,10);
}, 1);
m$(Byte, ["valueOf$S","valueOf$B","valueOf$S$I"],
function (s,radix) {
return Clazz.new_(Byte.c$, [s, radix||10]);
}, 1);
m$(Byte,"equals$O",
function(s){
return (s instanceof Byte) && s.valueOf()==this.valueOf();
});
Byte.toHexString$B=function(i){return i.toString(16);};
Byte.toOctalString$B=function(i){return i.toString(8);};
Byte.toBinaryString$B=function(i){return i.toString(2);};
m$(Byte,"decode$S",
function(n){
if (isNaN(n = Integer.decodeRaw$S(n)) || n < -128|| n > 127)
throw Clazz.new_(NumberFormatException.c$$S, ["Invalid Byte"]);
return Clazz.new_(Byte.c$, [n]);
}, 1);
Clazz._floatToString = function(f) {
var check57 = (Math.abs(f) >= 1e-6 && Math.abs(f) < 1e-3);
if (check57)
f/=1e7;
var s = (""+f).replace('e','E');
if (s.indexOf(".") < 0 && s.indexOf("Inf") < 0 && s.indexOf("NaN") < 0) {
if(s.indexOf('E') < 0)
s += ".0";
else {
s = s.replace('E', '.0E');
}
}
if (check57) {
s = s.substring(0, s.length - 2) + (parseInt(s.substring(s.length - 2)) - 7);
s = s.replace(".0000000000000001",".0");
}
return s;
}
Clazz._setDeclared("java.lang.Float", java.lang.Float=Float=function(){
if (typeof arguments[0] != "object")this.c$(arguments[0]);
});
decorateAsNumber(Float,"Float", "float", "F");
m$(Float, ["c$", "c$$S", "c$$F", "c$$D"], function(v){
v == null && (v = 0);
if (typeof v != "number")
v = Number(v);
this.valueOf=function(){return v;}
}, 1);
Float.toString=Float.toString$F=Float.prototype.toString=function(){
if(arguments.length!=0){
return Clazz._floatToString(arguments[0]);
}else if(this===Float){
return"class java.lang.Float";
}
return Clazz._floatToString(this.valueOf());
};
var a32, i32;
Float.floatToIntBits$F = function(f) {
if (isNaN(f))
return
return Float.floatToRawIntBits$F(f);
}
Float.floatToRawIntBits$F = function(f) {
i32 || (a32 = new Float32Array(1), i32 = new Int32Array(a32.buffer));
a32[0] = f;
return i32[0];
}
Float.intBitsToFloat$I = function(i) {
i32 || (a32 = new Float32Array(1), i32 = new Int32Array(a32.buffer));
i32[0] = i;
return a32[0];
}
Float.serialVersionUID=Float.prototype.serialVersionUID=-2671257302660747028;
Float.MIN_VALUE=Float.prototype.MIN_VALUE=1.4e-45;
Float.MAX_VALUE=Float.prototype.MAX_VALUE=3.4028235e+38;
Float.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
Float.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
Float.NaN=Number.NaN;
//Float.TYPE=Float.prototype.TYPE=Float;
m$(Float,"parseFloat$S",
function(s){
if(s==null){
throw Clazz.new_(NumberFormatException.c$$S, ["null"]);
}
if (typeof s == "number")return s; // important -- typeof NaN is "number" and is OK here
var floatVal=Number(s);
if(isNaN(floatVal)){
throw Clazz.new_(NumberFormatException.c$$S, ["Not a Number : "+s]);
}
return floatVal;
}, 1);
m$(Float,["valueOf$S","valueOf$F"],
function(s){
return Clazz.new_(Float.c$, [s]);
}, 1);
Float.isNaN$F = m$(Float,"isNaN$",
function(num){
return isNaN(arguments.length == 1 ? num : this.valueOf());
});
Float.isInfinite$F = m$(Float,"isInfinite$",
function(num){
return !Number.isFinite(arguments.length == 1 ? num : this.valueOf());
});
m$(Float,"equals$O",
function(s){
return (s instanceof Float) && s.valueOf()==this.valueOf();
});
Clazz._setDeclared("java.lang.Double", java.lang.Double=Double=function(){
if (typeof arguments[0] != "object")this.c$(arguments[0]);
});
decorateAsNumber(Double,"Double", "double", "D");
Double.toString=Double.toString$D=Double.prototype.toString=function(){
if(arguments.length!=0){
return Clazz._floatToString(arguments[0]);
}else if(this===Double){
return"class java.lang.Double";
}
return Clazz._floatToString(this.valueOf());
};
m$(Double, ["c$", "c$$S", "c$$D"], function(v){
v == null && (v = 0);
if (typeof v != "number")
v = Double.parseDouble$S(v);
this.valueOf=function(){return v;};
}, 1);
Double.serialVersionUID=Double.prototype.serialVersionUID=-9172774392245257468;
Double.MIN_VALUE=Double.prototype.MIN_VALUE=4.9e-324;
Double.MAX_VALUE=Double.prototype.MAX_VALUE=1.7976931348623157e+308;
Double.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
Double.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
Double.NaN=Number.NaN;
//Double.TYPE=Double.prototype.TYPE=Double;
Double.isNaN$D = m$(Double,"isNaN$",
function(num){
return isNaN(arguments.length == 1 ? num : this.valueOf());
});
Float.prototype.hashCode$ = Double.prototype.hashCode$ = function() {("" + this.valueOf()).hashCode$()}
Double.isInfinite$D = m$(Double,"isInfinite$",
function(num){
return!Number.isFinite(arguments.length == 1 ? num : this.valueOf());
});
m$(Double,"parseDouble$S",
function(s){
if(s==null){
throw Clazz.new_(NumberFormatException.c$$S, ["null"]);
}
if (typeof s == "number")return s; // important -- typeof NaN is "number" and is OK here
var doubleVal=Number(s);
if(isNaN(doubleVal)){
throw Clazz.new_(NumberFormatException.c$$S, ["Not a Number : "+s]);
}
return doubleVal;
}, 1);
m$(Double,["valueOf$S","valueOf$D"],
function(v){
return Clazz.new_(Double.c$, [v]);
}, 1);
Double.prototype.equals = m$(Double,"equals$O",
function(s){
return (s instanceof Double) && s.valueOf()==this.valueOf();
});
Clazz._setDeclared("java.lang.Boolean",
Boolean = java.lang.Boolean = Boolean || function(){
if (typeof arguments[0] != "object")this.c$(arguments[0]);
});
extendObject(Boolean);
Boolean.__CLASS_NAME__="Boolean";
addInterface(Boolean,[java.io.Serializable,java.lang.Comparable]);
setJ2STypeclass(Boolean, "boolean", "Z");
//extendPrototype(Boolean, true, false);
Boolean.serialVersionUID=Boolean.prototype.serialVersionUID=-3665804199014368530;
m$(Boolean, ["c$", "c$$S", "c$$Z"],
function(s){
var b = ((typeof s == "string" ? Boolean.toBoolean(s) : s) ? true : false);
this.valueOf=function(){return b;};
}, 1);
m$(Boolean,["booleanValue","booleanValue$"], function(){ return this.valueOf(); });
m$(Boolean,"compare$Z$Z", function(a,b){return(a == b ? 0 : a ? 1 : -1);}, 1);
m$(Boolean,["compareTo$Boolean","compareTo$TT"],
function(b){
return(b.valueOf() == this.valueOf() ? 0 : this.valueOf() ? 1 : -1);
});
Boolean.prototype.equals = m$(Boolean,"equals$O",
function(obj){
return obj instanceof Boolean && this.booleanValue()==obj.booleanValue();
});
m$(Boolean,"getBoolean$S",
function(name){
var result=false;
try{
result=Boolean.toBoolean(System.getProperty$S(name));
}catch(e){
if(Clazz.instanceOf(e,IllegalArgumentException)){
}else if(Clazz.instanceOf(e,NullPointerException)){
}else{
throw e;
}
}
return result;
}, 1);
m$(Boolean,"hashCode$", function(){ return this.valueOf()?1231:1237;});
m$(Boolean,"hashCode$Z", function(b){ return b?1231:1237;}, 1);
m$(Boolean,"logicalAnd$Z$Z", function(a,b){return(a && b);}, 1);
m$(Boolean,"logicalOr$Z$Z", function(a,b){return(a || b);}, 1);
m$(Boolean,"logicalXor$Z$Z", function(a,b){return !!(a ^ b);}, 1);
m$(Boolean,"parseBoolean$S", function(s){return Boolean.toBoolean(s);}, 1);
m$(Boolean,"toString",function(){return this.valueOf()?"true":"false";});
m$(Boolean,"toString$Z",function(b){return "" + b;}, 1);
m$(Boolean,"valueOf$S",function(s){ return("true".equalsIgnoreCase$S(s)?Boolean.TRUE:Boolean.FALSE);}, 1);
m$(Boolean,"valueOf$Z",function(b){ return(b?Boolean.TRUE:Boolean.FALSE);}, 1);
//the need is to have new Boolean(string), but that won't work with native Boolean
//so instead we have to do a lexical switch from "new Boolean" to "Boolean.from"
//note no $ here
m$(Boolean,"toBoolean",
function(name){
return(typeof name == "string" ? name.equalsIgnoreCase$S("true") : !!name);
}, 1);
m$(Boolean,"from",
function(name){
return Boolean.toBoolean(name) ? Boolean.TRUE : Boolean.FALSE;
}, 1);
Boolean.TRUE=Boolean.prototype.TRUE=Clazz.new_(Boolean.c$, [true]);
Boolean.FALSE=Boolean.prototype.FALSE=Clazz.new_(Boolean.c$, [false]);
Clazz._Encoding={
UTF8:"utf-8",
UTF16:"utf-16",
ASCII:"ascii"
};
(function(Encoding) {
Encoding.guessEncoding=function(str){
return (str.charCodeAt(0)==0xEF&&str.charCodeAt(1)==0xBB&&str.charCodeAt(2)==0xBF ? Encoding.UTF8
: str.charCodeAt(0)==0xFF&&str.charCodeAt(1)==0xFE ? Encoding.UTF16
: Encoding.ASCII);
};
Encoding.guessEncodingArray=function(a, offset){
return (a[offset]==0xEF&&a[offset + 1]==0xBB&&a[offset + 2]==0xBF ? Encoding.UTF8
: a[offset + 0]==0xFF&&a[offset + 1]==0xFE ? Encoding.UTF16 : Encoding.ASCII);
};
Encoding.readUTF8Array=function(a, offset, length){
if (arguments.length == 1) {
offset = 0;
length = a.length;
}
var encoding=Encoding.guessEncodingArray(a);
var startIdx=0;
if(encoding==Encoding.UTF8){
startIdx=3;
}else if(encoding==Encoding.UTF16){
startIdx=2;
}
var arrs=new Array();
for(var i=offset + startIdx, endIdx = offset + length; i < endIdx; i++){
var charCode=a[i];
if(charCode<0x80){
arrs[arrs.length]=String.fromCharCode(charCode);
}else if(charCode>0xc0&&charCode<0xe0){
var c1=charCode&0x1f;
var c2=a[++i]&0x3f;
var c=(c1<<6)+c2;
arrs[arrs.length]=String.fromCharCode(c);
}else if(charCode>=0xe0){
var c1=charCode&0x0f;
var c2=a[++i]&0x3f;
var c3=a[++i]&0x3f;
var c=(c1<<12)+(c2<<6)+c3;
arrs[arrs.length]=String.fromCharCode(c);
}
}
return arrs.join('');
};
Encoding.convert2UTF8=function(str){
var encoding=this.guessEncoding(str);
var startIdx=0;
if(encoding==Encoding.UTF8){
return str;
}else if(encoding==Encoding.UTF16){
startIdx=2;
}
var offset=0;
var arrs=new Array(offset+str.length-startIdx);
for(var i=startIdx;i