diff --git a/transpiler/pom.xml b/transpiler/pom.xml index 7d0d8375..7ffae63d 100644 --- a/transpiler/pom.xml +++ b/transpiler/pom.xml @@ -264,6 +264,12 @@ test true + + org.jsweet + j4ts + 0.6.0 + test + org.jsweet.candies jquery diff --git a/transpiler/src/main/java/org/jsweet/transpiler/JSweetTranspiler.java b/transpiler/src/main/java/org/jsweet/transpiler/JSweetTranspiler.java index a6570d8d..f58e6679 100644 --- a/transpiler/src/main/java/org/jsweet/transpiler/JSweetTranspiler.java +++ b/transpiler/src/main/java/org/jsweet/transpiler/JSweetTranspiler.java @@ -720,11 +720,9 @@ public class JSweetTranspiler implements JSweetOptions { SourceFile... sourceFiles) throws Exception { logger.info("[" + engineName + " engine] eval files: " + Arrays.asList(sourceFiles)); - EvalOptions options = new EvalOptions(isUsingModules(), workingDir); - if ("Java".equals(engineName)) { - JavaEval evaluator = new JavaEval(this, options); + JavaEval evaluator = new JavaEval(this, new EvalOptions(isUsingModules(), workingDir, false)); return evaluator.performEval(sourceFiles); } else { if (!areAllTranspiled(sourceFiles)) { @@ -755,7 +753,9 @@ public class JSweetTranspiler implements JSweetOptions { jsFiles = Stream.of(sourceFiles).map(sourceFile -> sourceFile.getJsFile()).collect(toList()); } - JavaScriptEval evaluator = new JavaScriptEval(options, JavaScriptRuntime.NodeJs); + JavaScriptEval evaluator = new JavaScriptEval( + new EvalOptions(isUsingModules(), workingDir, context.isUsingJavaRuntime()), + JavaScriptRuntime.NodeJs); return evaluator.performEval(jsFiles); } } diff --git a/transpiler/src/main/java/org/jsweet/transpiler/Java2TypeScriptTranslator.java b/transpiler/src/main/java/org/jsweet/transpiler/Java2TypeScriptTranslator.java index 8ef8535b..b880fb6d 100644 --- a/transpiler/src/main/java/org/jsweet/transpiler/Java2TypeScriptTranslator.java +++ b/transpiler/src/main/java/org/jsweet/transpiler/Java2TypeScriptTranslator.java @@ -2642,7 +2642,9 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter { } print(getOverloadMethodName(method.sym)).print("("); for (int j = 0; j < method.getParameters().size(); j++) { - if (j == method.getParameters().size() - 1 && Util.hasVarargs(overload.coreMethod.sym)) { + if (j == method.getParameters().size() - 1 && Util.hasVarargs(method.sym)) { + print("..."); + } else if (j == method.getParameters().size() - 1 && Util.hasVarargs(overload.coreMethod.sym)) { print(""); } print(avoidJSKeyword(overload.coreMethod.getParameters().get(j).name.toString())).print(", "); @@ -3154,9 +3156,17 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter { int i = 0; for (; i < m.getParameters().size(); i++) { print("("); + if (Class.class.getName().equals(context.types.erasure(m.getParameters().get(i).type).toString()) + && m.getParameters().get(i).type.getTypeArguments().head != null + && m.getParameters().get(i).type.getTypeArguments().head.isInterface()) { + print(avoidJSKeyword(overload.coreMethod.getParameters().get(i).name.toString())).print(" === "); + print(getStringLiteralQuote()).print(m.getParameters().get(i).type.getTypeArguments().head.toString()) + .print(getStringLiteralQuote()); + print(" || "); + } printInstanceOf(avoidJSKeyword(overload.coreMethod.getParameters().get(i).name.toString()), null, m.getParameters().get(i).type); - checkType(m.getParameters().get(i).type.tsym); + checkType(m.getParameters().get(i).type.tsym); print(" || ") .print(avoidJSKeyword(overload.coreMethod.getParameters().get(i).name.toString()) + " === null") .print(")"); @@ -3164,6 +3174,10 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter { } for (; i < overload.coreMethod.getParameters().size(); i++) { print(avoidJSKeyword(overload.coreMethod.getParameters().get(i).name.toString())).print(" === undefined"); + if (i == overload.coreMethod.getParameters().size() - 1 && overload.coreMethod.sym.isVarArgs()) { + print(" || "); + print(avoidJSKeyword(overload.coreMethod.getParameters().get(i).name.toString())).print(".length === 0"); + } print(" && "); } removeLastChars(4); @@ -4568,13 +4582,13 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter { println().endIndent().printIndent().print("}"); if (!interfaces.isEmpty()) { - print(", '" + INTERFACES_FIELD_NAME + "', { configurable: true, value: "); + print(", 'constructor', { configurable: true, value: { " + INTERFACES_FIELD_NAME +": "); print("["); for (String i : interfaces) { print(getStringLiteralQuote()).print(i).print(getStringLiteralQuote() + ","); } removeLastChar(); - print("]"); + print("] }"); print(" })"); } } else { @@ -5856,7 +5870,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter { if (context.isInterface(type.tsym)) { print(" != null && "); print("("); - print(exprStr, expr); + /*print(exprStr, expr); if (checkFirstArrayElement) print("[0]"); print("[" + getStringLiteralQuote() + INTERFACES_FIELD_NAME + getStringLiteralQuote() + "]") @@ -5864,9 +5878,10 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter { print(exprStr, expr); if (checkFirstArrayElement) print("[0]"); - print("[" + getStringLiteralQuote() + INTERFACES_FIELD_NAME + getStringLiteralQuote() - + "].indexOf(\"").print(type.tsym.getQualifiedName().toString()).print("\") >= 0"); - print(" || "); + print("[" + getStringLiteralQuote() + INTERFACES_FIELD_NAME + + getStringLiteralQuote() + "].indexOf(\"") + .print(type.tsym.getQualifiedName().toString()).print("\") >= 0"); + print(" || ");*/ print(exprStr, expr); if (checkFirstArrayElement) print("[0]"); @@ -5889,6 +5904,20 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter { print(" === " + getStringLiteralQuote() + "string" + getStringLiteralQuote()); } print(")"); + } else if (Class.class.getName().equals(type.tsym.getQualifiedName().toString())) { + print(" != null && "); + print("("); + print(exprStr, expr); + if (checkFirstArrayElement) + print("[0]"); + print("[" + getStringLiteralQuote() + CLASS_NAME_IN_CONSTRUCTOR + + getStringLiteralQuote() + "]").print(" != null"); + print(" || ((t) => { try { new t; return true; } catch { return false; } })("); + print(exprStr, expr); + if (checkFirstArrayElement) + print("[0]"); + print(")"); + print(")"); } else { if (type.tsym instanceof TypeVariableSymbol || Object.class.getName().equals(type.tsym.getQualifiedName().toString())) { @@ -5915,7 +5944,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter { print(exprStr, expr); if (checkFirstArrayElement) print("[0]"); - print(".length==0 || "); + print(".length == 0 || "); print(exprStr, expr); print("[0] == null ||"); if (t.elemtype instanceof ArrayType) { diff --git a/transpiler/src/main/java/org/jsweet/transpiler/eval/EvalOptions.java b/transpiler/src/main/java/org/jsweet/transpiler/eval/EvalOptions.java index fc7c660b..0a828c25 100644 --- a/transpiler/src/main/java/org/jsweet/transpiler/eval/EvalOptions.java +++ b/transpiler/src/main/java/org/jsweet/transpiler/eval/EvalOptions.java @@ -5,10 +5,12 @@ import java.io.File; public class EvalOptions { public final boolean useModules; public final File workingDir; + public final boolean useJavaRuntime; - public EvalOptions(boolean useModules, File workingDir) { + public EvalOptions(boolean useModules, File workingDir, boolean useJavaRuntime) { this.useModules = useModules; this.workingDir = workingDir; + this.useJavaRuntime = useJavaRuntime; } } diff --git a/transpiler/src/main/java/org/jsweet/transpiler/eval/JavaScriptEval.java b/transpiler/src/main/java/org/jsweet/transpiler/eval/JavaScriptEval.java index 1ed57537..3a46ae8c 100644 --- a/transpiler/src/main/java/org/jsweet/transpiler/eval/JavaScriptEval.java +++ b/transpiler/src/main/java/org/jsweet/transpiler/eval/JavaScriptEval.java @@ -3,8 +3,10 @@ package org.jsweet.transpiler.eval; import java.io.File; import java.io.IOException; import java.io.StringWriter; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; +import java.util.List; import java.util.Set; import org.apache.commons.io.FileUtils; @@ -52,6 +54,12 @@ public class JavaScriptEval extends RuntimeEval { File tmpFile = new File(options.workingDir, "eval.tmp_" + System.currentTimeMillis() + ".js"); FileUtils.deleteQuietly(tmpFile); + if (options.useJavaRuntime) { + List newFiles = new ArrayList<>(jsFiles); + newFiles.add(0, new File("src/test/resources/j4ts.js")); + jsFiles = newFiles; + } + Set alreadyWrittenScripts = new HashSet<>(); for (File jsFile : jsFiles) { if (!alreadyWrittenScripts.contains(jsFile)) { @@ -61,7 +69,7 @@ public class JavaScriptEval extends RuntimeEval { } } - logger.info("[no modules] eval file: " + tmpFile + " jsFiles=" + jsFiles); + logger.info("[no modules] eval file: " + tmpFile + " jsFiles=" + jsFiles + ", useJavaRuntime=" + options.useJavaRuntime); runProcess = runScript(trace, tmpFile); } diff --git a/transpiler/src/main/java/org/jsweet/transpiler/extension/Java2TypeScriptAdapter.java b/transpiler/src/main/java/org/jsweet/transpiler/extension/Java2TypeScriptAdapter.java index 6fc5efb7..57051dc8 100644 --- a/transpiler/src/main/java/org/jsweet/transpiler/extension/Java2TypeScriptAdapter.java +++ b/transpiler/src/main/java/org/jsweet/transpiler/extension/Java2TypeScriptAdapter.java @@ -1250,14 +1250,14 @@ public class Java2TypeScriptAdapter extends PrinterAdapter { switch (targetMethodName) { case "getName": printMacroName(targetMethodName); - getPrinter().print("(c => c[\"" + Java2TypeScriptTranslator.CLASS_NAME_IN_CONSTRUCTOR + "\"]?c[\"" + getPrinter().print("(c => typeof c === 'string'?c:c[\"" + Java2TypeScriptTranslator.CLASS_NAME_IN_CONSTRUCTOR + "\"]?c[\"" + Java2TypeScriptTranslator.CLASS_NAME_IN_CONSTRUCTOR + "\"]:c[\"name\"])("); printTarget(invocationElement.getTargetExpression()); print(")"); return true; case "getSimpleName": printMacroName(targetMethodName); - print("(c => c[\"" + Java2TypeScriptTranslator.CLASS_NAME_IN_CONSTRUCTOR + "\"]?c[\"" + print("(c => typeof c === 'string'?(c).substring((c).lastIndexOf('.')+1):c[\"" + Java2TypeScriptTranslator.CLASS_NAME_IN_CONSTRUCTOR + "\"]?c[\"" + Java2TypeScriptTranslator.CLASS_NAME_IN_CONSTRUCTOR + "\"].substring(c[\"" + Java2TypeScriptTranslator.CLASS_NAME_IN_CONSTRUCTOR + "\"].lastIndexOf('.')+1):c[\"name\"].substring(c[\"name\"].lastIndexOf('.')+1))("); diff --git a/transpiler/src/test/java/org/jsweet/test/transpiler/ApiTests.java b/transpiler/src/test/java/org/jsweet/test/transpiler/ApiTests.java index 3e34b4da..9b05b3da 100644 --- a/transpiler/src/test/java/org/jsweet/test/transpiler/ApiTests.java +++ b/transpiler/src/test/java/org/jsweet/test/transpiler/ApiTests.java @@ -78,14 +78,21 @@ public class ApiTests extends AbstractTest { @Test public void testJ4TSInvocations() { - transpile(ModuleKind.none, logHandler -> { + // with J4TS + transpilerTest().getTranspiler().setUsingJavaRuntime(true); + eval(ModuleKind.none, (logHandler, result) -> { logHandler.assertNoProblems(); }, getSourceFile(J4TSInvocations.class)); + // without J4TS + transpilerTest().getTranspiler().setUsingJavaRuntime(false); + eval(ModuleKind.none, (logHandler, result) -> { + logHandler.assertNoProblems(); + }, getSourceFile(J4TSInvocations.class)); } @Test public void testJdkInvocations() { - eval((logHandler, result) -> { + eval(ModuleKind.none, (logHandler, result) -> { Assert.assertEquals("There should be no errors", 0, logHandler.reportedProblems.size()); assertEquals("test", result.get("s1")); assertEquals("m1", result.get("s2")); diff --git a/transpiler/src/test/java/org/jsweet/test/transpiler/OverloadTests.java b/transpiler/src/test/java/org/jsweet/test/transpiler/OverloadTests.java index f93c015e..807a29cc 100644 --- a/transpiler/src/test/java/org/jsweet/test/transpiler/OverloadTests.java +++ b/transpiler/src/test/java/org/jsweet/test/transpiler/OverloadTests.java @@ -62,6 +62,8 @@ import source.overload.ConstructorOverloadWithFieldInitializer; import source.overload.InterfaceInheritance; import source.overload.LocalVariablesNameCollision; import source.overload.NonPublicRootMethod; +import source.overload.OverLoadClassAndObject; +import source.overload.OverLoadVarags; import source.overload.OverLoadWithClassParam; import source.overload.Overload; import source.overload.OverloadInInnerClass; @@ -262,6 +264,31 @@ public class OverloadTests extends AbstractTest { }, getSourceFile(ConstructorOverloadWithFieldInitializer.class)); } + @Test + public void testOverloadClassAndObjectWithJ4TS() { + transpilerTest().getTranspiler().setUsingJavaRuntime(true); + eval(ModuleKind.none, (logHandler, r) -> { + logHandler.assertNoProblems(); + }, getSourceFile(OverLoadClassAndObject.class)); + transpilerTest().getTranspiler().setUsingJavaRuntime(false); + } + + @Test + public void testOverloadClassAndObject() { + eval(ModuleKind.none, (logHandler, r) -> { + logHandler.assertNoProblems(); + }, getSourceFile(OverLoadClassAndObject.class)); + } + + @Test + public void testOverloadVarargs() { + transpilerTest().getTranspiler().setUsingJavaRuntime(true); + eval(ModuleKind.none, (logHandler, r) -> { + logHandler.assertNoProblems(); + }, getSourceFile(OverLoadVarags.class)); + transpilerTest().getTranspiler().setUsingJavaRuntime(false); + } + @Test public void testConstructorOverloadWithArray() { eval(ModuleKind.none, (logHandler, r) -> { diff --git a/transpiler/src/test/java/org/jsweet/test/transpiler/util/TranspilerTestRunner.java b/transpiler/src/test/java/org/jsweet/test/transpiler/util/TranspilerTestRunner.java index 07831d7b..4ecef400 100644 --- a/transpiler/src/test/java/org/jsweet/test/transpiler/util/TranspilerTestRunner.java +++ b/transpiler/src/test/java/org/jsweet/test/transpiler/util/TranspilerTestRunner.java @@ -96,6 +96,7 @@ public class TranspilerTestRunner { transpiler.setGenerateSourceMaps(false); transpiler.setUseTsserver(true); transpiler.setVerbose(verbose); + transpiler.setUsingJavaRuntime(false); FileUtils.deleteQuietly(transpiler.getWorkingDirectory()); } diff --git a/transpiler/src/test/java/source/overload/OverLoadClassAndObject.java b/transpiler/src/test/java/source/overload/OverLoadClassAndObject.java new file mode 100644 index 00000000..99b4c03c --- /dev/null +++ b/transpiler/src/test/java/source/overload/OverLoadClassAndObject.java @@ -0,0 +1,62 @@ +package source.overload; + +import static jsweet.util.Lang.$apply; +import static jsweet.util.Lang.object; + +public class OverLoadClassAndObject { + + public static void main(String[] args) { + OverLoadClassAndObject overload = new OverLoadClassAndObject(); + + System.out.println(overload.m(AnInterface.class)); + System.out.println(overload.m(new AClass())); + System.out.println((String)$apply(object(overload).$get("m"), new AClass())); + System.out.println((String)$apply(object(overload).$get("m"), AClass.class)); + // Overload with strings cannot work because AnInterface.class is transpiled as a string + System.out.println((String)$apply(object(overload).$get("m"), AnInterface.class)); + + System.out.println(overload.m2(AClass.class)); + System.out.println(overload.m2(new AClass())); + System.out.println((String)$apply(object(overload).$get("m2"), new AClass())); + System.out.println((String)$apply(object(overload).$get("m2"), AClass.class)); + + assert overload.m(AnInterface.class) == "2:source.overload.AnInterface"; + assert overload.m(new AClass()) == "1:object"; + assert $apply(object(overload).$get("m"), new AClass()) == "1:object"; + assert $apply(object(overload).$get("m"), AClass.class) == "2:source.overload.AClass"; + assert $apply(object(overload).$get("m"), AnInterface.class) == "2:source.overload.AnInterface"; + + assert overload.m2(AClass.class) == "2:source.overload.AClass"; + assert overload.m2(new AClass()) == "1:object"; + assert $apply(object(overload).$get("m2"), new AClass()) == "1:object"; + assert $apply(object(overload).$get("m2"), AClass.class) == "2:source.overload.AClass"; + + } + + String m(AnInterface o) { + return "1:" + o.getName(); + } + + String m(Class clazz) { + return "2:" + clazz.getName(); + } + + String m2(AClass o) { + return "1:" + o.getName(); + } + + String m2(Class clazz) { + return "2:" + clazz.getName(); + } + +} + +interface AnInterface { + String getName(); +} + +class AClass implements AnInterface { + public String getName() { + return "object"; + } +} \ No newline at end of file diff --git a/transpiler/src/test/java/source/overload/OverLoadVarags.java b/transpiler/src/test/java/source/overload/OverLoadVarags.java new file mode 100644 index 00000000..d610aabf --- /dev/null +++ b/transpiler/src/test/java/source/overload/OverLoadVarags.java @@ -0,0 +1,50 @@ +package source.overload; + +import static jsweet.util.Lang.$insert; + +public class OverLoadVarags { + + public static void main(String[] args) { + OverLoadVarags ov = new OverLoadVarags(); + System.out.println(ov.m(new AClass2())); + System.out.println(ov.m(new AClass2(), true, "a", "b", "c")); + System.out.println((String)$insert("ov.m(new AClass2())")); + System.out.println((String)$insert("ov.m(new AClass2(), true, 'a', 'b', 'c')")); + assert ov.m(new AClass2()) == "1:object"; + assert ov.m(new AClass2(), true, "a", "b", "c") == "objecta,b,c/3"; + assert $insert("ov.m(new AClass2())") == "1:object"; + assert $insert("ov.m(new AClass2(), true, 'a', 'b', 'c')") == "objecta,b,c/3"; + // passing an array does not work + // TODO: when invoking org method, test if passed expression type is an array and use call + //assert $insert("ov.m(new AClass2(), true, ['a', 'b', 'c'])") == "objecta,b,c/3"; + assert ov.mref(new AClass2(), "a", "b", "c") == "objecta,b,c/3"; + assert ov.mref(new AClass2(), new String[] {"a", "b", "c"}) == "objecta,b,c/3"; + } + + String m(AnInterface2 dto, boolean b, String... options) { + return dto.getName() + varM(options); + } + + String m(AnInterface2 dto) { + return "1:" + dto.getName(); + } + + String mref(AnInterface2 dto, String... options) { + return dto.getName() + varM(options); + } + + String varM(String... options) { + return "" + options + "/" + $insert("arguments.length"); + } + +} + +interface AnInterface2 { + String getName(); +} + +class AClass2 implements AnInterface2 { + public String getName() { + return "object"; + } +} diff --git a/transpiler/src/test/resources/j4ts.js b/transpiler/src/test/resources/j4ts.js new file mode 100644 index 00000000..38dbc524 --- /dev/null +++ b/transpiler/src/test/resources/j4ts.js @@ -0,0 +1,31761 @@ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __spreadArrays = (this && this.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; +/* Generated from Java with JSweet 2.3.9-SNAPSHOT - http://www.jsweet.org */ +var javaemul; +(function (javaemul) { + var internal; + (function (internal) { + /** + * Private implementation class for GWT. This API should not be + * considered public or stable. + * @class + */ + var Coercions = /** @class */ (function () { + function Coercions() { + } + /** + * Coerce js int to 32 bits. + * Trick related to JS and lack of integer rollover. + * {@see com.google.gwt.lang.Cast#narrow_int} + * @param {number} value + * @return {number} + */ + Coercions.ensureInt = function (value) { + return value | 0; + }; + return Coercions; + }()); + internal.Coercions = Coercions; + Coercions["__class"] = "javaemul.internal.Coercions"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var JreHelper = /** @class */ (function () { + function JreHelper() { + } + JreHelper.LOG10E_$LI$ = function () { if (JreHelper.LOG10E == null) { + JreHelper.LOG10E = Math.LOG10E; + } return JreHelper.LOG10E; }; + ; + return JreHelper; + }()); + internal.JreHelper = JreHelper; + JreHelper["__class"] = "javaemul.internal.JreHelper"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Wraps native boolean as an object. + * @param {boolean} value + * @class + */ + var BooleanHelper = /** @class */ (function () { + function BooleanHelper() { + } + BooleanHelper.TYPE_$LI$ = function () { if (BooleanHelper.TYPE == null) { + BooleanHelper.TYPE = Boolean; + } return BooleanHelper.TYPE; }; + ; + BooleanHelper.compare = function (x, y) { + return (x === y) ? 0 : (x ? 1 : -1); + }; + BooleanHelper.hashCode = function (value) { + return value ? 1231 : 1237; + }; + BooleanHelper.logicalAnd = function (a, b) { + return a && b; + }; + BooleanHelper.logicalOr = function (a, b) { + return a || b; + }; + BooleanHelper.logicalXor = function (a, b) { + return (a) !== (b); + }; + BooleanHelper.parseBoolean = function (s) { + return /* equalsIgnoreCase */ (function (o1, o2) { return o1.toUpperCase() === (o2 === null ? o2 : o2.toUpperCase()); })("true", s); + }; + BooleanHelper.toString = function (x) { + return /* valueOf */ new String(x).toString(); + }; + BooleanHelper.valueOf$boolean = function (b) { + return b ? BooleanHelper.TRUE : BooleanHelper.FALSE; + }; + BooleanHelper.valueOf$java_lang_String = function (s) { + return BooleanHelper.valueOf$boolean(BooleanHelper.parseBoolean(s)); + }; + BooleanHelper.valueOf = function (s) { + if (((typeof s === 'string') || s === null)) { + return javaemul.internal.BooleanHelper.valueOf$java_lang_String(s); + } + else if (((typeof s === 'boolean') || s === null)) { + return javaemul.internal.BooleanHelper.valueOf$boolean(s); + } + else + throw new Error('invalid overload'); + }; + BooleanHelper.prototype.booleanValue = function () { + return BooleanHelper.unsafeCast((javaemul.internal.InternalPreconditions.checkNotNull(this))); + }; + /*private*/ BooleanHelper.unsafeCast = function (value) { + return value; + }; + BooleanHelper.prototype.compareTo$javaemul_internal_BooleanHelper = function (b) { + return BooleanHelper.compare(this.booleanValue(), b.booleanValue()); + }; + /** + * + * @param {javaemul.internal.BooleanHelper} b + * @return {number} + */ + BooleanHelper.prototype.compareTo = function (b) { + if (((b != null && b instanceof javaemul.internal.BooleanHelper) || b === null)) { + return this.compareTo$javaemul_internal_BooleanHelper(b); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + BooleanHelper.prototype.equals = function (o) { + return javaemul.internal.InternalPreconditions.checkNotNull(this) === o; + }; + /** + * + * @return {number} + */ + BooleanHelper.prototype.hashCode = function () { + return BooleanHelper.hashCode(this.booleanValue()); + }; + /** + * + * @return {string} + */ + BooleanHelper.prototype.toString = function () { + return BooleanHelper.toString(this.booleanValue()); + }; + BooleanHelper.FALSE = false; + BooleanHelper.TRUE = true; + return BooleanHelper; + }()); + internal.BooleanHelper = BooleanHelper; + BooleanHelper["__class"] = "javaemul.internal.BooleanHelper"; + BooleanHelper["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Hashcode caching for strings. + * @class + */ + var StringHashCache = /** @class */ (function () { + function StringHashCache() { + } + StringHashCache.back_$LI$ = function () { if (StringHashCache.back == null) { + StringHashCache.back = StringHashCache.createNativeObject(); + } return StringHashCache.back; }; + ; + StringHashCache.front_$LI$ = function () { if (StringHashCache.front == null) { + StringHashCache.front = StringHashCache.createNativeObject(); + } return StringHashCache.front; }; + ; + StringHashCache.getHashCode = function (str) { + var key = ":" + str; + var result = StringHashCache.getProperty(StringHashCache.front_$LI$(), key); + if (!javaemul.internal.JsUtils.isUndefined(result)) { + return StringHashCache.unsafeCastToInt(result); + } + result = StringHashCache.getProperty(StringHashCache.back_$LI$(), key); + var hashCode = javaemul.internal.JsUtils.isUndefined(result) ? StringHashCache.compute(str) : StringHashCache.unsafeCastToInt(result); + StringHashCache.increment(); + javaemul.internal.JsUtils.setIntProperty(StringHashCache.front_$LI$(), key, hashCode); + return hashCode; + }; + /*private*/ StringHashCache.compute = function (str) { + var hashCode = 0; + var n = str.length; + var nBatch = n - 4; + var i = 0; + while ((i < nBatch)) { + { + hashCode = (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(str.charAt(i + 3)) + 31 * ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(str.charAt(i + 2)) + 31 * ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(str.charAt(i + 1)) + 31 * ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(str.charAt(i)) + 31 * hashCode))); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + i += 4; + } + } + ; + while ((i < n)) { + { + hashCode = hashCode * 31 + (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(str.charAt(i++)); + } + } + ; + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + return hashCode; + }; + /*private*/ StringHashCache.increment = function () { + if (StringHashCache.count === StringHashCache.MAX_CACHE) { + StringHashCache.back = StringHashCache.front; + StringHashCache.front = StringHashCache.createNativeObject(); + StringHashCache.count = 0; + } + ++StringHashCache.count; + }; + /*private*/ StringHashCache.getProperty = function (map, key) { + return (map[key]); + }; + /*private*/ StringHashCache.createNativeObject = function () { + return ({}); + }; + /*private*/ StringHashCache.unsafeCastToInt = function (o) { + return (o); + }; + /** + * Tracks the number of entries in front. + */ + StringHashCache.count = 0; + /** + * Pulled this number out of thin air. + */ + StringHashCache.MAX_CACHE = 256; + return StringHashCache; + }()); + internal.StringHashCache = StringHashCache; + StringHashCache["__class"] = "javaemul.internal.StringHashCache"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var ConsumingFunction = /** @class */ (function () { + function ConsumingFunction(consumer) { + if (this.consumer === undefined) { + this.consumer = null; + } + this.consumer = (consumer); + } + /** + * + * @param {*} t + * @return {*} + */ + ConsumingFunction.prototype.apply = function (t) { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(this.consumer); + return t; + }; + return ConsumingFunction; + }()); + stream.ConsumingFunction = ConsumingFunction; + ConsumingFunction["__class"] = "javaemul.internal.stream.ConsumingFunction"; + ConsumingFunction["__interfaces"] = ["java.util.function.Function"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var TerminalStreamRow = /** @class */ (function () { + function TerminalStreamRow() { + } + TerminalStreamRow.prototype.chain = function (next) { + if (next.constructor === javaemul.internal.stream.StreamRowEnd) { + return; + } + throw new java.lang.IllegalStateException(); + }; + TerminalStreamRow.prototype.end = function () { + }; + return TerminalStreamRow; + }()); + stream.TerminalStreamRow = TerminalStreamRow; + TerminalStreamRow["__class"] = "javaemul.internal.stream.TerminalStreamRow"; + TerminalStreamRow["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var RunnableChain = /** @class */ (function () { + function RunnableChain(run) { + if (this.run === undefined) { + this.run = null; + } + if (this.next === undefined) { + this.next = null; + } + this.run = (run); + } + RunnableChain.prototype.chain = function (next) { + if (this.next == null) { + this.next = next; + return; + } + this.next.chain(next); + }; + RunnableChain.prototype.runChain = function () { + ((function (target) { return (target['run'] === undefined) ? target : target['run']; })(this.run))(); + if (this.next == null) { + return; + } + this.next.runChain(); + }; + return RunnableChain; + }()); + stream.RunnableChain = RunnableChain; + RunnableChain["__class"] = "javaemul.internal.stream.RunnableChain"; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var QuiteRunnable = /** @class */ (function () { + function QuiteRunnable(loudRunnable) { + if (this.loudRunnable === undefined) { + this.loudRunnable = null; + } + this.loudRunnable = (loudRunnable); + } + /** + * + */ + QuiteRunnable.prototype.run = function () { + try { + ((function (target) { return (target['run'] === undefined) ? target : target['run']; })(this.loudRunnable))(); + } + catch (e) { + console.error(e.message, e); + } + ; + }; + return QuiteRunnable; + }()); + stream.QuiteRunnable = QuiteRunnable; + QuiteRunnable["__class"] = "javaemul.internal.stream.QuiteRunnable"; + QuiteRunnable["__interfaces"] = ["java.lang.Runnable"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var ChooseSmallest = /** @class */ (function () { + function ChooseSmallest(comparator) { + if (this.comparator === undefined) { + this.comparator = null; + } + this.comparator = (comparator); + } + ChooseSmallest.prototype.apply = function (t1, t2) { + if (((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.comparator))(t1, t2) <= 0) { + return t1; + } + return t2; + }; + return ChooseSmallest; + }()); + stream.ChooseSmallest = ChooseSmallest; + ChooseSmallest["__class"] = "javaemul.internal.stream.ChooseSmallest"; + ChooseSmallest["__interfaces"] = ["java.util.function.BiFunction", "java.util.function.BinaryOperator"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamHelper = /** @class */ (function () { + function StreamHelper(data) { + if (this.onCloseChain === undefined) { + this.onCloseChain = null; + } + if (this.head === undefined) { + this.head = null; + } + if (this.end === undefined) { + this.end = null; + } + if (this.data === undefined) { + this.data = null; + } + this.head = new javaemul.internal.stream.StreamRowMap(function (o) { return o; }); + this.end = new javaemul.internal.stream.StreamRowEnd(this.head); + this.head.chain(this.end); + this.data = data; + } + /*private*/ StreamHelper.prototype.chain = function (streamRow) { + this.end.chain(streamRow); + return this; + }; + /*private*/ StreamHelper.prototype.play = function () { + for (var index121 = this.data.iterator(); index121.hasNext();) { + var item = index121.next(); + { + if (!this.head.item(item)) { + break; + } + } + } + this.head.end(); + }; + /*private*/ StreamHelper.prototype.foldRight = function (identity, accumulator) { + var rowReduce = new javaemul.internal.stream.StreamRowReduce(identity, (accumulator)); + this.chain(rowReduce); + this.play(); + return rowReduce.getResult(); + }; + StreamHelper.prototype.filter = function (predicate) { + return this.chain(new javaemul.internal.stream.StreamRowFilter((predicate))); + }; + StreamHelper.prototype.map = function (mapper) { + return this.chain(new javaemul.internal.stream.StreamRowMap((mapper))); + }; + StreamHelper.prototype.mapToObj = function (mapper) { + return this.chain(new javaemul.internal.stream.StreamRowMap(function (n) { return (function (target) { return (typeof target === 'function') ? target(n) : target.apply(n); })(mapper); })); + }; + StreamHelper.prototype.flatMap = function (mapper) { + return this.chain(new javaemul.internal.stream.StreamRowFlatMap((mapper))); + }; + StreamHelper.prototype.distinct = function () { + return this.chain(new javaemul.internal.stream.StreamRowCollector((new java.util.LinkedHashSet()))); + }; + StreamHelper.prototype.sorted$ = function () { + return this.sorted$java_util_Comparator(function (a, b) { return a.compareTo(b); }); + }; + StreamHelper.prototype.sorted$java_util_Comparator = function (comparator) { + return this.chain(new javaemul.internal.stream.StreamRowSortingCollector((new java.util.ArrayList()), (comparator))); + }; + StreamHelper.prototype.sorted = function (comparator) { + if (((typeof comparator === 'function' && comparator.length === 2) || comparator === null)) { + return this.sorted$java_util_Comparator(comparator); + } + else if (comparator === undefined) { + return this.sorted$(); + } + else + throw new Error('invalid overload'); + }; + StreamHelper.prototype.peek = function (action) { + return this.chain(new javaemul.internal.stream.StreamRowMap(function (arg0) { return new javaemul.internal.stream.ConsumingFunction(action).apply(arg0); })); + }; + StreamHelper.prototype.limit = function (maxSize) { + return this.chain(new javaemul.internal.stream.StreamRowFilterFlop(function (arg0) { return new javaemul.internal.stream.CountingPredicate(maxSize).test(arg0); })); + }; + StreamHelper.prototype.skip = function (n) { + var p = (new javaemul.internal.stream.CountingPredicate(n)); + return this.chain(new javaemul.internal.stream.StreamRowFilter((function (p) { + return function (v) { return !p.test(v); }; + })(p))); + }; + StreamHelper.prototype.forEach = function (action) { + this.peek((action)); + this.play(); + }; + StreamHelper.prototype.forEachOrdered = function (action) { + this.forEach((action)); + }; + StreamHelper.prototype.toArray$ = function () { + var result = (new java.util.ArrayList()); + this.chain(new javaemul.internal.stream.StreamRowCollector(result)); + this.play(); + return result['toArray$'](); + }; + StreamHelper.prototype.toArray$java_util_function_IntFunction = function (generator) { + var result = (new java.util.ArrayList()); + this.chain(new javaemul.internal.stream.StreamRowCollector(result)); + this.play(); + return result['toArray$java_lang_Object_A']((function (target) { return (typeof target === 'function') ? target(result.size()) : target.apply(result.size()); })(generator)); + }; + StreamHelper.prototype.toArray = function (generator) { + if (((typeof generator === 'function' && generator.length === 1) || generator === null)) { + return this.toArray$java_util_function_IntFunction(generator); + } + else if (generator === undefined) { + return this.toArray$(); + } + else + throw new Error('invalid overload'); + }; + StreamHelper.prototype.reduce$java_lang_Object$java_util_function_BinaryOperator = function (identity, accumulator) { + return this.foldRight(java.util.Optional.of(identity), (accumulator)).get(); + }; + StreamHelper.prototype.reduce$java_util_function_BinaryOperator = function (accumulator) { + return this.foldRight(java.util.Optional.empty(), (accumulator)); + }; + StreamHelper.prototype.collect$java_util_stream_Collector = function (collector) { + var container = (function (target) { return (typeof target === 'function') ? target() : target.get(); })(collector.supplier()); + var accumulator = (collector.accumulator()); + this.chain(new javaemul.internal.stream.StreamRowMap(function (arg0) { + return new javaemul.internal.stream.ConsumingFunction((function (container, accumulator) { + return function (item) { return (function (target) { return (typeof target === 'function') ? target(container, item) : target.accept(container, item); })(accumulator); }; + })(container, accumulator)).apply(arg0); + })); + this.play(); + return container; + }; + StreamHelper.prototype.min = function (comparator) { + return this.foldRight(java.util.Optional.empty(), function (a, b) { return ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(comparator))(a, b) <= 0 ? a : b; }); + }; + StreamHelper.prototype.max = function (comparator) { + return this.foldRight(java.util.Optional.empty(), function (a, b) { return ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(comparator))(a, b) >= 0 ? a : b; }); + }; + StreamHelper.prototype.count = function () { + var counter = new javaemul.internal.stream.StreamRowCount(); + this.chain(counter); + this.play(); + return counter.getCount(); + }; + StreamHelper.prototype.anyMatch = function (predicate) { + var streamRow = new javaemul.internal.stream.StreamRowOnceFilter((predicate)); + this.chain(streamRow); + this.play(); + return streamRow.getPredicateValue(); + }; + StreamHelper.prototype.allMatch = function (predicate) { + var streamRow = new javaemul.internal.stream.StreamRowAllFilter((predicate)); + this.chain(streamRow); + this.play(); + return streamRow.getPredicateValue(); + }; + StreamHelper.prototype.noneMatch = function (predicate) { + return this.allMatch(function (v) { return !(function (target) { return (typeof target === 'function') ? target(v) : target.test(v); })(predicate); }); + }; + StreamHelper.prototype.findFirst = function () { + var streamRow = new javaemul.internal.stream.StreamRowOnceFilter(function (o) { return true; }); + this.chain(streamRow); + this.play(); + return streamRow.getFirstMatch(); + }; + StreamHelper.prototype.findAny = function () { + return this.findFirst(); + }; + StreamHelper.prototype.iterator = function () { + var result = (new java.util.ArrayList()); + this.chain(new javaemul.internal.stream.StreamRowCollector(result)); + this.play(); + return result.iterator(); + }; + StreamHelper.prototype.isParallel = function () { + return false; + }; + StreamHelper.prototype.sequential = function () { + return this; + }; + StreamHelper.prototype.parallel = function () { + return this; + }; + StreamHelper.prototype.unordered = function () { + return this; + }; + StreamHelper.prototype.onClose = function (closeHandler) { + var chainItem = new javaemul.internal.stream.RunnableChain(function () { return new javaemul.internal.stream.QuiteRunnable(closeHandler).run(); }); + if (this.onCloseChain == null) { + this.onCloseChain = chainItem; + } + else { + this.onCloseChain.chain(chainItem); + } + return this; + }; + StreamHelper.prototype.close = function () { + if (this.onCloseChain == null) { + return; + } + this.onCloseChain.runChain(); + }; + StreamHelper.prototype.mapToInt = function (mapper) { + throw new java.lang.IllegalStateException(); + }; + StreamHelper.prototype.mapToLong = function (mapper) { + throw new java.lang.IllegalStateException(); + }; + StreamHelper.prototype.mapToDouble = function (mapper) { + throw new java.lang.IllegalStateException(); + }; + StreamHelper.prototype.flatMapToInt = function (mapper) { + throw new java.lang.IllegalStateException(); + }; + StreamHelper.prototype.flatMapToLong = function (mapper) { + throw new java.lang.IllegalStateException(); + }; + StreamHelper.prototype.flatMapToDouble = function (mapper) { + throw new java.lang.IllegalStateException(); + }; + StreamHelper.prototype.spliterator = function () { + throw new java.lang.IllegalStateException(); + }; + StreamHelper.prototype.reduce$java_lang_Object$java_util_function_BiFunction$java_util_function_BinaryOperator = function (identity, accumulator, combiner) { + throw new java.lang.IllegalStateException(); + }; + StreamHelper.prototype.reduce = function (identity, accumulator, combiner) { + if (((identity != null) || identity === null) && ((typeof accumulator === 'function' && accumulator.length === 2) || accumulator === null) && ((typeof combiner === 'function' && combiner.length === 2) || combiner === null)) { + return this.reduce$java_lang_Object$java_util_function_BiFunction$java_util_function_BinaryOperator(identity, accumulator, combiner); + } + else if (((identity != null) || identity === null) && ((typeof accumulator === 'function' && accumulator.length === 2) || accumulator === null) && combiner === undefined) { + return this.reduce$java_lang_Object$java_util_function_BinaryOperator(identity, accumulator); + } + else if (((typeof identity === 'function' && identity.length === 2) || identity === null) && accumulator === undefined && combiner === undefined) { + return this.reduce$java_util_function_BinaryOperator(identity); + } + else + throw new Error('invalid overload'); + }; + StreamHelper.prototype.collect$java_util_function_Supplier$java_util_function_BiConsumer$java_util_function_BiConsumer = function (supplier, accumulator, combiner) { + throw new java.lang.IllegalStateException(); + }; + StreamHelper.prototype.collect = function (supplier, accumulator, combiner) { + if (((typeof supplier === 'function' && supplier.length === 0) || supplier === null) && ((typeof accumulator === 'function' && accumulator.length === 2) || accumulator === null) && ((typeof combiner === 'function' && combiner.length === 2) || combiner === null)) { + return this.collect$java_util_function_Supplier$java_util_function_BiConsumer$java_util_function_BiConsumer(supplier, accumulator, combiner); + } + else if (((supplier != null && (supplier["__interfaces"] != null && supplier["__interfaces"].indexOf("java.util.stream.Collector") >= 0 || supplier.constructor != null && supplier.constructor["__interfaces"] != null && supplier.constructor["__interfaces"].indexOf("java.util.stream.Collector") >= 0)) || supplier === null) && accumulator === undefined && combiner === undefined) { + return this.collect$java_util_stream_Collector(supplier); + } + else + throw new Error('invalid overload'); + }; + return StreamHelper; + }()); + stream.StreamHelper = StreamHelper; + StreamHelper["__class"] = "javaemul.internal.stream.StreamHelper"; + StreamHelper["__interfaces"] = ["java.util.stream.Stream"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var CountingPredicate = /** @class */ (function () { + function CountingPredicate(n) { + if (this.countDown === undefined) { + this.countDown = 0; + } + this.countDown = n; + } + /** + * + * @param {*} t + * @return {boolean} + */ + CountingPredicate.prototype.test = function (t) { + if (this.countDown <= 0) { + return false; + } + --this.countDown; + return true; + }; + return CountingPredicate; + }()); + stream.CountingPredicate = CountingPredicate; + CountingPredicate["__class"] = "javaemul.internal.stream.CountingPredicate"; + CountingPredicate["__interfaces"] = ["java.util.function.Predicate"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var TransientStreamRow = /** @class */ (function () { + function TransientStreamRow() { + if (this.next === undefined) { + this.next = null; + } + } + TransientStreamRow.prototype.chain = function (next) { + this.next = next; + }; + return TransientStreamRow; + }()); + stream.TransientStreamRow = TransientStreamRow; + TransientStreamRow["__class"] = "javaemul.internal.stream.TransientStreamRow"; + TransientStreamRow["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var VoidRunnable = /** @class */ (function () { + function VoidRunnable() { + } + VoidRunnable.dryRun_$LI$ = function () { if (VoidRunnable.dryRun == null) { + VoidRunnable.dryRun = new VoidRunnable(); + } return VoidRunnable.dryRun; }; + ; + VoidRunnable.prototype.run = function () { + }; + return VoidRunnable; + }()); + stream.VoidRunnable = VoidRunnable; + VoidRunnable["__class"] = "javaemul.internal.stream.VoidRunnable"; + VoidRunnable["__interfaces"] = ["java.lang.Runnable"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Provides an interface for simple JavaScript idioms that can not be expressed in Java. + * @class + */ + var JsUtils = /** @class */ (function () { + function JsUtils() { + } + JsUtils.getInfinity = function () { + return Infinity; + }; + JsUtils.isUndefined = function (value) { + return value == null; + }; + JsUtils.unsafeCastToString = function (string) { + return string; + }; + JsUtils.setPropertySafe = function (map, key, value) { + try { + (map)[key] = value; + } + catch (e) { + } + ; + }; + JsUtils.getIntProperty = function (map, key) { + return ((map)[key]); + }; + JsUtils.setIntProperty = function (map, key, value) { + (map)[key] = value; + }; + JsUtils.typeOf = function (o) { + return typeof o; + }; + return JsUtils; + }()); + internal.JsUtils = JsUtils; + JsUtils["__class"] = "javaemul.internal.JsUtils"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * A helper class for long comparison. + * @class + */ + var LongCompareHolder = /** @class */ (function () { + function LongCompareHolder() { + } + LongCompareHolder.getLongComparator = function () { + return function (l1, l2) { return l2 - l1; }; + }; + return LongCompareHolder; + }()); + internal.LongCompareHolder = LongCompareHolder; + LongCompareHolder["__class"] = "javaemul.internal.LongCompareHolder"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var ObjectHelper = /** @class */ (function () { + function ObjectHelper() { + } + ObjectHelper.clone = function (obj) { + var copy; + if (null == obj || "object" != typeof obj) + return obj; + if (obj instanceof Date) { + copy = new Date(); + copy.setTime(obj.getTime()); + return copy; + } + ; + if (obj instanceof Array) { + copy = []; + for (var i = 0, len = obj.length; i < len; i++) { + copy[i] = javaemul.internal.ObjectHelper.clone(obj[i]); + } + return copy; + } + ; + if (obj instanceof Object) { + copy = {}; + for (var attr in obj) { + if (obj.hasOwnProperty(attr)) + copy[attr] = javaemul.internal.ObjectHelper.clone(obj[attr]); + } + return copy; + } + ; + throw new Error("Unable to copy obj! Its type isn\'t supported."); + }; + return ObjectHelper; + }()); + internal.ObjectHelper = ObjectHelper; + ObjectHelper["__class"] = "javaemul.internal.ObjectHelper"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Wraps a native char as an object. + * + * TODO(jat): many of the classification methods implemented here are not + * correct in that they only handle ASCII characters, and many other methods are + * not currently implemented. I think the proper approach is to introduce * a + * deferred binding parameter which substitutes an implementation using a + * fully-correct Unicode character database, at the expense of additional data + * being downloaded. That way developers that need the functionality can get it + * without those who don't need it paying for it. + * + *
+         * The following methods are still not implemented -- most would require Unicode
+         * character db to be useful:
+         * - digit / is* / to*(int codePoint)
+         * - isDefined(char)
+         * - isIdentifierIgnorable(char)
+         * - isJavaIdentifierPart(char)
+         * - isJavaIdentifierStart(char)
+         * - isJavaLetter(char) -- deprecated, so probably not
+         * - isJavaLetterOrDigit(char) -- deprecated, so probably not
+         * - isISOControl(char)
+         * - isMirrored(char)
+         * - isSpaceChar(char)
+         * - isTitleCase(char)
+         * - isUnicodeIdentifierPart(char)
+         * - isUnicodeIdentifierStart(char)
+         * - getDirectionality(*)
+         * - getNumericValue(*)
+         * - getType(*)
+         * - reverseBytes(char) -- any use for this at all in the browser?
+         * - toTitleCase(*)
+         * - all the category constants for classification
+         *
+         * The following do not properly handle characters outside of ASCII:
+         * - digit(char c, int radix)
+         * - isDigit(char c)
+         * - isLetter(char c)
+         * - isLetterOrDigit(char c)
+         * - isLowerCase(char c)
+         * - isUpperCase(char c)
+         * 
+ * @param {string} value + * @class + */ + var CharacterHelper = /** @class */ (function () { + function CharacterHelper(value) { + if (this.value === undefined) { + this.value = null; + } + this.value = value; + } + CharacterHelper.TYPE_$LI$ = function () { if (CharacterHelper.TYPE == null) { + CharacterHelper.TYPE = String; + } return CharacterHelper.TYPE; }; + ; + CharacterHelper.charCount = function (codePoint) { + return codePoint >= CharacterHelper.MIN_SUPPLEMENTARY_CODE_POINT ? 2 : 1; + }; + CharacterHelper.codePointAt$char_A$int = function (a, index) { + return CharacterHelper.codePointAt$java_lang_CharSequence$int$int(new String(a), index, a.length); + }; + CharacterHelper.codePointAt$char_A$int$int = function (a, index, limit) { + return CharacterHelper.codePointAt$java_lang_CharSequence$int$int(new String(a), index, limit); + }; + CharacterHelper.codePointAt = function (a, index, limit) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null) && ((typeof index === 'number') || index === null) && ((typeof limit === 'number') || limit === null)) { + return javaemul.internal.CharacterHelper.codePointAt$char_A$int$int(a, index, limit); + } + else if (((a != null && (a["__interfaces"] != null && a["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || a.constructor != null && a.constructor["__interfaces"] != null && a.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof a === "string")) || a === null) && ((typeof index === 'number') || index === null) && ((typeof limit === 'number') || limit === null)) { + return javaemul.internal.CharacterHelper.codePointAt$java_lang_CharSequence$int$int(a, index, limit); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null) && ((typeof index === 'number') || index === null) && limit === undefined) { + return javaemul.internal.CharacterHelper.codePointAt$char_A$int(a, index); + } + else if (((a != null && (a["__interfaces"] != null && a["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || a.constructor != null && a.constructor["__interfaces"] != null && a.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof a === "string")) || a === null) && ((typeof index === 'number') || index === null) && limit === undefined) { + return javaemul.internal.CharacterHelper.codePointAt$java_lang_CharSequence$int(a, index); + } + else + throw new Error('invalid overload'); + }; + CharacterHelper.codePointAt$java_lang_CharSequence$int = function (seq, index) { + return CharacterHelper.codePointAt$java_lang_CharSequence$int$int(seq, index, seq.length); + }; + CharacterHelper.codePointBefore$char_A$int = function (a, index) { + return CharacterHelper.codePointBefore$java_lang_CharSequence$int$int(new String(a), index, 0); + }; + CharacterHelper.codePointBefore$char_A$int$int = function (a, index, start) { + return CharacterHelper.codePointBefore$java_lang_CharSequence$int$int(new String(a), index, start); + }; + CharacterHelper.codePointBefore = function (a, index, start) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null) && ((typeof index === 'number') || index === null) && ((typeof start === 'number') || start === null)) { + return javaemul.internal.CharacterHelper.codePointBefore$char_A$int$int(a, index, start); + } + else if (((a != null && (a["__interfaces"] != null && a["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || a.constructor != null && a.constructor["__interfaces"] != null && a.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof a === "string")) || a === null) && ((typeof index === 'number') || index === null) && ((typeof start === 'number') || start === null)) { + return javaemul.internal.CharacterHelper.codePointBefore$java_lang_CharSequence$int$int(a, index, start); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null) && ((typeof index === 'number') || index === null) && start === undefined) { + return javaemul.internal.CharacterHelper.codePointBefore$char_A$int(a, index); + } + else if (((a != null && (a["__interfaces"] != null && a["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || a.constructor != null && a.constructor["__interfaces"] != null && a.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof a === "string")) || a === null) && ((typeof index === 'number') || index === null) && start === undefined) { + return javaemul.internal.CharacterHelper.codePointBefore$java_lang_CharSequence$int(a, index); + } + else + throw new Error('invalid overload'); + }; + CharacterHelper.codePointBefore$java_lang_CharSequence$int = function (cs, index) { + return CharacterHelper.codePointBefore$java_lang_CharSequence$int$int(cs, index, 0); + }; + CharacterHelper.codePointCount$char_A$int$int = function (a, offset, count) { + return CharacterHelper.codePointCount$java_lang_CharSequence$int$int(new String(a), offset, offset + count); + }; + CharacterHelper.codePointCount = function (a, offset, count) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null) && ((typeof offset === 'number') || offset === null) && ((typeof count === 'number') || count === null)) { + return javaemul.internal.CharacterHelper.codePointCount$char_A$int$int(a, offset, count); + } + else if (((a != null && (a["__interfaces"] != null && a["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || a.constructor != null && a.constructor["__interfaces"] != null && a.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof a === "string")) || a === null) && ((typeof offset === 'number') || offset === null) && ((typeof count === 'number') || count === null)) { + return javaemul.internal.CharacterHelper.codePointCount$java_lang_CharSequence$int$int(a, offset, count); + } + else + throw new Error('invalid overload'); + }; + CharacterHelper.codePointCount$java_lang_CharSequence$int$int = function (seq, beginIndex, endIndex) { + var count = 0; + for (var idx = beginIndex; idx < endIndex;) { + { + var ch = seq.charAt(idx++); + if (CharacterHelper.isHighSurrogate(ch) && idx < endIndex && (CharacterHelper.isLowSurrogate(seq.charAt(idx)))) { + ++idx; + } + ++count; + } + ; + } + return count; + }; + CharacterHelper.compare = function (x, y) { + return (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(x) - (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(y); + }; + CharacterHelper.digit = function (c, radix) { + if (radix < CharacterHelper.MIN_RADIX || radix > CharacterHelper.MAX_RADIX) { + return -1; + } + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) >= '0'.charCodeAt(0) && (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) < '0'.charCodeAt(0) + Math.min(radix, 10)) { + return (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) - '0'.charCodeAt(0); + } + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) >= 'a'.charCodeAt(0) && (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) < (radix + 'a'.charCodeAt(0) - 10)) { + return (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) - 'a'.charCodeAt(0) + 10; + } + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) >= 'A'.charCodeAt(0) && (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) < (radix + 'A'.charCodeAt(0) - 10)) { + return (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) - 'A'.charCodeAt(0) + 10; + } + return -1; + }; + CharacterHelper.getNumericValue = function (ch) { + return (ch.charCodeAt(0) | 0); + }; + CharacterHelper.forDigit$int$int = function (digit, radix) { + if (radix < CharacterHelper.MIN_RADIX || radix > CharacterHelper.MAX_RADIX) { + return String.fromCharCode(0); + } + if (digit < 0 || digit >= radix) { + return String.fromCharCode(0); + } + return CharacterHelper.forDigit$int(digit); + }; + CharacterHelper.forDigit = function (digit, radix) { + if (((typeof digit === 'number') || digit === null) && ((typeof radix === 'number') || radix === null)) { + return javaemul.internal.CharacterHelper.forDigit$int$int(digit, radix); + } + else if (((typeof digit === 'number') || digit === null) && radix === undefined) { + return javaemul.internal.CharacterHelper.forDigit$int(digit); + } + else + throw new Error('invalid overload'); + }; + /** + * @skip + * + * public for shared implementation with Arrays.hashCode + * @param {string} c + * @return {number} + */ + CharacterHelper.hashCode = function (c) { + return (c).charCodeAt(0); + }; + CharacterHelper.isDigit = function (c) { + var result = ( /* valueOf */new String(c).toString()).match(CharacterHelper.digitRegex()); + return result != null && result.length > 0; + }; + CharacterHelper.digitRegex = function () { + return new RegExp("\\d"); + }; + CharacterHelper.isHighSurrogate = function (ch) { + return (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(ch) >= (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(CharacterHelper.MIN_HIGH_SURROGATE) && (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(ch) <= (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(CharacterHelper.MAX_HIGH_SURROGATE); + }; + CharacterHelper.isLetter = function (c) { + return ( /* valueOf */new String(c).toString()).match(CharacterHelper.leterRegex()).length > 0; + }; + CharacterHelper.leterRegex = function () { + return new RegExp("[A-Z]", "i"); + }; + CharacterHelper.isLetterOrDigit = function (c) { + var array = ( /* valueOf */new String(c).toString()).match(CharacterHelper.leterOrDigitRegex()); + if (array != null) + return ( /* valueOf */new String(c).toString()).match(CharacterHelper.leterOrDigitRegex()).length > 0; + return false; + }; + CharacterHelper.leterOrDigitRegex = function () { + return new RegExp("[A-Z\\d]", "i"); + }; + CharacterHelper.isLowerCase = function (c) { + return (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(CharacterHelper.toLowerCase$char(c)) == (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) && CharacterHelper.isLetter(c); + }; + CharacterHelper.isLowSurrogate = function (ch) { + return (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(ch) >= (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(CharacterHelper.MIN_LOW_SURROGATE) && (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(ch) <= (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(CharacterHelper.MAX_LOW_SURROGATE); + }; + /** + * Deprecated - see isWhitespace(char). + * @param {string} c + * @return {boolean} + */ + CharacterHelper.isSpace = function (c) { + switch ((c).charCodeAt(0)) { + case 32 /* ' ' */: + return true; + case 10 /* '\n' */: + return true; + case 9 /* '\t' */: + return true; + case 12 /* '\f' */: + return true; + case 13 /* '\r' */: + return true; + default: + return false; + } + }; + CharacterHelper.isWhitespace$char = function (ch) { + return ( /* valueOf */new String(ch).toString()).match(CharacterHelper.whitespaceRegex()).length > 0; + }; + CharacterHelper.isWhitespace = function (ch) { + if (((typeof ch === 'string') || ch === null)) { + return javaemul.internal.CharacterHelper.isWhitespace$char(ch); + } + else if (((typeof ch === 'number') || ch === null)) { + return javaemul.internal.CharacterHelper.isWhitespace$int(ch); + } + else + throw new Error('invalid overload'); + }; + CharacterHelper.isWhitespace$int = function (codePoint) { + return String.fromCharCode(codePoint).match(CharacterHelper.whitespaceRegex()).length > 0; + }; + CharacterHelper.whitespaceRegex = function () { + return new RegExp("[\\t-\\r \\u1680\\u180E\\u2000-\\u2006\\u2008-\\u200A\\u2028\\u2029\\u205F\\u3000\\uFEFF]|[\\x1C-\\x1F]"); + }; + CharacterHelper.isSupplementaryCodePoint = function (codePoint) { + return codePoint >= CharacterHelper.MIN_SUPPLEMENTARY_CODE_POINT && codePoint <= CharacterHelper.MAX_CODE_POINT; + }; + CharacterHelper.isSurrogatePair = function (highSurrogate, lowSurrogate) { + return CharacterHelper.isHighSurrogate(highSurrogate) && CharacterHelper.isLowSurrogate(lowSurrogate); + }; + CharacterHelper.isUpperCase = function (c) { + return (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(CharacterHelper.toUpperCase$char(c)) == (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) && CharacterHelper.isLetter(c); + }; + CharacterHelper.isValidCodePoint = function (codePoint) { + return codePoint >= CharacterHelper.MIN_CODE_POINT && codePoint <= CharacterHelper.MAX_CODE_POINT; + }; + CharacterHelper.offsetByCodePoints$char_A$int$int$int$int = function (a, start, count, index, codePointOffset) { + return CharacterHelper.offsetByCodePoints$java_lang_CharSequence$int$int((function (str, index, len) { return str.substring(index, index + len); })((a).join(''), start, count), index, codePointOffset); + }; + CharacterHelper.offsetByCodePoints = function (a, start, count, index, codePointOffset) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null) && ((typeof start === 'number') || start === null) && ((typeof count === 'number') || count === null) && ((typeof index === 'number') || index === null) && ((typeof codePointOffset === 'number') || codePointOffset === null)) { + return javaemul.internal.CharacterHelper.offsetByCodePoints$char_A$int$int$int$int(a, start, count, index, codePointOffset); + } + else if (((a != null && (a["__interfaces"] != null && a["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || a.constructor != null && a.constructor["__interfaces"] != null && a.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof a === "string")) || a === null) && ((typeof start === 'number') || start === null) && ((typeof count === 'number') || count === null) && index === undefined && codePointOffset === undefined) { + return javaemul.internal.CharacterHelper.offsetByCodePoints$java_lang_CharSequence$int$int(a, start, count); + } + else + throw new Error('invalid overload'); + }; + CharacterHelper.offsetByCodePoints$java_lang_CharSequence$int$int = function (seq, index, codePointOffset) { + if (codePointOffset < 0) { + while ((codePointOffset < 0)) { + { + --index; + if (CharacterHelper.isLowSurrogate(seq.charAt(index)) && CharacterHelper.isHighSurrogate(seq.charAt(index - 1))) { + --index; + } + ++codePointOffset; + } + } + ; + } + else { + while ((codePointOffset > 0)) { + { + if (CharacterHelper.isHighSurrogate(seq.charAt(index)) && CharacterHelper.isLowSurrogate(seq.charAt(index + 1))) { + ++index; + } + ++index; + --codePointOffset; + } + } + ; + } + return index; + }; + CharacterHelper.toChars$int = function (codePoint) { + javaemul.internal.InternalPreconditions.checkCriticalArgument(codePoint >= 0 && codePoint <= CharacterHelper.MAX_CODE_POINT, "CodePoint %s not in range [%s, %s]", /* toString */ ('' + (codePoint)), "0", /* toString */ ('' + (CharacterHelper.MAX_CODE_POINT))); + if (codePoint >= CharacterHelper.MIN_SUPPLEMENTARY_CODE_POINT) { + return [CharacterHelper.getHighSurrogate(codePoint), CharacterHelper.getLowSurrogate(codePoint)]; + } + else { + return [String.fromCharCode(codePoint)]; + } + }; + CharacterHelper.toChars$int$char_A$int = function (codePoint, dst, dstIndex) { + javaemul.internal.InternalPreconditions.checkCriticalArgument(codePoint >= 0 && codePoint <= CharacterHelper.MAX_CODE_POINT, "CodePoint %s not in range [%s, %s]", /* toString */ ('' + (codePoint)), "0", /* toString */ ('' + (CharacterHelper.MAX_CODE_POINT))); + if (codePoint >= CharacterHelper.MIN_SUPPLEMENTARY_CODE_POINT) { + dst[dstIndex++] = CharacterHelper.getHighSurrogate(codePoint); + dst[dstIndex] = CharacterHelper.getLowSurrogate(codePoint); + return 2; + } + else { + dst[dstIndex] = String.fromCharCode(codePoint); + return 1; + } + }; + CharacterHelper.toChars = function (codePoint, dst, dstIndex) { + if (((typeof codePoint === 'number') || codePoint === null) && ((dst != null && dst instanceof Array && (dst.length == 0 || dst[0] == null || (typeof dst[0] === 'string'))) || dst === null) && ((typeof dstIndex === 'number') || dstIndex === null)) { + return javaemul.internal.CharacterHelper.toChars$int$char_A$int(codePoint, dst, dstIndex); + } + else if (((typeof codePoint === 'number') || codePoint === null) && dst === undefined && dstIndex === undefined) { + return javaemul.internal.CharacterHelper.toChars$int(codePoint); + } + else + throw new Error('invalid overload'); + }; + CharacterHelper.toCodePoint = function (highSurrogate, lowSurrogate) { + return CharacterHelper.MIN_SUPPLEMENTARY_CODE_POINT + (((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(highSurrogate) & 1023) << 10) + ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(lowSurrogate) & 1023); + }; + CharacterHelper.toLowerCase$char = function (c) { + return /* valueOf */ new String(c).toString().toLowerCase().charAt(0); + }; + CharacterHelper.toLowerCase = function (c) { + if (((typeof c === 'string') || c === null)) { + return javaemul.internal.CharacterHelper.toLowerCase$char(c); + } + else if (((typeof c === 'number') || c === null)) { + return javaemul.internal.CharacterHelper.toLowerCase$int(c); + } + else + throw new Error('invalid overload'); + }; + CharacterHelper.toLowerCase$int = function (c) { + return ( /* valueOf */new String(String.fromCharCode(c)).toString().toLowerCase().charAt(0)).charCodeAt(0); + }; + CharacterHelper.toString = function (x) { + return /* valueOf */ new String(x).toString(); + }; + CharacterHelper.toUpperCase$char = function (c) { + return /* valueOf */ new String(c).toString().toUpperCase().charAt(0); + }; + CharacterHelper.toUpperCase = function (c) { + if (((typeof c === 'string') || c === null)) { + return javaemul.internal.CharacterHelper.toUpperCase$char(c); + } + else if (((typeof c === 'number') || c === null)) { + return javaemul.internal.CharacterHelper.toUpperCase$int(c); + } + else + throw new Error('invalid overload'); + }; + CharacterHelper.toUpperCase$int = function (c) { + return /* valueOf */ new String(String.fromCharCode(c)).toString().toUpperCase().charAt(0); + }; + CharacterHelper.valueOf = function (c) { + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) < 128) { + var result = CharacterHelper.BoxedValues.boxedValues_$LI$()[(c).charCodeAt(0)]; + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(result) == null) { + result = CharacterHelper.BoxedValues.boxedValues_$LI$()[(c).charCodeAt(0)] = new String(c); + } + return result; + } + return new String(c); + }; + CharacterHelper.codePointAt$java_lang_CharSequence$int$int = function (cs, index, limit) { + var hiSurrogate = cs.charAt(index++); + var loSurrogate; + if (CharacterHelper.isHighSurrogate(hiSurrogate) && index < limit && CharacterHelper.isLowSurrogate(loSurrogate = cs.charAt(index))) { + return CharacterHelper.toCodePoint(hiSurrogate, loSurrogate); + } + return (hiSurrogate).charCodeAt(0); + }; + CharacterHelper.codePointBefore$java_lang_CharSequence$int$int = function (cs, index, start) { + var loSurrogate = cs.charAt(--index); + var highSurrogate; + if (CharacterHelper.isLowSurrogate(loSurrogate) && index > start && CharacterHelper.isHighSurrogate(highSurrogate = cs.charAt(index - 1))) { + return CharacterHelper.toCodePoint(highSurrogate, loSurrogate); + } + return (loSurrogate).charCodeAt(0); + }; + CharacterHelper.forDigit$int = function (digit) { + var overBaseTen = digit - 10; + return String.fromCharCode((overBaseTen < 0 ? '0'.charCodeAt(0) + digit : 'a'.charCodeAt(0) + overBaseTen)); + }; + /** + * Computes the high surrogate character of the UTF16 representation of a + * non-BMP code point. See {@link getLowSurrogate}. + * + * @param {number} codePoint + * requested codePoint, required to be >= + * MIN_SUPPLEMENTARY_CODE_POINT + * @return {string} high surrogate character + */ + CharacterHelper.getHighSurrogate = function (codePoint) { + return String.fromCharCode(((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(CharacterHelper.MIN_HIGH_SURROGATE) + (((codePoint - CharacterHelper.MIN_SUPPLEMENTARY_CODE_POINT) >> 10) & 1023))); + }; + /** + * Computes the low surrogate character of the UTF16 representation of a non-BMP + * code point. See {@link getHighSurrogate}. + * + * @param {number} codePoint + * requested codePoint, required to be >= + * MIN_SUPPLEMENTARY_CODE_POINT + * @return {string} low surrogate character + */ + CharacterHelper.getLowSurrogate = function (codePoint) { + return String.fromCharCode(((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(CharacterHelper.MIN_LOW_SURROGATE) + ((codePoint - CharacterHelper.MIN_SUPPLEMENTARY_CODE_POINT) & 1023))); + }; + CharacterHelper.prototype.charValue = function () { + return this.value; + }; + CharacterHelper.prototype.compareTo$javaemul_internal_CharacterHelper = function (c) { + return CharacterHelper.compare(this.value, c.value); + }; + /** + * + * @param {javaemul.internal.CharacterHelper} c + * @return {number} + */ + CharacterHelper.prototype.compareTo = function (c) { + if (((c != null && c instanceof javaemul.internal.CharacterHelper) || c === null)) { + return this.compareTo$javaemul_internal_CharacterHelper(c); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + CharacterHelper.prototype.equals = function (o) { + return (o != null && o instanceof javaemul.internal.CharacterHelper) && ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(o.value) == (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(this.value)); + }; + /** + * + * @return {number} + */ + CharacterHelper.prototype.hashCode = function () { + return CharacterHelper.hashCode(this.value); + }; + /** + * + * @return {string} + */ + CharacterHelper.prototype.toString = function () { + return /* valueOf */ new String(this.value).toString(); + }; + CharacterHelper.MIN_RADIX = 2; + CharacterHelper.MAX_RADIX = 36; + CharacterHelper.MIN_VALUE = '\u0000'; + CharacterHelper.MAX_VALUE = '\uffff'; + CharacterHelper.MIN_SURROGATE = '\ud800'; + CharacterHelper.MAX_SURROGATE = '\udfff'; + CharacterHelper.MIN_LOW_SURROGATE = '\udc00'; + CharacterHelper.MAX_LOW_SURROGATE = '\udfff'; + CharacterHelper.MIN_HIGH_SURROGATE = '\ud800'; + CharacterHelper.MAX_HIGH_SURROGATE = '\udbff'; + CharacterHelper.MIN_SUPPLEMENTARY_CODE_POINT = 65536; + CharacterHelper.MIN_CODE_POINT = 0; + CharacterHelper.MAX_CODE_POINT = 1114111; + CharacterHelper.SIZE = 16; + return CharacterHelper; + }()); + internal.CharacterHelper = CharacterHelper; + CharacterHelper["__class"] = "javaemul.internal.CharacterHelper"; + CharacterHelper["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + (function (CharacterHelper) { + /** + * Use nested class to avoid clinit on outer. + * @class + */ + var BoxedValues = /** @class */ (function () { + function BoxedValues() { + } + BoxedValues.boxedValues_$LI$ = function () { if (BoxedValues.boxedValues == null) { + BoxedValues.boxedValues = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(128); + } return BoxedValues.boxedValues; }; + ; + return BoxedValues; + }()); + CharacterHelper.BoxedValues = BoxedValues; + BoxedValues["__class"] = "javaemul.internal.CharacterHelper.BoxedValues"; + })(CharacterHelper = internal.CharacterHelper || (internal.CharacterHelper = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Simple Helper class to return Date.now. + * @class + */ + var DateUtil = /** @class */ (function () { + function DateUtil() { + } + /** + * Returns the numeric value corresponding to the current time - the number + * of milliseconds elapsed since 1 January 1970 00:00:00 UTC. + * @return {number} + */ + DateUtil.now = function () { + if (Date.now) { + return Date.now(); + } + ; + return ((new Date()).getTime()); + }; + return DateUtil; + }()); + internal.DateUtil = DateUtil; + DateUtil["__class"] = "javaemul.internal.DateUtil"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Provides utilities to perform operations on Arrays. + * @class + */ + var ArrayHelper = /** @class */ (function () { + function ArrayHelper() { + } + ArrayHelper.clone = function (array, fromIndex, toIndex) { + var result = ArrayHelper.unsafeClone(array, fromIndex, toIndex); + return javaemul.internal.ArrayStamper.stampJavaTypeInfo(result, array); + }; + /** + * Unlike clone, this method returns a copy of the array that is not type + * marked. This is only safe for temp arrays as returned array will not do + * any type checks. + * @param {*} array + * @param {number} fromIndex + * @param {number} toIndex + * @return {Array} + */ + ArrayHelper.unsafeClone = function (array, fromIndex, toIndex) { + return array.slice(fromIndex, toIndex); + }; + ArrayHelper.createFrom = function (array, length) { + var result = ArrayHelper.createNativeArray(length); + return javaemul.internal.ArrayStamper.stampJavaTypeInfo(result, array); + }; + /*private*/ ArrayHelper.createNativeArray = function (length) { + return (new Array(length)); + }; + ArrayHelper.getLength = function (array) { + return (array.length | 0); + }; + ArrayHelper.setLength = function (array, length) { + array.length = length; + }; + ArrayHelper.removeFrom = function (array, index, deleteCount) { + array.splice(index, deleteCount); + }; + ArrayHelper.insertTo$java_lang_Object$int$java_lang_Object = function (array, index, value) { + array.splice(index, 0, value); + }; + ArrayHelper.insertTo$java_lang_Object$int$java_lang_Object_A = function (array, index, values) { + ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int$boolean(values, 0, array, index, values.length, false); + }; + ArrayHelper.insertTo = function (array, index, values) { + if (((array != null) || array === null) && ((typeof index === 'number') || index === null) && ((values != null && values instanceof Array && (values.length == 0 || values[0] == null || (values[0] != null))) || values === null)) { + return javaemul.internal.ArrayHelper.insertTo$java_lang_Object$int$java_lang_Object_A(array, index, values); + } + else if (((array != null) || array === null) && ((typeof index === 'number') || index === null) && ((values != null) || values === null)) { + return javaemul.internal.ArrayHelper.insertTo$java_lang_Object$int$java_lang_Object(array, index, values); + } + else + throw new Error('invalid overload'); + }; + /** + * This version of insertTo is specified only for arrays. + * Same implementation (and arguments) as "public static void insertTo(Object array, int index, Object[] values)" + * @param {*} array + * @param {number} index + * @param {Array} values + */ + ArrayHelper.insertValuesToArray = function (array, index, values) { + ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int$boolean(values, 0, array, index, values.length, false); + }; + ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int = function (array, srcOfs, dest, destOfs, len) { + ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int$boolean(array, srcOfs, dest, destOfs, len, true); + }; + ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int$boolean = function (src, srcOfs, dest, destOfs, len, overwrite) { + if (src === dest) { + src = ArrayHelper.unsafeClone(src, srcOfs, srcOfs + len); + srcOfs = 0; + } + for (var batchStart = srcOfs, end = srcOfs + len; batchStart < end;) { + { + var batchEnd = Math.min(batchStart + ArrayHelper.ARRAY_PROCESS_BATCH_SIZE, end); + len = batchEnd - batchStart; + ArrayHelper.applySplice(dest, destOfs, overwrite ? len : 0, ArrayHelper.unsafeClone(src, batchStart, batchEnd)); + batchStart = batchEnd; + destOfs += len; + } + ; + } + }; + ArrayHelper.copy = function (src, srcOfs, dest, destOfs, len, overwrite) { + if (((src != null) || src === null) && ((typeof srcOfs === 'number') || srcOfs === null) && ((dest != null) || dest === null) && ((typeof destOfs === 'number') || destOfs === null) && ((typeof len === 'number') || len === null) && ((typeof overwrite === 'boolean') || overwrite === null)) { + return javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int$boolean(src, srcOfs, dest, destOfs, len, overwrite); + } + else if (((src != null) || src === null) && ((typeof srcOfs === 'number') || srcOfs === null) && ((dest != null) || dest === null) && ((typeof destOfs === 'number') || destOfs === null) && ((typeof len === 'number') || len === null) && overwrite === undefined) { + return javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(src, srcOfs, dest, destOfs, len); + } + else + throw new Error('invalid overload'); + }; + /*private*/ ArrayHelper.applySplice = function (arrayObject, index, deleteCount, arrayToAdd) { + Array.prototype.splice.apply(arrayObject, [index, deleteCount].concat(arrayToAdd)); + }; + ArrayHelper.ARRAY_PROCESS_BATCH_SIZE = 10000; + return ArrayHelper; + }()); + internal.ArrayHelper = ArrayHelper; + ArrayHelper["__class"] = "javaemul.internal.ArrayHelper"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Math utility methods and constants. + * @class + */ + var MathHelper = /** @class */ (function () { + function MathHelper() { + } + MathHelper.EPSILON_$LI$ = function () { if (MathHelper.EPSILON == null) { + MathHelper.EPSILON = MathHelper.pow(2, -52); + } return MathHelper.EPSILON; }; + ; + MathHelper.MAX_VALUE_$LI$ = function () { if (MathHelper.MAX_VALUE == null) { + MathHelper.MAX_VALUE = (2 - MathHelper.EPSILON_$LI$()) * MathHelper.pow(2, 1023); + } return MathHelper.MAX_VALUE; }; + ; + MathHelper.MIN_VALUE_$LI$ = function () { if (MathHelper.MIN_VALUE == null) { + MathHelper.MIN_VALUE = MathHelper.pow(2, -1022); + } return MathHelper.MIN_VALUE; }; + ; + MathHelper.nextDown = function (x) { + return -MathHelper.nextUp(-x); + }; + MathHelper.ulp = function (x) { + return x < 0 ? MathHelper.nextUp(x) - x : x - (-MathHelper.nextUp(-x)); + }; + MathHelper.nextUp = function (x) { + if (x !== x) { + return x; + } + if (x === (-1 / 0 | 0)) { + return -MathHelper.MAX_VALUE_$LI$(); + } + if (x === (+1 / 0 | 0)) { + return (+1 / 0 | 0); + } + if (x === +MathHelper.MAX_VALUE_$LI$()) { + return (+1 / 0 | 0); + } + var y = x * (x < 0 ? 1 - MathHelper.EPSILON_$LI$() / 2 : 1 + MathHelper.EPSILON_$LI$()); + if (y === x) { + y = MathHelper.MIN_VALUE_$LI$() * MathHelper.EPSILON_$LI$() > 0 ? x + MathHelper.MIN_VALUE_$LI$() * MathHelper.EPSILON_$LI$() : x + MathHelper.MIN_VALUE_$LI$(); + } + if (y === (+1 / 0 | 0)) { + y = +MathHelper.MAX_VALUE_$LI$(); + } + var b = x + (y - x) / 2; + if (x < b && b < y) { + y = b; + } + var c = (y + x) / 2; + if (x < c && c < y) { + y = c; + } + return y === 0 ? -0 : y; + }; + MathHelper.PI_OVER_180_$LI$ = function () { if (MathHelper.PI_OVER_180 == null) { + MathHelper.PI_OVER_180 = MathHelper.PI / 180.0; + } return MathHelper.PI_OVER_180; }; + ; + MathHelper.PI_UNDER_180_$LI$ = function () { if (MathHelper.PI_UNDER_180 == null) { + MathHelper.PI_UNDER_180 = 180.0 / MathHelper.PI; + } return MathHelper.PI_UNDER_180; }; + ; + MathHelper.abs$double = function (x) { + return x <= 0 ? 0.0 - x : x; + }; + MathHelper.abs$float = function (x) { + return MathHelper.abs$double(x); + }; + MathHelper.abs$int = function (x) { + return x < 0 ? -x : x; + }; + MathHelper.abs = function (x) { + if (((typeof x === 'number') || x === null)) { + return javaemul.internal.MathHelper.abs$int(x); + } + else if (((typeof x === 'number') || x === null)) { + return javaemul.internal.MathHelper.abs$long(x); + } + else if (((typeof x === 'number') || x === null)) { + return javaemul.internal.MathHelper.abs$float(x); + } + else if (((typeof x === 'number') || x === null)) { + return javaemul.internal.MathHelper.abs$double(x); + } + else + throw new Error('invalid overload'); + }; + MathHelper.abs$long = function (x) { + return x < 0 ? -x : x; + }; + MathHelper.acos = function (x) { + return Math.acos(x); + }; + MathHelper.asin = function (x) { + return Math.asin(x); + }; + MathHelper.atan = function (x) { + return Math.atan(x); + }; + MathHelper.atan2 = function (y, x) { + return Math.atan2(y, x); + }; + MathHelper.cbrt = function (x) { + return MathHelper.pow(x, 1.0 / 3.0); + }; + MathHelper.ceil = function (x) { + return Math.ceil(x); + }; + MathHelper.copySign$double$double = function (magnitude, sign) { + if (sign < 0) { + return (magnitude < 0) ? magnitude : -magnitude; + } + else { + return (magnitude > 0) ? magnitude : -magnitude; + } + }; + MathHelper.copySign$float$float = function (magnitude, sign) { + return (MathHelper.copySign$double$double(magnitude, sign)); + }; + MathHelper.copySign = function (magnitude, sign) { + if (((typeof magnitude === 'number') || magnitude === null) && ((typeof sign === 'number') || sign === null)) { + return javaemul.internal.MathHelper.copySign$float$float(magnitude, sign); + } + else if (((typeof magnitude === 'number') || magnitude === null) && ((typeof sign === 'number') || sign === null)) { + return javaemul.internal.MathHelper.copySign$double$double(magnitude, sign); + } + else + throw new Error('invalid overload'); + }; + MathHelper.cos = function (x) { + return Math.cos(x); + }; + MathHelper.cosh = function (x) { + return (MathHelper.exp(x) + MathHelper.exp(-x)) / 2.0; + }; + MathHelper.exp = function (x) { + return Math.exp(x); + }; + MathHelper.expm1 = function (d) { + if (d === 0.0 || /* isNaN */ isNaN(d)) { + return d; + } + else if (!(function (value) { return Number.NEGATIVE_INFINITY === value || Number.POSITIVE_INFINITY === value; })(d)) { + if (d < 0.0) { + return -1.0; + } + else { + return javaemul.internal.DoubleHelper.POSITIVE_INFINITY; + } + } + return MathHelper.exp(d) + 1.0; + }; + MathHelper.floor = function (x) { + return Math.floor(x); + }; + MathHelper.hypot = function (x, y) { + return MathHelper.sqrt(x * x + y * y); + }; + MathHelper.log = function (x) { + return Math.log(x); + }; + MathHelper.log10 = function (x) { + return Math.log(x) * Math.LOG10E; + }; + MathHelper.log1p = function (x) { + return MathHelper.log(x + 1.0); + }; + MathHelper.max$double$double = function (x, y) { + return Math.max(x, y); + }; + MathHelper.max$float$float = function (x, y) { + return Math.max(x, y); + }; + MathHelper.max$int$int = function (x, y) { + return x > y ? x : y; + }; + MathHelper.max = function (x, y) { + if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) { + return javaemul.internal.MathHelper.max$int$int(x, y); + } + else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) { + return javaemul.internal.MathHelper.max$long$long(x, y); + } + else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) { + return javaemul.internal.MathHelper.max$float$float(x, y); + } + else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) { + return javaemul.internal.MathHelper.max$double$double(x, y); + } + else + throw new Error('invalid overload'); + }; + MathHelper.max$long$long = function (x, y) { + return x > y ? x : y; + }; + MathHelper.min$double$double = function (x, y) { + return Math.min(x, y); + }; + MathHelper.min$float$float = function (x, y) { + return Math.min(x, y); + }; + MathHelper.min$int$int = function (x, y) { + return x < y ? x : y; + }; + MathHelper.min = function (x, y) { + if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) { + return javaemul.internal.MathHelper.min$int$int(x, y); + } + else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) { + return javaemul.internal.MathHelper.min$long$long(x, y); + } + else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) { + return javaemul.internal.MathHelper.min$float$float(x, y); + } + else if (((typeof x === 'number') || x === null) && ((typeof y === 'number') || y === null)) { + return javaemul.internal.MathHelper.min$double$double(x, y); + } + else + throw new Error('invalid overload'); + }; + MathHelper.min$long$long = function (x, y) { + return x < y ? x : y; + }; + MathHelper.pow = function (x, exp) { + return Math.pow(x, exp); + }; + MathHelper.random = function () { + return Math.random(); + }; + MathHelper.rint = function (d) { + if ( /* isNaN */isNaN(d)) { + return d; + } + else if ( /* isInfinite */(function (value) { return Number.NEGATIVE_INFINITY === value || Number.POSITIVE_INFINITY === value; })(d)) { + return d; + } + else if (d === 0.0) { + return d; + } + else { + return MathHelper.round$double(d); + } + }; + MathHelper.round$double = function (x) { + return (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(Math.round(x)); + }; + MathHelper.round$float = function (x) { + var roundedValue = Math.round(x); + return MathHelper.unsafeCastToInt(roundedValue); + }; + MathHelper.round = function (x) { + if (((typeof x === 'number') || x === null)) { + return javaemul.internal.MathHelper.round$float(x); + } + else if (((typeof x === 'number') || x === null)) { + return javaemul.internal.MathHelper.round$double(x); + } + else + throw new Error('invalid overload'); + }; + /*private*/ MathHelper.unsafeCastToInt = function (d) { + return (d); + }; + MathHelper.scalb$double$int = function (d, scaleFactor) { + if (scaleFactor >= 31 || scaleFactor <= -31) { + return d * MathHelper.pow(2, scaleFactor); + } + else if (scaleFactor > 0) { + return d * (1 << scaleFactor); + } + else if (scaleFactor === 0) { + return d; + } + else { + return d * 1.0 / (1 << -scaleFactor); + } + }; + MathHelper.scalb$float$int = function (f, scaleFactor) { + if (scaleFactor >= 31 || scaleFactor <= -31) { + return f * MathHelper.pow(2, scaleFactor); + } + else if (scaleFactor > 0) { + return f * (1 << scaleFactor); + } + else if (scaleFactor === 0) { + return f; + } + else { + return f * 1.0 / (1 << -scaleFactor); + } + }; + MathHelper.scalb = function (f, scaleFactor) { + if (((typeof f === 'number') || f === null) && ((typeof scaleFactor === 'number') || scaleFactor === null)) { + return javaemul.internal.MathHelper.scalb$float$int(f, scaleFactor); + } + else if (((typeof f === 'number') || f === null) && ((typeof scaleFactor === 'number') || scaleFactor === null)) { + return javaemul.internal.MathHelper.scalb$double$int(f, scaleFactor); + } + else + throw new Error('invalid overload'); + }; + MathHelper.signum$double = function (d) { + if (d > 0.0) { + return 1.0; + } + else if (d < 0.0) { + return -1.0; + } + else { + return 0.0; + } + }; + MathHelper.signum$float = function (f) { + if (f > 0.0) { + return 1.0; + } + else if (f < 0.0) { + return -1.0; + } + else { + return 0.0; + } + }; + MathHelper.signum = function (f) { + if (((typeof f === 'number') || f === null)) { + return javaemul.internal.MathHelper.signum$float(f); + } + else if (((typeof f === 'number') || f === null)) { + return javaemul.internal.MathHelper.signum$double(f); + } + else + throw new Error('invalid overload'); + }; + MathHelper.sin = function (x) { + return Math.sin(x); + }; + MathHelper.sinh = function (x) { + return (MathHelper.exp(x) - MathHelper.exp(-x)) / 2.0; + }; + MathHelper.sqrt = function (x) { + return Math.sqrt(x); + }; + MathHelper.tan = function (x) { + return Math.tan(x); + }; + MathHelper.tanh = function (x) { + if (x === javaemul.internal.JsUtils.getInfinity()) { + return 1.0; + } + else if (x === -javaemul.internal.JsUtils.getInfinity()) { + return -1.0; + } + var e2x = MathHelper.exp(2.0 * x); + return (e2x - 1) / (e2x + 1); + }; + MathHelper.toDegrees = function (x) { + return x * MathHelper.PI_UNDER_180_$LI$(); + }; + MathHelper.toRadians = function (x) { + return x * MathHelper.PI_OVER_180_$LI$(); + }; + MathHelper.IEEEremainder = function (f1, f2) { + var r = Math.abs(f1 % f2); + if ( /* isNaN */isNaN(r) || r === f2 || r <= Math.abs(f2) / 2.0) { + return r; + } + else { + return /* signum */ (function (f) { if (f > 0) { + return 1; + } + else if (f < 0) { + return -1; + } + else { + return 0; + } })(f1) * (r - f2); + } + }; + MathHelper.E = 2.718281828459045; + MathHelper.PI = 3.141592653589793; + return MathHelper; + }()); + internal.MathHelper = MathHelper; + MathHelper["__class"] = "javaemul.internal.MathHelper"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * A utility to provide array stamping. Provided as a separate class to simplify + * super-source. + * @class + */ + var ArrayStamper = /** @class */ (function () { + function ArrayStamper() { + } + ArrayStamper.stampJavaTypeInfo = function (array, referenceType) { + return array; + }; + return ArrayStamper; + }()); + internal.ArrayStamper = ArrayStamper; + ArrayStamper["__class"] = "javaemul.internal.ArrayStamper"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Contains logics for calculating hash codes in JavaScript. + * @class + */ + var HashCodes = /** @class */ (function () { + function HashCodes() { + } + HashCodes.hashCodeForString = function (s) { + return javaemul.internal.StringHashCache.getHashCode(s); + }; + HashCodes.getIdentityHashCode = function (o) { + if (o == null) { + return 0; + } + return (typeof o === 'string') ? HashCodes.hashCodeForString(javaemul.internal.JsUtils.unsafeCastToString(o)) : HashCodes.getObjectIdentityHashCode(o); + }; + HashCodes.getObjectIdentityHashCode = function (o) { + if ((o)[HashCodes.HASH_CODE_PROPERTY] != null) { + return ((o)[HashCodes.HASH_CODE_PROPERTY]); + } + else { + return ((o)[HashCodes.HASH_CODE_PROPERTY] = HashCodes.getNextHashId()); + } + }; + /** + * Called from JSNI. Do not change this implementation without updating: + *
    + *
  • {@link com.google.gwt.user.client.rpc.impl.SerializerBase}
  • + *
+ * @return {number} + * @private + */ + /*private*/ HashCodes.getNextHashId = function () { + return ++HashCodes.sNextHashId; + }; + HashCodes.sNextHashId = 0; + HashCodes.HASH_CODE_PROPERTY = "$H"; + return HashCodes; + }()); + internal.HashCodes = HashCodes; + HashCodes["__class"] = "javaemul.internal.HashCodes"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Abstract base class for numeric wrapper classes. + * @class + */ + var NumberHelper = /** @class */ (function () { + function NumberHelper() { + } + /** + * @skip + * + * This function will determine the radix that the string is expressed + * in based on the parsing rules defined in the Javadocs for + * Integer.decode() and invoke __parseAndValidateInt. + * @param {string} s + * @param {number} lowerBound + * @param {number} upperBound + * @return {number} + */ + NumberHelper.__decodeAndValidateInt = function (s, lowerBound, upperBound) { + var decode = NumberHelper.__decodeNumberString(s); + return NumberHelper.__parseAndValidateInt(decode.payload, decode.radix, lowerBound, upperBound); + }; + NumberHelper.__decodeNumberString = function (s) { + var negative; + if ( /* startsWith */(function (str, searchString, position) { + if (position === void 0) { position = 0; } + return str.substr(position, searchString.length) === searchString; + })(s, "-")) { + negative = true; + s = s.substring(1); + } + else { + negative = false; + if ( /* startsWith */(function (str, searchString, position) { + if (position === void 0) { position = 0; } + return str.substr(position, searchString.length) === searchString; + })(s, "+")) { + s = s.substring(1); + } + } + var radix; + if ( /* startsWith */(function (str, searchString, position) { + if (position === void 0) { position = 0; } + return str.substr(position, searchString.length) === searchString; + })(s, "0x") || /* startsWith */ (function (str, searchString, position) { + if (position === void 0) { position = 0; } + return str.substr(position, searchString.length) === searchString; + })(s, "0X")) { + s = s.substring(2); + radix = 16; + } + else if ( /* startsWith */(function (str, searchString, position) { + if (position === void 0) { position = 0; } + return str.substr(position, searchString.length) === searchString; + })(s, "#")) { + s = s.substring(1); + radix = 16; + } + else if ( /* startsWith */(function (str, searchString, position) { + if (position === void 0) { position = 0; } + return str.substr(position, searchString.length) === searchString; + })(s, "0")) { + radix = 8; + } + else { + radix = 10; + } + if (negative) { + s = "-" + s; + } + return new NumberHelper.__Decode(radix, s); + }; + /** + * @skip + * + * This function contains common logic for parsing a String as a + * floating- point number and validating the range. + * @param {string} s + * @return {number} + */ + NumberHelper.__parseAndValidateDouble = function (s) { + if (!NumberHelper.__isValidDouble(s)) { + throw java.lang.NumberFormatException.forInputString(s); + } + return parseFloat(s); + }; + /** + * @skip + * + * This function contains common logic for parsing a String in a given + * radix and validating the result. + * @param {string} s + * @param {number} radix + * @param {number} lowerBound + * @param {number} upperBound + * @return {number} + */ + NumberHelper.__parseAndValidateInt = function (s, radix, lowerBound, upperBound) { + if (s == null) { + throw java.lang.NumberFormatException.forNullInputString(); + } + if (radix < javaemul.internal.CharacterHelper.MIN_RADIX || radix > javaemul.internal.CharacterHelper.MAX_RADIX) { + throw java.lang.NumberFormatException.forRadix(radix); + } + var length = s.length; + var startIndex = (length > 0) && ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(0)) == '-'.charCodeAt(0) || (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(0)) == '+'.charCodeAt(0)) ? 1 : 0; + for (var i = startIndex; i < length; i++) { + { + if (javaemul.internal.CharacterHelper.digit(s.charAt(i), radix) === -1) { + throw java.lang.NumberFormatException.forInputString(s); + } + } + ; + } + var toReturn = (parseInt(s, radix) | 0); + var isTooLow = toReturn < lowerBound; + if (javaemul.internal.DoubleHelper.isNaN(toReturn)) { + throw java.lang.NumberFormatException.forInputString(s); + } + else if (isTooLow || toReturn > upperBound) { + throw java.lang.NumberFormatException.forInputString(s); + } + return toReturn; + }; + /** + * @skip + * + * This function contains common logic for parsing a String in a given + * radix and validating the result. + * @param {string} s + * @param {number} radix + * @return {number} + */ + NumberHelper.__parseAndValidateLong = function (s, radix) { + if (s == null) { + throw java.lang.NumberFormatException.forNullInputString(); + } + if (radix < javaemul.internal.CharacterHelper.MIN_RADIX || radix > javaemul.internal.CharacterHelper.MAX_RADIX) { + throw java.lang.NumberFormatException.forRadix(radix); + } + var orig = s; + var length = s.length; + var negative = false; + if (length > 0) { + var c = s.charAt(0); + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) == '-'.charCodeAt(0) || (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) == '+'.charCodeAt(0)) { + s = s.substring(1); + length--; + negative = ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) == '-'.charCodeAt(0)); + } + } + if (length === 0) { + throw java.lang.NumberFormatException.forInputString(orig); + } + while ((s.length > 0 && (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(0)) == '0'.charCodeAt(0))) { + { + s = s.substring(1); + length--; + } + } + ; + if (length > NumberHelper.__ParseLong.maxLengthForRadix_$LI$()[radix]) { + throw java.lang.NumberFormatException.forInputString(orig); + } + for (var i = 0; i < length; i++) { + { + if (javaemul.internal.CharacterHelper.digit(s.charAt(i), radix) === -1) { + throw java.lang.NumberFormatException.forInputString(orig); + } + } + ; + } + var toReturn = 0; + var maxDigits = NumberHelper.__ParseLong.maxDigitsForRadix_$LI$()[radix]; + var radixPower = NumberHelper.__ParseLong.maxDigitsRadixPower_$LI$()[radix]; + var minValue = -NumberHelper.__ParseLong.maxValueForRadix_$LI$()[radix]; + var firstTime = true; + var head = length % maxDigits; + if (head > 0) { + toReturn = -(parseInt(s.substring(0, head), radix) | 0); + s = s.substring(head); + length -= head; + firstTime = false; + } + while ((length >= maxDigits)) { + { + head = (parseInt(s.substring(0, maxDigits), radix) | 0); + s = s.substring(maxDigits); + length -= maxDigits; + if (!firstTime) { + if (toReturn < minValue) { + throw java.lang.NumberFormatException.forInputString(orig); + } + toReturn *= radixPower; + } + else { + firstTime = false; + } + toReturn -= head; + } + } + ; + if (toReturn > 0) { + throw java.lang.NumberFormatException.forInputString(orig); + } + if (!negative) { + toReturn = -toReturn; + if (toReturn < 0) { + throw java.lang.NumberFormatException.forInputString(orig); + } + } + return toReturn; + }; + /** + * @skip + * + * @param {string} str + * @return {boolean} {@code true} if the string matches the float format, + * {@code false} otherwise + * @private + */ + NumberHelper.__isValidDouble = function (str) { + if (NumberHelper.floatRegex == null) { + NumberHelper.floatRegex = NumberHelper.createFloatRegex(); + } + return NumberHelper.floatRegex.test(str); + }; + NumberHelper.createFloatRegex = function () { + return (/^\s*[+-]?(NaN|Infinity|((\d+\.?\d*)|(\.\d+))([eE][+-]?\d+)?[dDfF]?)\s*$/); + }; + NumberHelper.prototype.byteValue = function () { + return (this.intValue() | 0); + }; + NumberHelper.prototype.shortValue = function () { + return (this.intValue() | 0); + }; + /** + * Stores a regular expression object to verify the format of float values. + */ + NumberHelper.floatRegex = null; + return NumberHelper; + }()); + internal.NumberHelper = NumberHelper; + NumberHelper["__class"] = "javaemul.internal.NumberHelper"; + NumberHelper["__interfaces"] = ["java.io.Serializable"]; + (function (NumberHelper) { + var __Decode = /** @class */ (function () { + function __Decode(radix, payload) { + if (this.payload === undefined) { + this.payload = null; + } + if (this.radix === undefined) { + this.radix = 0; + } + this.radix = radix; + this.payload = payload; + } + return __Decode; + }()); + NumberHelper.__Decode = __Decode; + __Decode["__class"] = "javaemul.internal.NumberHelper.__Decode"; + /** + * Use nested class to avoid clinit on outer. + * @class + */ + var __ParseLong = /** @class */ (function () { + function __ParseLong() { + } + __ParseLong.__static_initialize = function () { if (!__ParseLong.__static_initialized) { + __ParseLong.__static_initialized = true; + __ParseLong.__static_initializer_0(); + } }; + __ParseLong.maxDigitsForRadix_$LI$ = function () { __ParseLong.__static_initialize(); if (__ParseLong.maxDigitsForRadix == null) { + __ParseLong.maxDigitsForRadix = [-1, -1, 30, 19, 15, 13, 11, 11, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5]; + } return __ParseLong.maxDigitsForRadix; }; + ; + __ParseLong.maxDigitsRadixPower_$LI$ = function () { __ParseLong.__static_initialize(); if (__ParseLong.maxDigitsRadixPower == null) { + __ParseLong.maxDigitsRadixPower = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(37); + } return __ParseLong.maxDigitsRadixPower; }; + ; + __ParseLong.maxLengthForRadix_$LI$ = function () { __ParseLong.__static_initialize(); if (__ParseLong.maxLengthForRadix == null) { + __ParseLong.maxLengthForRadix = [-1, -1, 63, 40, 32, 28, 25, 23, 21, 20, 19, 19, 18, 18, 17, 17, 16, 16, 16, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 13]; + } return __ParseLong.maxLengthForRadix; }; + ; + __ParseLong.maxValueForRadix_$LI$ = function () { __ParseLong.__static_initialize(); if (__ParseLong.maxValueForRadix == null) { + __ParseLong.maxValueForRadix = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(37); + } return __ParseLong.maxValueForRadix; }; + ; + __ParseLong.__static_initializer_0 = function () { + for (var i = 2; i <= 36; i++) { + { + __ParseLong.maxDigitsRadixPower_$LI$()[i] = (Math.pow(i, __ParseLong.maxDigitsForRadix_$LI$()[i]) | 0); + __ParseLong.maxValueForRadix_$LI$()[i] = (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(9223372036854775807 / __ParseLong.maxDigitsRadixPower_$LI$()[i]); + } + ; + } + }; + __ParseLong.__static_initialized = false; + return __ParseLong; + }()); + NumberHelper.__ParseLong = __ParseLong; + __ParseLong["__class"] = "javaemul.internal.NumberHelper.__ParseLong"; + })(NumberHelper = internal.NumberHelper || (internal.NumberHelper = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +var test; +(function (test) { + var MyEnum; + (function (MyEnum) { + MyEnum[MyEnum["A"] = 0] = "A"; + MyEnum[MyEnum["B"] = 1] = "B"; + MyEnum[MyEnum["C"] = 2] = "C"; + })(MyEnum = test.MyEnum || (test.MyEnum = {})); + var MyComplexEnum; + (function (MyComplexEnum) { + MyComplexEnum[MyComplexEnum["A"] = 0] = "A"; + MyComplexEnum[MyComplexEnum["B"] = 1] = "B"; + MyComplexEnum[MyComplexEnum["C"] = 2] = "C"; + })(MyComplexEnum = test.MyComplexEnum || (test.MyComplexEnum = {})); + /** @ignore */ + var MyComplexEnum_$WRAPPER = /** @class */ (function () { + function MyComplexEnum_$WRAPPER(_$ordinal, _$name) { + this._$ordinal = _$ordinal; + this._$name = _$name; + } + MyComplexEnum_$WRAPPER.prototype.aFunction = function () { + return "test"; + }; + MyComplexEnum_$WRAPPER.prototype.name = function () { return this._$name; }; + MyComplexEnum_$WRAPPER.prototype.ordinal = function () { return this._$ordinal; }; + MyComplexEnum_$WRAPPER.prototype.compareTo = function (other) { return this._$ordinal - (isNaN(other) ? other._$ordinal : other); }; + return MyComplexEnum_$WRAPPER; + }()); + test.MyComplexEnum_$WRAPPER = MyComplexEnum_$WRAPPER; + MyComplexEnum["__class"] = "test.MyComplexEnum"; + MyComplexEnum["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + MyComplexEnum["_$wrappers"] = [new MyComplexEnum_$WRAPPER(0, "A"), new MyComplexEnum_$WRAPPER(1, "B"), new MyComplexEnum_$WRAPPER(2, "C")]; + var Test = /** @class */ (function () { + function Test() { + } + Test.main = function (args) { + console.info(java.util.Arrays.asList("a", "b", "c")); + }; + Test.assertEquals = function (o1, o2) { + if (!(o1 === o2)) { + throw new Error("invalid assertion: " + o1 + "!=" + o2); + } + }; + Test.assertTrue = function (b) { + if (!b) { + throw new Error("invalid assertion"); + } + }; + Test.assertFalse = function (b) { + if (b) { + throw new Error("invalid assertion"); + } + }; + Test.test = function () { + try { + Test.testArrays(); + Test.testList(); + Test.testMap(); + Test.testSet(); + Test.testString(); + Test.testIO(); + Test.testEnums(); + Test.testStreams(); + console.info("OS NAME: " + java.lang.System.getProperty$java_lang_String("os.name")); + console.info("Get input: "); + var scanner = new java.util.Scanner(java.lang.System.in_$LI$()); + if (scanner.hasNextLine()) { + console.info("Got input: " + scanner.nextLine()); + } + else { + console.info("No any input :("); + } + if (java.lang.System.ENVIRONMENT_IS_WEB_$LI$()) { + var result = document.getElementById("result"); + if (result != null) { + result.innerHTML = "Success!"; + } + } + else { + console.info("Success!"); + } + } + catch (e) { + console.error(e); + if (java.lang.System.ENVIRONMENT_IS_WEB_$LI$()) { + var result = document.getElementById("result"); + if (result != null) { + result.innerHTML = "Failure: " + e.message; + } + } + else { + console.info("Failure: " + e.message); + } + } + ; + }; + Test.comp1 = function (e) { + return e.compareTo(test.MyComplexEnum.A); + }; + Test.comp2 = function (e) { + return e.compareTo(test.MyEnum.A); + }; + Test.testEnums = function () { + console.info("testing enums"); + Test.assertEquals(1, test.MyEnum.B); + Test.assertEquals("A", /* Enum.name */ test.MyEnum[test.MyEnum.A]); + Test.assertEquals("A", /* Enum.name */ test.MyComplexEnum[test.MyComplexEnum.A]); + Test.assertEquals(0, /* Enum.compareTo */ ((test.MyEnum.A) - (test.MyEnum.A))); + Test.assertEquals(test.MyEnum.B, /* Enum.values */ function () { var result = []; for (var val in test.MyEnum) { + if (!isNaN(val)) { + result.push(parseInt(val, 10)); + } + } return result; }()[1]); + Test.assertEquals(0, Test.comp1((function (wrappers, value) { return wrappers === undefined ? value : wrappers[value]; })(test.MyComplexEnum["_$wrappers"], test.MyComplexEnum.A))); + console.info("end testing enums"); + }; + Test.testArrays = function () { + console.info("testing arrays"); + var srcArray = ["a", "b", "c"]; + var dstArray = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(srcArray.length - 1); + java.lang.System.arraycopy(srcArray, 1, dstArray, 0, srcArray.length - 1); + Test.assertEquals(2, dstArray.length); + Test.assertEquals("b", dstArray[0]); + Test.assertEquals("c", dstArray[1]); + var myArray = [3, 2, 1]; + Test.assertEquals(3, myArray[0]); + java.util.Arrays.sort$int_A(myArray); + Test.assertEquals(1, myArray[0]); + var l = java.util.Arrays.asList("a", "b", "c", "d"); + Test.assertEquals(4, l.size()); + var a = java.util.Arrays.copyOf$java_lang_Object_A$int(l['toArray$java_lang_Object_A']([]), 3); + Test.assertEquals(3, a.length); + var reverse = function (o1, o2) { + return /* compareTo */ o2.localeCompare(o1); + }; + java.util.Arrays.sort$java_lang_Object_A$java_util_Comparator(a, (reverse)); + Test.assertEquals("[c, b, a]", java.util.Arrays.asList(a[0], a[1], a[2]).toString()); + console.info("end testing arrays"); + }; + Test.testList = function () { + console.info("testing lists"); + var l = (new java.util.ArrayList()); + l.add("a"); + l.add("b"); + l.add("c"); + Test.assertEquals(l.toString(), "[a, b, c]"); + Test.assertEquals(l.subList(1, 3).toString(), "[b, c]"); + Test.assertEquals(l['remove$java_lang_Object']("b"), true); + Test.assertEquals(l['remove$java_lang_Object']("d"), false); + Test.assertEquals(l['remove$int'](1), "c"); + l.add("c"); + Test.assertEquals(l.toString(), "[a, c]"); + Test.assertEquals(l.size(), 2); + Test.assertEquals(l.get(1), "c"); + Test.assertEquals(l.indexOf("a"), 0); + var res = ""; + for (var index122 = l.iterator(); index122.hasNext();) { + var s = index122.next(); + { + res += s; + } + } + Test.assertEquals("ac", res); + var it = l.iterator(); + Test.assertTrue(it.hasNext()); + Test.assertEquals("a", it.next()); + Test.assertTrue(it.hasNext()); + Test.assertEquals("c", it.next()); + Test.assertFalse(it.hasNext()); + l.clear(); + l.add("bb"); + l.add("aa"); + Test.assertEquals(l.toString(), "[bb, aa]"); + java.util.Collections.sort$java_util_List$java_util_Comparator(l, (java.text.Collator.getInstance())); + Test.assertEquals(l.toString(), "[aa, bb]"); + console.info("end testing lists"); + }; + Test.testSet = function () { + console.info("testing sets"); + var s = (new java.util.HashSet()); + s.add("a"); + s.add("a"); + s.add("b"); + s.add("c"); + s.add("c"); + Test.assertEquals(s.toString(), "[a, b, c]"); + s.remove("b"); + Test.assertTrue(s.contains("a")); + Test.assertTrue(s.contains("c")); + Test.assertFalse(s.contains("b")); + Test.assertEquals(s.size(), 2); + console.info("testing bit sets"); + var bs = java.util.BitSet.valueOf([255]); + Test.assertTrue(bs.get$int(0)); + Test.assertTrue(bs.get$int(1)); + Test.assertTrue(bs.get$int(7)); + Test.assertFalse(bs.get$int(8)); + var bs2 = java.util.BitSet.valueOf([1]); + Test.assertTrue(bs2.get$int(0)); + Test.assertFalse(bs2.get$int(1)); + bs.and(bs2); + Test.assertTrue(bs.get$int(0)); + Test.assertFalse(bs.get$int(1)); + console.info("end testing sets"); + }; + Test.testMap = function () { + console.info("testing maps"); + var m = (new java.util.HashMap()); + m.put("a", "aa"); + m.put("b", "bb"); + m.put("c", "cc"); + Test.assertEquals(m.size(), 3); + Test.assertEquals("bb", m.get("b")); + m.remove("aa"); + Test.assertEquals(m.size(), 3); + m.remove("a"); + Test.assertEquals(m.size(), 2); + Test.assertEquals(null, m.get("undefinedKey")); + Test.assertFalse(m.get("undefinedKey") === undefined); + var m2 = (new java.util.HashMap()); + m2.put(Test.key1(), "a"); + m2.put(new test.MyKey("2"), "b"); + Test.assertEquals(2, m2.size()); + Test.assertEquals("a", m2.get(new test.MyKey("1"))); + Test.assertTrue(m2.containsKey(new test.MyKey("2"))); + Test.assertEquals("[1, 2]", m2.keySet().toString()); + Test.assertEquals("[a, b]", m2.values().toString()); + m2.remove(new test.MyKey("1")); + Test.assertEquals(1, m2.size()); + Test.assertEquals(null, m2.get(new test.MyKey("1"))); + Test.assertEquals(null, java.util.Collections.singletonMap(Test.key1(), "1").get(new test.MyKey("a"))); + Test.assertEquals("1", java.util.Collections.singletonMap(Test.key2(), "1").get(new test.MyKey("a"))); + Test.assertEquals("2", java.util.Collections.singletonMap(new test.MyKey("b"), "2").get(new test.MyKey("b"))); + console.info("end testing maps"); + }; + Test.testString = function () { + console.info("testing strings"); + var sb = new java.lang.StringBuilder(); + sb.append$boolean(true); + sb.append$char('c'); + sb.append$java_lang_String("test"); + sb.deleteCharAt(sb.length() - 1); + Test.assertEquals("truectes", sb.toString()); + sb.append$java_lang_CharSequence$int$int("abc", 0, 1); + Test.assertEquals("truectesa", sb.toString()); + var sb2 = new java.lang.StringBuffer(); + sb2.append$boolean(true); + sb2.append$char('c'); + sb2.append$java_lang_String("test"); + sb2.deleteCharAt(sb2.length() - 1); + Test.assertEquals("truectes", sb2.toString()); + Test.assertEquals('a', javaemul.internal.CharacterHelper.toLowerCase('A')); + Test.assertEquals("abc", "ABC".toLowerCase()); + console.info("end testing strings"); + }; + Test.testIO = function () { + console.info("testing io"); + var s = new java.io.ByteArrayInputStream(/* getBytes */ ("abc").split('').map(function (s) { return s.charCodeAt(0); })); + Test.assertEquals(javaemul.internal.CharacterHelper.getNumericValue('a'), s.read$()); + console.info("end testing io"); + }; + Test.testStreams = function () { + console.info("testing streams"); + var l = (new java.util.ArrayList()); + l.add("a"); + l.add("b"); + l.add("c"); + Test.assertEquals(l.stream().collect(java.util.stream.Collectors.toList()).toString(), "[a, b, c]"); + Test.assertEquals(l.stream().filter(function (e) { return e === ("a"); }).collect(java.util.stream.Collectors.toList()).toString(), "[a]"); + var str = java.util.stream.Stream.of([["GFG", "GeeksForGeeks"], ["g", "geeks"], ["G", "Geeks"]]); + var map = (str.collect(java.util.stream.Collectors.toMap$java_util_function_Function$java_util_function_Function(function (p) { return p[0]; }, function (p) { return p[1]; }))); + Test.assertEquals(map.size(), 3); + Test.assertEquals(map.get("g"), "geeks"); + console.info("end testing streams"); + }; + Test.key1 = function () { + return new test.MyKey("1"); + }; + Test.key2 = function () { + return new test.MyKey("a"); + }; + return Test; + }()); + test.Test = Test; + Test["__class"] = "test.Test"; + var MyKey = /** @class */ (function () { + function MyKey(data) { + if (this.data === undefined) { + this.data = null; + } + this.data = data; + } + MyKey.prototype.toString = function () { + return this.data; + }; + /** + * + * @param {*} obj + * @return {boolean} + */ + MyKey.prototype.equals = function (obj) { + return this.data === obj.data; + }; + /** + * + * @return {number} + */ + MyKey.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.data); + }; + return MyKey; + }()); + test.MyKey = MyKey; + MyKey["__class"] = "test.MyKey"; +})(test || (test = {})); +var java; +(function (java) { + var net; + (function (net) { + var URL = /** @class */ (function () { + function URL(protocol, host, port, file) { + if (((typeof protocol === 'string') || protocol === null) && ((typeof host === 'string') || host === null) && ((typeof port === 'number') || port === null) && ((typeof file === 'string') || file === null)) { + var __args = arguments; + { + var __args_1 = arguments; + var spec = protocol + "//" + host + ":" + port + "/" + file; + if (this.jsUrl === undefined) { + this.jsUrl = null; + } + this.jsUrl = java.net.InternalJsURLFactory.newJsURL(spec); + } + if (this.jsUrl === undefined) { + this.jsUrl = null; + } + } + else if (((typeof protocol === 'string') || protocol === null) && ((typeof host === 'string') || host === null) && ((typeof port === 'string') || port === null) && file === undefined) { + var __args = arguments; + var file_1 = __args[2]; + { + var __args_2 = arguments; + var spec = protocol + "//" + host + "/" + file_1; + if (this.jsUrl === undefined) { + this.jsUrl = null; + } + this.jsUrl = java.net.InternalJsURLFactory.newJsURL(spec); + } + if (this.jsUrl === undefined) { + this.jsUrl = null; + } + } + else if (((protocol != null && protocol instanceof java.net.URL) || protocol === null) && ((typeof host === 'string') || host === null) && port === undefined && file === undefined) { + var __args = arguments; + var url = __args[0]; + var string = __args[1]; + if (this.jsUrl === undefined) { + this.jsUrl = null; + } + this.jsUrl = java.net.InternalJsURLFactory.newJsURL(string, url.jsUrl); + } + else if (((typeof protocol === 'string') || protocol === null) && host === undefined && port === undefined && file === undefined) { + var __args = arguments; + var spec = __args[0]; + if (this.jsUrl === undefined) { + this.jsUrl = null; + } + this.jsUrl = java.net.InternalJsURLFactory.newJsURL(spec); + } + else + throw new Error('invalid overload'); + } + URL.prototype.openStream = function () { + var request = this.makeConnection(); + switch ((request.responseType)) { + case "arraybuffer": + return new java.io.ByteArrayInputStream(new Int8Array(request.response)); + case "blob": + var fileReaderSyncConstructor = (self["FileReaderSync"]); + if (typeof fileReaderSyncConstructor === ("function")) { + return new java.io.ByteArrayInputStream(((fileReaderSyncConstructor["readAsArrayBuffer"])(request.response))); + } + return new java.io.ByteArrayInputStream(/* getBytes */ (URL.createObjectURL(request.response)).split('').map(function (s) { return s.charCodeAt(0); })); + default: + return new java.io.ByteArrayInputStream(/* getBytes */ (request.response.toString()).split('').map(function (s) { return s.charCodeAt(0); })); + } + }; + /*private*/ URL.createObjectURL = function (obj) { + return ((java.net.InternalJsURLFactory.jsURLCtor_$LI$()["createObjectURL"])((obj))); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + URL.prototype.equals = function (o) { + if (this === o) + return true; + if (!(o != null && o instanceof java.net.URL)) + return false; + var url = o; + return java.util.Objects.equals(this.jsUrl, url.jsUrl); + }; + /** + * + * @return {number} + */ + URL.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.jsUrl); + }; + URL.prototype.getAuthority = function () { + var username = (this.jsUrl["username"]); + var password = (this.jsUrl["password"]); + if (username == null && password == null) + return ""; + if (username != null && password != null) + return username + ":" + password; + return username != null ? username : password; + }; + URL.prototype.getContent = function () { + return this.makeConnection().response; + }; + URL.prototype.getDefaultPort = function () { + switch ((this.getProtocol().toLowerCase())) { + case "http": + case "ws": + return 80; + case "https": + case "wss": + return 443; + case "ftp": + return 21; + case "sftp": + return 22; + case "gopher": + return 70; + case "file": + return 0; + } + return -1; + }; + URL.prototype.getFile = function () { + var wholePath = this.getPath(); + var query = this.getQuery(); + return wholePath + (query.length > 0 ? "?" + query : ""); + }; + URL.prototype.getHost = function () { + return (this.jsUrl["hostname"]); + }; + URL.prototype.getPath = function () { + return (this.jsUrl["pathname"]); + }; + URL.prototype.getPort = function () { + return (this.jsUrl["port"]); + }; + URL.prototype.getProtocol = function () { + return (this.jsUrl["protocol"]); + }; + URL.prototype.getQuery = function () { + return (this.jsUrl["search"]); + }; + URL.prototype.getRef = function () { + return (this.jsUrl["hash"]); + }; + URL.prototype.getUserInfo = function () { + return (this.jsUrl["username"]); + }; + URL.prototype.sameFile = function (other) { + return java.util.Objects.equals(this.getProtocol(), other.getProtocol()) && java.util.Objects.equals(this.getAuthority(), other.getAuthority()) && java.util.Objects.equals(this.getHost(), other.getHost()) && this.getPort() === other.getPort() && java.util.Objects.equals(this.getFile(), other.getFile()); + }; + URL.prototype.toExternalForm = function () { + return this.jsUrl.toString(); + }; + /*private*/ URL.prototype.makeConnection = function () { + var request = new XMLHttpRequest(); + request.open("GET", (this.jsUrl["href"]), false); + request.send(); + return request; + }; + /** + * + * @return {string} + */ + URL.prototype.toString = function () { + return (this.jsUrl["href"]); + }; + return URL; + }()); + net.URL = URL; + URL["__class"] = "java.net.URL"; + URL["__interfaces"] = ["java.io.Serializable"]; + })(net = java.net || (java.net = {})); +})(java || (java = {})); +(function (java) { + var net; + (function (net) { + var InternalJsURLFactory = /** @class */ (function () { + function InternalJsURLFactory() { + } + InternalJsURLFactory.jsURLCtor_$LI$ = function () { if (InternalJsURLFactory.jsURLCtor == null) { + InternalJsURLFactory.jsURLCtor = InternalJsURLFactory.getJsURLConstructor(); + } return InternalJsURLFactory.jsURLCtor; }; + ; + /*private*/ InternalJsURLFactory.getJsURLConstructor = function () { + var URLConstructor; + if (java.lang.System.ENVIRONMENT_IS_NODE_$LI$()) { + URLConstructor = (eval("global.URL || (global.URL = require(\"url\").URL)")); + } + else if (java.lang.System.ENVIRONMENT_IS_SHELL_$LI$()) { + var internalJsURLForShellClass = java.net.InternalJsURLForShell; + URLConstructor = (eval("this.URL || (this.URL = internalJsURLForShellClass)")); + } + else { + URLConstructor = (function () { return eval("URL"); }).call(null); + } + return URLConstructor; + }; + InternalJsURLFactory.newJsURL = function () { + var objects = []; + for (var _i = 0; _i < arguments.length; _i++) { + objects[_i] = arguments[_i]; + } + var ctor = InternalJsURLFactory.jsURLCtor_$LI$(); + return (new (ctor.bind.apply(ctor, [null].concat(objects)))()); + }; + return InternalJsURLFactory; + }()); + net.InternalJsURLFactory = InternalJsURLFactory; + InternalJsURLFactory["__class"] = "java.net.InternalJsURLFactory"; + })(net = java.net || (java.net = {})); +})(java || (java = {})); +(function (java) { + var net; + (function (net) { + var InternalJsURLForShell = /** @class */ (function () { + function InternalJsURLForShell(data, url) { + if (((typeof data === 'string') || data === null) && ((url != null && url instanceof Object) || url === null)) { + var __args = arguments; + { + var __args_3 = arguments; + var data_1 = url["href"] + __args_3[0]; + if (this.href === undefined) { + this.href = null; + } + if (this.protocol === undefined) { + this.protocol = null; + } + if (this.username === undefined) { + this.username = null; + } + if (this.password === undefined) { + this.password = null; + } + if (this.hostname === undefined) { + this.hostname = null; + } + if (this.port === undefined) { + this.port = null; + } + if (this.pathname === undefined) { + this.pathname = null; + } + if (this.search === undefined) { + this.search = null; + } + if (this.hash === undefined) { + this.hash = null; + } + this.href = data_1; + var protocolEnd = data_1.indexOf("://"); + if (protocolEnd === -1) + throw new Error("Wrong URL, no protocol"); + this.protocol = data_1.substring(0, protocolEnd); + var userPassEnd = data_1.indexOf("@", protocolEnd + 3); + var userEnd = userPassEnd === -1 ? -1 : data_1.indexOf(":", protocolEnd + 3); + if (userEnd > userPassEnd) + userEnd = -1; + this.username = userPassEnd === -1 ? null : userEnd === -1 ? data_1.substring(protocolEnd + 3, userPassEnd) : data_1.substring(protocolEnd + 3, userEnd); + this.password = userPassEnd === -1 || userEnd === -1 ? null : data_1.substring(userPassEnd + 1, userEnd); + var hostStart = userPassEnd === -1 ? protocolEnd + 3 : userPassEnd + 1; + var hostPortEnd = data_1.indexOf("/", hostStart); + var portStart = data_1.indexOf(":", hostStart); + this.hostname = portStart === -1 || portStart > hostPortEnd ? data_1.substring(hostStart, hostPortEnd) : data_1.substring(hostStart, portStart); + this.port = portStart !== -1 && portStart < hostPortEnd ? javaemul.internal.IntegerHelper.parseInt(data_1.substring(portStart + 1, hostPortEnd)) : null; + var searchStart = data_1.indexOf("?", hostPortEnd); + var hashStart = data_1.indexOf("#", hostPortEnd); + this.search = searchStart !== -1 ? hashStart === -1 ? data_1.substring(searchStart + 1) : data_1.substring(searchStart + 1, hashStart) : null; + this.hash = hashStart !== -1 ? data_1.substring(hashStart + 1) : null; + this.pathname = searchStart === -1 && hashStart === -1 ? data_1.substring(hostPortEnd + 1) : data_1.substring(hostPortEnd + 1, searchStart === -1 ? hashStart : searchStart); + } + if (this.href === undefined) { + this.href = null; + } + if (this.protocol === undefined) { + this.protocol = null; + } + if (this.username === undefined) { + this.username = null; + } + if (this.password === undefined) { + this.password = null; + } + if (this.hostname === undefined) { + this.hostname = null; + } + if (this.port === undefined) { + this.port = null; + } + if (this.pathname === undefined) { + this.pathname = null; + } + if (this.search === undefined) { + this.search = null; + } + if (this.hash === undefined) { + this.hash = null; + } + } + else if (((typeof data === 'string') || data === null) && url === undefined) { + var __args = arguments; + if (this.href === undefined) { + this.href = null; + } + if (this.protocol === undefined) { + this.protocol = null; + } + if (this.username === undefined) { + this.username = null; + } + if (this.password === undefined) { + this.password = null; + } + if (this.hostname === undefined) { + this.hostname = null; + } + if (this.port === undefined) { + this.port = null; + } + if (this.pathname === undefined) { + this.pathname = null; + } + if (this.search === undefined) { + this.search = null; + } + if (this.hash === undefined) { + this.hash = null; + } + this.href = data; + var protocolEnd = data.indexOf("://"); + if (protocolEnd === -1) + throw new Error("Wrong URL, no protocol"); + this.protocol = data.substring(0, protocolEnd); + var userPassEnd = data.indexOf("@", protocolEnd + 3); + var userEnd = userPassEnd === -1 ? -1 : data.indexOf(":", protocolEnd + 3); + if (userEnd > userPassEnd) + userEnd = -1; + this.username = userPassEnd === -1 ? null : userEnd === -1 ? data.substring(protocolEnd + 3, userPassEnd) : data.substring(protocolEnd + 3, userEnd); + this.password = userPassEnd === -1 || userEnd === -1 ? null : data.substring(userPassEnd + 1, userEnd); + var hostStart = userPassEnd === -1 ? protocolEnd + 3 : userPassEnd + 1; + var hostPortEnd = data.indexOf("/", hostStart); + var portStart = data.indexOf(":", hostStart); + this.hostname = portStart === -1 || portStart > hostPortEnd ? data.substring(hostStart, hostPortEnd) : data.substring(hostStart, portStart); + this.port = portStart !== -1 && portStart < hostPortEnd ? javaemul.internal.IntegerHelper.parseInt(data.substring(portStart + 1, hostPortEnd)) : null; + var searchStart = data.indexOf("?", hostPortEnd); + var hashStart = data.indexOf("#", hostPortEnd); + this.search = searchStart !== -1 ? hashStart === -1 ? data.substring(searchStart + 1) : data.substring(searchStart + 1, hashStart) : null; + this.hash = hashStart !== -1 ? data.substring(hashStart + 1) : null; + this.pathname = searchStart === -1 && hashStart === -1 ? data.substring(hostPortEnd + 1) : data.substring(hostPortEnd + 1, searchStart === -1 ? hashStart : searchStart); + } + else + throw new Error('invalid overload'); + } + return InternalJsURLForShell; + }()); + net.InternalJsURLForShell = InternalJsURLForShell; + InternalJsURLForShell["__class"] = "java.net.InternalJsURLForShell"; + })(net = java.net || (java.net = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var EventListenerProxy = /** @class */ (function () { + function EventListenerProxy(listener) { + if (this.listener === undefined) { + this.listener = null; + } + this.listener = listener; + } + EventListenerProxy.prototype.getListener = function () { + return this.listener; + }; + return EventListenerProxy; + }()); + util.EventListenerProxy = EventListenerProxy; + EventListenerProxy["__class"] = "java.util.EventListenerProxy"; + EventListenerProxy["__interfaces"] = ["java.util.EventListener"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var Map; + (function (Map) { + var Entry; + (function (Entry) { + /** + * + * Returns a comparator that compares {@link Map.Entry} by value using the given + * {@link Comparator}. + * + *

+ * The returned comparator is serializable if the specified comparator is also + * serializable. + * + * @param + * the type of the map keys + * @param + * the type of the map values + * @param {*} cmp + * the value {@link Comparator} + * @return {*} a comparator that compares {@link Map.Entry} by the value. + * @since 1.8 + */ + function comparingByValue(cmp) { + java.util.Objects.requireNonNull((cmp)); + return (function (c1, c2) { return ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(cmp))(c1.getValue(), c2.getValue()); }); + } + Entry.comparingByValue = comparingByValue; + })(Entry = Map.Entry || (Map.Entry = {})); + })(Map = util.Map || (util.Map = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * A factory to create JavaScript Map instances. + * @class + */ + var InternalJsMapFactory = /** @class */ (function () { + function InternalJsMapFactory() { + } + InternalJsMapFactory.jsMapCtor_$LI$ = function () { if (InternalJsMapFactory.jsMapCtor == null) { + InternalJsMapFactory.jsMapCtor = InternalJsMapFactory.getJsMapConstructor(); + } return InternalJsMapFactory.jsMapCtor; }; + ; + /*private*/ InternalJsMapFactory.getJsMapConstructor = function () { + return (function () { return eval("Map"); }).call(null); + }; + InternalJsMapFactory.newJsMap = function () { + return (new (InternalJsMapFactory.jsMapCtor_$LI$())()); + }; + return InternalJsMapFactory; + }()); + util.InternalJsMapFactory = InternalJsMapFactory; + InternalJsMapFactory["__class"] = "java.util.InternalJsMapFactory"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Incomplete and naive implementation of the BitSet utility (mainly for + * compatibility/compilation purpose). + * + * @author Renaud Pawlak + * @param {number} nbits + * @class + */ + var BitSet = /** @class */ (function () { + function BitSet(nbits) { + if (((typeof nbits === 'number') || nbits === null)) { + var __args = arguments; + this.bits = []; + while ((nbits > 0)) { + { + (this.bits).push(false); + nbits--; + } + } + ; + } + else if (nbits === undefined) { + var __args = arguments; + this.bits = []; + } + else + throw new Error('invalid overload'); + } + BitSet.valueOf = function (longs) { + var bs = new BitSet(); + bs.bits = new Array(longs.length * 64); + for (var n = 0; n < longs.length * 64; n++) { + { + bs.bits[n] = ((longs[(n / 64 | 0)] & (1 << (n % 64))) !== 0); + } + ; + } + return bs; + }; + BitSet.prototype.flip$int = function (bitIndex) { + this.bits[bitIndex] = !this.bits[bitIndex]; + }; + BitSet.prototype.flip$int$int = function (fromIndex, toIndex) { + for (var i = fromIndex; i <= toIndex; i++) { + { + this.flip$int(i); + } + ; + } + }; + BitSet.prototype.flip = function (fromIndex, toIndex) { + if (((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null)) { + return this.flip$int$int(fromIndex, toIndex); + } + else if (((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined) { + return this.flip$int(fromIndex); + } + else + throw new Error('invalid overload'); + }; + BitSet.prototype.set$int = function (bitIndex) { + this.bits[bitIndex] = true; + }; + BitSet.prototype.set$int$boolean = function (bitIndex, value) { + if (value) { + this.set$int(bitIndex); + } + else { + this.clear$int(bitIndex); + } + }; + BitSet.prototype.set$int$int = function (fromIndex, toIndex) { + for (var i = fromIndex; i <= toIndex; i++) { + { + this.set$int(i); + } + ; + } + }; + BitSet.prototype.set$int$int$boolean = function (fromIndex, toIndex, value) { + if (value) { + this.set$int$int(fromIndex, toIndex); + } + else { + this.clear$int$int(fromIndex, toIndex); + } + }; + BitSet.prototype.set = function (fromIndex, toIndex, value) { + if (((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof value === 'boolean') || value === null)) { + return this.set$int$int$boolean(fromIndex, toIndex, value); + } + else if (((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'boolean') || toIndex === null) && value === undefined) { + return this.set$int$boolean(fromIndex, toIndex); + } + else if (((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && value === undefined) { + return this.set$int$int(fromIndex, toIndex); + } + else if (((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined && value === undefined) { + return this.set$int(fromIndex); + } + else + throw new Error('invalid overload'); + }; + BitSet.prototype.clear$int = function (bitIndex) { + this.bits[bitIndex] = false; + }; + BitSet.prototype.clear$int$int = function (fromIndex, toIndex) { + for (var i = fromIndex; i <= toIndex; i++) { + { + this.clear$int(i); + } + ; + } + }; + BitSet.prototype.clear = function (fromIndex, toIndex) { + if (((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null)) { + return this.clear$int$int(fromIndex, toIndex); + } + else if (((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined) { + return this.clear$int(fromIndex); + } + else if (fromIndex === undefined && toIndex === undefined) { + return this.clear$(); + } + else + throw new Error('invalid overload'); + }; + BitSet.prototype.clear$ = function () { + this.bits = []; + }; + BitSet.prototype.get$int = function (bitIndex) { + return this.bits[bitIndex]; + }; + BitSet.prototype.get$int$int = function (fromIndex, toIndex) { + var bs = new BitSet(); + for (var i = fromIndex; i <= toIndex; i++) { + { + (bs.bits).push(this.bits[i]); + } + ; + } + return bs; + }; + BitSet.prototype.get = function (fromIndex, toIndex) { + if (((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null)) { + return this.get$int$int(fromIndex, toIndex); + } + else if (((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined) { + return this.get$int(fromIndex); + } + else + throw new Error('invalid overload'); + }; + BitSet.prototype.length = function () { + return this.bits.length; + }; + BitSet.prototype.isEmpty = function () { + return this.bits.length === 0; + }; + BitSet.prototype.cardinality = function () { + var sum = 0; + for (var i = 0; i < this.bits.length; i++) { + { + sum += this.bits[i] ? 1 : 0; + } + ; + } + return sum; + }; + BitSet.prototype.and = function (set) { + for (var i = 0; i < this.bits.length; i++) { + { + this.bits[i] = this.bits[i] && set.get$int(i); + } + ; + } + }; + BitSet.prototype.or = function (set) { + for (var i = 0; i < this.bits.length; i++) { + { + this.bits[i] = this.bits[i] || set.get$int(i); + } + ; + } + }; + BitSet.prototype.xor = function (set) { + for (var i = 0; i < this.bits.length; i++) { + { + this.bits[i] = (this.bits[i] && !set.get$int(i)) || (!this.bits[i] && set.get$int(i)); + } + ; + } + }; + BitSet.prototype.andNot = function (set) { + for (var i = 0; i < this.bits.length; i++) { + { + this.bits[i] = this.bits[i] && !set.get$int(i); + } + ; + } + }; + BitSet.prototype.size = function () { + return this.bits.length; + }; + BitSet.prototype.equals = function (obj) { + if (!(obj != null && obj instanceof java.util.BitSet)) + return false; + if (this === obj) + return true; + var set = obj; + if (set.bits.length !== this.bits.length) { + return false; + } + for (var i = 0; i < set.bits.length; i++) { + { + if (!set.bits[i] == this.bits[i]) { + return false; + } + } + ; + } + return true; + }; + BitSet.prototype.clone = function () { + var bs = new BitSet(); + bs.bits = (this.bits).slice(0, this.bits.length); + return bs; + }; + return BitSet; + }()); + util.BitSet = BitSet; + BitSet["__class"] = "java.util.BitSet"; + BitSet["__interfaces"] = ["java.lang.Cloneable", "java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * See the + * official Java API doc for details. + * @class + */ + var Objects = /** @class */ (function () { + function Objects() { + } + Objects.compare = function (a, b, c) { + return a === b ? 0 : ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(c))(a, b); + }; + Objects.deepEquals = function (a, b) { + if (a === b) { + return true; + } + if (a == null || b == null) { + return false; + } + if ( /* equals */(function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(a, b)) { + return true; + } + var class1 = a.constructor; + var class2 = b.constructor; + if (!class1.isArray() || !(function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(class1, class2)) { + return false; + } + if (a != null && a instanceof Array && (a.length == 0 || a[0] == null || a[0] != null)) { + return java.util.Arrays.deepEquals(a, b); + } + if (a != null && a instanceof Array && (a.length == 0 || a[0] == null || typeof a[0] === 'boolean')) { + return java.util.Arrays.equals$boolean_A$boolean_A(a, b); + } + if (a != null && a instanceof Array && (a.length == 0 || a[0] == null || typeof a[0] === 'number')) { + return java.util.Arrays.equals$byte_A$byte_A(a, b); + } + if (a != null && a instanceof Array && (a.length == 0 || a[0] == null || typeof a[0] === 'string')) { + return java.util.Arrays.equals$char_A$char_A(a, b); + } + if (a != null && a instanceof Array && (a.length == 0 || a[0] == null || typeof a[0] === 'number')) { + return java.util.Arrays.equals$short_A$short_A(a, b); + } + if (a != null && a instanceof Array && (a.length == 0 || a[0] == null || typeof a[0] === 'number')) { + return java.util.Arrays.equals$int_A$int_A(a, b); + } + if (a != null && a instanceof Array && (a.length == 0 || a[0] == null || typeof a[0] === 'number')) { + return java.util.Arrays.equals$long_A$long_A(a, b); + } + if (a != null && a instanceof Array && (a.length == 0 || a[0] == null || typeof a[0] === 'number')) { + return java.util.Arrays.equals$float_A$float_A(a, b); + } + if (a != null && a instanceof Array && (a.length == 0 || a[0] == null || typeof a[0] === 'number')) { + return java.util.Arrays.equals$double_A$double_A(a, b); + } + return true; + }; + Objects.equals = function (a, b) { + return (a === b) || (a != null && /* equals */ (function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(a, b)); + }; + Objects.hashCode = function (o) { + return o != null ? /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(o) : 0; + }; + Objects.hash = function () { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return java.util.Arrays.hashCode$java_lang_Object_A(values); + }; + Objects.isNull = function (obj) { + return obj == null; + }; + Objects.nonNull = function (obj) { + return obj != null; + }; + Objects.requireNonNull$java_lang_Object = function (obj) { + if (obj == null) { + throw new java.lang.NullPointerException(); + } + return obj; + }; + Objects.requireNonNull$java_lang_Object$java_lang_String = function (obj, message) { + if (obj == null) { + throw new java.lang.NullPointerException(message); + } + return obj; + }; + Objects.requireNonNull = function (obj, message) { + if (((obj != null) || obj === null) && ((typeof message === 'string') || message === null)) { + return java.util.Objects.requireNonNull$java_lang_Object$java_lang_String(obj, message); + } + else if (((obj != null) || obj === null) && ((typeof message === 'function' && message.length === 0) || message === null)) { + return java.util.Objects.requireNonNull$java_lang_Object$java_util_function_Supplier(obj, message); + } + else if (((obj != null) || obj === null) && message === undefined) { + return java.util.Objects.requireNonNull$java_lang_Object(obj); + } + else + throw new Error('invalid overload'); + }; + Objects.requireNonNull$java_lang_Object$java_util_function_Supplier = function (obj, messageSupplier) { + if (obj == null) { + throw new java.lang.NullPointerException((function (target) { return (typeof target === 'function') ? target() : target.get(); })(messageSupplier)); + } + return obj; + }; + Objects.toString$java_lang_Object = function (o) { + return /* valueOf */ new String(o).toString(); + }; + Objects.toString$java_lang_Object$java_lang_String = function (o, nullDefault) { + return o != null ? o.toString() : nullDefault; + }; + Objects.toString = function (o, nullDefault) { + if (((o != null) || o === null) && ((typeof nullDefault === 'string') || nullDefault === null)) { + return java.util.Objects.toString$java_lang_Object$java_lang_String(o, nullDefault); + } + else if (((o != null) || o === null) && nullDefault === undefined) { + return java.util.Objects.toString$java_lang_Object(o); + } + else + throw new Error('invalid overload'); + }; + return Objects; + }()); + util.Objects = Objects; + Objects["__class"] = "java.util.Objects"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * See + * the official Java API doc for details. + * + * @param type of the wrapped reference + * @class + */ + var Optional = /** @class */ (function () { + function Optional(ref) { + if (((ref != null) || ref === null)) { + var __args = arguments; + if (this.ref === undefined) { + this.ref = null; + } + this.ref = (javaemul.internal.InternalPreconditions.checkCriticalNotNull(ref)); + } + else if (ref === undefined) { + var __args = arguments; + if (this.ref === undefined) { + this.ref = null; + } + this.ref = null; + } + else + throw new Error('invalid overload'); + } + Optional.empty = function () { + return Optional.EMPTY_$LI$(); + }; + Optional.of = function (value) { + return (new Optional(value)); + }; + Optional.ofNullable = function (value) { + return value == null ? Optional.empty() : Optional.of(value); + }; + Optional.EMPTY_$LI$ = function () { if (Optional.EMPTY == null) { + Optional.EMPTY = (new Optional()); + } return Optional.EMPTY; }; + ; + Optional.prototype.isPresent = function () { + return this.ref != null; + }; + Optional.prototype.get = function () { + javaemul.internal.InternalPreconditions.checkCriticalElement(this.isPresent()); + return this.ref; + }; + Optional.prototype.ifPresent = function (consumer) { + var _this = this; + if (this.isPresent()) { + (function (target) { return (typeof target === 'function') ? target(_this.ref) : target.accept(_this.ref); })(consumer); + } + }; + Optional.prototype.filter = function (predicate) { + var _this = this; + javaemul.internal.InternalPreconditions.checkCriticalNotNull((predicate)); + if (!this.isPresent() || (function (target) { return (typeof target === 'function') ? target(_this.ref) : target.test(_this.ref); })(predicate)) { + return this; + } + return Optional.empty(); + }; + Optional.prototype.map = function (mapper) { + var _this = this; + javaemul.internal.InternalPreconditions.checkCriticalNotNull((mapper)); + if (this.isPresent()) { + return Optional.ofNullable((function (target) { return (typeof target === 'function') ? target(_this.ref) : target.apply(_this.ref); })(mapper)); + } + return Optional.empty(); + }; + Optional.prototype.flatMap = function (mapper) { + var _this = this; + javaemul.internal.InternalPreconditions.checkCriticalNotNull((mapper)); + if (this.isPresent()) { + return (javaemul.internal.InternalPreconditions.checkCriticalNotNull((function (target) { return (typeof target === 'function') ? target(_this.ref) : target.apply(_this.ref); })(mapper))); + } + return Optional.empty(); + }; + Optional.prototype.orElse = function (other) { + return this.isPresent() ? this.ref : other; + }; + Optional.prototype.orElseGet = function (other) { + return this.isPresent() ? this.ref : (function (target) { return (typeof target === 'function') ? target() : target.get(); })(other); + }; + Optional.prototype.orElseThrow = function (exceptionSupplier) { + if (this.isPresent()) { + return this.ref; + } + throw (function (target) { return (typeof target === 'function') ? target() : target.get(); })(exceptionSupplier); + }; + /** + * + * @param {*} obj + * @return {boolean} + */ + Optional.prototype.equals = function (obj) { + if (obj === this) { + return true; + } + if (!(obj != null && obj instanceof java.util.Optional)) { + return false; + } + var other = obj; + return java.util.Objects.equals(this.ref, other.ref); + }; + /** + * + * @return {number} + */ + Optional.prototype.hashCode = function () { + return java.util.Objects.hashCode(this.ref); + }; + /** + * + * @return {string} + */ + Optional.prototype.toString = function () { + return this.isPresent() ? "Optional.of(" + /* valueOf */ new String(this.ref).toString() + ")" : "Optional.empty()"; + }; + return Optional; + }()); + util.Optional = Optional; + Optional["__class"] = "java.util.Optional"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * See + * the official Java API doc for details. + * @class + */ + var OptionalDouble = /** @class */ (function () { + function OptionalDouble(value) { + if (((typeof value === 'number') || value === null)) { + var __args = arguments; + if (this.ref === undefined) { + this.ref = 0; + } + if (this.present === undefined) { + this.present = false; + } + this.ref = value; + this.present = true; + } + else if (value === undefined) { + var __args = arguments; + if (this.ref === undefined) { + this.ref = 0; + } + if (this.present === undefined) { + this.present = false; + } + this.ref = 0; + this.present = false; + } + else + throw new Error('invalid overload'); + } + OptionalDouble.empty = function () { + return OptionalDouble.EMPTY_$LI$(); + }; + OptionalDouble.of = function (value) { + return new OptionalDouble(value); + }; + OptionalDouble.EMPTY_$LI$ = function () { if (OptionalDouble.EMPTY == null) { + OptionalDouble.EMPTY = new OptionalDouble(); + } return OptionalDouble.EMPTY; }; + ; + OptionalDouble.prototype.isPresent = function () { + return this.present; + }; + OptionalDouble.prototype.getAsDouble = function () { + javaemul.internal.InternalPreconditions.checkCriticalElement(this.present); + return this.ref; + }; + OptionalDouble.prototype.ifPresent = function (consumer) { + var _this = this; + if (this.present) { + (function (target) { return (typeof target === 'function') ? target(_this.ref) : target.accept(_this.ref); })(consumer); + } + }; + OptionalDouble.prototype.orElse = function (other) { + return this.present ? this.ref : other; + }; + OptionalDouble.prototype.orElseGet = function (other) { + return this.present ? this.ref : (function (target) { return (typeof target === 'function') ? target() : target.getAsDouble(); })(other); + }; + OptionalDouble.prototype.orElseThrow = function (exceptionSupplier) { + if (this.present) { + return this.ref; + } + throw (function (target) { return (typeof target === 'function') ? target() : target.get(); })(exceptionSupplier); + }; + /** + * + * @param {*} obj + * @return {boolean} + */ + OptionalDouble.prototype.equals = function (obj) { + if (obj === this) { + return true; + } + if (!(obj != null && obj instanceof java.util.OptionalDouble)) { + return false; + } + var other = obj; + return this.present === other.present && /* compare */ (this.ref - other.ref) === 0; + }; + /** + * + * @return {number} + */ + OptionalDouble.prototype.hashCode = function () { + return this.present ? javaemul.internal.DoubleHelper.hashCode(this.ref) : 0; + }; + /** + * + * @return {string} + */ + OptionalDouble.prototype.toString = function () { + return this.present ? "OptionalDouble.of(" + /* toString */ ('' + (this.ref)) + ")" : "OptionalDouble.empty()"; + }; + return OptionalDouble; + }()); + util.OptionalDouble = OptionalDouble; + OptionalDouble["__class"] = "java.util.OptionalDouble"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Construct an Observable with zero Observers. + * @class + */ + var Observable = /** @class */ (function () { + function Observable() { + this.changed = false; + if (this.obs === undefined) { + this.obs = null; + } + this.obs = (new java.util.Vector()); + } + /** + * Adds an observer to the set of observers for this object, provided that + * it is not the same as some observer already in the set. The order in + * which notifications will be delivered to multiple observers is not + * specified. See the class comment. + * + * @param {*} o + * an observer to be added. + * @throws NullPointerException + * if the parameter o is null. + */ + Observable.prototype.addObserver = function (o) { + if (o == null) + throw new java.lang.NullPointerException(); + if (!this.obs.contains(o)) { + this.obs.addElement(o); + } + }; + /** + * Deletes an observer from the set of observers of this object. Passing + * null to this method will have no effect. + * + * @param {*} o + * the observer to be deleted. + */ + Observable.prototype.deleteObserver = function (o) { + this.obs.removeElement(o); + }; + Observable.prototype.notifyObservers$ = function () { + this.notifyObservers$java_lang_Object(null); + }; + Observable.prototype.notifyObservers$java_lang_Object = function (arg) { + var arrLocal; + if (!this.changed) + return; + arrLocal = this.obs.toArray$(); + this.clearChanged(); + for (var i = arrLocal.length - 1; i >= 0; i--) { + arrLocal[i].update(this, arg); + } + }; + /** + * If this object has changed, as indicated by the hasChanged + * method, then notify all of its observers and then call the + * clearChanged method to indicate that this object has no + * longer changed. + *

+ * Each observer has its update method called with two + * arguments: this observable object and the arg argument. + * + * @param {*} arg + * any object. + * @see java.util.Observable#clearChanged() + * @see java.util.Observable#hasChanged() + * @see java.util.Observer#update(java.util.Observable, java.lang.Object) + */ + Observable.prototype.notifyObservers = function (arg) { + if (((arg != null) || arg === null)) { + return this.notifyObservers$java_lang_Object(arg); + } + else if (arg === undefined) { + return this.notifyObservers$(); + } + else + throw new Error('invalid overload'); + }; + /** + * Clears the observer list so that this object no longer has any observers. + */ + Observable.prototype.deleteObservers = function () { + this.obs.removeAllElements(); + }; + /** + * Marks this Observable object as having been changed; the + * hasChanged method will now return true. + */ + Observable.prototype.setChanged = function () { + this.changed = true; + }; + /** + * Indicates that this object has no longer changed, or that it has already + * notified all of its observers of its most recent change, so that the + * hasChanged method will now return false. This method is + * called automatically by the notifyObservers methods. + * + * @see java.util.Observable#notifyObservers() + * @see java.util.Observable#notifyObservers(java.lang.Object) + */ + Observable.prototype.clearChanged = function () { + this.changed = false; + }; + /** + * Tests if this object has changed. + * + * @return {boolean} true if and only if the setChanged + * method has been called more recently than the + * clearChanged method on this object; + * false otherwise. + * @see java.util.Observable#clearChanged() + * @see java.util.Observable#setChanged() + */ + Observable.prototype.hasChanged = function () { + return this.changed; + }; + /** + * Returns the number of observers of this Observable object. + * + * @return {number} the number of observers of this object. + */ + Observable.prototype.countObservers = function () { + return this.obs.size(); + }; + return Observable; + }()); + util.Observable = Observable; + Observable["__class"] = "java.util.Observable"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * A simple wrapper around JavaScriptObject to provide {@link java.util.Map}-like semantics for any + * key type. + *

+ * Implementation notes: + *

+ * A key's hashCode is the index in backingMap which should contain that key. Since several keys may + * have the same hash, each value in hashCodeMap is actually an array containing all entries whose + * keys share the same hash. + * @param {java.util.AbstractHashMap} host + * @class + */ + var InternalHashCodeMap = /** @class */ (function () { + function InternalHashCodeMap(host) { + this.backingMap = java.util.InternalJsMapFactory.newJsMap(); + if (this.host === undefined) { + this.host = null; + } + if (this.__size === undefined) { + this.__size = 0; + } + this.host = host; + } + /* Default method injected from java.lang.Iterable */ + InternalHashCodeMap.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_1 = function (index123) { + var t = index123.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index123 = this.iterator(); index123.hasNext();) { + _loop_1(index123); + } + }; + InternalHashCodeMap.prototype.put = function (key, value) { + var hashCode = this.hash(key); + var chain = this.getChainOrEmpty(hashCode); + if (chain.length === 0) { + this.backingMap.set(hashCode, chain); + } + else { + var entry = this.findEntryInChain(key, chain); + if (entry != null) { + return entry.setValue(value); + } + } + chain[chain.length] = (new java.util.AbstractMap.SimpleEntry(key, value)); + this.__size++; + java.util.ConcurrentModificationDetector.structureChanged(this.host); + return null; + }; + InternalHashCodeMap.prototype.remove = function (key) { + var hashCode = this.hash(key); + var chain = this.getChainOrEmpty(hashCode); + for (var i = 0; i < chain.length; i++) { + { + var entry = chain[i]; + if (this.host._equals(key, entry.getKey())) { + if (chain.length === 1) { + javaemul.internal.ArrayHelper.setLength(chain, 0); + this.backingMap["delete"](hashCode); + } + else { + javaemul.internal.ArrayHelper.removeFrom(chain, i, 1); + } + this.__size--; + java.util.ConcurrentModificationDetector.structureChanged(this.host); + return entry.getValue(); + } + } + ; + } + return null; + }; + InternalHashCodeMap.prototype.getEntry = function (key) { + return this.findEntryInChain(key, this.getChainOrEmpty(this.hash(key))); + }; + /*private*/ InternalHashCodeMap.prototype.findEntryInChain = function (key, chain) { + for (var index124 = 0; index124 < chain.length; index124++) { + var entry = chain[index124]; + { + if (this.host._equals(key, entry.getKey())) { + return entry; + } + } + } + return null; + }; + InternalHashCodeMap.prototype.size = function () { + return this.__size; + }; + /** + * + * @return {*} + */ + InternalHashCodeMap.prototype.iterator = function () { + return new InternalHashCodeMap.InternalHashCodeMap$0(this); + }; + /*private*/ InternalHashCodeMap.prototype.getChainOrEmpty = function (hashCode) { + var chain = this.unsafeCastToArray(this.backingMap.get(hashCode)); + return chain == null ? this.newEntryChain() : chain; + }; + /*private*/ InternalHashCodeMap.prototype.newEntryChain = function () { + return ([]); + }; + /*private*/ InternalHashCodeMap.prototype.unsafeCastToArray = function (arr) { + return (arr); + }; + /** + * Returns hash code of the key as calculated by {@link AbstractHashMap#getHashCode(Object)} but + * also handles null keys as well. + * @param {*} key + * @return {number} + * @private + */ + /*private*/ InternalHashCodeMap.prototype.hash = function (key) { + return key == null ? 0 : this.host.getHashCode(key); + }; + return InternalHashCodeMap; + }()); + util.InternalHashCodeMap = InternalHashCodeMap; + InternalHashCodeMap["__class"] = "java.util.InternalHashCodeMap"; + InternalHashCodeMap["__interfaces"] = ["java.lang.Iterable"]; + (function (InternalHashCodeMap) { + var InternalHashCodeMap$0 = /** @class */ (function () { + function InternalHashCodeMap$0(__parent) { + this.__parent = __parent; + this.chains = this.__parent.backingMap.entries(); + this.itemIndex = 0; + this.chain = this.__parent.newEntryChain(); + this.lastEntry = null; + } + /* Default method injected from java.util.Iterator */ + InternalHashCodeMap$0.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + InternalHashCodeMap$0.prototype.hasNext = function () { + if (this.itemIndex < this.chain.length) { + return true; + } + var current = this.chains.next(); + if (!current.done) { + this.chain = this.__parent.unsafeCastToArray(current.value[1]); + this.itemIndex = 0; + return true; + } + return false; + }; + /** + * + * @return {*} + */ + InternalHashCodeMap$0.prototype.next = function () { + this.lastEntry = this.chain[this.itemIndex++]; + return this.lastEntry; + }; + /** + * + */ + InternalHashCodeMap$0.prototype.remove = function () { + this.__parent.remove(this.lastEntry.getKey()); + if (this.itemIndex !== 0) { + this.itemIndex--; + } + }; + return InternalHashCodeMap$0; + }()); + InternalHashCodeMap.InternalHashCodeMap$0 = InternalHashCodeMap$0; + InternalHashCodeMap$0["__interfaces"] = ["java.util.Iterator"]; + })(InternalHashCodeMap = util.InternalHashCodeMap || (util.InternalHashCodeMap = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var stream; + (function (stream) { + var IntStream; + (function (IntStream) { + function range(startInclusive, endExclusive) { + if (startInclusive >= endExclusive) { + return java.util.Collections.emptyList().stream(); + } + else { + var result = (new java.util.ArrayList()); + for (; startInclusive < endExclusive; ++startInclusive) { + { + result.add(startInclusive); + } + ; + } + return result.stream(); + } + } + IntStream.range = range; + })(IntStream = stream.IntStream || (stream.IntStream = {})); + })(stream = util.stream || (util.stream = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var stream; + (function (stream) { + var Collector; + (function (Collector) { + var Characteristics; + (function (Characteristics) { + /** + * Indicates that this collector is concurrent, meaning that + * the result container can support the accumulator function being + * called concurrently with the same result container from multiple + * threads. + * + *

If a {@code CONCURRENT} collector is not also {@code UNORDERED}, + * then it should only be evaluated concurrently if applied to an + * unordered data source. + */ + Characteristics[Characteristics["CONCURRENT"] = 0] = "CONCURRENT"; + /** + * Indicates that the collection operation does not commit to preserving + * the encounter order of input elements. (This might be true if the + * result container has no intrinsic order, such as a {@link Set}.) + */ + Characteristics[Characteristics["UNORDERED"] = 1] = "UNORDERED"; + /** + * Indicates that the finisher function is the identity function and + * can be elided. If set, it must be the case that an unchecked cast + * from A to R will succeed. + */ + Characteristics[Characteristics["IDENTITY_FINISH"] = 2] = "IDENTITY_FINISH"; + })(Characteristics = Collector.Characteristics || (Collector.Characteristics = {})); + })(Collector = stream.Collector || (stream.Collector = {})); + })(stream = util.stream || (util.stream = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var stream; + (function (stream) { + var Stream; + (function (Stream) { + function of() { + var values = []; + for (var _i = 0; _i < arguments.length; _i++) { + values[_i] = arguments[_i]; + } + return java.util.Arrays.asList.apply(null, values).stream(); + } + Stream.of = of; + })(Stream = stream.Stream || (stream.Stream = {})); + })(stream = util.stream || (util.stream = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * See + * the official Java API doc for details. + * @class + */ + var OptionalInt = /** @class */ (function () { + function OptionalInt(value) { + if (((typeof value === 'number') || value === null)) { + var __args = arguments; + if (this.ref === undefined) { + this.ref = 0; + } + if (this.present === undefined) { + this.present = false; + } + this.ref = value; + this.present = true; + } + else if (value === undefined) { + var __args = arguments; + if (this.ref === undefined) { + this.ref = 0; + } + if (this.present === undefined) { + this.present = false; + } + this.ref = 0; + this.present = false; + } + else + throw new Error('invalid overload'); + } + OptionalInt.empty = function () { + return OptionalInt.EMPTY_$LI$(); + }; + OptionalInt.of = function (value) { + return new OptionalInt(value); + }; + OptionalInt.EMPTY_$LI$ = function () { if (OptionalInt.EMPTY == null) { + OptionalInt.EMPTY = new OptionalInt(); + } return OptionalInt.EMPTY; }; + ; + OptionalInt.prototype.isPresent = function () { + return this.present; + }; + OptionalInt.prototype.getAsInt = function () { + javaemul.internal.InternalPreconditions.checkCriticalElement(this.present); + return this.ref; + }; + OptionalInt.prototype.ifPresent = function (consumer) { + var _this = this; + if (this.present) { + (function (target) { return (typeof target === 'function') ? target(_this.ref) : target.accept(_this.ref); })(consumer); + } + }; + OptionalInt.prototype.orElse = function (other) { + return this.present ? this.ref : other; + }; + OptionalInt.prototype.orElseGet = function (other) { + return this.present ? this.ref : (function (target) { return (typeof target === 'function') ? target() : target.getAsInt(); })(other); + }; + OptionalInt.prototype.orElseThrow = function (exceptionSupplier) { + if (this.present) { + return this.ref; + } + throw (function (target) { return (typeof target === 'function') ? target() : target.get(); })(exceptionSupplier); + }; + /** + * + * @param {*} obj + * @return {boolean} + */ + OptionalInt.prototype.equals = function (obj) { + if (obj === this) { + return true; + } + if (!(obj != null && obj instanceof java.util.OptionalInt)) { + return false; + } + var other = obj; + return this.present === other.present && /* compare */ (this.ref - other.ref) === 0; + }; + /** + * + * @return {number} + */ + OptionalInt.prototype.hashCode = function () { + return this.present ? javaemul.internal.IntegerHelper.hashCode(this.ref) : 0; + }; + /** + * + * @return {string} + */ + OptionalInt.prototype.toString = function () { + return this.present ? "OptionalInt.of(" + /* toString */ ('' + (this.ref)) + ")" : "OptionalInt.empty()"; + }; + return OptionalInt; + }()); + util.OptionalInt = OptionalInt; + OptionalInt["__class"] = "java.util.OptionalInt"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * See + * the official Java API doc for details. + * @class + */ + var OptionalLong = /** @class */ (function () { + function OptionalLong(value) { + if (((typeof value === 'number') || value === null)) { + var __args = arguments; + if (this.ref === undefined) { + this.ref = 0; + } + if (this.present === undefined) { + this.present = false; + } + this.ref = value; + this.present = true; + } + else if (value === undefined) { + var __args = arguments; + if (this.ref === undefined) { + this.ref = 0; + } + if (this.present === undefined) { + this.present = false; + } + this.ref = 0; + this.present = false; + } + else + throw new Error('invalid overload'); + } + OptionalLong.empty = function () { + return OptionalLong.EMPTY_$LI$(); + }; + OptionalLong.of = function (value) { + return new OptionalLong(value); + }; + OptionalLong.EMPTY_$LI$ = function () { if (OptionalLong.EMPTY == null) { + OptionalLong.EMPTY = new OptionalLong(); + } return OptionalLong.EMPTY; }; + ; + OptionalLong.prototype.isPresent = function () { + return this.present; + }; + OptionalLong.prototype.getAsLong = function () { + javaemul.internal.InternalPreconditions.checkCriticalElement(this.present); + return this.ref; + }; + OptionalLong.prototype.ifPresent = function (consumer) { + var _this = this; + if (this.present) { + (function (target) { return (typeof target === 'function') ? target(_this.ref) : target.accept(_this.ref); })(consumer); + } + }; + OptionalLong.prototype.orElse = function (other) { + return this.present ? this.ref : other; + }; + OptionalLong.prototype.orElseGet = function (other) { + return this.present ? this.ref : (function (target) { return (typeof target === 'function') ? target() : target.getAsLong(); })(other); + }; + OptionalLong.prototype.orElseThrow = function (exceptionSupplier) { + if (this.present) { + return this.ref; + } + throw (function (target) { return (typeof target === 'function') ? target() : target.get(); })(exceptionSupplier); + }; + /** + * + * @param {*} obj + * @return {boolean} + */ + OptionalLong.prototype.equals = function (obj) { + if (obj === this) { + return true; + } + if (!(obj != null && obj instanceof java.util.OptionalLong)) { + return false; + } + var other = obj; + return this.present === other.present && /* compare */ (this.ref - other.ref) === 0; + }; + /** + * + * @return {number} + */ + OptionalLong.prototype.hashCode = function () { + return this.present ? javaemul.internal.LongHelper.hashCode(this.ref) : 0; + }; + /** + * + * @return {string} + */ + OptionalLong.prototype.toString = function () { + return this.present ? "OptionalLong.of(" + /* toString */ ('' + (this.ref)) + ")" : "OptionalLong.empty()"; + }; + return OptionalLong; + }()); + util.OptionalLong = OptionalLong; + OptionalLong["__class"] = "java.util.OptionalLong"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Available as a superclass of event objects. + * @param {*} source + * @class + */ + var EventObject = /** @class */ (function () { + function EventObject(source) { + if (this.source === undefined) { + this.source = null; + } + this.source = source; + } + EventObject.prototype.getSource = function () { + return this.source; + }; + return EventObject; + }()); + util.EventObject = EventObject; + EventObject["__class"] = "java.util.EventObject"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var InternalJsMap; + (function (InternalJsMap) { + })(InternalJsMap = util.InternalJsMap || (util.InternalJsMap = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Constructs a string tokenizer for the specified string. All + * characters in the delim argument are the delimiters + * for separating tokens. + *

+ * If the returnDelims flag is true, then + * the delimiter characters are also returned as tokens. Each + * delimiter is returned as a string of length one. If the flag is + * false, the delimiter characters are skipped and only + * serve as separators between tokens. + *

+ * Note that if delim is null, this constructor does + * not throw an exception. However, trying to invoke other methods on the + * resulting StringTokenizer may result in a + * NullPointerException. + * + * @param {string} str a string to be parsed. + * @param {string} delim the delimiters. + * @param {boolean} returnDelims flag indicating whether to return the delimiters + * as tokens. + * @exception NullPointerException if str is null + * @class + * @author unascribed + */ + var StringTokenizer = /** @class */ (function () { + function StringTokenizer(str, delim, returnDelims) { + if (((typeof str === 'string') || str === null) && ((typeof delim === 'string') || delim === null) && ((typeof returnDelims === 'boolean') || returnDelims === null)) { + var __args = arguments; + if (this.currentPosition === undefined) { + this.currentPosition = 0; + } + if (this.newPosition === undefined) { + this.newPosition = 0; + } + if (this.maxPosition === undefined) { + this.maxPosition = 0; + } + if (this.str === undefined) { + this.str = null; + } + if (this.delimiters === undefined) { + this.delimiters = null; + } + if (this.retDelims === undefined) { + this.retDelims = false; + } + if (this.delimsChanged === undefined) { + this.delimsChanged = false; + } + if (this.maxDelimCodePoint === undefined) { + this.maxDelimCodePoint = 0; + } + if (this.delimiterCodePoints === undefined) { + this.delimiterCodePoints = null; + } + this.hasSurrogates = false; + this.currentPosition = 0; + this.newPosition = -1; + this.delimsChanged = false; + this.str = str; + this.maxPosition = str.length; + this.delimiters = delim; + this.retDelims = returnDelims; + this.setMaxDelimCodePoint(); + } + else if (((typeof str === 'string') || str === null) && ((typeof delim === 'string') || delim === null) && returnDelims === undefined) { + var __args = arguments; + { + var __args_4 = arguments; + var returnDelims_1 = false; + if (this.currentPosition === undefined) { + this.currentPosition = 0; + } + if (this.newPosition === undefined) { + this.newPosition = 0; + } + if (this.maxPosition === undefined) { + this.maxPosition = 0; + } + if (this.str === undefined) { + this.str = null; + } + if (this.delimiters === undefined) { + this.delimiters = null; + } + if (this.retDelims === undefined) { + this.retDelims = false; + } + if (this.delimsChanged === undefined) { + this.delimsChanged = false; + } + if (this.maxDelimCodePoint === undefined) { + this.maxDelimCodePoint = 0; + } + if (this.delimiterCodePoints === undefined) { + this.delimiterCodePoints = null; + } + this.hasSurrogates = false; + this.currentPosition = 0; + this.newPosition = -1; + this.delimsChanged = false; + this.str = str; + this.maxPosition = str.length; + this.delimiters = delim; + this.retDelims = returnDelims_1; + this.setMaxDelimCodePoint(); + } + if (this.currentPosition === undefined) { + this.currentPosition = 0; + } + if (this.newPosition === undefined) { + this.newPosition = 0; + } + if (this.maxPosition === undefined) { + this.maxPosition = 0; + } + if (this.str === undefined) { + this.str = null; + } + if (this.delimiters === undefined) { + this.delimiters = null; + } + if (this.retDelims === undefined) { + this.retDelims = false; + } + if (this.delimsChanged === undefined) { + this.delimsChanged = false; + } + if (this.maxDelimCodePoint === undefined) { + this.maxDelimCodePoint = 0; + } + if (this.delimiterCodePoints === undefined) { + this.delimiterCodePoints = null; + } + this.hasSurrogates = false; + } + else if (((typeof str === 'string') || str === null) && delim === undefined && returnDelims === undefined) { + var __args = arguments; + { + var __args_5 = arguments; + var delim_1 = " \t\n\r\f"; + var returnDelims_2 = false; + if (this.currentPosition === undefined) { + this.currentPosition = 0; + } + if (this.newPosition === undefined) { + this.newPosition = 0; + } + if (this.maxPosition === undefined) { + this.maxPosition = 0; + } + if (this.str === undefined) { + this.str = null; + } + if (this.delimiters === undefined) { + this.delimiters = null; + } + if (this.retDelims === undefined) { + this.retDelims = false; + } + if (this.delimsChanged === undefined) { + this.delimsChanged = false; + } + if (this.maxDelimCodePoint === undefined) { + this.maxDelimCodePoint = 0; + } + if (this.delimiterCodePoints === undefined) { + this.delimiterCodePoints = null; + } + this.hasSurrogates = false; + this.currentPosition = 0; + this.newPosition = -1; + this.delimsChanged = false; + this.str = str; + this.maxPosition = str.length; + this.delimiters = delim_1; + this.retDelims = returnDelims_2; + this.setMaxDelimCodePoint(); + } + if (this.currentPosition === undefined) { + this.currentPosition = 0; + } + if (this.newPosition === undefined) { + this.newPosition = 0; + } + if (this.maxPosition === undefined) { + this.maxPosition = 0; + } + if (this.str === undefined) { + this.str = null; + } + if (this.delimiters === undefined) { + this.delimiters = null; + } + if (this.retDelims === undefined) { + this.retDelims = false; + } + if (this.delimsChanged === undefined) { + this.delimsChanged = false; + } + if (this.maxDelimCodePoint === undefined) { + this.maxDelimCodePoint = 0; + } + if (this.delimiterCodePoints === undefined) { + this.delimiterCodePoints = null; + } + this.hasSurrogates = false; + } + else + throw new Error('invalid overload'); + } + /** + * Set maxDelimCodePoint to the highest char in the delimiter set. + * @private + */ + /*private*/ StringTokenizer.prototype.setMaxDelimCodePoint = function () { + if (this.delimiters == null) { + this.maxDelimCodePoint = 0; + return; + } + var m = 0; + var c; + var count = 0; + for (var i = 0; i < this.delimiters.length; i += javaemul.internal.CharacterHelper.charCount(c)) { + { + c = (this.delimiters.charAt(i)).charCodeAt(0); + if (c >= (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(javaemul.internal.CharacterHelper.MIN_HIGH_SURROGATE) && c <= (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(javaemul.internal.CharacterHelper.MAX_LOW_SURROGATE)) { + c = /* codePointAt */ this.delimiters.charCodeAt(i); + this.hasSurrogates = true; + } + if (m < c) + m = c; + count++; + } + ; + } + this.maxDelimCodePoint = m; + if (this.hasSurrogates) { + this.delimiterCodePoints = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(count); + for (var i = 0, j = 0; i < count; i++, j += javaemul.internal.CharacterHelper.charCount(c)) { + { + c = /* codePointAt */ this.delimiters.charCodeAt(j); + this.delimiterCodePoints[i] = c; + } + ; + } + } + }; + /** + * Skips delimiters starting from the specified position. If retDelims + * is false, returns the index of the first non-delimiter character at or + * after startPos. If retDelims is true, startPos is returned. + * @param {number} startPos + * @return {number} + * @private + */ + /*private*/ StringTokenizer.prototype.skipDelimiters = function (startPos) { + if (this.delimiters == null) + throw new java.lang.NullPointerException(); + var position = startPos; + while ((!this.retDelims && position < this.maxPosition)) { + { + if (!this.hasSurrogates) { + var c = this.str.charAt(position); + if (((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) > this.maxDelimCodePoint) || (this.delimiters.indexOf(c) < 0)) + break; + position++; + } + else { + var c = this.str.charCodeAt(position); + if ((c > this.maxDelimCodePoint) || !this.isDelimiter(c)) { + break; + } + position += javaemul.internal.CharacterHelper.charCount(c); + } + } + } + ; + return position; + }; + /** + * Skips ahead from startPos and returns the index of the next delimiter + * character encountered, or maxPosition if no such delimiter is found. + * @param {number} startPos + * @return {number} + * @private + */ + /*private*/ StringTokenizer.prototype.scanToken = function (startPos) { + var position = startPos; + while ((position < this.maxPosition)) { + { + if (!this.hasSurrogates) { + var c = this.str.charAt(position); + if (((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) <= this.maxDelimCodePoint) && (this.delimiters.indexOf(c) >= 0)) + break; + position++; + } + else { + var c = this.str.charCodeAt(position); + if ((c <= this.maxDelimCodePoint) && this.isDelimiter(c)) + break; + position += javaemul.internal.CharacterHelper.charCount(c); + } + } + } + ; + if (this.retDelims && (startPos === position)) { + if (!this.hasSurrogates) { + var c = this.str.charAt(position); + if (((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) <= this.maxDelimCodePoint) && (this.delimiters.indexOf(c) >= 0)) + position++; + } + else { + var c = this.str.charCodeAt(position); + if ((c <= this.maxDelimCodePoint) && this.isDelimiter(c)) + position += javaemul.internal.CharacterHelper.charCount(c); + } + } + return position; + }; + /*private*/ StringTokenizer.prototype.isDelimiter = function (codePoint) { + for (var i = 0; i < this.delimiterCodePoints.length; i++) { + { + if (this.delimiterCodePoints[i] === codePoint) { + return true; + } + } + ; + } + return false; + }; + /** + * Tests if there are more tokens available from this tokenizer's string. + * If this method returns true, then a subsequent call to + * nextToken with no argument will successfully return a token. + * + * @return {boolean} true if and only if there is at least one token + * in the string after the current position; false + * otherwise. + */ + StringTokenizer.prototype.hasMoreTokens = function () { + this.newPosition = this.skipDelimiters(this.currentPosition); + return (this.newPosition < this.maxPosition); + }; + StringTokenizer.prototype.nextToken$ = function () { + this.currentPosition = (this.newPosition >= 0 && !this.delimsChanged) ? this.newPosition : this.skipDelimiters(this.currentPosition); + this.delimsChanged = false; + this.newPosition = -1; + if (this.currentPosition >= this.maxPosition) + throw new java.util.NoSuchElementException(); + var start = this.currentPosition; + this.currentPosition = this.scanToken(this.currentPosition); + return this.str.substring(start, this.currentPosition); + }; + StringTokenizer.prototype.nextToken$java_lang_String = function (delim) { + this.delimiters = delim; + this.delimsChanged = true; + this.setMaxDelimCodePoint(); + return this.nextToken$(); + }; + /** + * Returns the next token in this string tokenizer's string. First, + * the set of characters considered to be delimiters by this + * StringTokenizer object is changed to be the characters in + * the string delim. Then the next token in the string + * after the current position is returned. The current position is + * advanced beyond the recognized token. The new delimiter set + * remains the default after this call. + * + * @param {string} delim the new delimiters. + * @return {string} the next token, after switching to the new delimiter set. + * @exception NoSuchElementException if there are no more tokens in this + * tokenizer's string. + * @exception NullPointerException if delim is null + */ + StringTokenizer.prototype.nextToken = function (delim) { + if (((typeof delim === 'string') || delim === null)) { + return this.nextToken$java_lang_String(delim); + } + else if (delim === undefined) { + return this.nextToken$(); + } + else + throw new Error('invalid overload'); + }; + /** + * Returns the same value as the hasMoreTokens + * method. It exists so that this class can implement the + * Enumeration interface. + * + * @return {boolean} true if there are more tokens; + * false otherwise. + * @see java.util.Enumeration + * @see java.util.StringTokenizer#hasMoreTokens() + */ + StringTokenizer.prototype.hasMoreElements = function () { + return this.hasMoreTokens(); + }; + /** + * Returns the same value as the nextToken method, + * except that its declared return value is Object rather than + * String. It exists so that this class can implement the + * Enumeration interface. + * + * @return {*} the next token in the string. + * @exception NoSuchElementException if there are no more tokens in this + * tokenizer's string. + * @see java.util.Enumeration + * @see java.util.StringTokenizer#nextToken() + */ + StringTokenizer.prototype.nextElement = function () { + return this.nextToken$(); + }; + /** + * Calculates the number of times that this tokenizer's + * nextToken method can be called before it generates an + * exception. The current position is not advanced. + * + * @return {number} the number of tokens remaining in the string using the current + * delimiter set. + * @see java.util.StringTokenizer#nextToken() + */ + StringTokenizer.prototype.countTokens = function () { + var count = 0; + var currpos = this.currentPosition; + while ((currpos < this.maxPosition)) { + { + currpos = this.skipDelimiters(currpos); + if (currpos >= this.maxPosition) + break; + currpos = this.scanToken(currpos); + count++; + } + } + ; + return count; + }; + return StringTokenizer; + }()); + util.StringTokenizer = StringTokenizer; + StringTokenizer["__class"] = "java.util.StringTokenizer"; + StringTokenizer["__interfaces"] = ["java.util.Enumeration"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var regex; + (function (regex) { + var Matcher = /** @class */ (function () { + function Matcher(_pattern, text) { + if (this._pattern === undefined) { + this._pattern = null; + } + if (this.text === undefined) { + this.text = null; + } + if (this.starts === undefined) { + this.starts = null; + } + if (this.ends === undefined) { + this.ends = null; + } + if (this.groups === undefined) { + this.groups = null; + } + this.first = -1; + this.last = 0; + this.lastAppendPosition = 0; + this._pattern = _pattern; + this.text = text; + this.reset$(); + } + Matcher.prototype.hasGroups = function () { + if (this.groups == null) + throw new java.lang.IllegalStateException("No match available"); + }; + Matcher.prototype.searchWith = function (regExp) { + var startLastIndex = (regExp.lastIndex | 0); + var exec = regExp.exec(this.text); + this.groups = exec; + if (this.groups == null) { + this.reset$(); + return false; + } + this.starts = []; + this.ends = []; + var parenthesisStart = []; + var parenthesisEnds = []; + var nonCapturesToCaptures = new Matcher.NonCapturesToCaptures(parenthesisStart, parenthesisEnds); + var regExpStringWithAllCaptures = (regExp.source).replace(new RegExp("((?:\\\\.|\\[\\^?\\]\\]|\\[\\^?(?:[^\\\\\\]]|\\\\.|)+\\])+)|\\(((?:\\?\\:)?)|(\\))", "g"), ((function (nonCapturesToCaptures) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return nonCapturesToCaptures.apply(args); + }; + })(nonCapturesToCaptures))); + var regExpWithAllCaptures = new RegExp(regExpStringWithAllCaptures); + var indexGetter = new Matcher.IndexGetter(regExp.source, parenthesisStart, parenthesisEnds, this.starts, this.ends, startLastIndex); + (this.text.substring(startLastIndex)).replace(regExpWithAllCaptures, ((function (indexGetter) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return indexGetter.apply(args); + }; + })(indexGetter))); + return true; + }; + Matcher.prototype.end$ = function () { + return this.end$int(0); + }; + Matcher.prototype.end$int = function (i) { + this.hasGroups(); + return this.ends[i]; + }; + Matcher.prototype.end$java_lang_String = function (string) { + return this.end$int(this._pattern.namedGroupsNames.get(string) + this.regionStart()); + }; + Matcher.prototype.end = function (string) { + if (((typeof string === 'string') || string === null)) { + return this.end$java_lang_String(string); + } + else if (((typeof string === 'number') || string === null)) { + return this.end$int(string); + } + else if (string === undefined) { + return this.end$(); + } + else + throw new Error('invalid overload'); + }; + Matcher.prototype.find$ = function () { + return this.searchWith(this._pattern.regexp); + }; + Matcher.prototype.find$int = function (start) { + this._pattern.regexp.lastIndex = start; + return this.find$(); + }; + Matcher.prototype.find = function (start) { + if (((typeof start === 'number') || start === null)) { + return this.find$int(start); + } + else if (start === undefined) { + return this.find$(); + } + else + throw new Error('invalid overload'); + }; + Matcher.prototype.group$ = function () { + return this.group$int(0); + }; + Matcher.prototype.group$int = function (i) { + this.hasGroups(); + return this.groups[i]; + }; + Matcher.prototype.group$java_lang_String = function (string) { + return this.group$int(this._pattern.namedGroupsNames.get(string) + this.regionStart()); + }; + Matcher.prototype.group = function (string) { + if (((typeof string === 'string') || string === null)) { + return this.group$java_lang_String(string); + } + else if (((typeof string === 'number') || string === null)) { + return this.group$int(string); + } + else if (string === undefined) { + return this.group$(); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + Matcher.prototype.groupCount = function () { + return this.groups.length - 1; + }; + Matcher.prototype.hitEnd = function () { + return this.end$() === this.text.length; + }; + Matcher.prototype.lookingAt = function () { + this.reset$(); + return this.searchWith(java.util.regex.Pattern.compile$java_lang_String("^(?:" + this._pattern.pattern() + ")").regexp); + }; + Matcher.prototype.matches = function () { + this.reset$(); + return this.searchWith(java.util.regex.Pattern.compile$java_lang_String("^(?:" + this._pattern.pattern() + ")$").regexp); + }; + Matcher.prototype.pattern = function () { + return this._pattern; + }; + Matcher.prototype.regionEnd = function () { + this.hasGroups(); + return this.groups.length; + }; + Matcher.prototype.regionStart = function () { + this.hasGroups(); + return 1; + }; + Matcher.prototype.replaceAll = function (replacement) { + this.reset$(); + this.text = (this.text).replace(this._pattern.regexp, replacement); + return this.text; + }; + Matcher.prototype.replaceFirst = function (replacement) { + this.reset$(); + var firstReplacer = new Matcher.FirstReplacer(replacement); + this.text = (this.text).replace(this._pattern.regexp, (((function (firstReplacer) { + return function (args) { return firstReplacer.apply(args); }; + })(firstReplacer)))); + return this.text; + }; + Matcher.prototype.reset$ = function () { + this._pattern.regexp.lastIndex = 0; + this.groups = null; + this.starts = null; + this.ends = null; + this.first = -1; + this.last = 0; + return this; + }; + Matcher.prototype.reset$java_lang_CharSequence = function (input) { + this.text = input.toString(); + return this.reset$(); + }; + Matcher.prototype.reset = function (input) { + if (((input != null && (input["__interfaces"] != null && input["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || input.constructor != null && input.constructor["__interfaces"] != null && input.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof input === "string")) || input === null)) { + return this.reset$java_lang_CharSequence(input); + } + else if (input === undefined) { + return this.reset$(); + } + else + throw new Error('invalid overload'); + }; + Matcher.prototype.start$ = function () { + return this.start$int(0); + }; + Matcher.prototype.start$int = function (i) { + this.hasGroups(); + return this.starts[i]; + }; + Matcher.prototype.start$java_lang_String = function (string) { + return this.start$int(this._pattern.namedGroupsNames.get(string) + this.regionStart()); + }; + Matcher.prototype.start = function (string) { + if (((typeof string === 'string') || string === null)) { + return this.start$java_lang_String(string); + } + else if (((typeof string === 'number') || string === null)) { + return this.start$int(string); + } + else if (string === undefined) { + return this.start$(); + } + else + throw new Error('invalid overload'); + }; + Matcher.prototype.toMatchResult = function () { + return this; + }; + Matcher.prototype.usePattern = function (newPattern) { + this._pattern = newPattern; + return this; + }; + return Matcher; + }()); + regex.Matcher = Matcher; + Matcher["__class"] = "java.util.regex.Matcher"; + Matcher["__interfaces"] = ["java.util.regex.MatchResult"]; + (function (Matcher) { + var IndexGetter = /** @class */ (function () { + function IndexGetter(regexString, parenthesisStart, parenthesisEnd, starts, ends, startLastIndex) { + if (this.regexString === undefined) { + this.regexString = null; + } + if (this.parenthesisStart === undefined) { + this.parenthesisStart = null; + } + if (this.parenthesisEnd === undefined) { + this.parenthesisEnd = null; + } + if (this.starts === undefined) { + this.starts = null; + } + if (this.ends === undefined) { + this.ends = null; + } + if (this.startLastIndex === undefined) { + this.startLastIndex = 0; + } + this.regexString = regexString; + this.parenthesisStart = parenthesisStart; + this.parenthesisEnd = parenthesisEnd; + this.starts = starts; + this.ends = ends; + this.startLastIndex = startLastIndex; + } + /** + * + * @param {Array} args + * @return {string} + */ + IndexGetter.prototype.apply = function (args) { + (this.starts).push((args[args.length - 2])); + (this.ends).push((this.starts[0]) + args[0].length); + var lastIndices = (new java.util.Stack()); + lastIndices.push(this.ends[0]); + lastIndices.push(this.starts[0]); + var countEndsFrom = 0; + for (var i = 0; i < args.length - 3; ++i) { + { + var pl = this.parenthesisStart[i]; + while ((this.parenthesisEnd[countEndsFrom] < pl)) { + { + countEndsFrom += 1; + lastIndices.pop(); + } + } + ; + var start = lastIndices.pop(); + var len = args[i + 1] != null ? args[i + 1].length : 0; + lastIndices.push(start + len); + lastIndices.push(start); + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(this.regexString.charAt(pl + 1)) == '?'.charCodeAt(0)) { + continue; + } + if (len === 0) { + (this.starts).push(-1); + (this.ends).push(-1); + } + else { + start += this.startLastIndex; + (this.starts).push(start); + (this.ends).push(start + len); + } + } + ; + } + this.starts[0] += this.startLastIndex; + this.ends[0] += this.startLastIndex; + return args[0]; + }; + return IndexGetter; + }()); + Matcher.IndexGetter = IndexGetter; + IndexGetter["__class"] = "java.util.regex.Matcher.IndexGetter"; + IndexGetter["__interfaces"] = ["java.util.function.Function"]; + var NonCapturesToCaptures = /** @class */ (function () { + function NonCapturesToCaptures(start, ends) { + if (this.start === undefined) { + this.start = null; + } + if (this.ends === undefined) { + this.ends = null; + } + this.start = start; + this.ends = ends; + } + /** + * + * @param {Array} args + * @return {string} + */ + NonCapturesToCaptures.prototype.apply = function (args) { + if (args[1] !== undefined) { + return args[1]; + } + if (args[2] !== undefined) { + (this.start).push(javaemul.internal.IntegerHelper.parseInt((args[args.length - 2]))); + return "("; + } + if (args[3] !== undefined) { + (this.ends).push(javaemul.internal.IntegerHelper.parseInt((args[args.length - 2]))); + return args[3]; + } + throw new Error("NonCapturesToCaptures"); + }; + return NonCapturesToCaptures; + }()); + Matcher.NonCapturesToCaptures = NonCapturesToCaptures; + NonCapturesToCaptures["__class"] = "java.util.regex.Matcher.NonCapturesToCaptures"; + NonCapturesToCaptures["__interfaces"] = ["java.util.function.Function"]; + var FirstReplacer = /** @class */ (function () { + function FirstReplacer(replacement) { + if (this.replacement === undefined) { + this.replacement = null; + } + this.first = true; + this.replacement = replacement; + } + /** + * + * @param {Array} args + * @return {string} + */ + FirstReplacer.prototype.apply = function (args) { + if (this.first) { + this.first = false; + return this.replacement; + } + return args[0]; + }; + return FirstReplacer; + }()); + Matcher.FirstReplacer = FirstReplacer; + FirstReplacer["__class"] = "java.util.regex.Matcher.FirstReplacer"; + FirstReplacer["__interfaces"] = ["java.util.function.Function"]; + })(Matcher = regex.Matcher || (regex.Matcher = {})); + })(regex = util.regex || (util.regex = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var regex; + (function (regex_1) { + var Pattern = /** @class */ (function () { + function Pattern(regexp, _flags, namedGroupsNames) { + if (this.regexp === undefined) { + this.regexp = null; + } + if (this._flags === undefined) { + this._flags = 0; + } + if (this.namedGroupsNames === undefined) { + this.namedGroupsNames = null; + } + this.regexp = regexp; + this._flags = _flags; + this.namedGroupsNames = namedGroupsNames; + } + Pattern.compile$java_lang_String = function (regexp) { + return Pattern.compile$java_lang_String$int(regexp, 0); + }; + Pattern.compile$java_lang_String$int = function (regexpString, flags) { + var jsFlags = "g"; + if ((flags & Pattern.MULTILINE) > 0) { + jsFlags += "m"; + } + if ((flags & Pattern.CASE_INSENSITIVE) > 0) { + jsFlags += "i"; + } + if ((flags & Pattern.UNICODE_CHARACTER_CLASS) > 0) { + jsFlags += "u"; + } + if ((flags & Pattern.UNICODE_CASE) > 0) { + jsFlags += "ui"; + } + var namedGroupsNames = (new java.util.HashMap()); + var groupNameRemover = new Pattern.GroupNameRemover(namedGroupsNames); + regexpString = (regexpString).replace(new RegExp("(?:\\\\\\\\)*(\\\\?)\\[\\^?\\]?|(?:\\\\\\\\)*(\\\\?)\\]|(?:\\\\\\\\)*(\\\\?)\\((?:(\\?\\:)|\\?<([^>]+)>)?", "g"), (((function (groupNameRemover) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return groupNameRemover.apply(args); + }; + })(groupNameRemover)))).replace(new RegExp("(\\?\\:|(?:[*+?]|\\{[^\\}]+\\})*)((?:[^\\\\()|]|\\\\.|\\[\\^?\\]\\]|\\[\\^?(?:[^\\\\\\]]|\\\\.|)+\\])*)", "g"), ((function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (args[2] === undefined || args[2].length === 0) { + return args[1]; + } + var regexp = args[args.length - 1]; + var startIndexOfMatched = javaemul.internal.IntegerHelper.parseInt((args[args.length - 2])); + var endIndexOfMatched = startIndexOfMatched + args[0].length; + var hasOpenBracket = (startIndexOfMatched > 0 && ("(" === (regexp.charAt(startIndexOfMatched - 1)))) || (startIndexOfMatched > 2 && ("(?:" === (regexp.substr(startIndexOfMatched - 3, 3)))); + var hasCloseBracket = regexp.length > endIndexOfMatched && (")" === (regexp.charAt(endIndexOfMatched))); + if (hasOpenBracket && hasCloseBracket) { + return args[1] + args[2]; + } + return args[1] + "(?:" + args[2] + ")"; + }))); + try { + return new Pattern(new RegExp(regexpString, jsFlags), flags, namedGroupsNames); + } + catch (e) { + throw new java.util.regex.PatternSyntaxException(e, regexpString); + } + ; + }; + Pattern.compile = function (regexpString, flags) { + if (((typeof regexpString === 'string') || regexpString === null) && ((typeof flags === 'number') || flags === null)) { + return java.util.regex.Pattern.compile$java_lang_String$int(regexpString, flags); + } + else if (((typeof regexpString === 'string') || regexpString === null) && flags === undefined) { + return java.util.regex.Pattern.compile$java_lang_String(regexpString); + } + else + throw new Error('invalid overload'); + }; + Pattern.prototype.flags = function () { + return this._flags; + }; + Pattern.prototype.matcher = function (sequence) { + return new java.util.regex.Matcher(this, sequence.toString()); + }; + Pattern.matches = function (regex, input) { + return Pattern.compile$java_lang_String(regex).matcher(input).matches(); + }; + Pattern.prototype.pattern = function () { + return this.regexp.source; + }; + Pattern.quote = function (s) { + return JSON.stringify(s); + }; + Pattern.prototype.split = function (input, limit) { + if (limit === void 0) { limit = 0; } + return (input.toString()).split(this.regexp, limit).toArray(); + }; + Pattern.prototype.splitAsStream = function (input) { + return java.util.Arrays.stream(this.split(input)); + }; + /** + * + * @return {string} + */ + Pattern.prototype.toString = function () { + return this.pattern(); + }; + Pattern.CASE_INSENSITIVE = 2; + Pattern.MULTILINE = 8; + Pattern.UNICODE_CASE = 64; + Pattern.UNICODE_CHARACTER_CLASS = 256; + return Pattern; + }()); + regex_1.Pattern = Pattern; + Pattern["__class"] = "java.util.regex.Pattern"; + Pattern["__interfaces"] = ["java.io.Serializable"]; + (function (Pattern) { + var GroupNameRemover = /** @class */ (function () { + function GroupNameRemover(namedGroupsNames) { + if (this.namedGroupsNames === undefined) { + this.namedGroupsNames = null; + } + this.count = 0; + this.inBrackets = false; + this.namedGroupsNames = namedGroupsNames; + } + /** + * + * @param {Array} args + * @return {string} + */ + GroupNameRemover.prototype.apply = function (args) { + if (this.inBrackets || args[2] !== undefined) { + this.inBrackets = args[2] === undefined || args[2].length === 1; + return args[0]; + } + if (args[1] !== undefined) { + this.inBrackets = args[1].length === 0; + return args[0]; + } + if (args[3] !== undefined && args[3].length !== 0) { + return args[0]; + } + if (args[4] === undefined) { + this.count += 1; + } + if (args[5] !== undefined) { + this.namedGroupsNames.put((args[5]), this.count); + args[0] = args[0].replace(new RegExp("\\?<[^>]+>"), ""); + } + return args[0]; + }; + return GroupNameRemover; + }()); + Pattern.GroupNameRemover = GroupNameRemover; + GroupNameRemover["__class"] = "java.util.regex.Pattern.GroupNameRemover"; + GroupNameRemover["__interfaces"] = ["java.util.function.Function"]; + })(Pattern = regex_1.Pattern || (regex_1.Pattern = {})); + })(regex = util.regex || (util.regex = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Skeletal implementation of the Collection interface. [Sun + * docs] + * + * @param the element type. + * @class + */ + var AbstractCollection = /** @class */ (function () { + function AbstractCollection() { + } + /* Default method injected from java.util.Collection */ + AbstractCollection.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_2 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_2(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + AbstractCollection.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + AbstractCollection.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + AbstractCollection.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_3 = function (index125) { + var t = index125.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index125 = this.iterator(); index125.hasNext();) { + _loop_3(index125); + } + }; + /** + * + * @param {*} o + * @return {boolean} + */ + AbstractCollection.prototype.add = function (o) { + throw new java.lang.UnsupportedOperationException("Add not supported on this collection"); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + AbstractCollection.prototype.addAll = function (c) { + javaemul.internal.InternalPreconditions.checkNotNull(c); + var changed = false; + for (var index126 = c.iterator(); index126.hasNext();) { + var e = index126.next(); + { + changed = this.add(e) || changed; + } + } + return changed; + }; + /** + * + */ + AbstractCollection.prototype.clear = function () { + for (var iter = this.iterator(); iter.hasNext();) { + { + iter.next(); + iter.remove(); + } + ; + } + }; + /** + * + * @param {*} o + * @return {boolean} + */ + AbstractCollection.prototype.contains = function (o) { + return this.advanceToFind(o, false); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + AbstractCollection.prototype.containsAll = function (c) { + javaemul.internal.InternalPreconditions.checkNotNull(c); + for (var index127 = c.iterator(); index127.hasNext();) { + var e = index127.next(); + { + if (!this.contains(e)) { + return false; + } + } + } + return true; + }; + /** + * + * @return {boolean} + */ + AbstractCollection.prototype.isEmpty = function () { + return this.size() === 0; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + AbstractCollection.prototype.remove = function (o) { + return this.advanceToFind(o, true); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + AbstractCollection.prototype.removeAll = function (c) { + javaemul.internal.InternalPreconditions.checkNotNull(c); + var changed = false; + for (var iter = this.iterator(); iter.hasNext();) { + { + var o = iter.next(); + if (c.contains(o)) { + iter.remove(); + changed = true; + } + } + ; + } + return changed; + }; + /** + * + * @param {*} c + * @return {boolean} + */ + AbstractCollection.prototype.retainAll = function (c) { + javaemul.internal.InternalPreconditions.checkNotNull(c); + var changed = false; + for (var iter = this.iterator(); iter.hasNext();) { + { + var o = iter.next(); + if (!c.contains(o)) { + iter.remove(); + changed = true; + } + } + ; + } + return changed; + }; + AbstractCollection.prototype.toArray$ = function () { + return this.toArray$java_lang_Object_A((function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(this.size())); + }; + AbstractCollection.prototype.toArray$java_lang_Object_A = function (a) { + var size = this.size(); + if (a.length < size) { + a = javaemul.internal.ArrayHelper.createFrom(a, size); + } + var result = a; + var it = this.iterator(); + for (var i = 0; i < size; ++i) { + { + result[i] = it.next(); + } + ; + } + if (a.length > size) { + a[size] = null; + } + return a; + }; + /** + * + * @param {Array} a + * @return {Array} + */ + AbstractCollection.prototype.toArray = function (a) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null)) { + return this.toArray$java_lang_Object_A(a); + } + else if (a === undefined) { + return this.toArray$(); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {string} + */ + AbstractCollection.prototype.toString = function () { + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index128 = this.iterator(); index128.hasNext();) { + var e = index128.next(); + { + joiner.add(e === this ? "(this Collection)" : /* valueOf */ new String(e).toString()); + } + } + return joiner.toString(); + }; + /*private*/ AbstractCollection.prototype.advanceToFind = function (o, remove) { + for (var iter = this.iterator(); iter.hasNext();) { + { + var e = iter.next(); + if (java.util.Objects.equals(o, e)) { + if (remove) { + iter.remove(); + } + return true; + } + } + ; + } + return false; + }; + return AbstractCollection; + }()); + util.AbstractCollection = AbstractCollection; + AbstractCollection["__class"] = "java.util.AbstractCollection"; + AbstractCollection["__interfaces"] = ["java.util.Collection", "java.lang.Iterable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var TimerTask = /** @class */ (function () { + function TimerTask() { + this.state = TimerTask.VIRGIN; + if (this.nextExecutionTime === undefined) { + this.nextExecutionTime = 0; + } + this.period = 0; + if (this.handle === undefined) { + this.handle = 0; + } + } + TimerTask.prototype.cancel = function () { + var success = this.state === TimerTask.SCHEDULED; + this.state = TimerTask.CANCELLED; + this.nextExecutionTime = 0; + this.period = 0; + return success; + }; + TimerTask.prototype.scheduledExecutionTime = function () { + return this.period < 0 ? this.nextExecutionTime + this.period : this.nextExecutionTime - this.period; + }; + TimerTask.VIRGIN = 0; + TimerTask.SCHEDULED = 1; + TimerTask.EXECUTED = 2; + TimerTask.CANCELLED = 3; + return TimerTask; + }()); + util.TimerTask = TimerTask; + TimerTask["__class"] = "java.util.TimerTask"; + TimerTask["__interfaces"] = ["java.lang.Runnable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Construct a random generator with the given {@code seed} as the initial + * state. + * + * @param {number} seed the seed that will determine the initial state of this random + * number generator. + * @see #setSeed + * @class + */ + var Random = /** @class */ (function () { + function Random(seed) { + if (((typeof seed === 'number') || seed === null)) { + var __args = arguments; + if (this.nextNextGaussian === undefined) { + this.nextNextGaussian = 0; + } + if (this.seedhi === undefined) { + this.seedhi = 0; + } + if (this.seedlo === undefined) { + this.seedlo = 0; + } + this.haveNextNextGaussian = false; + this.setSeed$long(seed); + } + else if (seed === undefined) { + var __args = arguments; + if (this.nextNextGaussian === undefined) { + this.nextNextGaussian = 0; + } + if (this.seedhi === undefined) { + this.seedhi = 0; + } + if (this.seedlo === undefined) { + this.seedlo = 0; + } + this.haveNextNextGaussian = false; + var seed_1 = Random.uniqueSeed++ + javaemul.internal.DateUtil.now(); + var hi = (Math.floor(seed_1 * Random.twoToTheMinus24) | 0) & 16777215; + var lo = ((seed_1 - (hi * Random.twoToThe24)) | 0); + this.setSeed$int$int(hi, lo); + } + else + throw new Error('invalid overload'); + } + Random.__static_initialize = function () { if (!Random.__static_initialized) { + Random.__static_initialized = true; + Random.__static_initializer_0(); + } }; + Random.twoToTheXMinus24_$LI$ = function () { Random.__static_initialize(); if (Random.twoToTheXMinus24 == null) { + Random.twoToTheXMinus24 = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(25); + } return Random.twoToTheXMinus24; }; + ; + Random.twoToTheXMinus48_$LI$ = function () { Random.__static_initialize(); if (Random.twoToTheXMinus48 == null) { + Random.twoToTheXMinus48 = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(33); + } return Random.twoToTheXMinus48; }; + ; + Random.__static_initializer_0 = function () { + var twoToTheXMinus48Tmp = 1.52587890625E-5; + for (var i = 32; i >= 0; i--) { + { + Random.twoToTheXMinus48_$LI$()[i] = twoToTheXMinus48Tmp; + twoToTheXMinus48Tmp *= 0.5; + } + ; + } + var twoToTheXMinus24Tmp = 1.0; + for (var i = 24; i >= 0; i--) { + { + Random.twoToTheXMinus24_$LI$()[i] = twoToTheXMinus24Tmp; + twoToTheXMinus24Tmp *= 0.5; + } + ; + } + }; + /** + * Returns the next pseudo-random, uniformly distributed {@code boolean} value + * generated by this generator. + * + * @return {boolean} a pseudo-random, uniformly distributed boolean value. + */ + Random.prototype.nextBoolean = function () { + return this.nextInternal(1) !== 0; + }; + /** + * Modifies the {@code byte} array by a random sequence of {@code byte}s + * generated by this random number generator. + * + * @param {Array} buf non-null array to contain the new random {@code byte}s. + * @see #next + */ + Random.prototype.nextBytes = function (buf) { + javaemul.internal.InternalPreconditions.checkNotNull(buf); + var rand = 0; + var count = 0; + var loop = 0; + while ((count < buf.length)) { + { + if (loop === 0) { + rand = (this.nextInternal(32) | 0); + loop = 3; + } + else { + loop--; + } + buf[count++] = (rand | 0); + rand >>= 8; + } + } + ; + }; + /** + * Generates a normally distributed random {@code double} number between 0.0 + * inclusively and 1.0 exclusively. + * + * @return {number} a random {@code double} in the range [0.0 - 1.0) + * @see #nextFloat + */ + Random.prototype.nextDouble = function () { + return this.nextInternal(26) * Random.twoToTheMinus26 + this.nextInternal(27) * Random.twoToTheMinus53; + }; + /** + * Generates a normally distributed random {@code float} number between 0.0 + * inclusively and 1.0 exclusively. + * + * @return {number} float a random {@code float} number between [0.0 and 1.0) + * @see #nextDouble + */ + Random.prototype.nextFloat = function () { + return (this.nextInternal(24) * Random.twoToTheMinus24); + }; + /** + * Pseudo-randomly generates (approximately) a normally distributed {@code + * double} value with mean 0.0 and a standard deviation value of {@code 1.0} + * using the polar method of G. E. P. Box, M. E. Muller, and G. + * Marsaglia, as described by Donald E. Knuth in The Art of Computer + * Programming, Volume 2: Seminumerical Algorithms, section 3.4.1, + * subsection C, algorithm P. + * + * @return {number} a random {@code double} + * @see #nextDouble + */ + Random.prototype.nextGaussian = function () { + if (this.haveNextNextGaussian) { + this.haveNextNextGaussian = false; + return this.nextNextGaussian; + } + var v1; + var v2; + var s; + do { + { + v1 = 2 * this.nextDouble() - 1; + v2 = 2 * this.nextDouble() - 1; + s = v1 * v1 + v2 * v2; + } + } while ((s >= 1)); + var norm = (s === 0) ? 0.0 : Math.sqrt(-2.0 * Math.log(s) / s); + this.nextNextGaussian = v2 * norm; + this.haveNextNextGaussian = true; + return v1 * norm; + }; + Random.prototype.nextInt$ = function () { + return (this.nextInternal(32) | 0); + }; + Random.prototype.nextInt$int = function (n) { + javaemul.internal.InternalPreconditions.checkCriticalArgument(n > 0, "Random nextInt parameter can only be positive: %s", /* toString */ ('' + (n))); + if ((n & -n) === n) { + return (((n * this.nextInternal(31)) * Random.twoToTheMinus31) | 0); + } + var bits; + var val; + do { + { + bits = this.nextInternal(31); + val = bits % n; + } + } while ((bits - val + (n - 1) < 0)); + return (val | 0); + }; + /** + * Returns a new pseudo-random {@code int} value which is uniformly + * distributed between 0 (inclusively) and the value of {@code n} + * (exclusively). + * + * @param {number} n the exclusive upper border of the range [0 - n). + * @return {number} a random {@code int}. + */ + Random.prototype.nextInt = function (n) { + if (((typeof n === 'number') || n === null)) { + return this.nextInt$int(n); + } + else if (n === undefined) { + return this.nextInt$(); + } + else + throw new Error('invalid overload'); + }; + /** + * Generates a uniformly distributed 64-bit integer value from the random + * number sequence. + * + * @return {number} 64-bit random integer. + * @see java.lang.Integer#MAX_VALUE + * @see java.lang.Integer#MIN_VALUE + * @see #next + * @see #nextInt() + * @see #nextInt(int) + */ + Random.prototype.nextLong = function () { + return ((function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(this.nextInternal(32)) << 32) + (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(this.nextInternal(32)); + }; + Random.prototype.setSeed$long = function (seed) { + this.setSeed$int$int((((seed >> 24) & 16777215) | 0), ((seed & 16777215) | 0)); + }; + /** + * Returns a pseudo-random uniformly distributed {@code int} value of the + * number of bits specified by the argument {@code bits} as described by + * Donald E. Knuth in The Art of Computer Programming, Volume 2: + * Seminumerical Algorithms, section 3.2.1. + * + * @param {number} bits number of bits of the returned value. + * @return {number} a pseudo-random generated int number. + * @see #nextBytes + * @see #nextDouble + * @see #nextFloat + * @see #nextInt() + * @see #nextInt(int) + * @see #nextGaussian + * @see #nextLong + */ + Random.prototype.next = function (bits) { + return (this.nextInternal(bits) | 0); + }; + /*private*/ Random.prototype.nextInternal = function (bits) { + var hi = this.seedhi * Random.multiplierLo + this.seedlo * Random.multiplierHi; + var lo = this.seedlo * Random.multiplierLo + 11; + var carry = Math.floor(lo * Random.twoToTheMinus24); + hi += carry; + lo -= carry * Random.twoToThe24; + hi %= Random.twoToThe24; + this.seedhi = hi; + this.seedlo = lo; + if (bits <= 24) { + return Math.floor(this.seedhi * Random.twoToTheXMinus24_$LI$()[bits]); + } + else { + var h = this.seedhi * (1 << (bits - 24)); + var l = Math.floor(this.seedlo * Random.twoToTheXMinus48_$LI$()[bits]); + var dval = h + l; + if (dval >= Random.twoToThe31) { + dval -= Random.twoToThe32; + } + return dval; + } + }; + Random.prototype.setSeed$int$int = function (seedhi, seedlo) { + this.seedhi = seedhi ^ 1502; + this.seedlo = seedlo ^ 15525485; + this.haveNextNextGaussian = false; + }; + Random.prototype.setSeed = function (seedhi, seedlo) { + if (((typeof seedhi === 'number') || seedhi === null) && ((typeof seedlo === 'number') || seedlo === null)) { + return this.setSeed$int$int(seedhi, seedlo); + } + else if (((typeof seedhi === 'number') || seedhi === null) && seedlo === undefined) { + return this.setSeed$long(seedhi); + } + else + throw new Error('invalid overload'); + }; + Random.__static_initialized = false; + Random.multiplierHi = 1502; + Random.multiplierLo = 15525485; + Random.twoToThe24 = 1.6777216E7; + Random.twoToThe31 = 2.147483648E9; + Random.twoToThe32 = 4.294967296E9; + Random.twoToTheMinus24 = 5.9604644775390625E-8; + Random.twoToTheMinus26 = 1.4901161193847656E-8; + Random.twoToTheMinus31 = 4.6566128730773926E-10; + Random.twoToTheMinus53 = 1.1102230246251565E-16; + /** + * A value used to avoid two random number generators produced at the same + * time having the same seed. + */ + Random.uniqueSeed = 0; + return Random; + }()); + util.Random = Random; + Random["__class"] = "java.util.Random"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * A very simple emulation of Locale for shared-code patterns like + * {@code String.toUpperCase(Locale.US)}. + *

+ * Note: Any changes to this class should put into account the assumption that + * was made in rest of the JRE emulation. + * @class + */ + var Locale = /** @class */ (function () { + function Locale() { + } + Locale.ROOT_$LI$ = function () { if (Locale.ROOT == null) { + Locale.ROOT = new Locale.RootLocale(); + } return Locale.ROOT; }; + ; + Locale.ENGLISH_$LI$ = function () { if (Locale.ENGLISH == null) { + Locale.ENGLISH = new Locale.EnglishLocale(); + } return Locale.ENGLISH; }; + ; + Locale.US_$LI$ = function () { if (Locale.US == null) { + Locale.US = new Locale.USLocale(); + } return Locale.US; }; + ; + Locale.FRANCE_$LI$ = function () { if (Locale.FRANCE == null) { + Locale.FRANCE = new Locale.FrenchLocale(); + } return Locale.FRANCE; }; + ; + Locale.UK_$LI$ = function () { if (Locale.UK == null) { + Locale.UK = new Locale.UKLocale(); + } return Locale.UK; }; + ; + Locale.defaultLocale_$LI$ = function () { if (Locale.defaultLocale == null) { + Locale.defaultLocale = new Locale.DefaultLocale(); + } return Locale.defaultLocale; }; + ; + /** + * Returns an instance that represents the browser's default locale (not + * necessarily the one defined by 'gwt.locale'). + * @return {java.util.Locale} + */ + Locale.getDefault = function () { + return Locale.defaultLocale_$LI$(); + }; + return Locale; + }()); + util.Locale = Locale; + Locale["__class"] = "java.util.Locale"; + (function (Locale) { + var RootLocale = /** @class */ (function (_super) { + __extends(RootLocale, _super); + function RootLocale() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + RootLocale.prototype.toString = function () { + return ""; + }; + return RootLocale; + }(java.util.Locale)); + Locale.RootLocale = RootLocale; + RootLocale["__class"] = "java.util.Locale.RootLocale"; + var EnglishLocale = /** @class */ (function (_super) { + __extends(EnglishLocale, _super); + function EnglishLocale() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + EnglishLocale.prototype.toString = function () { + return "en"; + }; + return EnglishLocale; + }(java.util.Locale)); + Locale.EnglishLocale = EnglishLocale; + EnglishLocale["__class"] = "java.util.Locale.EnglishLocale"; + var FrenchLocale = /** @class */ (function (_super) { + __extends(FrenchLocale, _super); + function FrenchLocale() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + FrenchLocale.prototype.toString = function () { + return "fr"; + }; + return FrenchLocale; + }(java.util.Locale)); + Locale.FrenchLocale = FrenchLocale; + FrenchLocale["__class"] = "java.util.Locale.FrenchLocale"; + var USLocale = /** @class */ (function (_super) { + __extends(USLocale, _super); + function USLocale() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + USLocale.prototype.toString = function () { + return "en_US"; + }; + return USLocale; + }(java.util.Locale)); + Locale.USLocale = USLocale; + USLocale["__class"] = "java.util.Locale.USLocale"; + var UKLocale = /** @class */ (function (_super) { + __extends(UKLocale, _super); + function UKLocale() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + UKLocale.prototype.toString = function () { + return "en-gb"; + }; + return UKLocale; + }(java.util.Locale)); + Locale.UKLocale = UKLocale; + UKLocale["__class"] = "java.util.Locale.UKLocale"; + var DefaultLocale = /** @class */ (function (_super) { + __extends(DefaultLocale, _super); + function DefaultLocale() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + DefaultLocale.prototype.toString = function () { + return "fr"; + }; + return DefaultLocale; + }(java.util.Locale)); + Locale.DefaultLocale = DefaultLocale; + DefaultLocale["__class"] = "java.util.Locale.DefaultLocale"; + })(Locale = util.Locale || (util.Locale = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var Comparators = /** @class */ (function () { + function Comparators() { + } + Comparators.NATURAL_$LI$ = function () { if (Comparators.NATURAL == null) { + Comparators.NATURAL = function (a, b) { return new Comparators.NaturalComparator().compare(a, b); }; + } return Comparators.NATURAL; }; + ; + /** + * Returns the natural Comparator. + *

+ * Example: + * + *

Comparator<String> compareString = Comparators.natural()
+ * + * @return {*} the natural Comparator + */ + Comparators.natural = function () { + return (Comparators.NATURAL_$LI$()); + }; + return Comparators; + }()); + util.Comparators = Comparators; + Comparators["__class"] = "java.util.Comparators"; + (function (Comparators) { + var NaturalComparator = /** @class */ (function () { + function NaturalComparator() { + } + /** + * + * @param {*} o1 + * @param {*} o2 + * @return {number} + */ + NaturalComparator.prototype.compare = function (o1, o2) { + javaemul.internal.InternalPreconditions.checkNotNull(o1); + javaemul.internal.InternalPreconditions.checkNotNull(o2); + if ((o1)["compareTo"] === undefined) { + return /* compareTo */ o1.toString().localeCompare(o2.toString()); + } + return o1.compareTo(o2); + }; + return NaturalComparator; + }()); + Comparators.NaturalComparator = NaturalComparator; + NaturalComparator["__class"] = "java.util.Comparators.NaturalComparator"; + NaturalComparator["__interfaces"] = ["java.util.Comparator"]; + })(Comparators = util.Comparators || (util.Comparators = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Represents a date and time. + * @param {number} year + * @param {number} month + * @param {number} date + * @param {number} hrs + * @param {number} min + * @param {number} sec + * @class + */ + var Date = /** @class */ (function () { + function Date(year, month, date, hrs, min, sec) { + if (((typeof year === 'number') || year === null) && ((typeof month === 'number') || month === null) && ((typeof date === 'number') || date === null) && ((typeof hrs === 'number') || hrs === null) && ((typeof min === 'number') || min === null) && ((typeof sec === 'number') || sec === null)) { + var __args = arguments; + if (this.jsdate === undefined) { + this.jsdate = null; + } + this.jsdate = (new (Date.jsdateClass())()); + this.jsdate["setFullYear"](this.jsdate, year + 1900, month, date); + this.jsdate["setHours"](this.jsdate, hrs, min, sec, 0); + this.fixDaylightSavings(hrs); + } + else if (((typeof year === 'number') || year === null) && ((typeof month === 'number') || month === null) && ((typeof date === 'number') || date === null) && ((typeof hrs === 'number') || hrs === null) && ((typeof min === 'number') || min === null) && sec === undefined) { + var __args = arguments; + { + var __args_6 = arguments; + var sec_1 = 0; + if (this.jsdate === undefined) { + this.jsdate = null; + } + this.jsdate = (new (Date.jsdateClass())()); + this.jsdate["setFullYear"](this.jsdate, year + 1900, month, date); + this.jsdate["setHours"](this.jsdate, hrs, min, sec_1, 0); + this.fixDaylightSavings(hrs); + } + if (this.jsdate === undefined) { + this.jsdate = null; + } + } + else if (((typeof year === 'number') || year === null) && ((typeof month === 'number') || month === null) && ((typeof date === 'number') || date === null) && hrs === undefined && min === undefined && sec === undefined) { + var __args = arguments; + { + var __args_7 = arguments; + var hrs_1 = 0; + var min_1 = 0; + var sec_2 = 0; + if (this.jsdate === undefined) { + this.jsdate = null; + } + this.jsdate = (new (Date.jsdateClass())()); + this.jsdate["setFullYear"](this.jsdate, year + 1900, month, date); + this.jsdate["setHours"](this.jsdate, hrs_1, min_1, sec_2, 0); + this.fixDaylightSavings(hrs_1); + } + if (this.jsdate === undefined) { + this.jsdate = null; + } + } + else if (((typeof year === 'string') || year === null) && month === undefined && date === undefined && hrs === undefined && min === undefined && sec === undefined) { + var __args = arguments; + var date_1 = __args[0]; + { + var __args_8 = arguments; + var date_2 = Date.parse(__args_8[0]); + if (this.jsdate === undefined) { + this.jsdate = null; + } + this.jsdate = (new (Date.jsdateClass())(date_2)); + } + if (this.jsdate === undefined) { + this.jsdate = null; + } + } + else if (((typeof year === 'number') || year === null) && month === undefined && date === undefined && hrs === undefined && min === undefined && sec === undefined) { + var __args = arguments; + var date_3 = __args[0]; + if (this.jsdate === undefined) { + this.jsdate = null; + } + this.jsdate = (new (Date.jsdateClass())(date_3)); + } + else if (year === undefined && month === undefined && date === undefined && hrs === undefined && min === undefined && sec === undefined) { + var __args = arguments; + if (this.jsdate === undefined) { + this.jsdate = null; + } + this.jsdate = (new (Date.jsdateClass())()); + } + else + throw new Error('invalid overload'); + } + Date.parse = function (s) { + var parsed = (Date.jsdateClass()["parse"](s)); + if ( /* isNaN */isNaN(parsed)) { + throw new java.lang.IllegalArgumentException(); + } + return (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(parsed); + }; + Date.UTC = function (year, month, date, hrs, min, sec) { + return (Date.jsdateClass()["UTC"](year + 1900, month, date, hrs, min, sec, 0)); + }; + /** + * Ensure a number is displayed with two digits. + * + * @return {string} a two-character base 10 representation of the number + * @param {number} number + */ + Date.padTwo = function (number) { + if (number < 10) { + return "0" + number; + } + else { + return /* valueOf */ new String(number).toString(); + } + }; + Date.jsdateClass = function () { + return (window["Date"]); + }; + Date.prototype.after = function (when) { + return this.getTime() > when.getTime(); + }; + Date.prototype.before = function (when) { + return this.getTime() < when.getTime(); + }; + Date.prototype.clone = function () { + return new Date(this.getTime()); + }; + Date.prototype.compareTo$java_util_Date = function (other) { + return /* compare */ (this.getTime() - other.getTime()); + }; + /** + * + * @param {java.util.Date} other + * @return {number} + */ + Date.prototype.compareTo = function (other) { + if (((other != null && other instanceof Date) || other === null)) { + return this.compareTo$java_util_Date(other); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} obj + * @return {boolean} + */ + Date.prototype.equals = function (obj) { + return ((obj != null && obj instanceof Date) && (this.getTime() === obj.getTime())); + }; + Date.prototype.getDate = function () { + return (this.jsdate["getDate"](this.jsdate)); + }; + Date.prototype.getDay = function () { + return (this.jsdate["getDay"](this.jsdate)); + }; + Date.prototype.getHours = function () { + return (this.jsdate["getHours"](this.jsdate)); + }; + Date.prototype.getMinutes = function () { + return (this.jsdate["getMinutes"](this.jsdate)); + }; + Date.prototype.getMonth = function () { + return (this.jsdate["getMonth"](this.jsdate)); + }; + Date.prototype.getSeconds = function () { + return (this.jsdate["getSeconds"](this.jsdate)); + }; + Date.prototype.getTime = function () { + return (this.jsdate["getTime"](this.jsdate)); + }; + Date.prototype.getTimezoneOffset = function () { + return (this.jsdate["getTimezoneOffset"](this.jsdate)); + }; + Date.prototype.getYear = function () { + return (this.jsdate["getFullYear"](this.jsdate)) - 1900; + }; + /** + * + * @return {number} + */ + Date.prototype.hashCode = function () { + var time = this.getTime(); + return ((time ^ (time >>> 32)) | 0); + }; + Date.prototype.setDate = function (date) { + var hours = this.getHours(); + this.jsdate["setDate"](this.jsdate, date); + this.fixDaylightSavings(hours); + }; + Date.prototype.setHours = function (hours) { + this.jsdate["setHours"](this.jsdate, hours); + this.fixDaylightSavings(hours); + }; + Date.prototype.setMinutes = function (minutes) { + var hours = this.getHours() + (minutes / 60 | 0); + this.jsdate["setMinutes"](this.jsdate, minutes); + this.fixDaylightSavings(hours); + }; + Date.prototype.setMonth = function (month) { + var hours = this.getHours(); + this.jsdate["setMonth"](this.jsdate, month); + this.fixDaylightSavings(hours); + }; + Date.prototype.setSeconds = function (seconds) { + var hours = this.getHours() + (seconds / (60 * 60) | 0); + this.jsdate["setSeconds"](this.jsdate, seconds); + this.fixDaylightSavings(hours); + }; + Date.prototype.setTime = function (time) { + this.jsdate["setTime"](this.jsdate, time); + }; + Date.prototype.setYear = function (year) { + var hours = this.getHours(); + this.jsdate["setFullYear"](this.jsdate, year + 1900); + this.fixDaylightSavings(hours); + }; + Date.prototype.toGMTString = function () { + return this.jsdate["getUTCDate"](this.jsdate) + " " + Date.StringData.MONTHS_$LI$()[(this.jsdate["getUTCMonth"](this.jsdate))] + " " + this.jsdate["getUTCFullYear"](this.jsdate) + " " + Date.padTwo((this.jsdate["getUTCHours"](this.jsdate))) + ":" + Date.padTwo((this.jsdate["getUTCMinutes"](this.jsdate))) + ":" + Date.padTwo((this.jsdate["getUTCSeconds"](this.jsdate))) + " GMT"; + }; + Date.prototype.toLocaleString = function () { + return this.jsdate.toLocaleString(); + }; + /** + * + * @return {string} + */ + Date.prototype.toString = function () { + var offset = -(this.getTimezoneOffset() | 0); + var hourOffset = ((offset >= 0) ? "+" : "") + ((offset / 60 | 0)); + var minuteOffset = Date.padTwo(Math.abs(offset) % 60); + return Date.StringData.DAYS_$LI$()[(this.getDay() | 0)] + " " + Date.StringData.MONTHS_$LI$()[(this.getMonth() | 0)] + " " + Date.padTwo((this.getDate() | 0)) + " " + Date.padTwo((this.getHours() | 0)) + ":" + Date.padTwo((this.getMinutes() | 0)) + ":" + Date.padTwo((this.getSeconds() | 0)) + " GMT" + hourOffset + minuteOffset + " " + this.jsdate["getFullYear"](this.jsdate); + }; + /** + * Detects if the requested time falls into a non-existent time range due to + * local time advancing into daylight savings time or is ambiguous due to + * going out of daylight savings. If so, adjust accordingly. + * @param {number} requestedHours + * @private + */ + Date.prototype.fixDaylightSavings = function (requestedHours) { + requestedHours %= 24; + if (this.getHours() !== requestedHours) { + var copy = (new (Date.jsdateClass())(this.getTime())); + copy["setDate"](((copy["getDate"](copy)) + 1)); + var timeDiff = (this.jsdate["getTimezoneOffset"](this.jsdate)) - (copy["getTimezoneOffset"](copy)); + if (timeDiff > 0) { + var timeDiffHours = (timeDiff / 60 | 0); + var timeDiffMinutes = timeDiff % 60; + var day = (this.getDate() | 0); + var badHours = (this.getHours() | 0); + if (badHours + timeDiffHours >= 24) { + day++; + } + var newTime = (new (Date.jsdateClass())((this.jsdate["getFullYear"](this.jsdate)), this.getMonth(), day, requestedHours + timeDiffHours, this.getMinutes() + timeDiffMinutes, this.getSeconds(), (this.jsdate["getMilliseconds"](this.jsdate)))); + this.setTime((newTime["getMilliseconds"](newTime))); + } + } + var originalTimeInMillis = this.getTime(); + this.setTime(originalTimeInMillis + Date.ONE_HOUR_IN_MILLISECONDS); + if (this.getHours() !== requestedHours) { + this.setTime(originalTimeInMillis); + } + }; + Date.ONE_HOUR_IN_MILLISECONDS = 60 * 60 * 1000; + return Date; + }()); + util.Date = Date; + Date["__class"] = "java.util.Date"; + Date["__interfaces"] = ["java.lang.Cloneable", "java.lang.Comparable", "java.io.Serializable"]; + (function (Date) { + /** + * Encapsulates static data to avoid Date itself having a static + * initializer. + * @class + */ + var StringData = /** @class */ (function () { + function StringData() { + } + StringData.DAYS_$LI$ = function () { if (StringData.DAYS == null) { + StringData.DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + } return StringData.DAYS; }; + ; + StringData.MONTHS_$LI$ = function () { if (StringData.MONTHS == null) { + StringData.MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + } return StringData.MONTHS; }; + ; + return StringData; + }()); + Date.StringData = StringData; + StringData["__class"] = "java.util.Date.StringData"; + })(Date = util.Date || (util.Date = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var logging; + (function (logging) { + /** + * An emulation of the java.util.logging.Handler class. See + * + * The Java API doc for details + * @class + */ + var Handler = /** @class */ (function () { + function Handler() { + if (this.formatter === undefined) { + this.formatter = null; + } + if (this.level === undefined) { + this.level = null; + } + } + Handler.prototype.getFormatter = function () { + return this.formatter; + }; + Handler.prototype.getLevel = function () { + if (this.level != null) { + return this.level; + } + return java.util.logging.Level.ALL_$LI$(); + }; + Handler.prototype.isLoggable = function (record) { + return this.getLevel().intValue() <= record.getLevel().intValue(); + }; + Handler.prototype.setFormatter = function (newFormatter) { + this.formatter = newFormatter; + }; + Handler.prototype.setLevel = function (newLevel) { + this.level = newLevel; + }; + return Handler; + }()); + logging.Handler = Handler; + Handler["__class"] = "java.util.logging.Handler"; + })(logging = util.logging || (util.logging = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var logging; + (function (logging) { + /** + * An emulation of the java.util.logging.LogRecord class. See + * + * The Java API doc for details + * @param {java.util.logging.Level} level + * @param {string} msg + * @class + */ + var LogRecord = /** @class */ (function () { + function LogRecord(level, msg) { + if (((level != null && level instanceof java.util.logging.Level) || level === null) && ((typeof msg === 'string') || msg === null)) { + var __args = arguments; + if (this.level === undefined) { + this.level = null; + } + if (this.msg === undefined) { + this.msg = null; + } + if (this.millis === undefined) { + this.millis = 0; + } + this.loggerName = ""; + this.thrown = null; + this.level = level; + this.msg = msg; + this.millis = java.lang.System.currentTimeMillis(); + } + else if (level === undefined && msg === undefined) { + var __args = arguments; + if (this.level === undefined) { + this.level = null; + } + if (this.msg === undefined) { + this.msg = null; + } + if (this.millis === undefined) { + this.millis = 0; + } + this.loggerName = ""; + this.thrown = null; + } + else + throw new Error('invalid overload'); + } + LogRecord.prototype.getLevel = function () { + return this.level; + }; + LogRecord.prototype.getLoggerName = function () { + return this.loggerName; + }; + LogRecord.prototype.getMessage = function () { + return this.msg; + }; + LogRecord.prototype.getMillis = function () { + return this.millis; + }; + LogRecord.prototype.getThrown = function () { + return this.thrown; + }; + LogRecord.prototype.setLevel = function (newLevel) { + this.level = newLevel; + }; + LogRecord.prototype.setLoggerName = function (newName) { + this.loggerName = newName; + }; + LogRecord.prototype.setMessage = function (newMessage) { + this.msg = newMessage; + }; + LogRecord.prototype.setMillis = function (newMillis) { + this.millis = newMillis; + }; + LogRecord.prototype.setThrown = function (newThrown) { + this.thrown = newThrown; + }; + return LogRecord; + }()); + logging.LogRecord = LogRecord; + LogRecord["__class"] = "java.util.logging.LogRecord"; + LogRecord["__interfaces"] = ["java.io.Serializable"]; + })(logging = util.logging || (util.logging = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var logging; + (function (logging) { + /** + * An emulation of the java.util.logging.LogManager class. See + * + * The Java API doc for details + * @class + */ + var LogManager = /** @class */ (function () { + function LogManager() { + this.loggerMap = (new java.util.HashMap()); + } + LogManager.getLogManager = function () { + if (LogManager.singleton == null) { + LogManager.singleton = new LogManager(); + var rootLogger = new java.util.logging.Logger("", null); + rootLogger.setLevel(java.util.logging.Level.INFO_$LI$()); + LogManager.singleton.addLoggerImpl(rootLogger); + } + return LogManager.singleton; + }; + LogManager.prototype.addLogger = function (logger) { + if (this.getLogger(logger.getName()) != null) { + return false; + } + this.addLoggerAndEnsureParents(logger); + return true; + }; + LogManager.prototype.getLogger = function (name) { + return this.loggerMap.get(name); + }; + LogManager.prototype.getLoggerNames = function () { + return java.util.Collections.enumeration(this.loggerMap.keySet()); + }; + /** + * Helper function to add a logger when we have already determined that it + * does not exist. When we add a logger, we recursively add all of it's + * ancestors. Since loggers do not get removed, logger creation is cheap, + * and there are not usually too many loggers in an ancestry chain, + * this is a simple way to ensure that the parent/child relationships are + * always correctly set up. + * @param {java.util.logging.Logger} logger + * @private + */ + /*private*/ LogManager.prototype.addLoggerAndEnsureParents = function (logger) { + var name = logger.getName(); + var parentName = name.substring(0, Math.max(0, name.lastIndexOf('.'))); + logger.setParent(this.ensureLogger(parentName)); + this.addLoggerImpl(logger); + }; + /*private*/ LogManager.prototype.addLoggerImpl = function (logger) { + if (java.lang.System.getProperty$java_lang_String$java_lang_String("gwt.logging.simpleConsoleHandler", "ENABLED") === ("ENABLED")) { + if ( /* isEmpty */(logger.getName().length === 0)) { + logger.addHandler(new java.util.logging.SimpleConsoleLogHandler()); + } + } + this.loggerMap.put(logger.getName(), logger); + }; + /** + * Helper function to create a logger if it does not exist since the public + * APIs for getLogger and addLogger make it difficult to use those functions + * for this. + * @param {string} name + * @return {java.util.logging.Logger} + */ + LogManager.prototype.ensureLogger = function (name) { + var logger = this.getLogger(name); + if (logger == null) { + var newLogger = new java.util.logging.Logger(name, null); + this.addLoggerAndEnsureParents(newLogger); + return newLogger; + } + return logger; + }; + LogManager.singleton = null; + return LogManager; + }()); + logging.LogManager = LogManager; + LogManager["__class"] = "java.util.logging.LogManager"; + })(logging = util.logging || (util.logging = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var logging; + (function (logging) { + /** + * An emulation of the java.util.logging.Formatter class. See + * + * The Java API doc for details + * @class + */ + var Formatter = /** @class */ (function () { + function Formatter() { + } + Formatter.prototype.formatMessage = function (record) { + return this.format(record); + }; + return Formatter; + }()); + logging.Formatter = Formatter; + Formatter["__class"] = "java.util.logging.Formatter"; + })(logging = util.logging || (util.logging = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var logging; + (function (logging) { + /** + * An emulation of the java.util.logging.Level class. See + * + * The Java API doc for details + * @class + */ + var Level = /** @class */ (function () { + function Level() { + } + Level.ALL_$LI$ = function () { if (Level.ALL == null) { + Level.ALL = new Level.LevelAll(); + } return Level.ALL; }; + ; + Level.CONFIG_$LI$ = function () { if (Level.CONFIG == null) { + Level.CONFIG = new Level.LevelConfig(); + } return Level.CONFIG; }; + ; + Level.FINE_$LI$ = function () { if (Level.FINE == null) { + Level.FINE = new Level.LevelFine(); + } return Level.FINE; }; + ; + Level.FINER_$LI$ = function () { if (Level.FINER == null) { + Level.FINER = new Level.LevelFiner(); + } return Level.FINER; }; + ; + Level.FINEST_$LI$ = function () { if (Level.FINEST == null) { + Level.FINEST = new Level.LevelFinest(); + } return Level.FINEST; }; + ; + Level.INFO_$LI$ = function () { if (Level.INFO == null) { + Level.INFO = new Level.LevelInfo(); + } return Level.INFO; }; + ; + Level.OFF_$LI$ = function () { if (Level.OFF == null) { + Level.OFF = new Level.LevelOff(); + } return Level.OFF; }; + ; + Level.SEVERE_$LI$ = function () { if (Level.SEVERE == null) { + Level.SEVERE = new Level.LevelSevere(); + } return Level.SEVERE; }; + ; + Level.WARNING_$LI$ = function () { if (Level.WARNING == null) { + Level.WARNING = new Level.LevelWarning(); + } return Level.WARNING; }; + ; + Level.parse = function (name) { + java.util.logging.Logger.assertLoggingValues(); + var loggingDisabled = java.lang.System.getProperty$java_lang_String$java_lang_String("gwt.logging.enabled", "FALSE") === ("FALSE"); + if (loggingDisabled) { + return null; + } + var value = name.toUpperCase(); + switch ((value)) { + case "ALL": + return Level.ALL_$LI$(); + case "CONFIG": + return Level.CONFIG_$LI$(); + case "FINE": + return Level.FINE_$LI$(); + case "FINER": + return Level.FINER_$LI$(); + case "FINEST": + return Level.FINEST_$LI$(); + case "INFO": + return Level.INFO_$LI$(); + case "OFF": + return Level.OFF_$LI$(); + case "SEVERE": + return Level.SEVERE_$LI$(); + case "WARNING": + return Level.WARNING_$LI$(); + default: + throw new java.lang.IllegalArgumentException("Invalid level \"" + name + "\""); + } + }; + Level.prototype.getName = function () { + return "DUMMY"; + }; + Level.prototype.intValue = function () { + return -1; + }; + /** + * + * @return {string} + */ + Level.prototype.toString = function () { + return this.getName(); + }; + return Level; + }()); + logging.Level = Level; + Level["__class"] = "java.util.logging.Level"; + Level["__interfaces"] = ["java.io.Serializable"]; + (function (Level) { + var LevelAll = /** @class */ (function (_super) { + __extends(LevelAll, _super); + function LevelAll() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + LevelAll.prototype.getName = function () { + return "ALL"; + }; + /** + * + * @return {number} + */ + LevelAll.prototype.intValue = function () { + return javaemul.internal.IntegerHelper.MIN_VALUE; + }; + return LevelAll; + }(java.util.logging.Level)); + Level.LevelAll = LevelAll; + LevelAll["__class"] = "java.util.logging.Level.LevelAll"; + LevelAll["__interfaces"] = ["java.io.Serializable"]; + var LevelConfig = /** @class */ (function (_super) { + __extends(LevelConfig, _super); + function LevelConfig() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + LevelConfig.prototype.getName = function () { + return "CONFIG"; + }; + /** + * + * @return {number} + */ + LevelConfig.prototype.intValue = function () { + return 700; + }; + return LevelConfig; + }(java.util.logging.Level)); + Level.LevelConfig = LevelConfig; + LevelConfig["__class"] = "java.util.logging.Level.LevelConfig"; + LevelConfig["__interfaces"] = ["java.io.Serializable"]; + var LevelFine = /** @class */ (function (_super) { + __extends(LevelFine, _super); + function LevelFine() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + LevelFine.prototype.getName = function () { + return "FINE"; + }; + /** + * + * @return {number} + */ + LevelFine.prototype.intValue = function () { + return 500; + }; + return LevelFine; + }(java.util.logging.Level)); + Level.LevelFine = LevelFine; + LevelFine["__class"] = "java.util.logging.Level.LevelFine"; + LevelFine["__interfaces"] = ["java.io.Serializable"]; + var LevelFiner = /** @class */ (function (_super) { + __extends(LevelFiner, _super); + function LevelFiner() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + LevelFiner.prototype.getName = function () { + return "FINER"; + }; + /** + * + * @return {number} + */ + LevelFiner.prototype.intValue = function () { + return 400; + }; + return LevelFiner; + }(java.util.logging.Level)); + Level.LevelFiner = LevelFiner; + LevelFiner["__class"] = "java.util.logging.Level.LevelFiner"; + LevelFiner["__interfaces"] = ["java.io.Serializable"]; + var LevelFinest = /** @class */ (function (_super) { + __extends(LevelFinest, _super); + function LevelFinest() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + LevelFinest.prototype.getName = function () { + return "FINEST"; + }; + /** + * + * @return {number} + */ + LevelFinest.prototype.intValue = function () { + return 300; + }; + return LevelFinest; + }(java.util.logging.Level)); + Level.LevelFinest = LevelFinest; + LevelFinest["__class"] = "java.util.logging.Level.LevelFinest"; + LevelFinest["__interfaces"] = ["java.io.Serializable"]; + var LevelInfo = /** @class */ (function (_super) { + __extends(LevelInfo, _super); + function LevelInfo() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + LevelInfo.prototype.getName = function () { + return "INFO"; + }; + /** + * + * @return {number} + */ + LevelInfo.prototype.intValue = function () { + return 800; + }; + return LevelInfo; + }(java.util.logging.Level)); + Level.LevelInfo = LevelInfo; + LevelInfo["__class"] = "java.util.logging.Level.LevelInfo"; + LevelInfo["__interfaces"] = ["java.io.Serializable"]; + var LevelOff = /** @class */ (function (_super) { + __extends(LevelOff, _super); + function LevelOff() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + LevelOff.prototype.getName = function () { + return "OFF"; + }; + /** + * + * @return {number} + */ + LevelOff.prototype.intValue = function () { + return javaemul.internal.IntegerHelper.MAX_VALUE; + }; + return LevelOff; + }(java.util.logging.Level)); + Level.LevelOff = LevelOff; + LevelOff["__class"] = "java.util.logging.Level.LevelOff"; + LevelOff["__interfaces"] = ["java.io.Serializable"]; + var LevelSevere = /** @class */ (function (_super) { + __extends(LevelSevere, _super); + function LevelSevere() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + LevelSevere.prototype.getName = function () { + return "SEVERE"; + }; + /** + * + * @return {number} + */ + LevelSevere.prototype.intValue = function () { + return 1000; + }; + return LevelSevere; + }(java.util.logging.Level)); + Level.LevelSevere = LevelSevere; + LevelSevere["__class"] = "java.util.logging.Level.LevelSevere"; + LevelSevere["__interfaces"] = ["java.io.Serializable"]; + var LevelWarning = /** @class */ (function (_super) { + __extends(LevelWarning, _super); + function LevelWarning() { + return _super.call(this) || this; + } + /** + * + * @return {string} + */ + LevelWarning.prototype.getName = function () { + return "WARNING"; + }; + /** + * + * @return {number} + */ + LevelWarning.prototype.intValue = function () { + return 900; + }; + return LevelWarning; + }(java.util.logging.Level)); + Level.LevelWarning = LevelWarning; + LevelWarning["__class"] = "java.util.logging.Level.LevelWarning"; + LevelWarning["__interfaces"] = ["java.io.Serializable"]; + })(Level = logging.Level || (logging.Level = {})); + })(logging = util.logging || (util.logging = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * See + * the official Java API doc for details. + * @param {*} delimiter + * @param {*} prefix + * @param {*} suffix + * @class + */ + var StringJoiner = /** @class */ (function () { + function StringJoiner(delimiter, prefix, suffix) { + if (((delimiter != null && (delimiter["__interfaces"] != null && delimiter["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || delimiter.constructor != null && delimiter.constructor["__interfaces"] != null && delimiter.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof delimiter === "string")) || delimiter === null) && ((prefix != null && (prefix["__interfaces"] != null && prefix["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || prefix.constructor != null && prefix.constructor["__interfaces"] != null && prefix.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof prefix === "string")) || prefix === null) && ((suffix != null && (suffix["__interfaces"] != null && suffix["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || suffix.constructor != null && suffix.constructor["__interfaces"] != null && suffix.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof suffix === "string")) || suffix === null)) { + var __args = arguments; + if (this.delimiter === undefined) { + this.delimiter = null; + } + if (this.prefix === undefined) { + this.prefix = null; + } + if (this.suffix === undefined) { + this.suffix = null; + } + if (this.builder === undefined) { + this.builder = null; + } + if (this.emptyValue === undefined) { + this.emptyValue = null; + } + javaemul.internal.InternalPreconditions.checkNotNull(delimiter, "delimiter"); + javaemul.internal.InternalPreconditions.checkNotNull(prefix, "prefix"); + javaemul.internal.InternalPreconditions.checkNotNull(suffix, "suffix"); + this.delimiter = delimiter.toString(); + this.prefix = prefix.toString(); + this.suffix = suffix.toString(); + this.emptyValue = this.prefix + this.suffix; + } + else if (((delimiter != null && (delimiter["__interfaces"] != null && delimiter["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || delimiter.constructor != null && delimiter.constructor["__interfaces"] != null && delimiter.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof delimiter === "string")) || delimiter === null) && prefix === undefined && suffix === undefined) { + var __args = arguments; + { + var __args_9 = arguments; + var prefix_1 = ""; + var suffix_1 = ""; + if (this.delimiter === undefined) { + this.delimiter = null; + } + if (this.prefix === undefined) { + this.prefix = null; + } + if (this.suffix === undefined) { + this.suffix = null; + } + if (this.builder === undefined) { + this.builder = null; + } + if (this.emptyValue === undefined) { + this.emptyValue = null; + } + javaemul.internal.InternalPreconditions.checkNotNull(delimiter, "delimiter"); + javaemul.internal.InternalPreconditions.checkNotNull(prefix_1, "prefix"); + javaemul.internal.InternalPreconditions.checkNotNull(suffix_1, "suffix"); + this.delimiter = delimiter.toString(); + this.prefix = prefix_1.toString(); + this.suffix = suffix_1.toString(); + this.emptyValue = this.prefix + this.suffix; + } + if (this.delimiter === undefined) { + this.delimiter = null; + } + if (this.prefix === undefined) { + this.prefix = null; + } + if (this.suffix === undefined) { + this.suffix = null; + } + if (this.builder === undefined) { + this.builder = null; + } + if (this.emptyValue === undefined) { + this.emptyValue = null; + } + } + else + throw new Error('invalid overload'); + } + StringJoiner.prototype.add = function (newElement) { + this.initBuilderOrAddDelimiter(); + this.builder.append$java_lang_CharSequence(newElement); + return this; + }; + StringJoiner.prototype.length = function () { + if (this.builder == null) { + return this.emptyValue.length; + } + return this.builder.length() + this.suffix.length; + }; + StringJoiner.prototype.merge = function (other) { + if (other.builder != null) { + var otherLength = other.builder.length(); + this.initBuilderOrAddDelimiter(); + this.builder.append$java_lang_CharSequence$int$int(other.builder, other.prefix.length, otherLength); + } + return this; + }; + StringJoiner.prototype.setEmptyValue = function (emptyValue) { + javaemul.internal.InternalPreconditions.checkNotNull(emptyValue); + this.emptyValue = emptyValue.toString(); + return this; + }; + /** + * + * @return {string} + */ + StringJoiner.prototype.toString = function () { + if (this.builder == null) { + return this.emptyValue; + } + else if ( /* isEmpty */(this.suffix.length === 0)) { + return this.builder.toString(); + } + else { + return this.builder.toString() + this.suffix; + } + }; + /*private*/ StringJoiner.prototype.initBuilderOrAddDelimiter = function () { + if (this.builder == null) { + this.builder = new java.lang.StringBuilder(this.prefix); + } + else { + this.builder.append$java_lang_String(this.delimiter); + } + }; + return StringJoiner; + }()); + util.StringJoiner = StringJoiner; + StringJoiner["__class"] = "java.util.StringJoiner"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Basic {@link Map.Entry} implementation that implements hashCode, equals, and + * toString. + * @class + */ + var AbstractMapEntry = /** @class */ (function () { + function AbstractMapEntry() { + } + /** + * + * @param {*} other + * @return {boolean} + */ + AbstractMapEntry.prototype.equals = function (other) { + if (!(other != null && (other["__interfaces"] != null && other["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || other.constructor != null && other.constructor["__interfaces"] != null && other.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0))) { + return false; + } + var entry = other; + return java.util.Objects.equals(this.getKey(), entry.getKey()) && java.util.Objects.equals(this.getValue(), entry.getValue()); + }; + /** + * Calculate the hash code using Sun's specified algorithm. + * @return {number} + */ + AbstractMapEntry.prototype.hashCode = function () { + return java.util.Objects.hashCode(this.getKey()) ^ java.util.Objects.hashCode(this.getValue()); + }; + /** + * + * @return {string} + */ + AbstractMapEntry.prototype.toString = function () { + return this.getKey() + "=" + this.getValue(); + }; + return AbstractMapEntry; + }()); + util.AbstractMapEntry = AbstractMapEntry; + AbstractMapEntry["__class"] = "java.util.AbstractMapEntry"; + AbstractMapEntry["__interfaces"] = ["java.util.Map.Entry"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var security; + (function (security) { + /** + * Message Digest Service Provider Interface - [Sun's + * docs]. + * @class + */ + var MessageDigestSpi = /** @class */ (function () { + function MessageDigestSpi() { + } + MessageDigestSpi.prototype.engineDigest$ = function () { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); }; + MessageDigestSpi.prototype.engineDigest$byte_A$int$int = function (buf, offset, len) { + var digest = this.engineDigest$(); + if (buf.length < digest.length + offset) { + throw new java.security.DigestException("Insufficient buffer space for digest"); + } + if (len < digest.length) { + throw new java.security.DigestException("Length not large enough to hold digest"); + } + java.lang.System.arraycopy(digest, 0, buf, offset, digest.length); + return digest.length; + }; + MessageDigestSpi.prototype.engineDigest = function (buf, offset, len) { + if (((buf != null && buf instanceof Array && (buf.length == 0 || buf[0] == null || (typeof buf[0] === 'number'))) || buf === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.engineDigest$byte_A$int$int(buf, offset, len); + } + else if (buf === undefined && offset === undefined && len === undefined) { + return this.engineDigest$(); + } + else + throw new Error('invalid overload'); + }; + MessageDigestSpi.prototype.engineGetDigestLength = function () { + return 0; + }; + MessageDigestSpi.prototype.engineUpdate$byte = function (input) { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); }; + MessageDigestSpi.prototype.engineUpdate$byte_A$int$int = function (input, offset, len) { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); }; + MessageDigestSpi.prototype.engineUpdate = function (input, offset, len) { + if (((input != null && input instanceof Array && (input.length == 0 || input[0] == null || (typeof input[0] === 'number'))) || input === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.engineUpdate$byte_A$int$int(input, offset, len); + } + else if (((typeof input === 'number') || input === null) && offset === undefined && len === undefined) { + return this.engineUpdate$byte(input); + } + else + throw new Error('invalid overload'); + }; + return MessageDigestSpi; + }()); + security.MessageDigestSpi = MessageDigestSpi; + MessageDigestSpi["__class"] = "java.security.MessageDigestSpi"; + })(security = java.security || (java.security = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * Provides a series of utilities to be reused between IO classes. + * + * TODO(chehayeb): move these checks to InternalPreconditions. + * @class + */ + var IOUtils = /** @class */ (function () { + function IOUtils() { + } + IOUtils.checkOffsetAndCount$byte_A$int$int = function (buffer, byteOffset, byteCount) { + javaemul.internal.InternalPreconditions.checkNotNull(buffer); + IOUtils.checkOffsetAndCount$int$int$int(buffer.length, byteOffset, byteCount); + }; + /** + * Validates the offset and the byte count for the given array of bytes. + * + * @param {Array} buffer Array of bytes to be checked. + * @param {number} byteOffset Starting offset in the array. + * @param {number} byteCount Total number of bytes to be accessed. + * @throws NullPointerException if the given reference to the buffer is null. + * @throws IndexOutOfBoundsException if {@code byteOffset} is negative, {@code byteCount} is + * negative or their sum exceeds the buffer length. + */ + IOUtils.checkOffsetAndCount = function (buffer, byteOffset, byteCount) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof byteOffset === 'number') || byteOffset === null) && ((typeof byteCount === 'number') || byteCount === null)) { + return java.io.IOUtils.checkOffsetAndCount$byte_A$int$int(buffer, byteOffset, byteCount); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'string'))) || buffer === null) && ((typeof byteOffset === 'number') || byteOffset === null) && ((typeof byteCount === 'number') || byteCount === null)) { + return java.io.IOUtils.checkOffsetAndCount$char_A$int$int(buffer, byteOffset, byteCount); + } + else if (((typeof buffer === 'number') || buffer === null) && ((typeof byteOffset === 'number') || byteOffset === null) && ((typeof byteCount === 'number') || byteCount === null)) { + return java.io.IOUtils.checkOffsetAndCount$int$int$int(buffer, byteOffset, byteCount); + } + else + throw new Error('invalid overload'); + }; + IOUtils.checkOffsetAndCount$char_A$int$int = function (buffer, charOffset, charCount) { + javaemul.internal.InternalPreconditions.checkNotNull(buffer); + IOUtils.checkOffsetAndCount$int$int$int(buffer.length, charOffset, charCount); + }; + /*private*/ IOUtils.checkOffsetAndCount$int$int$int = function (length, offset, count) { + if ((offset < 0) || (count < 0) || ((offset + count) > length)) { + throw new java.lang.IndexOutOfBoundsException(); + } + }; + return IOUtils; + }()); + io.IOUtils = IOUtils; + IOUtils["__class"] = "java.io.IOUtils"; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * JSweet implementation. + * @class + */ + var Writer = /** @class */ (function () { + function Writer(lock) { + if (((lock != null) || lock === null)) { + var __args = arguments; + if (this.writeBuffer === undefined) { + this.writeBuffer = null; + } + if (this.lock === undefined) { + this.lock = null; + } + if (lock == null) { + throw new java.lang.NullPointerException(); + } + this.lock = lock; + } + else if (lock === undefined) { + var __args = arguments; + if (this.writeBuffer === undefined) { + this.writeBuffer = null; + } + if (this.lock === undefined) { + this.lock = null; + } + this.lock = this; + } + else + throw new Error('invalid overload'); + } + Writer.prototype.write$int = function (c) { + { + if (this.writeBuffer == null) { + this.writeBuffer = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(Writer.WRITE_BUFFER_SIZE); + } + this.writeBuffer[0] = String.fromCharCode(c); + this.write$char_A$int$int(this.writeBuffer, 0, 1); + } + ; + }; + Writer.prototype.write$char_A = function (cbuf) { + this.write$char_A$int$int(cbuf, 0, cbuf.length); + }; + Writer.prototype.write$char_A$int$int = function (cbuf, off, len) { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); }; + Writer.prototype.write$java_lang_String = function (str) { + this.write$java_lang_String$int$int(str, 0, str.length); + }; + Writer.prototype.write$java_lang_String$int$int = function (str, off, len) { + { + var cbuf = void 0; + if (len <= Writer.WRITE_BUFFER_SIZE) { + if (this.writeBuffer == null) { + this.writeBuffer = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(Writer.WRITE_BUFFER_SIZE); + } + cbuf = this.writeBuffer; + } + else { + cbuf = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(len); + } + /* getChars */ (function (a, s, e, d, l) { d.splice.apply(d, [l, e - s].concat(a.substring(s, e).split(''))); })(str, off, (off + len), cbuf, 0); + this.write$char_A$int$int(cbuf, 0, len); + } + ; + }; + Writer.prototype.write = function (str, off, len) { + if (((typeof str === 'string') || str === null) && ((typeof off === 'number') || off === null) && ((typeof len === 'number') || len === null)) { + return this.write$java_lang_String$int$int(str, off, len); + } + else if (((str != null && str instanceof Array && (str.length == 0 || str[0] == null || (typeof str[0] === 'string'))) || str === null) && ((typeof off === 'number') || off === null) && ((typeof len === 'number') || len === null)) { + return this.write$char_A$int$int(str, off, len); + } + else if (((str != null && str instanceof Array && (str.length == 0 || str[0] == null || (typeof str[0] === 'string'))) || str === null) && off === undefined && len === undefined) { + return this.write$char_A(str); + } + else if (((typeof str === 'string') || str === null) && off === undefined && len === undefined) { + return this.write$java_lang_String(str); + } + else if (((typeof str === 'number') || str === null) && off === undefined && len === undefined) { + return this.write$int(str); + } + else + throw new Error('invalid overload'); + }; + Writer.prototype.append$java_lang_CharSequence = function (csq) { + if (csq == null) + this.write$java_lang_String("null"); + else + this.write$java_lang_String(csq.toString()); + return this; + }; + Writer.prototype.append$java_lang_CharSequence$int$int = function (csq, start, end) { + var cs = (csq == null ? "null" : csq); + this.write$java_lang_String(/* subSequence */ cs.substring(start, end).toString()); + return this; + }; + Writer.prototype.append = function (csq, start, end) { + if (((csq != null && (csq["__interfaces"] != null && csq["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || csq.constructor != null && csq.constructor["__interfaces"] != null && csq.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof csq === "string")) || csq === null) && ((typeof start === 'number') || start === null) && ((typeof end === 'number') || end === null)) { + return this.append$java_lang_CharSequence$int$int(csq, start, end); + } + else if (((csq != null && (csq["__interfaces"] != null && csq["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || csq.constructor != null && csq.constructor["__interfaces"] != null && csq.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof csq === "string")) || csq === null) && start === undefined && end === undefined) { + return this.append$java_lang_CharSequence(csq); + } + else if (((typeof csq === 'string') || csq === null) && start === undefined && end === undefined) { + return this.append$char(csq); + } + else + throw new Error('invalid overload'); + }; + Writer.prototype.append$char = function (c) { + this.write$int((c).charCodeAt(0)); + return this; + }; + Writer.WRITE_BUFFER_SIZE = 1024; + return Writer; + }()); + io.Writer = Writer; + Writer["__class"] = "java.io.Writer"; + Writer["__interfaces"] = ["java.lang.Appendable", "java.io.Closeable", "java.lang.AutoCloseable", "java.io.Flushable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * This constructor does nothing. It is provided for signature + * compatibility. + * @class + * @extends * + */ + var InputStream = /** @class */ (function () { + function InputStream() { + } + /** + * Returns an estimated number of bytes that can be read or skipped without blocking for more + * input. + * + *

Note that this method provides such a weak guarantee that it is not very useful in + * practice. + * + *

Firstly, the guarantee is "without blocking for more input" rather than "without + * blocking": a read may still block waiting for I/O to complete — the guarantee is + * merely that it won't have to wait indefinitely for data to be written. The result of this + * method should not be used as a license to do I/O on a thread that shouldn't be blocked. + * + *

Secondly, the result is a + * conservative estimate and may be significantly smaller than the actual number of bytes + * available. In particular, an implementation that always returns 0 would be correct. + * In general, callers should only use this method if they'd be satisfied with + * treating the result as a boolean yes or no answer to the question "is there definitely + * data ready?". + * + *

Thirdly, the fact that a given number of bytes is "available" does not guarantee that a + * read or skip will actually read or skip that many bytes: they may read or skip fewer. + * + *

It is particularly important to realize that you must not use this method to + * size a container and assume that you can read the entirety of the stream without needing + * to resize the container. Such callers should probably write everything they read to a + * {@link ByteArrayOutputStream} and convert that to a byte array. Alternatively, if you're + * reading from a file, {@link File#length} returns the current length of the file (though + * assuming the file's length can't change may be incorrect, reading a file is inherently + * racy). + * + *

The default implementation of this method in {@code InputStream} always returns 0. + * Subclasses should override this method if they are able to indicate the number of bytes + * available. + * + * @return {number} the estimated number of bytes available + * @throws IOException if this stream is closed or an error occurs + */ + InputStream.prototype.available = function () { + return 0; + }; + /** + * Closes this stream. Concrete implementations of this class should free + * any resources during close. This implementation does nothing. + * + * @throws IOException + * if an error occurs while closing this stream. + */ + InputStream.prototype.close = function () { + }; + /** + * Sets a mark position in this InputStream. The parameter {@code readlimit} + * indicates how many bytes can be read before the mark is invalidated. + * Sending {@code reset()} will reposition the stream back to the marked + * position provided {@code readLimit} has not been surpassed. + *

+ * This default implementation does nothing and concrete subclasses must + * provide their own implementation. + * + * @param {number} readlimit + * the number of bytes that can be read from this stream before + * the mark is invalidated. + * @see #markSupported() + * @see #reset() + */ + InputStream.prototype.mark = function (readlimit) { + }; + /** + * Indicates whether this stream supports the {@code mark()} and + * {@code reset()} methods. The default implementation returns {@code false}. + * + * @return {boolean} always {@code false}. + * @see #mark(int) + * @see #reset() + */ + InputStream.prototype.markSupported = function () { + return false; + }; + InputStream.prototype.read$ = function () { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); }; + InputStream.prototype.read$byte_A = function (buffer) { + javaemul.internal.InternalPreconditions.checkNotNull(buffer); + return this.read$byte_A$int$int(buffer, 0, buffer.length); + }; + InputStream.prototype.read$byte_A$int$int = function (buffer, byteOffset, byteCount) { + java.io.IOUtils.checkOffsetAndCount$byte_A$int$int(buffer, byteOffset, byteCount); + for (var i = 0; i < byteCount; ++i) { + { + var c = void 0; + try { + if ((c = this.read$()) === -1) { + return i === 0 ? -1 : i; + } + } + catch (e) { + if (i !== 0) { + return i; + } + throw e; + } + ; + buffer[byteOffset + i] = (c | 0); + } + ; + } + return byteCount; + }; + /** + * Reads up to {@code byteCount} bytes from this stream and stores them in + * the byte array {@code buffer} starting at {@code byteOffset}. + * Returns the number of bytes actually read or -1 if the end of the stream + * has been reached. + * + * @throws IndexOutOfBoundsException + * if {@code byteOffset < 0 || byteCount < 0 || byteOffset + byteCount > buffer.length}. + * @throws IOException + * if the stream is closed or another IOException occurs. + * @param {Array} buffer + * @param {number} byteOffset + * @param {number} byteCount + * @return {number} + */ + InputStream.prototype.read = function (buffer, byteOffset, byteCount) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof byteOffset === 'number') || byteOffset === null) && ((typeof byteCount === 'number') || byteCount === null)) { + return this.read$byte_A$int$int(buffer, byteOffset, byteCount); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && byteOffset === undefined && byteCount === undefined) { + return this.read$byte_A(buffer); + } + else if (buffer === undefined && byteOffset === undefined && byteCount === undefined) { + return this.read$(); + } + else + throw new Error('invalid overload'); + }; + /** + * Resets this stream to the last marked location. Throws an + * {@code IOException} if the number of bytes read since the mark has been + * set is greater than the limit provided to {@code mark}, or if no mark + * has been set. + *

+ * This implementation always throws an {@code IOException} and concrete + * subclasses should provide the proper implementation. + * + * @throws IOException + * if this stream is closed or another IOException occurs. + */ + InputStream.prototype.reset = function () { + throw new java.io.IOException(); + }; + /** + * Skips at most {@code byteCount} bytes in this stream. The number of actual + * bytes skipped may be anywhere between 0 and {@code byteCount}. If + * {@code byteCount} is negative, this method does nothing and returns 0, but + * some subclasses may throw. + * + *

Note the "at most" in the description of this method: this method may + * choose to skip fewer bytes than requested. Callers should always + * check the return value. + * + *

This default implementation reads bytes into a temporary buffer. Concrete + * subclasses should provide their own implementation. + * + * @return {number} the number of bytes actually skipped. + * @throws IOException if this stream is closed or another IOException + * occurs. + * @param {number} byteCount + */ + InputStream.prototype.skip = function (byteCount) { + if (byteCount <= 0) { + return 0; + } + var bSize = (Math.min(InputStream.MAX_SKIP_BUFFER_SIZE, byteCount) | 0); + var b = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(bSize); + var skipped = 0; + while ((skipped < byteCount)) { + { + var toRead = (Math.min(byteCount - skipped, b.length) | 0); + var readCount = this.read$byte_A$int$int(b, 0, toRead); + if (readCount === -1) { + break; + } + skipped += readCount; + if (readCount < toRead) { + break; + } + } + } + ; + return skipped; + }; + /** + * Size of the temporary buffer used when skipping bytes with {@link skip(long)}. + */ + InputStream.MAX_SKIP_BUFFER_SIZE = 4096; + return InputStream; + }()); + io.InputStream = InputStream; + InputStream["__class"] = "java.io.InputStream"; + InputStream["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * JSweet implementation. + * @class + */ + var Reader = /** @class */ (function () { + function Reader(lock) { + if (((lock != null) || lock === null)) { + var __args = arguments; + if (this.lock === undefined) { + this.lock = null; + } + this.skipBuffer = null; + if (lock == null) { + throw new java.lang.NullPointerException(); + } + this.lock = lock; + } + else if (lock === undefined) { + var __args = arguments; + if (this.lock === undefined) { + this.lock = null; + } + this.skipBuffer = null; + this.lock = this; + } + else + throw new Error('invalid overload'); + } + Reader.prototype.read$ = function () { + var cb = [null]; + if (this.read$char_A$int$int(cb, 0, 1) === -1) + return -1; + else + return (cb[0]).charCodeAt(0); + }; + Reader.prototype.read$char_A = function (cbuf) { + return this.read$char_A$int$int(cbuf, 0, cbuf.length); + }; + Reader.prototype.read$char_A$int$int = function (cbuf, off, len) { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); }; + Reader.prototype.read = function (cbuf, off, len) { + if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && ((typeof off === 'number') || off === null) && ((typeof len === 'number') || len === null)) { + return this.read$char_A$int$int(cbuf, off, len); + } + else if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && off === undefined && len === undefined) { + return this.read$char_A(cbuf); + } + else if (cbuf === undefined && off === undefined && len === undefined) { + return this.read$(); + } + else + throw new Error('invalid overload'); + }; + Reader.prototype.skip = function (n) { + if (n < 0) + throw new java.lang.IllegalArgumentException("skip value is negative"); + var nn = (Math.min(n, Reader.maxSkipBufferSize) | 0); + if ((this.skipBuffer == null) || (this.skipBuffer.length < nn)) + this.skipBuffer = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(nn); + var r = n; + while ((r > 0)) { + { + var nc = this.read$char_A$int$int(this.skipBuffer, 0, (Math.min(r, nn) | 0)); + if (nc === -1) + break; + r -= nc; + } + } + ; + return n - r; + }; + Reader.prototype.ready = function () { + return false; + }; + Reader.prototype.markSupported = function () { + return false; + }; + Reader.prototype.mark = function (readAheadLimit) { + throw new java.io.IOException("mark() not supported"); + }; + Reader.prototype.reset = function () { + throw new java.io.IOException("reset() not supported"); + }; + /** + * Maximum skip-buffer size + */ + Reader.maxSkipBufferSize = 8192; + return Reader; + }()); + io.Reader = Reader; + Reader["__class"] = "java.io.Reader"; + Reader["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * Default constructor. + * @class + */ + var OutputStream = /** @class */ (function () { + function OutputStream() { + } + /** + * Closes this stream. Implementations of this method should free any + * resources used by the stream. This implementation does nothing. + * + * @throws IOException + * if an error occurs while closing this stream. + */ + OutputStream.prototype.close = function () { + }; + /** + * Flushes this stream. Implementations of this method should ensure that + * any buffered data is written out. This implementation does nothing. + * + * @throws IOException + * if an error occurs while flushing this stream. + */ + OutputStream.prototype.flush = function () { + }; + OutputStream.prototype.write$byte_A = function (buffer) { + javaemul.internal.InternalPreconditions.checkNotNull(buffer); + this.write$byte_A$int$int(buffer, 0, buffer.length); + }; + OutputStream.prototype.write$byte_A$int$int = function (buffer, offset, count) { + java.io.IOUtils.checkOffsetAndCount$byte_A$int$int(buffer, offset, count); + for (var i = offset; i < offset + count; i++) { + { + this.write$int(buffer[i]); + } + ; + } + }; + /** + * Writes {@code count} bytes from the byte array {@code buffer} starting at + * position {@code offset} to this stream. + * + * @param {Array} buffer + * the buffer to be written. + * @param {number} offset + * the start position in {@code buffer} from where to get bytes. + * @param {number} count + * the number of bytes from {@code buffer} to write to this + * stream. + * @throws IOException + * if an error occurs while writing to this stream. + * @throws IndexOutOfBoundsException + * if {@code offset < 0} or {@code count < 0}, or if + * {@code offset + count} is bigger than the length of + * {@code buffer}. + */ + OutputStream.prototype.write = function (buffer, offset, count) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof offset === 'number') || offset === null) && ((typeof count === 'number') || count === null)) { + return this.write$byte_A$int$int(buffer, offset, count); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && offset === undefined && count === undefined) { + return this.write$byte_A(buffer); + } + else if (((typeof buffer === 'number') || buffer === null) && offset === undefined && count === undefined) { + return this.write$int(buffer); + } + else + throw new Error('invalid overload'); + }; + OutputStream.prototype.write$int = function (oneByte) { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); }; + return OutputStream; + }()); + io.OutputStream = OutputStream; + OutputStream["__class"] = "java.io.OutputStream"; + OutputStream["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable", "java.io.Flushable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var ref; + (function (ref) { + /** + * This implements the reference API in a minimal way. In JavaScript, there is + * no control over the reference and the GC. So this implementation's only + * purpose is for compilation. + * @class + */ + var Reference = /** @class */ (function () { + function Reference(referent) { + if (this.referent === undefined) { + this.referent = null; + } + this.referent = referent; + } + Reference.prototype.get = function () { + return this.referent; + }; + Reference.prototype.clear = function () { + this.referent = null; + }; + return Reference; + }()); + ref.Reference = Reference; + Reference["__class"] = "java.lang.ref.Reference"; + })(ref = lang.ref || (lang.ref = {})); + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * Represents an error caused by an assertion failure. + * @param {string} message + * @param {java.lang.Throwable} cause + * @class + * @extends java.lang.Error + */ + var AssertionError = /** @class */ (function (_super) { + __extends(AssertionError, _super); + function AssertionError(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'boolean') || message === null) && cause === undefined) { + var __args = arguments; + { + var __args_10 = arguments; + var message_1 = new String(__args_10[0]).toString(); + _this = _super.call(this, message_1) || this; + _this.message = message_1; + } + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + { + var __args_11 = arguments; + var message_2 = new String(__args_11[0]).toString(); + _this = _super.call(this, message_2) || this; + _this.message = message_2; + } + } + else if (((typeof message === 'number') || message === null) && cause === undefined) { + var __args = arguments; + { + var __args_12 = arguments; + var message_3 = new String(__args_12[0]).toString(); + _this = _super.call(this, message_3) || this; + _this.message = message_3; + } + } + else if (((typeof message === 'number') || message === null) && cause === undefined) { + var __args = arguments; + { + var __args_13 = arguments; + var message_4 = new String(__args_13[0]).toString(); + _this = _super.call(this, message_4) || this; + _this.message = message_4; + } + } + else if (((typeof message === 'number') || message === null) && cause === undefined) { + var __args = arguments; + { + var __args_14 = arguments; + var message_5 = new String(__args_14[0]).toString(); + _this = _super.call(this, message_5) || this; + _this.message = message_5; + } + } + else if (((typeof message === 'number') || message === null) && cause === undefined) { + var __args = arguments; + { + var __args_15 = arguments; + var message_6 = new String(__args_15[0]).toString(); + _this = _super.call(this, message_6) || this; + _this.message = message_6; + } + } + else if (((message != null) || message === null) && cause === undefined) { + var __args = arguments; + _this = _super.call(this, /* valueOf */ new String(message).toString()) || this; + _this.message = /* valueOf */ new String(message).toString(); + } + else if (message === undefined && cause === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return AssertionError; + }(Error)); + lang.AssertionError = AssertionError; + AssertionError["__class"] = "java.lang.AssertionError"; + AssertionError["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * Included for hosted mode source compatibility. Partially implemented + * + * @skip + * @param {string} className + * @param {string} methodName + * @param {string} fileName + * @param {number} lineNumber + * @class + */ + var StackTraceElement = /** @class */ (function () { + function StackTraceElement(className, methodName, fileName, lineNumber) { + if (((typeof className === 'string') || className === null) && ((typeof methodName === 'string') || methodName === null) && ((typeof fileName === 'string') || fileName === null) && ((typeof lineNumber === 'number') || lineNumber === null)) { + var __args = arguments; + if (this.className === undefined) { + this.className = null; + } + if (this.fileName === undefined) { + this.fileName = null; + } + if (this.lineNumber === undefined) { + this.lineNumber = 0; + } + if (this.methodName === undefined) { + this.methodName = null; + } + this.className = className; + this.methodName = methodName; + this.fileName = fileName; + this.lineNumber = lineNumber; + } + else if (className === undefined && methodName === undefined && fileName === undefined && lineNumber === undefined) { + var __args = arguments; + if (this.className === undefined) { + this.className = null; + } + if (this.fileName === undefined) { + this.fileName = null; + } + if (this.lineNumber === undefined) { + this.lineNumber = 0; + } + if (this.methodName === undefined) { + this.methodName = null; + } + } + else + throw new Error('invalid overload'); + } + StackTraceElement.prototype.getClassName = function () { + return this.className; + }; + StackTraceElement.prototype.getFileName = function () { + return this.fileName; + }; + StackTraceElement.prototype.getLineNumber = function () { + return this.lineNumber; + }; + StackTraceElement.prototype.getMethodName = function () { + return this.methodName; + }; + /** + * + * @param {*} other + * @return {boolean} + */ + StackTraceElement.prototype.equals = function (other) { + if (other != null && other instanceof java.lang.StackTraceElement) { + var st = other; + return this.lineNumber === st.lineNumber && java.util.Objects.equals(this.methodName, st.methodName) && java.util.Objects.equals(this.className, st.className) && java.util.Objects.equals(this.fileName, st.fileName); + } + return false; + }; + /** + * + * @return {number} + */ + StackTraceElement.prototype.hashCode = function () { + return java.util.Objects.hash(this.lineNumber, this.className, this.methodName, this.fileName); + }; + /** + * + * @return {string} + */ + StackTraceElement.prototype.toString = function () { + return this.className + "." + this.methodName + "(" + (this.fileName != null ? this.fileName : "Unknown Source") + (this.lineNumber >= 0 ? ":" + this.lineNumber : "") + ")"; + }; + return StackTraceElement; + }()); + lang.StackTraceElement = StackTraceElement; + StackTraceElement["__class"] = "java.lang.StackTraceElement"; + StackTraceElement["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * Constructs a {@code VirtualMachineError} with the specified + * detail message and cause.

Note that the detail message + * associated with {@code cause} is not automatically + * incorporated in this error's detail message. + * + * @param {string} message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param {java.lang.Throwable} cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.8 + * @class + * @extends java.lang.Error + * @author Frank Yellin + */ + var VirtualMachineError = /** @class */ (function (_super) { + __extends(VirtualMachineError, _super); + function VirtualMachineError(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined) { + var __args = arguments; + var cause_1 = __args[0]; + _this = _super.call(this, cause_1) || this; + _this.message = cause_1; + } + else if (message === undefined && cause === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + VirtualMachineError.serialVersionUID = 4161983926571568670; + return VirtualMachineError; + }(Error)); + lang.VirtualMachineError = VirtualMachineError; + VirtualMachineError["__class"] = "java.lang.VirtualMachineError"; + VirtualMachineError["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @param {java.lang.Throwable} cause + * @class + * @extends java.lang.Throwable + */ + var Exception = /** @class */ (function (_super) { + __extends(Exception, _super); + function Exception(message, cause, enableSuppression, writableStackTrace) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null) && ((typeof enableSuppression === 'boolean') || enableSuppression === null) && ((typeof writableStackTrace === 'boolean') || writableStackTrace === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null) && enableSuppression === undefined && writableStackTrace === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'string') || message === null) && cause === undefined && enableSuppression === undefined && writableStackTrace === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined && enableSuppression === undefined && writableStackTrace === undefined) { + var __args = arguments; + var cause_2 = __args[0]; + _this = _super.call(this, cause_2) || this; + _this.message = cause_2; + } + else if (message === undefined && cause === undefined && enableSuppression === undefined && writableStackTrace === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return Exception; + }(Error)); + lang.Exception = Exception; + Exception["__class"] = "java.lang.Exception"; + Exception["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * For JRE compatibility. + * @class + */ + var Void = /** @class */ (function () { + function Void() { + } + return Void; + }()); + lang.Void = Void; + Void["__class"] = "java.lang.Void"; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var IllegalAccessError = /** @class */ (function (_super) { + __extends(IllegalAccessError, _super); + function IllegalAccessError(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined) { + var __args = arguments; + var cause_3 = __args[0]; + _this = _super.call(this, cause_3) || this; + _this.message = cause_3; + } + else if (message === undefined && cause === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return IllegalAccessError; + }(Error)); + lang.IllegalAccessError = IllegalAccessError; + IllegalAccessError["__class"] = "java.lang.IllegalAccessError"; + IllegalAccessError["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var reflect; + (function (reflect) { + var Array = /** @class */ (function () { + function Array() { + } + Array.newInstance = function (componentType, length) { + var array = []; + array.length = length; + return array; + }; + return Array; + }()); + reflect.Array = Array; + Array["__class"] = "java.lang.reflect.Array"; + })(reflect = lang.reflect || (lang.reflect = {})); + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var NoSuchMethodError = /** @class */ (function (_super) { + __extends(NoSuchMethodError, _super); + function NoSuchMethodError(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined) { + var __args = arguments; + var cause_4 = __args[0]; + _this = _super.call(this, cause_4) || this; + _this.message = cause_4; + } + else if (message === undefined && cause === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return NoSuchMethodError; + }(Error)); + lang.NoSuchMethodError = NoSuchMethodError; + NoSuchMethodError["__class"] = "java.lang.NoSuchMethodError"; + NoSuchMethodError["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var annotation; + (function (annotation) { + /** + * Enumerates types of declared elements in a Java program [Sun + * docs]. + * @enum + * @property {java.lang.annotation.ElementType} ANNOTATION_TYPE + * @property {java.lang.annotation.ElementType} CONSTRUCTOR + * @property {java.lang.annotation.ElementType} FIELD + * @property {java.lang.annotation.ElementType} LOCAL_VARIABLE + * @property {java.lang.annotation.ElementType} METHOD + * @property {java.lang.annotation.ElementType} PACKAGE + * @property {java.lang.annotation.ElementType} PARAMETER + * @property {java.lang.annotation.ElementType} TYPE + * @class + */ + var ElementType; + (function (ElementType) { + ElementType[ElementType["ANNOTATION_TYPE"] = 0] = "ANNOTATION_TYPE"; + ElementType[ElementType["CONSTRUCTOR"] = 1] = "CONSTRUCTOR"; + ElementType[ElementType["FIELD"] = 2] = "FIELD"; + ElementType[ElementType["LOCAL_VARIABLE"] = 3] = "LOCAL_VARIABLE"; + ElementType[ElementType["METHOD"] = 4] = "METHOD"; + ElementType[ElementType["PACKAGE"] = 5] = "PACKAGE"; + ElementType[ElementType["PARAMETER"] = 6] = "PARAMETER"; + ElementType[ElementType["TYPE"] = 7] = "TYPE"; + })(ElementType = annotation.ElementType || (annotation.ElementType = {})); + })(annotation = lang.annotation || (lang.annotation = {})); + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var annotation; + (function (annotation) { + /** + * Enumerates annotation retention policies [Sun + * docs]. + * @enum + * @property {java.lang.annotation.RetentionPolicy} CLASS + * @property {java.lang.annotation.RetentionPolicy} RUNTIME + * @property {java.lang.annotation.RetentionPolicy} SOURCE + * @class + */ + var RetentionPolicy; + (function (RetentionPolicy) { + RetentionPolicy[RetentionPolicy["CLASS"] = 0] = "CLASS"; + RetentionPolicy[RetentionPolicy["RUNTIME"] = 1] = "RUNTIME"; + RetentionPolicy[RetentionPolicy["SOURCE"] = 2] = "SOURCE"; + })(RetentionPolicy = annotation.RetentionPolicy || (annotation.RetentionPolicy = {})); + })(annotation = lang.annotation || (lang.annotation = {})); + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var annotation; + (function (annotation) { + /** + * Indicates the annotation parser determined the annotation was malformed when + * reading from the class file [Sun + * docs]. + * @class + * @extends java.lang.Error + */ + var AnnotationFormatError = /** @class */ (function (_super) { + __extends(AnnotationFormatError, _super); + function AnnotationFormatError() { + var _this = _super.call(this) || this; + Object.setPrototypeOf(_this, AnnotationFormatError.prototype); + return _this; + } + return AnnotationFormatError; + }(Error)); + annotation.AnnotationFormatError = AnnotationFormatError; + AnnotationFormatError["__class"] = "java.lang.annotation.AnnotationFormatError"; + AnnotationFormatError["__interfaces"] = ["java.io.Serializable"]; + })(annotation = lang.annotation || (lang.annotation = {})); + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * Generally unsupported. This class is provided so that the GWT compiler can + * choke down class literal references. + *

+ * NOTE: The code in this class is very sensitive and should keep its + * dependencies upon other classes to a minimum. + * + * @param + * the type of the object + * @class + */ + var Class = /** @class */ (function () { + function Class() { + if (this.enumValueOfFunc === undefined) { + this.enumValueOfFunc = null; + } + if (this.modifiers === undefined) { + this.modifiers = 0; + } + if (this.componentType === undefined) { + this.componentType = null; + } + if (this.enumConstantsFunc === undefined) { + this.enumConstantsFunc = null; + } + if (this.enumSuperclass === undefined) { + this.enumSuperclass = null; + } + if (this.superclass === undefined) { + this.superclass = null; + } + if (this.simpleName === undefined) { + this.simpleName = null; + } + if (this.typeName === undefined) { + this.typeName = null; + } + if (this.canonicalName === undefined) { + this.canonicalName = null; + } + if (this.packageName === undefined) { + this.packageName = null; + } + if (this.compoundName === undefined) { + this.compoundName = null; + } + if (this.typeId === undefined) { + this.typeId = null; + } + if (this.arrayLiterals === undefined) { + this.arrayLiterals = null; + } + this.sequentialId = Class.nextSequentialId++; + this.typeName = null; + this.simpleName = null; + this.packageName = null; + this.compoundName = null; + this.canonicalName = null; + this.typeId = null; + this.arrayLiterals = null; + } + Class.constructors_$LI$ = function () { if (Class.constructors == null) { + Class.constructors = (new Array()); + } return Class.constructors; }; + ; + Class.classes_$LI$ = function () { if (Class.classes == null) { + Class.classes = (new Array()); + } return Class.classes; }; + ; + Class.getConstructorForClass = function (clazz) { + var index = (Class.classes_$LI$().indexOf(clazz) | 0); + return index === -1 ? null : Class.constructors_$LI$()[index]; + }; + Class.getClassForConstructor = function (constructor) { + var index = (Class.constructors_$LI$().indexOf(constructor) | 0); + return index === -1 ? null : Class.classes_$LI$()[index]; + }; + Class.mapConstructorToClass = function (constructor, clazz) { + Class.constructors_$LI$().push(constructor); + Class.classes_$LI$().push(clazz); + }; + /** + * Create a Class object for an array. + *

+ * + * Arrays are not registered in the prototype table and get the class + * literal explicitly at construction. + *

+ * @param {java.lang.Class} leafClass + * @param {number} dimensions + * @return {java.lang.Class} + * @private + */ + /*private*/ Class.getClassLiteralForArray = function (leafClass, dimensions) { + var arrayLiterals = leafClass.arrayLiterals = leafClass.arrayLiterals == null ? [] : leafClass.arrayLiterals; + return arrayLiterals[dimensions] != null ? arrayLiterals[dimensions] : (arrayLiterals[dimensions] = leafClass.createClassLiteralForArray(dimensions)); + }; + /*private*/ Class.prototype.createClassLiteralForArray = function (dimensions) { + var clazz = (new java.lang.Class()); + clazz.modifiers = Class.ARRAY; + clazz.superclass = Object; + if (dimensions > 1) { + clazz.componentType = Class.getClassLiteralForArray(this, dimensions - 1); + } + else { + clazz.componentType = this; + } + return clazz; + }; + /** + * Create a Class object for a class. + * + * @skip + * @param {string} packageName + * @param {string} compoundClassName + * @param {string} typeId + * @param {java.lang.Class} superclass + * @return {java.lang.Class} + */ + Class.createForClass = function (packageName, compoundClassName, typeId, superclass) { + var clazz = Class.createClassObject(packageName, compoundClassName, typeId); + clazz.superclass = superclass; + return clazz; + }; + /** + * Create a Class object for an enum. + * + * @skip + * @param {string} packageName + * @param {string} compoundClassName + * @param {string} typeId + * @param {java.lang.Class} superclass + * @param {Function} enumConstantsFunc + * @param {Function} enumValueOfFunc + * @return {java.lang.Class} + */ + Class.createForEnum = function (packageName, compoundClassName, typeId, superclass, enumConstantsFunc, enumValueOfFunc) { + var clazz = Class.createClassObject(packageName, compoundClassName, typeId); + clazz.modifiers = (enumConstantsFunc != null) ? Class.ENUM : 0; + clazz.superclass = clazz.enumSuperclass = superclass; + clazz.enumConstantsFunc = enumConstantsFunc; + clazz.enumValueOfFunc = enumValueOfFunc; + return clazz; + }; + /** + * Create a Class object for an interface. + * + * @skip + * @param {string} packageName + * @param {string} compoundClassName + * @return {java.lang.Class} + */ + Class.createForInterface = function (packageName, compoundClassName) { + var clazz = Class.createClassObject(packageName, compoundClassName, null); + clazz.modifiers = Class.INTERFACE; + return clazz; + }; + /** + * Create a Class object for a primitive. + * + * @skip + * @param {string} className + * @param {string} primitiveTypeId + * @return {java.lang.Class} + */ + Class.createForPrimitive = function (className, primitiveTypeId) { + var clazz = Class.createClassObject("", className, primitiveTypeId); + clazz.modifiers = Class.PRIMITIVE; + return clazz; + }; + /** + * Used by {@link WebModePayloadSink} to create uninitialized instances. + * @param {java.lang.Class} clazz + * @return {*} + */ + Class.getPrototypeForClass = function (clazz) { + if (clazz.isPrimitive()) { + return null; + } + return Class.getConstructorForClass(clazz).prototype; + }; + /** + * Creates the class object for a type and initiliazes its fields. + * @param {string} packageName + * @param {string} compoundClassName + * @param {string} typeId + * @return {java.lang.Class} + * @private + */ + /*private*/ Class.createClassObject = function (packageName, compoundClassName, typeId) { + var clazz = (new java.lang.Class()); + clazz.packageName = packageName; + clazz.compoundName = compoundClassName; + return clazz; + }; + /** + * Initiliazes {@code clazz} names from metadata. + *

+ * Written in JSNI to minimize dependencies (on String.+). + * @param {java.lang.Class} clazz + * @private + */ + /*private*/ Class.initializeNames = function (clazz) { + if (clazz.isArray()) { + var componentType = clazz.componentType; + if (componentType.isPrimitive()) { + clazz.typeName = "[" + componentType.typeId; + } + else if (!componentType.isArray()) { + clazz.typeName = "[L" + /* getName */ (function (c) { return c["__class"] ? c["__class"] : c["name"]; })(componentType) + ";"; + } + else { + clazz.typeName = "[" + /* getName */ (function (c) { return c["__class"] ? c["__class"] : c["name"]; })(componentType); + } + clazz.canonicalName = componentType.getCanonicalName() + "[]"; + clazz.simpleName = /* getSimpleName */ (function (c) { return c["__class"] ? c["__class"].substring(c["__class"].lastIndexOf('.') + 1) : c["name"].substring(c["name"].lastIndexOf('.') + 1); })(componentType) + "[]"; + return; + } + var packageName = clazz.packageName; + var compoundName = clazz.compoundName.split("/"); + clazz.typeName = [packageName, (compoundName).join("$")].join("."); + clazz.canonicalName = [packageName, (compoundName).join(".")].join("."); + clazz.simpleName = compoundName[compoundName.length - 1]; + }; + /** + * Sets the class object for primitives. + *

+ * Written in JSNI to minimize dependencies (on (String)+). + * @param {java.lang.Class} clazz + * @param {Object} primitiveTypeId + */ + Class.synthesizePrimitiveNamesFromTypeId = function (clazz, primitiveTypeId) { + clazz.typeName = "Class$" + primitiveTypeId; + clazz.canonicalName = clazz.typeName; + clazz.simpleName = clazz.typeName; + }; + Class.prototype.desiredAssertionStatus = function () { + return false; + }; + /*private*/ Class.prototype.ensureNamesAreInitialized = function () { + if (this.typeName != null) { + return; + } + Class.initializeNames(this); + }; + Class.prototype.getCanonicalName = function () { + this.ensureNamesAreInitialized(); + return this.canonicalName; + }; + Class.prototype.getComponentType = function () { + return this.componentType; + }; + Class.prototype.getEnumConstants = function () { + return (this.enumConstantsFunc && (this.enumConstantsFunc)()); + }; + Class.prototype.getName = function () { + this.ensureNamesAreInitialized(); + return this.typeName; + }; + Class.prototype.getSimpleName = function () { + this.ensureNamesAreInitialized(); + return this.simpleName; + }; + Class.prototype.getSuperclass = function () { + return this.superclass; + }; + Class.prototype.isArray = function () { + return (this.modifiers & Class.ARRAY) !== 0; + }; + Class.prototype.isEnum = function () { + return (this.modifiers & Class.ENUM) !== 0; + }; + Class.prototype.isInterface = function () { + return (this.modifiers & Class.INTERFACE) !== 0; + }; + Class.prototype.isPrimitive = function () { + return (this.modifiers & Class.PRIMITIVE) !== 0; + }; + /** + * + * @return {string} + */ + Class.prototype.toString = function () { + return (this.isInterface() ? "interface " : (this.isPrimitive() ? "" : "class ")) + /* getName */ (function (c) { return c["__class"] ? c["__class"] : c["name"]; })(this); + }; + /** + * Used by Enum to allow getSuperclass() to be pruned. + * @return {java.lang.Class} + */ + Class.prototype.getEnumSuperclass = function () { + return this.enumSuperclass; + }; + Class.PRIMITIVE = 1; + Class.INTERFACE = 2; + Class.ARRAY = 4; + Class.ENUM = 8; + Class.nextSequentialId = 1; + return Class; + }()); + lang.Class = Class; + Class["__class"] = "java.lang.Class"; + Class["__interfaces"] = ["java.lang.reflect.Type"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var ThreadLocal = /** @class */ (function () { + function ThreadLocal() { + if (this.value === undefined) { + this.value = null; + } + } + ThreadLocal.prototype.initialValue = function () { + return null; + }; + ThreadLocal.prototype.get = function () { + return this.value; + }; + ThreadLocal.prototype.set = function (value) { + this.value = value; + }; + ThreadLocal.prototype.remove = function () { + }; + ThreadLocal.prototype.childValue = function (parentValue) { + throw new java.lang.UnsupportedOperationException(); + }; + return ThreadLocal; + }()); + lang.ThreadLocal = ThreadLocal; + ThreadLocal["__class"] = "java.lang.ThreadLocal"; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * A base class to share implementation between {@link StringBuffer} and {@link StringBuilder}. + *

+ * Most methods will give expected performance results. Exception is {@link #setCharAt(int, char)}, + * which is O(n), and thus should not be used many times on the same StringBuffer. + * @param {string} string + * @class + */ + var AbstractStringBuilder = /** @class */ (function () { + function AbstractStringBuilder(string) { + if (this.string === undefined) { + this.string = null; + } + this.string = string; + } + AbstractStringBuilder.prototype.length = function () { + return this.string.length; + }; + AbstractStringBuilder.prototype.setLength = function (newLength) { + var oldLength = this.length(); + if (newLength < oldLength) { + this.string = this.string.substring(0, newLength); + } + else if (newLength > oldLength) { + this.string += /* valueOf */ new String((function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(newLength - oldLength)).toString(); + } + }; + AbstractStringBuilder.prototype.capacity = function () { + return javaemul.internal.IntegerHelper.MAX_VALUE; + }; + AbstractStringBuilder.prototype.ensureCapacity = function (ignoredCapacity) { + }; + AbstractStringBuilder.prototype.trimToSize = function () { + }; + AbstractStringBuilder.prototype.charAt = function (index) { + return this.string.charAt(index); + }; + AbstractStringBuilder.prototype.getChars = function (srcStart, srcEnd, dst, dstStart) { + javaemul.internal.InternalPreconditions.checkStringBounds(srcStart, srcEnd, this.length()); + javaemul.internal.InternalPreconditions.checkStringBounds(dstStart, dstStart + (srcEnd - srcStart), dst.length); + while ((srcStart < srcEnd)) { + { + dst[dstStart++] = this.string.charAt(srcStart++); + } + } + ; + }; + /** + * Warning! This method is much slower than the JRE implementation. If you need to do + * character level manipulation, you are strongly advised to use a char[] directly. + * @param {number} index + * @param {string} x + */ + AbstractStringBuilder.prototype.setCharAt = function (index, x) { + this.replace0(index, index + 1, /* valueOf */ new String(x).toString()); + }; + AbstractStringBuilder.prototype.subSequence = function (start, end) { + return this.string.substring(start, end); + }; + AbstractStringBuilder.prototype.substring$int = function (begin) { + return this.string.substring(begin); + }; + AbstractStringBuilder.prototype.substring$int$int = function (begin, end) { + return this.string.substring(begin, end); + }; + AbstractStringBuilder.prototype.substring = function (begin, end) { + if (((typeof begin === 'number') || begin === null) && ((typeof end === 'number') || end === null)) { + return this.substring$int$int(begin, end); + } + else if (((typeof begin === 'number') || begin === null) && end === undefined) { + return this.substring$int(begin); + } + else + throw new Error('invalid overload'); + }; + AbstractStringBuilder.prototype.indexOf$java_lang_String = function (x) { + return this.string.indexOf(x); + }; + AbstractStringBuilder.prototype.indexOf$java_lang_String$int = function (x, start) { + return this.string.indexOf(x, start); + }; + AbstractStringBuilder.prototype.indexOf = function (x, start) { + if (((typeof x === 'string') || x === null) && ((typeof start === 'number') || start === null)) { + return this.indexOf$java_lang_String$int(x, start); + } + else if (((typeof x === 'string') || x === null) && start === undefined) { + return this.indexOf$java_lang_String(x); + } + else + throw new Error('invalid overload'); + }; + AbstractStringBuilder.prototype.lastIndexOf$java_lang_String = function (s) { + return this.string.lastIndexOf(s); + }; + AbstractStringBuilder.prototype.lastIndexOf$java_lang_String$int = function (s, start) { + return this.string.lastIndexOf(s, start); + }; + AbstractStringBuilder.prototype.lastIndexOf = function (s, start) { + if (((typeof s === 'string') || s === null) && ((typeof start === 'number') || start === null)) { + return this.lastIndexOf$java_lang_String$int(s, start); + } + else if (((typeof s === 'string') || s === null) && start === undefined) { + return this.lastIndexOf$java_lang_String(s); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {string} + */ + AbstractStringBuilder.prototype.toString = function () { + return this.string; + }; + AbstractStringBuilder.prototype.append0 = function (x, start, end) { + if (x == null) { + x = "null"; + } + this.string += /* subSequence */ x.substring(start, end); + }; + AbstractStringBuilder.prototype.appendCodePoint0 = function (x) { + this.string += /* valueOf */ new String(/* toChars */ String.fromCharCode(x)).toString(); + }; + AbstractStringBuilder.prototype.replace0 = function (start, end, toInsert) { + this.string = this.string.substring(0, start) + toInsert + this.string.substring(end); + }; + AbstractStringBuilder.prototype.reverse0 = function () { + var length = this.string.length; + if (length <= 1) { + return; + } + var buffer = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(length); + buffer[0] = this.string.charAt(length - 1); + for (var i = 1; i < length; i++) { + { + buffer[i] = this.string.charAt(length - 1 - i); + if (javaemul.internal.CharacterHelper.isSurrogatePair(buffer[i], buffer[i - 1])) { + AbstractStringBuilder.swap(buffer, i - 1, i); + } + } + ; + } + this.string = new String(buffer); + }; + /*private*/ AbstractStringBuilder.swap = function (buffer, f, s) { + var tmp = buffer[f]; + buffer[f] = buffer[s]; + buffer[s] = tmp; + }; + return AbstractStringBuilder; + }()); + lang.AbstractStringBuilder = AbstractStringBuilder; + AbstractStringBuilder["__class"] = "java.lang.AbstractStringBuilder"; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * The first-class representation of an enumeration. + * + * @param + * @class + */ + var Enum = /** @class */ (function () { + function Enum(name, ordinal) { + if (this.__name === undefined) { + this.__name = null; + } + if (this.__ordinal === undefined) { + this.__ordinal = 0; + } + this.__name = name; + this.__ordinal = ordinal; + } + Enum.valueOf$java_lang_Class$java_lang_String = function (enumType, name) { + var enumValueOfFunc = javaemul.internal.InternalPreconditions.checkNotNull(enumType).enumValueOfFunc; + javaemul.internal.InternalPreconditions.checkCriticalArgument(enumValueOfFunc != null, "EnumValueOfFunc is null at enum class: %s, enum value name: %s", /* getName */ (function (c) { return c["__class"] ? c["__class"] : c["name"]; })(enumType), name); + javaemul.internal.InternalPreconditions.checkNotNull(name); + return (Enum.invokeValueOf(enumValueOfFunc, name)); + }; + Enum.valueOf = function (enumType, name) { + if (((enumType != null && enumType instanceof java.lang.Class) || enumType === null) && ((typeof name === 'string') || name === null)) { + return java.lang.Enum.valueOf$java_lang_Class$java_lang_String(enumType, name); + } + else if (((enumType != null && enumType instanceof Object) || enumType === null) && ((typeof name === 'string') || name === null)) { + return java.lang.Enum.valueOf$def_js_Object$java_lang_String(enumType, name); + } + else + throw new Error('invalid overload'); + }; + Enum.createValueOfMap = function (enumConstants) { + var result = new Object(); + for (var index129 = 0; index129 < enumConstants.length; index129++) { + var value = enumConstants[index129]; + { + Enum.put0(result, ":" + value.name(), value); + } + } + return result; + }; + Enum.valueOf$def_js_Object$java_lang_String = function (map, name) { + javaemul.internal.InternalPreconditions.checkNotNull(name); + var result = (java.lang.Enum.get0(map, ":" + name)); + javaemul.internal.InternalPreconditions.checkCriticalArgument(result != null, "Enum constant undefined: %s", name); + return result; + }; + /*private*/ Enum.get0 = function (map, name) { + return (map[name]); + }; + /*private*/ Enum.invokeValueOf = function (enumValueOfFunc, name) { + return (enumValueOfFunc(name)); + }; + /*private*/ Enum.put0 = function (map, name, value) { + map[name] = value; + }; + Enum.prototype.compareTo$java_lang_Enum = function (other) { + return this.__ordinal - other.__ordinal; + }; + /** + * + * @param {java.lang.Enum} other + * @return {number} + */ + Enum.prototype.compareTo = function (other) { + if (((other != null) || other === null)) { + return this.compareTo$java_lang_Enum(other); + } + else + throw new Error('invalid overload'); + }; + Enum.prototype.getDeclaringClass = function () { + return null; + }; + Enum.prototype.name = function () { + return this.__name != null ? this.__name : "" + this.__ordinal; + }; + Enum.prototype.ordinal = function () { + return this.__ordinal; + }; + /** + * + * @return {string} + */ + Enum.prototype.toString = function () { + return this.name(); + }; + return Enum; + }()); + lang.Enum = Enum; + Enum["__class"] = "java.lang.Enum"; + Enum["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var beans; + (function (beans) { + /** + * General-purpose beans control methods. GWT only supports a limited subset of these methods. Only + * the documented methods are available. + * @class + */ + var Beans = /** @class */ (function () { + function Beans() { + } + /** + * @return {boolean} true if we are running in the design time mode. + */ + Beans.isDesignTime = function () { + return false; + }; + return Beans; + }()); + beans.Beans = Beans; + Beans["__class"] = "java.beans.Beans"; + })(beans = java.beans || (java.beans = {})); +})(java || (java = {})); +(function (java) { + var beans; + (function (beans) { + var PropertyDescriptor = /** @class */ (function () { + function PropertyDescriptor() { + } + PropertyDescriptor.prototype.getPropertyType = function () { + return null; + }; + return PropertyDescriptor; + }()); + beans.PropertyDescriptor = PropertyDescriptor; + PropertyDescriptor["__class"] = "java.beans.PropertyDescriptor"; + })(beans = java.beans || (java.beans = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var file; + (function (file) { + var Paths = /** @class */ (function () { + function Paths() { + } + Paths.get = function () { + var paths = []; + for (var _i = 0; _i < arguments.length; _i++) { + paths[_i] = arguments[_i]; + } + return new java.nio.file.Path((paths).join(java.nio.file.Path.PATH_SEPARATOR_$LI$())); + }; + return Paths; + }()); + file.Paths = Paths; + Paths["__class"] = "java.nio.file.Paths"; + })(file = nio.file || (nio.file = {})); + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var ByteOrder = /** @class */ (function () { + function ByteOrder() { + } + ByteOrder.BIG_ENDIAN_$LI$ = function () { if (ByteOrder.BIG_ENDIAN == null) { + ByteOrder.BIG_ENDIAN = new ByteOrder(); + } return ByteOrder.BIG_ENDIAN; }; + ; + ByteOrder.LITTLE_ENDIAN_$LI$ = function () { if (ByteOrder.LITTLE_ENDIAN == null) { + ByteOrder.LITTLE_ENDIAN = new ByteOrder(); + } return ByteOrder.LITTLE_ENDIAN; }; + ; + /** + * + * @return {string} + */ + ByteOrder.prototype.toString = function () { + return this === ByteOrder.BIG_ENDIAN_$LI$() ? "BIG_ENDIAN" : "LITTLE_ENDIAN"; + }; + ByteOrder.nativeOrder = function () { + if (ByteOrder.NativeInstanceHolder.INSTANCE == null) { + ByteOrder.NativeInstanceHolder.INSTANCE = ByteOrder.NativeInstanceHolder.nativeOrderTester(); + } + return ByteOrder.NativeInstanceHolder.INSTANCE; + }; + return ByteOrder; + }()); + nio.ByteOrder = ByteOrder; + ByteOrder["__class"] = "java.nio.ByteOrder"; + (function (ByteOrder) { + var NativeInstanceHolder = /** @class */ (function () { + function NativeInstanceHolder() { + } + NativeInstanceHolder.nativeOrderTester = function () { + var arrayBuffer = new ArrayBuffer(2); + var uint8Array = new Uint8Array(arrayBuffer); + var uint16array = new Uint16Array(arrayBuffer); + uint8Array.set(Uint8Array.from([170, 187]), 0); + if (uint16array[0] === 48042) + return java.nio.ByteOrder.LITTLE_ENDIAN_$LI$(); + if (uint16array[0] === 43707) + return java.nio.ByteOrder.BIG_ENDIAN_$LI$(); + throw new Error("Something crazy just happened in native order test"); + }; + NativeInstanceHolder.INSTANCE = null; + return NativeInstanceHolder; + }()); + ByteOrder.NativeInstanceHolder = NativeInstanceHolder; + NativeInstanceHolder["__class"] = "java.nio.ByteOrder.NativeInstanceHolder"; + })(ByteOrder = nio.ByteOrder || (nio.ByteOrder = {})); + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var Buffer = /** @class */ (function () { + function Buffer(capacity, readOnly) { + if (this._capacity === undefined) { + this._capacity = 0; + } + if (this.readOnly === undefined) { + this.readOnly = false; + } + if (this._position === undefined) { + this._position = 0; + } + if (this._limit === undefined) { + this._limit = 0; + } + if (this._mark === undefined) { + this._mark = 0; + } + this._capacity = capacity; + this.readOnly = readOnly; + this._position = 0; + this._limit = capacity; + this._mark = -1; + } + Buffer.prototype.arrayOffset = function () { + return 0; + }; + Buffer.prototype.capacity = function () { + return this._capacity; + }; + Buffer.prototype.clear = function () { + this._limit = this._capacity; + this._position = 0; + this._mark = -1; + return this; + }; + Buffer.prototype.flip = function () { + this._limit = this._position; + this._position = 0; + this._mark = -1; + return this; + }; + Buffer.prototype.hasArray = function () { + return this.array() != null; + }; + Buffer.prototype.hasRemaining = function () { + return this._position < this._limit; + }; + Buffer.prototype.isDirect = function () { + return false; + }; + Buffer.prototype.isReadOnly = function () { + return this.readOnly; + }; + Buffer.prototype.limit$ = function () { + return this._limit; + }; + Buffer.prototype.limit$int = function (newLimit) { + if (newLimit > this._capacity) + throw new java.lang.IllegalArgumentException("limit is bigger than capacity"); + this._limit = newLimit; + this._position = Math.min(this._position, this._limit); + if (this._mark > this._limit) + this._mark = -1; + return this; + }; + Buffer.prototype.limit = function (newLimit) { + if (((typeof newLimit === 'number') || newLimit === null)) { + return this.limit$int(newLimit); + } + else if (newLimit === undefined) { + return this.limit$(); + } + else + throw new Error('invalid overload'); + }; + Buffer.prototype.mark = function () { + this._mark = this._position; + return this; + }; + Buffer.prototype.position$ = function () { + return this._position; + }; + Buffer.prototype.position$int = function (newPosition) { + if (newPosition > this._limit) + throw new java.lang.IllegalArgumentException("position is bigger than limit"); + this._position = newPosition; + if (this._mark > this._position) + this._mark = -1; + return this; + }; + Buffer.prototype.position = function (newPosition) { + if (((typeof newPosition === 'number') || newPosition === null)) { + return this.position$int(newPosition); + } + else if (newPosition === undefined) { + return this.position$(); + } + else + throw new Error('invalid overload'); + }; + Buffer.prototype.remaining = function () { + return this._limit - this._position; + }; + Buffer.prototype.reset = function () { + if (this._mark === -1) + throw new java.nio.InvalidMarkException(); + this._position = this._mark; + return this; + }; + Buffer.prototype.rewind = function () { + this._position = 0; + this._mark = -1; + return this; + }; + return Buffer; + }()); + nio.Buffer = Buffer; + Buffer["__class"] = "java.nio.Buffer"; + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var charset; + (function (charset) { + /** + * A minimal emulation of {@link Charset}. + * @class + */ + var Charset = /** @class */ (function () { + function Charset(name, aliasesIgnored) { + if (this.__name === undefined) { + this.__name = null; + } + this.__name = name; + } + Charset.availableCharsets = function () { + if (Charset.AvailableCharsets.CHARSETS == null) { + var map = (new java.util.TreeMap()); + map.put(javaemul.internal.EmulatedCharset.ISO_8859_1_$LI$().name(), javaemul.internal.EmulatedCharset.ISO_8859_1_$LI$()); + map.put(javaemul.internal.EmulatedCharset.ISO_LATIN_1_$LI$().name(), javaemul.internal.EmulatedCharset.ISO_LATIN_1_$LI$()); + map.put(javaemul.internal.EmulatedCharset.UTF_8_$LI$().name(), javaemul.internal.EmulatedCharset.UTF_8_$LI$()); + Charset.AvailableCharsets.CHARSETS = java.util.Collections.unmodifiableSortedMap(map); + } + return Charset.AvailableCharsets.CHARSETS; + }; + Charset.forName = function (charsetName) { + javaemul.internal.InternalPreconditions.checkArgument(charsetName != null, "Null charset name"); + charsetName = charsetName.toUpperCase(); + if (javaemul.internal.EmulatedCharset.ISO_8859_1_$LI$().name() === charsetName) { + return javaemul.internal.EmulatedCharset.ISO_8859_1_$LI$(); + } + else if (javaemul.internal.EmulatedCharset.ISO_LATIN_1_$LI$().name() === charsetName) { + return javaemul.internal.EmulatedCharset.ISO_LATIN_1_$LI$(); + } + else if (javaemul.internal.EmulatedCharset.UTF_8_$LI$().name() === charsetName) { + return javaemul.internal.EmulatedCharset.UTF_8_$LI$(); + } + if (!Charset.createLegalCharsetNameRegex().test(charsetName)) { + throw new java.nio.charset.IllegalCharsetNameException(charsetName); + } + else { + throw new java.nio.charset.UnsupportedCharsetException(charsetName); + } + }; + Charset.createLegalCharsetNameRegex = function () { + return new RegExp("^[A-Za-z0-9][\\w-:\\.\\+]*$"); + }; + Charset.prototype.name = function () { + return this.__name; + }; + Charset.prototype.compareTo$java_nio_charset_Charset = function (that) { + return /* compareToIgnoreCase */ this.__name.toUpperCase().localeCompare(that.__name.toUpperCase()); + }; + /** + * + * @param {java.nio.charset.Charset} that + * @return {number} + */ + Charset.prototype.compareTo = function (that) { + if (((that != null && that instanceof java.nio.charset.Charset) || that === null)) { + return this.compareTo$java_nio_charset_Charset(that); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + Charset.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.__name); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + Charset.prototype.equals = function (o) { + if (o === this) { + return true; + } + if (!(o != null && o instanceof java.nio.charset.Charset)) { + return false; + } + var that = o; + return this.__name === that.__name; + }; + /** + * + * @return {string} + */ + Charset.prototype.toString = function () { + return this.__name; + }; + return Charset; + }()); + charset.Charset = Charset; + Charset["__class"] = "java.nio.charset.Charset"; + Charset["__interfaces"] = ["java.lang.Comparable"]; + (function (Charset) { + var AvailableCharsets = /** @class */ (function () { + function AvailableCharsets() { + } + AvailableCharsets.CHARSETS = null; + return AvailableCharsets; + }()); + Charset.AvailableCharsets = AvailableCharsets; + AvailableCharsets["__class"] = "java.nio.charset.Charset.AvailableCharsets"; + })(Charset = charset.Charset || (charset.Charset = {})); + })(charset = nio.charset || (nio.charset = {})); + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var text; + (function (text) { + /** + * A basic implementation for Java collators. + * + * @author Renaud Pawlak + * @class + */ + var Collator = /** @class */ (function () { + function Collator() { + } + Collator.getInstance = function () { + if (Collator.collator == null) { + Collator.collator = new Collator(); + } + return Collator.collator; + }; + /** + * + * @param {*} a + * @param {*} b + * @return {number} + */ + Collator.prototype.compare = function (a, b) { + return a.localeCompare(b); + }; + Collator.collator = null; + return Collator; + }()); + text.Collator = Collator; + Collator["__class"] = "java.text.Collator"; + Collator["__interfaces"] = ["java.util.Comparator"]; + })(text = java.text || (java.text = {})); +})(java || (java = {})); +(function (java) { + var text; + (function (text) { + var Normalizer = /** @class */ (function () { + function Normalizer() { + } + Normalizer.normalize = function (src, form) { + return (src.toString()).normalize(/* Enum.name */ java.text.Normalizer.Form[form]).toString(); + }; + return Normalizer; + }()); + text.Normalizer = Normalizer; + Normalizer["__class"] = "java.text.Normalizer"; + (function (Normalizer) { + var Form; + (function (Form) { + /** + * Canonical decomposition. + */ + Form[Form["NFD"] = 0] = "NFD"; + /** + * Canonical decomposition, followed by canonical composition. + */ + Form[Form["NFC"] = 1] = "NFC"; + /** + * Compatibility decomposition. + */ + Form[Form["NFKD"] = 2] = "NFKD"; + /** + * Compatibility decomposition, followed by canonical composition. + */ + Form[Form["NFKC"] = 3] = "NFKC"; + })(Form = Normalizer.Form || (Normalizer.Form = {})); + })(Normalizer = text.Normalizer || (text.Normalizer = {})); + })(text = java.text || (java.text = {})); +})(java || (java = {})); +(function (java) { + var text; + (function (text) { + /** + * Create a new ParsePosition with the given initial index. + * + * @param {number} index initial index + * @class + * @author Mark Davis + */ + var ParsePosition = /** @class */ (function () { + function ParsePosition(index) { + this.index = 0; + this.errorIndex = -1; + this.index = index; + } + /** + * Retrieve the current parse position. On input to a parse method, this + * is the index of the character at which parsing will begin; on output, it + * is the index of the character following the last character parsed. + * + * @return {number} the current parse position + */ + ParsePosition.prototype.getIndex = function () { + return this.index; + }; + /** + * Set the current parse position. + * + * @param {number} index the current parse position + */ + ParsePosition.prototype.setIndex = function (index) { + this.index = index; + }; + /** + * Set the index at which a parse error occurred. Formatters + * should set this before returning an error code from their + * parseObject method. The default value is -1 if this is not set. + * + * @param {number} ei the index at which an error occurred + * @since 1.2 + */ + ParsePosition.prototype.setErrorIndex = function (ei) { + this.errorIndex = ei; + }; + /** + * Retrieve the index at which an error occurred, or -1 if the + * error index has not been set. + * + * @return {number} the index at which an error occurred + * @since 1.2 + */ + ParsePosition.prototype.getErrorIndex = function () { + return this.errorIndex; + }; + /** + * Overrides equals + * @param {*} obj + * @return {boolean} + */ + ParsePosition.prototype.equals = function (obj) { + if (obj == null) + return false; + if (!(obj != null && obj instanceof java.text.ParsePosition)) + return false; + var other = obj; + return (this.index === other.index && this.errorIndex === other.errorIndex); + }; + /** + * Returns a hash code for this ParsePosition. + * @return {number} a hash code value for this object + */ + ParsePosition.prototype.hashCode = function () { + return (this.errorIndex << 16) | this.index; + }; + /** + * Return a string representation of this ParsePosition. + * @return {string} a string representation of this object + */ + ParsePosition.prototype.toString = function () { + return /* getName */ (function (c) { return c["__class"] ? c["__class"] : c["name"]; })(this.constructor) + "[index=" + this.index + ",errorIndex=" + this.errorIndex + ']'; + }; + return ParsePosition; + }()); + text.ParsePosition = ParsePosition; + ParsePosition["__class"] = "java.text.ParsePosition"; + })(text = java.text || (java.text = {})); +})(java || (java = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + /** + * @author Władysław Kargul + * @param {*} previous + * @class + * @extends javaemul.internal.stream.TerminalStreamRow + */ + var StreamRowEnd = /** @class */ (function (_super) { + __extends(StreamRowEnd, _super); + function StreamRowEnd(previous) { + var _this = _super.call(this) || this; + if (_this.previous === undefined) { + _this.previous = null; + } + _this.previous = previous; + return _this; + } + StreamRowEnd.prototype.chain = function (next) { + if (this.previous != null) { + this.previous.chain(next); + } + this.previous = next; + next.chain(this); + }; + StreamRowEnd.prototype.item = function (a) { + return true; + }; + return StreamRowEnd; + }(javaemul.internal.stream.TerminalStreamRow)); + stream.StreamRowEnd = StreamRowEnd; + StreamRowEnd["__class"] = "javaemul.internal.stream.StreamRowEnd"; + StreamRowEnd["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowAllFilter = /** @class */ (function (_super) { + __extends(StreamRowAllFilter, _super); + function StreamRowAllFilter(predicate) { + var _this = _super.call(this) || this; + if (_this.predicate === undefined) { + _this.predicate = null; + } + if (_this.predicateValue === undefined) { + _this.predicateValue = false; + } + if (_this.attempts === undefined) { + _this.attempts = 0; + } + _this.predicate = (predicate); + return _this; + } + StreamRowAllFilter.prototype.getPredicateValue = function () { + return this.attempts === 0 || this.predicateValue; + }; + StreamRowAllFilter.prototype.item = function (a) { + ++this.attempts; + this.predicateValue = (function (target) { return (typeof target === 'function') ? target(a) : target.test(a); })(this.predicate) && this.predicateValue; + return this.predicateValue; + }; + return StreamRowAllFilter; + }(javaemul.internal.stream.TerminalStreamRow)); + stream.StreamRowAllFilter = StreamRowAllFilter; + StreamRowAllFilter["__class"] = "javaemul.internal.stream.StreamRowAllFilter"; + StreamRowAllFilter["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowOnceFilter = /** @class */ (function (_super) { + __extends(StreamRowOnceFilter, _super); + function StreamRowOnceFilter(predicate) { + var _this = _super.call(this) || this; + if (_this.predicate === undefined) { + _this.predicate = null; + } + if (_this.predicateValue === undefined) { + _this.predicateValue = false; + } + _this.firstMatch = java.util.Optional.empty(); + _this.predicate = (predicate); + return _this; + } + StreamRowOnceFilter.prototype.getFirstMatch = function () { + return this.firstMatch; + }; + StreamRowOnceFilter.prototype.getPredicateValue = function () { + return this.predicateValue; + }; + StreamRowOnceFilter.prototype.item = function (a) { + this.predicateValue = (function (target) { return (typeof target === 'function') ? target(a) : target.test(a); })(this.predicate); + if (this.predicateValue) { + this.firstMatch = java.util.Optional.of(a); + } + return !this.predicateValue; + }; + return StreamRowOnceFilter; + }(javaemul.internal.stream.TerminalStreamRow)); + stream.StreamRowOnceFilter = StreamRowOnceFilter; + StreamRowOnceFilter["__class"] = "javaemul.internal.stream.StreamRowOnceFilter"; + StreamRowOnceFilter["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowReduce = /** @class */ (function (_super) { + __extends(StreamRowReduce, _super); + function StreamRowReduce(result, operator) { + var _this = _super.call(this) || this; + if (_this.result === undefined) { + _this.result = null; + } + if (_this.operator === undefined) { + _this.operator = null; + } + _this.result = result; + _this.operator = (operator); + return _this; + } + StreamRowReduce.prototype.getResult = function () { + return this.result; + }; + StreamRowReduce.prototype.item = function (a) { + var _this = this; + this.result = java.util.Optional.of(this.result.map(function (v) { return (function (target) { return (typeof target === 'function') ? target(v, a) : target.apply(v, a); })(_this.operator); }).orElse(a)); + return true; + }; + return StreamRowReduce; + }(javaemul.internal.stream.TerminalStreamRow)); + stream.StreamRowReduce = StreamRowReduce; + StreamRowReduce["__class"] = "javaemul.internal.stream.StreamRowReduce"; + StreamRowReduce["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowCount = /** @class */ (function (_super) { + __extends(StreamRowCount, _super); + function StreamRowCount() { + var _this = _super.call(this) || this; + if (_this.count === undefined) { + _this.count = 0; + } + return _this; + } + StreamRowCount.prototype.getCount = function () { + return this.count; + }; + StreamRowCount.prototype.item = function (a) { + ++this.count; + return true; + }; + return StreamRowCount; + }(javaemul.internal.stream.TerminalStreamRow)); + stream.StreamRowCount = StreamRowCount; + StreamRowCount["__class"] = "javaemul.internal.stream.StreamRowCount"; + StreamRowCount["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowCollector = /** @class */ (function (_super) { + __extends(StreamRowCollector, _super); + function StreamRowCollector(collection) { + var _this = _super.call(this) || this; + if (_this.collection === undefined) { + _this.collection = null; + } + _this.collection = collection; + return _this; + } + StreamRowCollector.prototype.item = function (a) { + this.collection.add(a); + return true; + }; + StreamRowCollector.prototype.end = function () { + for (var index130 = this.collection.iterator(); index130.hasNext();) { + var item = index130.next(); + { + if (!this.next.item(item)) { + break; + } + } + } + this.next.end(); + }; + return StreamRowCollector; + }(javaemul.internal.stream.TransientStreamRow)); + stream.StreamRowCollector = StreamRowCollector; + StreamRowCollector["__class"] = "javaemul.internal.stream.StreamRowCollector"; + StreamRowCollector["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowMap = /** @class */ (function (_super) { + __extends(StreamRowMap, _super); + function StreamRowMap(map) { + var _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + _this.map = (map); + return _this; + } + StreamRowMap.prototype.item = function (a) { + return this.next.item((function (target) { return (typeof target === 'function') ? target(a) : target.apply(a); })(this.map)); + }; + StreamRowMap.prototype.end = function () { + this.next.end(); + }; + return StreamRowMap; + }(javaemul.internal.stream.TransientStreamRow)); + stream.StreamRowMap = StreamRowMap; + StreamRowMap["__class"] = "javaemul.internal.stream.StreamRowMap"; + StreamRowMap["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowFilter = /** @class */ (function (_super) { + __extends(StreamRowFilter, _super); + function StreamRowFilter(predicate) { + var _this = _super.call(this) || this; + if (_this.predicate === undefined) { + _this.predicate = null; + } + _this.predicate = (predicate); + return _this; + } + StreamRowFilter.prototype.item = function (a) { + if ((function (target) { return (typeof target === 'function') ? target(a) : target.test(a); })(this.predicate)) { + return this.next.item(a); + } + return true; + }; + StreamRowFilter.prototype.end = function () { + this.next.end(); + }; + return StreamRowFilter; + }(javaemul.internal.stream.TransientStreamRow)); + stream.StreamRowFilter = StreamRowFilter; + StreamRowFilter["__class"] = "javaemul.internal.stream.StreamRowFilter"; + StreamRowFilter["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowFilterFlop = /** @class */ (function (_super) { + __extends(StreamRowFilterFlop, _super); + function StreamRowFilterFlop(predicate) { + var _this = _super.call(this) || this; + if (_this.predicate === undefined) { + _this.predicate = null; + } + _this.predicate = (predicate); + return _this; + } + StreamRowFilterFlop.prototype.item = function (a) { + var test = (function (target) { return (typeof target === 'function') ? target(a) : target.test(a); })(this.predicate); + if (test) { + return this.next.item(a); + } + return false; + }; + StreamRowFilterFlop.prototype.end = function () { + this.next.end(); + }; + return StreamRowFilterFlop; + }(javaemul.internal.stream.TransientStreamRow)); + stream.StreamRowFilterFlop = StreamRowFilterFlop; + StreamRowFilterFlop["__class"] = "javaemul.internal.stream.StreamRowFilterFlop"; + StreamRowFilterFlop["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowFlatMap = /** @class */ (function (_super) { + __extends(StreamRowFlatMap, _super); + function StreamRowFlatMap(flatMap) { + var _this = _super.call(this) || this; + if (_this.flatMap === undefined) { + _this.flatMap = null; + } + _this.flatMap = (flatMap); + return _this; + } + StreamRowFlatMap.prototype.item = function (a) { + var _this = this; + var subStream = (function (target) { return (typeof target === 'function') ? target(a) : target.apply(a); })(this.flatMap); + try { + try { + subStream.forEach(function (o) { + if (!_this.next.item(o)) { + throw new javaemul.internal.stream.StopException(); + } + }); + } + catch (e) { + return false; + } + ; + } + finally { + subStream.close(); + } + ; + return true; + }; + StreamRowFlatMap.prototype.end = function () { + this.next.end(); + }; + return StreamRowFlatMap; + }(javaemul.internal.stream.TransientStreamRow)); + stream.StreamRowFlatMap = StreamRowFlatMap; + StreamRowFlatMap["__class"] = "javaemul.internal.stream.StreamRowFlatMap"; + StreamRowFlatMap["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Wraps a primitive double as an object. + * @param {number} value + * @class + * @extends javaemul.internal.NumberHelper + */ + var DoubleHelper = /** @class */ (function (_super) { + __extends(DoubleHelper, _super); + function DoubleHelper(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this) || this; + } + else if (((typeof s === 'number') || s === null)) { + var __args = arguments; + var value = __args[0]; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + DoubleHelper.compare = function (x, y) { + if (x < y) { + return -1; + } + if (x > y) { + return 1; + } + if (x === y) { + return 0; + } + if (DoubleHelper.isNaN(x)) { + if (DoubleHelper.isNaN(y)) { + return 0; + } + else { + return 1; + } + } + else { + return -1; + } + }; + DoubleHelper.doubleToLongBits = function (value) { + if (DoubleHelper.isNaN(value)) { + return 9221120237041090560; + } + var negative = false; + if (value === 0.0) { + if (1.0 / value === DoubleHelper.NEGATIVE_INFINITY) { + return -9223372036854775808; + } + else { + return 0; + } + } + if (value < 0.0) { + negative = true; + value = -value; + } + if (DoubleHelper.isInfinite(value)) { + if (negative) { + return -4503599627370496; + } + else { + return 9218868437227405312; + } + } + var exp = 0; + if (value < 1.0) { + var bit = 512; + for (var i = 0; i < 10; i++, bit >>= 1) { + { + if (value < DoubleHelper.PowersTable.invPowers_$LI$()[i] && exp - bit >= -1023) { + value *= DoubleHelper.PowersTable.powers_$LI$()[i]; + exp -= bit; + } + } + ; + } + if (value < 1.0 && exp - 1 >= -1023) { + value *= 2.0; + exp--; + } + } + else if (value >= 2.0) { + var bit = 512; + for (var i = 0; i < 10; i++, bit >>= 1) { + { + if (value >= DoubleHelper.PowersTable.powers_$LI$()[i]) { + value *= DoubleHelper.PowersTable.invPowers_$LI$()[i]; + exp += bit; + } + } + ; + } + } + if (exp > -1023) { + value -= 1.0; + } + else { + value *= 0.5; + } + var ihi = (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })((value * DoubleHelper.POWER_20)); + value -= ihi * DoubleHelper.POWER_MINUS_20; + var ilo = (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })((value * DoubleHelper.POWER_52)); + ihi |= (exp + 1023) << 20; + if (negative) { + ihi |= 2147483648; + } + return (ihi << 32) | ilo; + }; + /** + * @skip Here for shared implementation with Arrays.hashCode + * @param {number} d + * @return {number} + */ + DoubleHelper.hashCode = function (d) { + return (d | 0); + }; + DoubleHelper.isInfinite = function (x) { + return x === javaemul.internal.JsUtils.getInfinity() || x === -javaemul.internal.JsUtils.getInfinity(); + }; + DoubleHelper.isNaN = function (x) { + return (isNaN(x)); + }; + DoubleHelper.longBitsToDouble = function (bits) { + var ihi = (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })((bits >> 32)); + var ilo = (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })((bits & 4294967295)); + if (ihi < 0) { + ihi += 4294967296; + } + if (ilo < 0) { + ilo += 4294967296; + } + var negative = (ihi & -2147483648) !== 0; + var exp = (((ihi >> 20) & 2047) | 0); + ihi &= 1048575; + if (exp === 0) { + var d_1 = (ihi * DoubleHelper.POWER_MINUS_20) + (ilo * DoubleHelper.POWER_MINUS_52); + d_1 *= DoubleHelper.POWER_MINUS_1022; + return negative ? (d_1 === 0.0 ? -0.0 : -d_1) : d_1; + } + else if (exp === 2047) { + if (ihi === 0 && ilo === 0) { + return negative ? DoubleHelper.NEGATIVE_INFINITY : DoubleHelper.POSITIVE_INFINITY; + } + else { + return DoubleHelper.NaN; + } + } + exp -= 1023; + var d = 1.0 + (ihi * DoubleHelper.POWER_MINUS_20) + (ilo * DoubleHelper.POWER_MINUS_52); + if (exp > 0) { + var bit = 512; + for (var i = 0; i < 10; i++, bit >>= 1) { + { + if (exp >= bit) { + d *= DoubleHelper.PowersTable.powers_$LI$()[i]; + exp -= bit; + } + } + ; + } + } + else if (exp < 0) { + while ((exp < 0)) { + { + var bit = 512; + for (var i = 0; i < 10; i++, bit >>= 1) { + { + if (exp <= -bit) { + d *= DoubleHelper.PowersTable.invPowers_$LI$()[i]; + exp += bit; + } + } + ; + } + } + } + ; + } + return negative ? -d : d; + }; + DoubleHelper.parseDouble = function (s) { + return internal.NumberHelper.__parseAndValidateDouble(s); + }; + DoubleHelper.toString = function (b) { + return /* valueOf */ new String(b).toString(); + }; + DoubleHelper.valueOf$double = function (d) { + return new Number(d); + }; + DoubleHelper.valueOf$java_lang_String = function (s) { + return new Number(s); + }; + DoubleHelper.valueOf = function (s) { + if (((typeof s === 'string') || s === null)) { + return javaemul.internal.DoubleHelper.valueOf$java_lang_String(s); + } + else if (((typeof s === 'number') || s === null)) { + return javaemul.internal.DoubleHelper.valueOf$double(s); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + DoubleHelper.prototype.byteValue = function () { + return (this.doubleValue() | 0); + }; + DoubleHelper.prototype.compareTo$javaemul_internal_DoubleHelper = function (b) { + return DoubleHelper.compare(this.doubleValue(), b.doubleValue()); + }; + /** + * + * @param {javaemul.internal.DoubleHelper} b + * @return {number} + */ + DoubleHelper.prototype.compareTo = function (b) { + if (((b != null && b instanceof javaemul.internal.DoubleHelper) || b === null)) { + return this.compareTo$javaemul_internal_DoubleHelper(b); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + DoubleHelper.prototype.doubleValue = function () { + return DoubleHelper.unsafeCast((javaemul.internal.InternalPreconditions.checkNotNull(this))); + }; + DoubleHelper.unsafeCast = function (instance) { + return (instance); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + DoubleHelper.prototype.equals = function (o) { + return javaemul.internal.InternalPreconditions.checkNotNull(this) === o; + }; + /** + * + * @return {number} + */ + DoubleHelper.prototype.floatValue = function () { + return this.doubleValue(); + }; + /** + * Performance caution: using Double objects as map keys is not recommended. + * Using double values as keys is generally a bad idea due to difficulty + * determining exact equality. In addition, there is no efficient JavaScript + * equivalent of doubleToIntBits. As a result, this method + * computes a hash code by truncating the whole number portion of the + * double, which may lead to poor performance for certain value sets if + * Doubles are used as keys in a {@link java.util.HashMap}. + * @return {number} + */ + DoubleHelper.prototype.hashCode = function () { + return DoubleHelper.hashCode(this.doubleValue()); + }; + /** + * + * @return {number} + */ + DoubleHelper.prototype.intValue = function () { + return (this.doubleValue() | 0); + }; + DoubleHelper.prototype.isInfinite = function () { + return DoubleHelper.isInfinite(this.doubleValue()); + }; + DoubleHelper.prototype.isNaN = function () { + return DoubleHelper.isNaN(this.doubleValue()); + }; + /** + * + * @return {number} + */ + DoubleHelper.prototype.longValue = function () { + return (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(this.doubleValue()); + }; + /** + * + * @return {number} + */ + DoubleHelper.prototype.shortValue = function () { + return (this.doubleValue() | 0); + }; + /** + * + * @return {string} + */ + DoubleHelper.prototype.toString = function () { + return DoubleHelper.toString(this.doubleValue()); + }; + DoubleHelper.MAX_VALUE = 1.7976931348623157E308; + DoubleHelper.MIN_VALUE = 4.9E-324; + DoubleHelper.MIN_NORMAL = 2.2250738585072014E-308; + DoubleHelper.MAX_EXPONENT = 1023; + DoubleHelper.MIN_EXPONENT = -1022; + DoubleHelper.NaN = 0.0 / 0.0; + DoubleHelper.NEGATIVE_INFINITY = -1.0 / 0.0; + DoubleHelper.POSITIVE_INFINITY = 1.0 / 0.0; + DoubleHelper.SIZE = 64; + DoubleHelper.POWER_512 = 1.3407807929942597E154; + DoubleHelper.POWER_MINUS_512 = 7.458340731200207E-155; + DoubleHelper.POWER_256 = 1.157920892373162E77; + DoubleHelper.POWER_MINUS_256 = 8.636168555094445E-78; + DoubleHelper.POWER_128 = 3.4028236692093846E38; + DoubleHelper.POWER_MINUS_128 = 2.9387358770557188E-39; + DoubleHelper.POWER_64 = 1.8446744073709552E19; + DoubleHelper.POWER_MINUS_64 = 5.421010862427522E-20; + DoubleHelper.POWER_52 = 4.503599627370496E15; + DoubleHelper.POWER_MINUS_52 = 2.220446049250313E-16; + DoubleHelper.POWER_32 = 4.294967296E9; + DoubleHelper.POWER_MINUS_32 = 2.3283064365386963E-10; + DoubleHelper.POWER_31 = 2.147483648E9; + DoubleHelper.POWER_20 = 1048576.0; + DoubleHelper.POWER_MINUS_20 = 9.5367431640625E-7; + DoubleHelper.POWER_16 = 65536.0; + DoubleHelper.POWER_MINUS_16 = 1.52587890625E-5; + DoubleHelper.POWER_8 = 256.0; + DoubleHelper.POWER_MINUS_8 = 0.00390625; + DoubleHelper.POWER_4 = 16.0; + DoubleHelper.POWER_MINUS_4 = 0.0625; + DoubleHelper.POWER_2 = 4.0; + DoubleHelper.POWER_MINUS_2 = 0.25; + DoubleHelper.POWER_1 = 2.0; + DoubleHelper.POWER_MINUS_1 = 0.5; + DoubleHelper.POWER_MINUS_1022 = 2.2250738585072014E-308; + return DoubleHelper; + }(javaemul.internal.NumberHelper)); + internal.DoubleHelper = DoubleHelper; + DoubleHelper["__class"] = "javaemul.internal.DoubleHelper"; + DoubleHelper["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + (function (DoubleHelper) { + var PowersTable = /** @class */ (function () { + function PowersTable() { + } + PowersTable.powers_$LI$ = function () { if (PowersTable.powers == null) { + PowersTable.powers = [javaemul.internal.DoubleHelper.POWER_512, javaemul.internal.DoubleHelper.POWER_256, javaemul.internal.DoubleHelper.POWER_128, javaemul.internal.DoubleHelper.POWER_64, javaemul.internal.DoubleHelper.POWER_32, javaemul.internal.DoubleHelper.POWER_16, javaemul.internal.DoubleHelper.POWER_8, javaemul.internal.DoubleHelper.POWER_4, javaemul.internal.DoubleHelper.POWER_2, javaemul.internal.DoubleHelper.POWER_1]; + } return PowersTable.powers; }; + ; + PowersTable.invPowers_$LI$ = function () { if (PowersTable.invPowers == null) { + PowersTable.invPowers = [javaemul.internal.DoubleHelper.POWER_MINUS_512, javaemul.internal.DoubleHelper.POWER_MINUS_256, javaemul.internal.DoubleHelper.POWER_MINUS_128, javaemul.internal.DoubleHelper.POWER_MINUS_64, javaemul.internal.DoubleHelper.POWER_MINUS_32, javaemul.internal.DoubleHelper.POWER_MINUS_16, javaemul.internal.DoubleHelper.POWER_MINUS_8, javaemul.internal.DoubleHelper.POWER_MINUS_4, javaemul.internal.DoubleHelper.POWER_MINUS_2, javaemul.internal.DoubleHelper.POWER_MINUS_1]; + } return PowersTable.invPowers; }; + ; + return PowersTable; + }()); + DoubleHelper.PowersTable = PowersTable; + PowersTable["__class"] = "javaemul.internal.DoubleHelper.PowersTable"; + })(DoubleHelper = internal.DoubleHelper || (internal.DoubleHelper = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Wraps a primitive short as an object. + * @param {number} value + * @class + * @extends javaemul.internal.NumberHelper + */ + var ShortHelper = /** @class */ (function (_super) { + __extends(ShortHelper, _super); + function ShortHelper(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = ShortHelper.parseShort(s); + } + else if (((typeof s === 'number') || s === null)) { + var __args = arguments; + var value = __args[0]; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = value; + } + else + throw new Error('invalid overload'); + return _this; + } + ShortHelper.MIN_VALUE_$LI$ = function () { if (ShortHelper.MIN_VALUE == null) { + ShortHelper.MIN_VALUE = (32768 | 0); + } return ShortHelper.MIN_VALUE; }; + ; + ShortHelper.MAX_VALUE_$LI$ = function () { if (ShortHelper.MAX_VALUE == null) { + ShortHelper.MAX_VALUE = (32767 | 0); + } return ShortHelper.MAX_VALUE; }; + ; + ShortHelper.TYPE_$LI$ = function () { if (ShortHelper.TYPE == null) { + ShortHelper.TYPE = Number; + } return ShortHelper.TYPE; }; + ; + ShortHelper.compare = function (x, y) { + return x - y; + }; + ShortHelper.decode = function (s) { + return ShortHelper.valueOf$short((internal.NumberHelper.__decodeAndValidateInt(s, ShortHelper.MIN_VALUE_$LI$(), ShortHelper.MAX_VALUE_$LI$()) | 0)); + }; + /** + * @skip Here for shared implementation with Arrays.hashCode + * @param {number} s + * @return {number} + */ + ShortHelper.hashCode = function (s) { + return s; + }; + ShortHelper.parseShort = function (s, radix) { + if (radix === void 0) { radix = 10; } + return (internal.NumberHelper.__parseAndValidateInt(s, radix, ShortHelper.MIN_VALUE_$LI$(), ShortHelper.MAX_VALUE_$LI$()) | 0); + }; + ShortHelper.reverseBytes = function (s) { + return ((((s & 255) << 8) | ((s & 65280) >> 8)) | 0); + }; + ShortHelper.toString = function (b) { + return /* valueOf */ new String(b).toString(); + }; + ShortHelper.valueOf$short = function (s) { + if (s > -129 && s < 128) { + var rebase = s + 128; + var result = ShortHelper.BoxedValues.boxedValues_$LI$()[rebase]; + if (result == null) { + result = ShortHelper.BoxedValues.boxedValues_$LI$()[rebase] = new Number(s); + } + return result; + } + return new Number(s); + }; + ShortHelper.valueOf$java_lang_String = function (s) { + return ShortHelper.valueOf$java_lang_String$int(s, 10); + }; + ShortHelper.valueOf$java_lang_String$int = function (s, radix) { + return ShortHelper.valueOf$short(ShortHelper.parseShort(s, radix)); + }; + ShortHelper.valueOf = function (s, radix) { + if (((typeof s === 'string') || s === null) && ((typeof radix === 'number') || radix === null)) { + return javaemul.internal.ShortHelper.valueOf$java_lang_String$int(s, radix); + } + else if (((typeof s === 'string') || s === null) && radix === undefined) { + return javaemul.internal.ShortHelper.valueOf$java_lang_String(s); + } + else if (((typeof s === 'number') || s === null) && radix === undefined) { + return javaemul.internal.ShortHelper.valueOf$short(s); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + ShortHelper.prototype.byteValue = function () { + return (this.value | 0); + }; + ShortHelper.prototype.compareTo$javaemul_internal_ShortHelper = function (b) { + return ShortHelper.compare(this.value, b.value); + }; + /** + * + * @param {javaemul.internal.ShortHelper} b + * @return {number} + */ + ShortHelper.prototype.compareTo = function (b) { + if (((b != null && b instanceof javaemul.internal.ShortHelper) || b === null)) { + return this.compareTo$javaemul_internal_ShortHelper(b); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + ShortHelper.prototype.doubleValue = function () { + return this.value; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + ShortHelper.prototype.equals = function (o) { + return (o != null && o instanceof javaemul.internal.ShortHelper) && (o.value === this.value); + }; + /** + * + * @return {number} + */ + ShortHelper.prototype.floatValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + ShortHelper.prototype.hashCode = function () { + return ShortHelper.hashCode(this.value); + }; + /** + * + * @return {number} + */ + ShortHelper.prototype.intValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + ShortHelper.prototype.longValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + ShortHelper.prototype.shortValue = function () { + return this.value; + }; + /** + * + * @return {string} + */ + ShortHelper.prototype.toString = function () { + return ShortHelper.toString(this.value); + }; + ShortHelper.SIZE = 16; + return ShortHelper; + }(javaemul.internal.NumberHelper)); + internal.ShortHelper = ShortHelper; + ShortHelper["__class"] = "javaemul.internal.ShortHelper"; + ShortHelper["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + (function (ShortHelper) { + /** + * Use nested class to avoid clinit on outer. + * @class + */ + var BoxedValues = /** @class */ (function () { + function BoxedValues() { + } + BoxedValues.boxedValues_$LI$ = function () { if (BoxedValues.boxedValues == null) { + BoxedValues.boxedValues = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(256); + } return BoxedValues.boxedValues; }; + ; + return BoxedValues; + }()); + ShortHelper.BoxedValues = BoxedValues; + BoxedValues["__class"] = "javaemul.internal.ShortHelper.BoxedValues"; + })(ShortHelper = internal.ShortHelper || (internal.ShortHelper = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Wraps native byte as an object. + * @param {number} value + * @class + * @extends javaemul.internal.NumberHelper + */ + var ByteHelper = /** @class */ (function (_super) { + __extends(ByteHelper, _super); + function ByteHelper(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = ByteHelper.parseByte(s); + } + else if (((typeof s === 'number') || s === null)) { + var __args = arguments; + var value = __args[0]; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = value; + } + else + throw new Error('invalid overload'); + return _this; + } + ByteHelper.MIN_VALUE_$LI$ = function () { if (ByteHelper.MIN_VALUE == null) { + ByteHelper.MIN_VALUE = (128 | 0); + } return ByteHelper.MIN_VALUE; }; + ; + ByteHelper.MAX_VALUE_$LI$ = function () { if (ByteHelper.MAX_VALUE == null) { + ByteHelper.MAX_VALUE = (127 | 0); + } return ByteHelper.MAX_VALUE; }; + ; + ByteHelper.TYPE_$LI$ = function () { if (ByteHelper.TYPE == null) { + ByteHelper.TYPE = Number; + } return ByteHelper.TYPE; }; + ; + ByteHelper.compare = function (x, y) { + return x - y; + }; + ByteHelper.decode = function (s) { + return ByteHelper.valueOf$byte((internal.NumberHelper.__decodeAndValidateInt(s, ByteHelper.MIN_VALUE_$LI$(), ByteHelper.MAX_VALUE_$LI$()) | 0)); + }; + /** + * @skip + * + * Here for shared implementation with Arrays.hashCode + * @param {number} b + * @return {number} + */ + ByteHelper.hashCode = function (b) { + return b; + }; + ByteHelper.parseByte = function (s, radix) { + if (radix === void 0) { radix = 10; } + return (internal.NumberHelper.__parseAndValidateInt(s, radix, ByteHelper.MIN_VALUE_$LI$(), ByteHelper.MAX_VALUE_$LI$()) | 0); + }; + ByteHelper.toString = function (b) { + return /* valueOf */ new String(b).toString(); + }; + ByteHelper.valueOf$byte = function (b) { + var rebase = b + 128; + var result = ByteHelper.BoxedValues.boxedValues_$LI$()[rebase]; + if (result == null) { + result = ByteHelper.BoxedValues.boxedValues_$LI$()[rebase] = new Number(b); + } + return result; + }; + ByteHelper.valueOf$java_lang_String = function (s) { + return ByteHelper.valueOf$java_lang_String$int(s, 10); + }; + ByteHelper.valueOf$java_lang_String$int = function (s, radix) { + return javaemul.internal.ByteHelper.valueOf(ByteHelper.parseByte(s, radix)); + }; + ByteHelper.valueOf = function (s, radix) { + if (((typeof s === 'string') || s === null) && ((typeof radix === 'number') || radix === null)) { + return javaemul.internal.ByteHelper.valueOf$java_lang_String$int(s, radix); + } + else if (((typeof s === 'string') || s === null) && radix === undefined) { + return javaemul.internal.ByteHelper.valueOf$java_lang_String(s); + } + else if (((typeof s === 'number') || s === null) && radix === undefined) { + return javaemul.internal.ByteHelper.valueOf$byte(s); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + ByteHelper.prototype.byteValue = function () { + return this.value; + }; + ByteHelper.prototype.compareTo$javaemul_internal_ByteHelper = function (b) { + return ByteHelper.compare(this.value, b.value); + }; + /** + * + * @param {javaemul.internal.ByteHelper} b + * @return {number} + */ + ByteHelper.prototype.compareTo = function (b) { + if (((b != null && b instanceof javaemul.internal.ByteHelper) || b === null)) { + return this.compareTo$javaemul_internal_ByteHelper(b); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + ByteHelper.prototype.doubleValue = function () { + return this.value; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + ByteHelper.prototype.equals = function (o) { + return (o != null && o instanceof javaemul.internal.ByteHelper) && (o.value === this.value); + }; + /** + * + * @return {number} + */ + ByteHelper.prototype.floatValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + ByteHelper.prototype.hashCode = function () { + return ByteHelper.hashCode(this.value); + }; + /** + * + * @return {number} + */ + ByteHelper.prototype.intValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + ByteHelper.prototype.longValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + ByteHelper.prototype.shortValue = function () { + return this.value; + }; + /** + * + * @return {string} + */ + ByteHelper.prototype.toString = function () { + return ByteHelper.toString(this.value); + }; + ByteHelper.SIZE = 8; + return ByteHelper; + }(javaemul.internal.NumberHelper)); + internal.ByteHelper = ByteHelper; + ByteHelper["__class"] = "javaemul.internal.ByteHelper"; + ByteHelper["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + (function (ByteHelper) { + /** + * Use nested class to avoid clinit on outer. + * @class + */ + var BoxedValues = /** @class */ (function () { + function BoxedValues() { + } + BoxedValues.boxedValues_$LI$ = function () { if (BoxedValues.boxedValues == null) { + BoxedValues.boxedValues = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(256); + } return BoxedValues.boxedValues; }; + ; + return BoxedValues; + }()); + ByteHelper.BoxedValues = BoxedValues; + BoxedValues["__class"] = "javaemul.internal.ByteHelper.BoxedValues"; + })(ByteHelper = internal.ByteHelper || (internal.ByteHelper = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Wraps a primitive float as an object. + * @param {number} value + * @class + * @extends javaemul.internal.NumberHelper + */ + var FloatHelper = /** @class */ (function (_super) { + __extends(FloatHelper, _super); + function FloatHelper(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = FloatHelper.parseFloat(s); + } + else if (((typeof s === 'number') || s === null)) { + var __args = arguments; + var value = __args[0]; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = value; + } + else if (((typeof s === 'number') || s === null)) { + var __args = arguments; + var value = __args[0]; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = value; + } + else + throw new Error('invalid overload'); + return _this; + } + FloatHelper.compare = function (x, y) { + return javaemul.internal.DoubleHelper.compare(x, y); + }; + FloatHelper.floatToIntBits = function (value) { + if (FloatHelper.isNaN(value)) { + return 2143289344; + } + if (value === 0.0) { + if (1.0 / value === FloatHelper.NEGATIVE_INFINITY) { + return -2147483648; + } + else { + return 0; + } + } + var negative = false; + if (value < 0.0) { + negative = true; + value = -value; + } + if (FloatHelper.isInfinite(value)) { + if (negative) { + return -8388608; + } + else { + return 2139095040; + } + } + var l = javaemul.internal.DoubleHelper.doubleToLongBits(value); + var exp = ((((l >> 52) & 2047) - 1023) | 0); + var mantissa = (((l & 4503599627370495) >> 29) | 0); + if (exp <= -127) { + mantissa = (8388608 | mantissa) >> (-127 - exp + 1); + exp = -127; + } + var bits = negative ? FloatHelper.POWER_31_INT : 0; + bits |= (exp + 127) << 23; + bits |= mantissa; + return (bits | 0); + }; + /** + * @skip Here for shared implementation with Arrays.hashCode. + * @param {number} f + * @return {number} hash value of float (currently just truncated to int) + */ + FloatHelper.hashCode = function (f) { + return (f | 0); + }; + FloatHelper.intBitsToFloat = function (bits) { + var negative = (bits & -2147483648) !== 0; + var exp = (bits >> 23) & 255; + bits &= 8388607; + if (exp === 0) { + if (bits === 0) { + return negative ? -0.0 : 0.0; + } + } + else if (exp === 255) { + if (bits === 0) { + return negative ? FloatHelper.NEGATIVE_INFINITY : FloatHelper.POSITIVE_INFINITY; + } + else { + return FloatHelper.NaN; + } + } + if (exp === 0) { + exp = 1; + while (((bits & 8388608) === 0)) { + { + bits <<= 1; + exp--; + } + } + ; + bits &= 8388607; + } + var bits64 = negative ? -9223372036854775808 : 0; + bits64 |= ((function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })((exp + 896))) << 52; + bits64 |= ((function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(bits)) << 29; + return javaemul.internal.DoubleHelper.longBitsToDouble(bits64); + }; + FloatHelper.isInfinite = function (x) { + return javaemul.internal.DoubleHelper.isInfinite(x); + }; + FloatHelper.isNaN = function (x) { + return javaemul.internal.DoubleHelper.isNaN(x); + }; + FloatHelper.parseFloat = function (s) { + var doubleValue = internal.NumberHelper.__parseAndValidateDouble(s); + if (doubleValue > FloatHelper.MAX_VALUE) { + return FloatHelper.POSITIVE_INFINITY; + } + else if (doubleValue < -FloatHelper.MAX_VALUE) { + return FloatHelper.NEGATIVE_INFINITY; + } + return doubleValue; + }; + FloatHelper.toString = function (b) { + return /* valueOf */ new String(b).toString(); + }; + FloatHelper.valueOf$float = function (f) { + return new Number(f); + }; + FloatHelper.valueOf$java_lang_String = function (s) { + return new Number(s); + }; + FloatHelper.valueOf = function (s) { + if (((typeof s === 'string') || s === null)) { + return javaemul.internal.FloatHelper.valueOf$java_lang_String(s); + } + else if (((typeof s === 'number') || s === null)) { + return javaemul.internal.FloatHelper.valueOf$float(s); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + FloatHelper.prototype.byteValue = function () { + return (this.value | 0); + }; + FloatHelper.prototype.compareTo$javaemul_internal_FloatHelper = function (b) { + return FloatHelper.compare(this.value, b.value); + }; + /** + * + * @param {javaemul.internal.FloatHelper} b + * @return {number} + */ + FloatHelper.prototype.compareTo = function (b) { + if (((b != null && b instanceof javaemul.internal.FloatHelper) || b === null)) { + return this.compareTo$javaemul_internal_FloatHelper(b); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + FloatHelper.prototype.doubleValue = function () { + return this.value; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + FloatHelper.prototype.equals = function (o) { + return (o != null && o instanceof javaemul.internal.FloatHelper) && (o.value === this.value); + }; + /** + * + * @return {number} + */ + FloatHelper.prototype.floatValue = function () { + return this.value; + }; + /** + * Performance caution: using Float objects as map keys is not recommended. + * Using floating point values as keys is generally a bad idea due to + * difficulty determining exact equality. In addition, there is no efficient + * JavaScript equivalent of floatToIntBits. As a result, this + * method computes a hash code by truncating the whole number portion of the + * float, which may lead to poor performance for certain value sets if + * Floats are used as keys in a {@link java.util.HashMap}. + * @return {number} + */ + FloatHelper.prototype.hashCode = function () { + return FloatHelper.hashCode(this.value); + }; + /** + * + * @return {number} + */ + FloatHelper.prototype.intValue = function () { + return (this.value | 0); + }; + FloatHelper.prototype.isInfinite = function () { + return FloatHelper.isInfinite(this.value); + }; + FloatHelper.prototype.isNaN = function () { + return FloatHelper.isNaN(this.value); + }; + /** + * + * @return {number} + */ + FloatHelper.prototype.longValue = function () { + return (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(this.value); + }; + /** + * + * @return {number} + */ + FloatHelper.prototype.shortValue = function () { + return (this.value | 0); + }; + /** + * + * @return {string} + */ + FloatHelper.prototype.toString = function () { + return FloatHelper.toString(this.value); + }; + FloatHelper.MAX_VALUE = 3.4028235E38; + FloatHelper.MIN_VALUE = 1.4E-45; + FloatHelper.MAX_EXPONENT = 127; + FloatHelper.MIN_EXPONENT = -126; + FloatHelper.MIN_NORMAL = 1.17549435E-38; + FloatHelper.NaN = 0.0 / 0.0; + FloatHelper.NEGATIVE_INFINITY = -1.0 / 0.0; + FloatHelper.POSITIVE_INFINITY = 1.0 / 0.0; + FloatHelper.SIZE = 32; + FloatHelper.POWER_31_INT = 2147483648; + return FloatHelper; + }(javaemul.internal.NumberHelper)); + internal.FloatHelper = FloatHelper; + FloatHelper["__class"] = "javaemul.internal.FloatHelper"; + FloatHelper["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Wraps a primitive int as an object. + * @param {number} value + * @class + * @extends javaemul.internal.NumberHelper + */ + var IntegerHelper = /** @class */ (function (_super) { + __extends(IntegerHelper, _super); + function IntegerHelper(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = IntegerHelper.parseInt(s); + } + else if (((typeof s === 'number') || s === null)) { + var __args = arguments; + var value = __args[0]; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = value; + } + else + throw new Error('invalid overload'); + return _this; + } + IntegerHelper.bitCount = function (x) { + x -= ((x >> 1) & 1431655765); + x = (((x >> 2) & 858993459) + (x & 858993459)); + x = (((x >> 4) + x) & 252645135); + x += (x >> 8); + x += (x >> 16); + return x & 63; + }; + IntegerHelper.compare = function (x, y) { + if (x < y) { + return -1; + } + else if (x > y) { + return 1; + } + else { + return 0; + } + }; + IntegerHelper.decode = function (s) { + return IntegerHelper.valueOf$int(internal.NumberHelper.__decodeAndValidateInt(s, IntegerHelper.MIN_VALUE, IntegerHelper.MAX_VALUE)); + }; + /** + * @skip + * + * Here for shared implementation with Arrays.hashCode + * @param {number} i + * @return {number} + */ + IntegerHelper.hashCode = function (i) { + return i; + }; + IntegerHelper.highestOneBit = function (i) { + if (i < 0) { + return IntegerHelper.MIN_VALUE; + } + else if (i === 0) { + return 0; + } + else { + var rtn = void 0; + for (rtn = 1073741824; (rtn & i) === 0; rtn >>= 1) { + { + } + ; + } + return rtn; + } + }; + IntegerHelper.lowestOneBit = function (i) { + return i & -i; + }; + IntegerHelper.numberOfLeadingZeros = function (i) { + if (i < 0) { + return 0; + } + else if (i === 0) { + return IntegerHelper.SIZE; + } + else { + var y = void 0; + var m = void 0; + var n = void 0; + y = -(i >> 16); + m = (y >> 16) & 16; + n = 16 - m; + i = i >> m; + y = i - 256; + m = (y >> 16) & 8; + n += m; + i <<= m; + y = i - 4096; + m = (y >> 16) & 4; + n += m; + i <<= m; + y = i - 16384; + m = (y >> 16) & 2; + n += m; + i <<= m; + y = i >> 14; + m = y & ~(y >> 1); + return n + 2 - m; + } + }; + IntegerHelper.numberOfTrailingZeros = function (i) { + if (i === 0) { + return IntegerHelper.SIZE; + } + else { + var rtn = 0; + for (var r = 1; (r & i) === 0; r <<= 1) { + { + rtn++; + } + ; + } + return rtn; + } + }; + IntegerHelper.parseInt = function (s, radix) { + if (radix === void 0) { radix = 10; } + return internal.NumberHelper.__parseAndValidateInt(s, radix, IntegerHelper.MIN_VALUE, IntegerHelper.MAX_VALUE); + }; + IntegerHelper.reverse = function (i) { + var nibbles = IntegerHelper.ReverseNibbles.reverseNibbles_$LI$(); + return (nibbles[i >>> 28]) | (nibbles[(i >> 24) & 15] << 4) | (nibbles[(i >> 20) & 15] << 8) | (nibbles[(i >> 16) & 15] << 12) | (nibbles[(i >> 12) & 15] << 16) | (nibbles[(i >> 8) & 15] << 20) | (nibbles[(i >> 4) & 15] << 24) | (nibbles[i & 15] << 28); + }; + IntegerHelper.reverseBytes = function (i) { + return ((i & 255) << 24) | ((i & 65280) << 8) | ((i & 16711680) >> 8) | ((i & -16777216) >>> 24); + }; + IntegerHelper.rotateLeft = function (i, distance) { + while ((distance-- > 0)) { + { + i = i << 1 | ((i < 0) ? 1 : 0); + } + } + ; + return i; + }; + IntegerHelper.rotateRight = function (i, distance) { + var ui = i & IntegerHelper.MAX_VALUE; + var carry = (i < 0) ? 1073741824 : 0; + while ((distance-- > 0)) { + { + var nextcarry = ui & 1; + ui = carry | (ui >> 1); + carry = (nextcarry === 0) ? 0 : 1073741824; + } + } + ; + if (carry !== 0) { + ui = ui | IntegerHelper.MIN_VALUE; + } + return ui; + }; + IntegerHelper.signum = function (i) { + if (i === 0) { + return 0; + } + else if (i < 0) { + return -1; + } + else { + return 1; + } + }; + IntegerHelper.toBinaryString = function (value) { + return IntegerHelper.toUnsignedRadixString(value, 2); + }; + IntegerHelper.toHexString = function (value) { + return IntegerHelper.toUnsignedRadixString(value, 16); + }; + IntegerHelper.toOctalString = function (value) { + return IntegerHelper.toUnsignedRadixString(value, 8); + }; + IntegerHelper.toString$int = function (value) { + return /* valueOf */ new String(value).toString(); + }; + IntegerHelper.toString$int$int = function (value, radix) { + if (radix === 10 || radix < javaemul.internal.CharacterHelper.MIN_RADIX || radix > javaemul.internal.CharacterHelper.MAX_RADIX) { + return /* valueOf */ new String(value).toString(); + } + return IntegerHelper.toRadixString(value, radix); + }; + IntegerHelper.toString = function (value, radix) { + if (((typeof value === 'number') || value === null) && ((typeof radix === 'number') || radix === null)) { + return javaemul.internal.IntegerHelper.toString$int$int(value, radix); + } + else if (((typeof value === 'number') || value === null) && radix === undefined) { + return javaemul.internal.IntegerHelper.toString$int(value); + } + else + throw new Error('invalid overload'); + }; + IntegerHelper.valueOf$int = function (i) { + if (i > -129 && i < 128) { + var rebase = i + 128; + var result = IntegerHelper.BoxedValues.boxedValues_$LI$()[rebase]; + if (result == null) { + result = IntegerHelper.BoxedValues.boxedValues_$LI$()[rebase] = new Number(i); + } + return result; + } + return new Number(i); + }; + IntegerHelper.valueOf$java_lang_String = function (s) { + return IntegerHelper.valueOf$java_lang_String$int(s, 10); + }; + IntegerHelper.valueOf$java_lang_String$int = function (s, radix) { + return IntegerHelper.valueOf$int(IntegerHelper.parseInt(s, radix)); + }; + IntegerHelper.valueOf = function (s, radix) { + if (((typeof s === 'string') || s === null) && ((typeof radix === 'number') || radix === null)) { + return javaemul.internal.IntegerHelper.valueOf$java_lang_String$int(s, radix); + } + else if (((typeof s === 'string') || s === null) && radix === undefined) { + return javaemul.internal.IntegerHelper.valueOf$java_lang_String(s); + } + else if (((typeof s === 'number') || s === null) && radix === undefined) { + return javaemul.internal.IntegerHelper.valueOf$int(s); + } + else + throw new Error('invalid overload'); + }; + IntegerHelper.toRadixString = function (value, radix) { + return (value.toString(radix)); + }; + IntegerHelper.toUnsignedRadixString = function (value, radix) { + return ((value >>> 0).toString(radix)); + }; + /** + * + * @return {number} + */ + IntegerHelper.prototype.byteValue = function () { + return (this.value | 0); + }; + IntegerHelper.prototype.compareTo$javaemul_internal_IntegerHelper = function (b) { + return IntegerHelper.compare(this.value, b.value); + }; + /** + * + * @param {javaemul.internal.IntegerHelper} b + * @return {number} + */ + IntegerHelper.prototype.compareTo = function (b) { + if (((b != null && b instanceof javaemul.internal.IntegerHelper) || b === null)) { + return this.compareTo$javaemul_internal_IntegerHelper(b); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + IntegerHelper.prototype.doubleValue = function () { + return this.value; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + IntegerHelper.prototype.equals = function (o) { + return (o != null && o instanceof javaemul.internal.IntegerHelper) && (o.value === this.value); + }; + /** + * + * @return {number} + */ + IntegerHelper.prototype.floatValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + IntegerHelper.prototype.hashCode = function () { + return IntegerHelper.hashCode(this.value); + }; + /** + * + * @return {number} + */ + IntegerHelper.prototype.intValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + IntegerHelper.prototype.longValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + IntegerHelper.prototype.shortValue = function () { + return (this.value | 0); + }; + /** + * + * @return {string} + */ + IntegerHelper.prototype.toString = function () { + return IntegerHelper.toString$int(this.value); + }; + IntegerHelper.getInteger = function (nm) { + return IntegerHelper.decode(java.lang.System.getProperty$java_lang_String(nm)); + }; + IntegerHelper.MAX_VALUE = 2147483647; + IntegerHelper.MIN_VALUE = -2147483648; + IntegerHelper.SIZE = 32; + return IntegerHelper; + }(javaemul.internal.NumberHelper)); + internal.IntegerHelper = IntegerHelper; + IntegerHelper["__class"] = "javaemul.internal.IntegerHelper"; + IntegerHelper["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + (function (IntegerHelper) { + /** + * Use nested class to avoid clinit on outer. + * @class + */ + var BoxedValues = /** @class */ (function () { + function BoxedValues() { + } + BoxedValues.boxedValues_$LI$ = function () { if (BoxedValues.boxedValues == null) { + BoxedValues.boxedValues = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(256); + } return BoxedValues.boxedValues; }; + ; + return BoxedValues; + }()); + IntegerHelper.BoxedValues = BoxedValues; + BoxedValues["__class"] = "javaemul.internal.IntegerHelper.BoxedValues"; + /** + * Use nested class to avoid clinit on outer. + * @class + */ + var ReverseNibbles = /** @class */ (function () { + function ReverseNibbles() { + } + ReverseNibbles.reverseNibbles_$LI$ = function () { if (ReverseNibbles.reverseNibbles == null) { + ReverseNibbles.reverseNibbles = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15]; + } return ReverseNibbles.reverseNibbles; }; + ; + return ReverseNibbles; + }()); + IntegerHelper.ReverseNibbles = ReverseNibbles; + ReverseNibbles["__class"] = "javaemul.internal.IntegerHelper.ReverseNibbles"; + })(IntegerHelper = internal.IntegerHelper || (internal.IntegerHelper = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Wraps a primitive long as an object. + * @param {number} value + * @class + * @extends javaemul.internal.NumberHelper + */ + var LongHelper = /** @class */ (function (_super) { + __extends(LongHelper, _super); + function LongHelper(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = LongHelper.parseLong(s); + } + else if (((typeof s === 'number') || s === null)) { + var __args = arguments; + var value = __args[0]; + _this = _super.call(this) || this; + if (_this.value === undefined) { + _this.value = 0; + } + _this.value = value; + } + else + throw new Error('invalid overload'); + return _this; + } + LongHelper.bitCount = function (i) { + var high = ((i >> 32) | 0); + var low = (i | 0); + return javaemul.internal.IntegerHelper.bitCount(high) + javaemul.internal.IntegerHelper.bitCount(low); + }; + LongHelper.compare = function (x, y) { + if (x < y) { + return -1; + } + else if (x > y) { + return 1; + } + else { + return 0; + } + }; + LongHelper.decode = function (s) { + var decode = internal.NumberHelper.__decodeNumberString(s); + return LongHelper.valueOf$java_lang_String$int(decode.payload, decode.radix); + }; + /** + * @skip Here for shared implementation with Arrays.hashCode + * @param {number} l + * @return {number} + */ + LongHelper.hashCode = function (l) { + return (l | 0); + }; + LongHelper.highestOneBit = function (i) { + var high = ((i >> 32) | 0); + if (high !== 0) { + return ((function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(javaemul.internal.IntegerHelper.highestOneBit(high))) << 32; + } + else { + return javaemul.internal.IntegerHelper.highestOneBit((i | 0)) & 4294967295; + } + }; + LongHelper.lowestOneBit = function (i) { + return i & -i; + }; + LongHelper.numberOfLeadingZeros = function (i) { + var high = ((i >> 32) | 0); + if (high !== 0) { + return javaemul.internal.IntegerHelper.numberOfLeadingZeros(high); + } + else { + return javaemul.internal.IntegerHelper.numberOfLeadingZeros((i | 0)) + 32; + } + }; + LongHelper.numberOfTrailingZeros = function (i) { + var low = (i | 0); + if (low !== 0) { + return javaemul.internal.IntegerHelper.numberOfTrailingZeros(low); + } + else { + return javaemul.internal.IntegerHelper.numberOfTrailingZeros(((i >> 32) | 0)) + 32; + } + }; + LongHelper.parseLong = function (s, radix) { + if (radix === void 0) { radix = 10; } + return internal.NumberHelper.__parseAndValidateLong(s, radix); + }; + LongHelper.reverse = function (i) { + var high = ((i >>> 32) | 0); + var low = (i | 0); + return ((function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(javaemul.internal.IntegerHelper.reverse(low)) << 32) | (javaemul.internal.IntegerHelper.reverse(high) & 4294967295); + }; + LongHelper.reverseBytes = function (i) { + var high = ((i >>> 32) | 0); + var low = (i | 0); + return ((function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(javaemul.internal.IntegerHelper.reverseBytes(low)) << 32) | (javaemul.internal.IntegerHelper.reverseBytes(high) & 4294967295); + }; + LongHelper.rotateLeft = function (i, distance) { + while ((distance-- > 0)) { + { + i = i << 1 | ((i < 0) ? 1 : 0); + } + } + ; + return i; + }; + LongHelper.rotateRight = function (i, distance) { + var ui = i & LongHelper.MAX_VALUE; + var carry = (i < 0) ? 4611686018427387904 : 0; + while ((distance-- > 0)) { + { + var nextcarry = ui & 1; + ui = carry | (ui >> 1); + carry = (nextcarry === 0) ? 0 : 4611686018427387904; + } + } + ; + if (carry !== 0) { + ui = ui | LongHelper.MIN_VALUE; + } + return ui; + }; + LongHelper.signum = function (i) { + if (i === 0) { + return 0; + } + else if (i < 0) { + return -1; + } + else { + return 1; + } + }; + LongHelper.toBinaryString = function (value) { + return LongHelper.toPowerOfTwoUnsignedString(value, 1); + }; + LongHelper.toHexString = function (value) { + return LongHelper.toPowerOfTwoUnsignedString(value, 4); + }; + LongHelper.toOctalString = function (value) { + return LongHelper.toPowerOfTwoUnsignedString(value, 3); + }; + LongHelper.toString$long = function (value) { + return /* valueOf */ new String(value).toString(); + }; + LongHelper.toString$long$int = function (value, intRadix) { + if (intRadix === 10 || intRadix < javaemul.internal.CharacterHelper.MIN_RADIX || intRadix > javaemul.internal.CharacterHelper.MAX_RADIX) { + return /* valueOf */ new String(value).toString(); + } + var intValue = (value | 0); + if (intValue === value) { + return javaemul.internal.IntegerHelper.toString$int$int(intValue, intRadix); + } + var negative = value < 0; + if (!negative) { + value = -value; + } + var bufLen = intRadix < 8 ? 65 : 23; + var buf = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(bufLen); + var cursor = bufLen; + var radix = intRadix; + do { + { + var q = (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(value / radix); + buf[--cursor] = javaemul.internal.CharacterHelper.forDigit$int(((radix * q - value) | 0)); + value = q; + } + } while ((value !== 0)); + if (negative) { + buf[--cursor] = '-'; + } + return /* valueOf */ (function (str, index, len) { return str.join('').substring(index, index + len); })(buf, cursor, bufLen - cursor); + }; + LongHelper.toString = function (value, intRadix) { + if (((typeof value === 'number') || value === null) && ((typeof intRadix === 'number') || intRadix === null)) { + return javaemul.internal.LongHelper.toString$long$int(value, intRadix); + } + else if (((typeof value === 'number') || value === null) && intRadix === undefined) { + return javaemul.internal.LongHelper.toString$long(value); + } + else + throw new Error('invalid overload'); + }; + LongHelper.valueOf$long = function (i) { + if (i > -129 && i < 128) { + var rebase = (i | 0) + 128; + var result = LongHelper.BoxedValues.boxedValues_$LI$()[rebase]; + if (result == null) { + result = LongHelper.BoxedValues.boxedValues_$LI$()[rebase] = new Number(i); + } + return result; + } + return new Number(i); + }; + LongHelper.valueOf$java_lang_String = function (s) { + return LongHelper.valueOf$java_lang_String$int(s, 10); + }; + LongHelper.valueOf$java_lang_String$int = function (s, radix) { + return LongHelper.valueOf$long(LongHelper.parseLong(s, radix)); + }; + LongHelper.valueOf = function (s, radix) { + if (((typeof s === 'string') || s === null) && ((typeof radix === 'number') || radix === null)) { + return javaemul.internal.LongHelper.valueOf$java_lang_String$int(s, radix); + } + else if (((typeof s === 'string') || s === null) && radix === undefined) { + return javaemul.internal.LongHelper.valueOf$java_lang_String(s); + } + else if (((typeof s === 'number') || s === null) && radix === undefined) { + return javaemul.internal.LongHelper.valueOf$long(s); + } + else + throw new Error('invalid overload'); + }; + LongHelper.toPowerOfTwoUnsignedString = function (value, shift) { + var radix = 1 << shift; + if (javaemul.internal.IntegerHelper.MIN_VALUE <= value && value <= javaemul.internal.IntegerHelper.MAX_VALUE) { + return javaemul.internal.IntegerHelper.toString$int$int((value | 0), radix); + } + var mask = radix - 1; + var bufSize = (64 / shift | 0) + 1; + var buf = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(bufSize); + var pos = bufSize; + do { + { + buf[--pos] = javaemul.internal.CharacterHelper.forDigit$int(((value | 0)) & mask); + value >>>= shift; + } + } while ((value !== 0)); + return /* valueOf */ (function (str, index, len) { return str.join('').substring(index, index + len); })(buf, pos, bufSize - pos); + }; + /** + * + * @return {number} + */ + LongHelper.prototype.byteValue = function () { + return (this.value | 0); + }; + LongHelper.prototype.compareTo$javaemul_internal_LongHelper = function (b) { + return LongHelper.compare(this.value, b.value); + }; + /** + * + * @param {javaemul.internal.LongHelper} b + * @return {number} + */ + LongHelper.prototype.compareTo = function (b) { + if (((b != null && b instanceof javaemul.internal.LongHelper) || b === null)) { + return this.compareTo$javaemul_internal_LongHelper(b); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {number} + */ + LongHelper.prototype.doubleValue = function () { + return this.value; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + LongHelper.prototype.equals = function (o) { + return (o != null && o instanceof javaemul.internal.LongHelper) && (o.value === this.value); + }; + /** + * + * @return {number} + */ + LongHelper.prototype.floatValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + LongHelper.prototype.hashCode = function () { + return LongHelper.hashCode(this.value); + }; + /** + * + * @return {number} + */ + LongHelper.prototype.intValue = function () { + return (this.value | 0); + }; + /** + * + * @return {number} + */ + LongHelper.prototype.longValue = function () { + return this.value; + }; + /** + * + * @return {number} + */ + LongHelper.prototype.shortValue = function () { + return (this.value | 0); + }; + /** + * + * @return {string} + */ + LongHelper.prototype.toString = function () { + return LongHelper.toString$long(this.value); + }; + LongHelper.MAX_VALUE = 9223372036854775807; + LongHelper.MIN_VALUE = -9223372036854775808; + LongHelper.SIZE = 64; + return LongHelper; + }(javaemul.internal.NumberHelper)); + internal.LongHelper = LongHelper; + LongHelper["__class"] = "javaemul.internal.LongHelper"; + LongHelper["__interfaces"] = ["java.lang.Comparable", "java.io.Serializable"]; + (function (LongHelper) { + /** + * Use nested class to avoid clinit on outer. + * @class + */ + var BoxedValues = /** @class */ (function () { + function BoxedValues() { + } + BoxedValues.boxedValues_$LI$ = function () { if (BoxedValues.boxedValues == null) { + BoxedValues.boxedValues = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(256); + } return BoxedValues.boxedValues; }; + ; + return BoxedValues; + }()); + LongHelper.BoxedValues = BoxedValues; + BoxedValues["__class"] = "javaemul.internal.LongHelper.BoxedValues"; + })(LongHelper = internal.LongHelper || (internal.LongHelper = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (java) { + var util; + (function (util) { + var Scanner = /** @class */ (function () { + function Scanner(string) { + if (((typeof string === 'string') || string === null)) { + var __args = arguments; + { + var __args_16 = arguments; + var reader = new java.io.StringReader(string); + if (this.reader === undefined) { + this.reader = null; + } + if (this.matcher === undefined) { + this.matcher = null; + } + if (this.nextDelimiterWithPattern === undefined) { + this.nextDelimiterWithPattern = null; + } + this.currentDelimiter = Scanner.whiteSpacePattern_$LI$(); + this.buf = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(1024); + this.bufferFilledLength = 0; + this.currentPosition = 0; + this.nextTokenStart = 0; + this.nextDelimiterStart = -1; + this.nextDelimiterEnd = -1; + this.defaultRadix = 10; + this.closed = false; + this.reader = reader; + } + if (this.reader === undefined) { + this.reader = null; + } + if (this.matcher === undefined) { + this.matcher = null; + } + if (this.nextDelimiterWithPattern === undefined) { + this.nextDelimiterWithPattern = null; + } + this.currentDelimiter = Scanner.whiteSpacePattern_$LI$(); + this.buf = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(1024); + this.bufferFilledLength = 0; + this.currentPosition = 0; + this.nextTokenStart = 0; + this.nextDelimiterStart = -1; + this.nextDelimiterEnd = -1; + this.defaultRadix = 10; + this.closed = false; + } + else if (((string != null && string instanceof java.io.InputStream) || string === null)) { + var __args = arguments; + var inputStream = __args[0]; + { + var __args_17 = arguments; + var reader = new java.io.InputStreamReader(inputStream); + if (this.reader === undefined) { + this.reader = null; + } + if (this.matcher === undefined) { + this.matcher = null; + } + if (this.nextDelimiterWithPattern === undefined) { + this.nextDelimiterWithPattern = null; + } + this.currentDelimiter = Scanner.whiteSpacePattern_$LI$(); + this.buf = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(1024); + this.bufferFilledLength = 0; + this.currentPosition = 0; + this.nextTokenStart = 0; + this.nextDelimiterStart = -1; + this.nextDelimiterEnd = -1; + this.defaultRadix = 10; + this.closed = false; + this.reader = reader; + } + if (this.reader === undefined) { + this.reader = null; + } + if (this.matcher === undefined) { + this.matcher = null; + } + if (this.nextDelimiterWithPattern === undefined) { + this.nextDelimiterWithPattern = null; + } + this.currentDelimiter = Scanner.whiteSpacePattern_$LI$(); + this.buf = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(1024); + this.bufferFilledLength = 0; + this.currentPosition = 0; + this.nextTokenStart = 0; + this.nextDelimiterStart = -1; + this.nextDelimiterEnd = -1; + this.defaultRadix = 10; + this.closed = false; + } + else if (((string != null && string instanceof java.io.Reader) || string === null)) { + var __args = arguments; + var reader = __args[0]; + if (this.reader === undefined) { + this.reader = null; + } + if (this.matcher === undefined) { + this.matcher = null; + } + if (this.nextDelimiterWithPattern === undefined) { + this.nextDelimiterWithPattern = null; + } + this.currentDelimiter = Scanner.whiteSpacePattern_$LI$(); + this.buf = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(1024); + this.bufferFilledLength = 0; + this.currentPosition = 0; + this.nextTokenStart = 0; + this.nextDelimiterStart = -1; + this.nextDelimiterEnd = -1; + this.defaultRadix = 10; + this.closed = false; + this.reader = reader; + } + else + throw new Error('invalid overload'); + } + /* Default method injected from java.util.Iterator */ + Scanner.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /* Default method injected from java.util.Iterator */ + Scanner.prototype.remove = function () { + throw new java.lang.UnsupportedOperationException(); + }; + Scanner.numeral_$LI$ = function () { if (Scanner.numeral == null) { + Scanner.numeral = Scanner.digit + "+"; + } return Scanner.numeral; }; + ; + Scanner.decimalNumeral_$LI$ = function () { if (Scanner.decimalNumeral == null) { + Scanner.decimalNumeral = "(?:" + Scanner.numeral_$LI$() + "|" + Scanner.numeral_$LI$() + Scanner.decimalSeparator + Scanner.digit + "*|" + Scanner.decimalSeparator + Scanner.digit + "+)"; + } return Scanner.decimalNumeral; }; + ; + Scanner.exponent_$LI$ = function () { if (Scanner.exponent == null) { + Scanner.exponent = "(?:[eE][+-]?" + Scanner.digit + "+)"; + } return Scanner.exponent; }; + ; + Scanner.decimal_$LI$ = function () { if (Scanner.decimal == null) { + Scanner.decimal = "(?:[-+]?" + Scanner.decimalNumeral_$LI$() + Scanner.exponent_$LI$() + "?)"; + } return Scanner.decimal; }; + ; + Scanner.signedNonNumber_$LI$ = function () { if (Scanner.signedNonNumber == null) { + Scanner.signedNonNumber = "(?:[-+]?" + Scanner.nonNumber + ")"; + } return Scanner.signedNonNumber; }; + ; + Scanner.booleanPattern_$LI$ = function () { if (Scanner.booleanPattern == null) { + Scanner.booleanPattern = java.util.regex.Pattern.compile("true|TRUE|True|1|false|FALSE|False|0"); + } return Scanner.booleanPattern; }; + ; + Scanner.integerPattern_$LI$ = function () { if (Scanner.integerPattern == null) { + Scanner.integerPattern = java.util.regex.Pattern.compile("[-+]?" + Scanner.numeral_$LI$()); + } return Scanner.integerPattern; }; + ; + Scanner.floatPattern_$LI$ = function () { if (Scanner.floatPattern == null) { + Scanner.floatPattern = java.util.regex.Pattern.compile(Scanner.decimal_$LI$() + "|" + Scanner.hexFloat + "|" + Scanner.signedNonNumber_$LI$()); + } return Scanner.floatPattern; }; + ; + Scanner.endLinePattern_$LI$ = function () { if (Scanner.endLinePattern == null) { + Scanner.endLinePattern = java.util.regex.Pattern.compile("[\\n\\r]+"); + } return Scanner.endLinePattern; }; + ; + Scanner.whiteSpacePattern_$LI$ = function () { if (Scanner.whiteSpacePattern == null) { + Scanner.whiteSpacePattern = java.util.regex.Pattern.compile("\\s+"); + } return Scanner.whiteSpacePattern; }; + ; + /** + * + */ + Scanner.prototype.close = function () { + this.closed = true; + this.reader.close(); + }; + Scanner.prototype.delimiter = function () { + return this.currentDelimiter; + }; + Scanner.prototype.useDelimiter$java_lang_String = function (currentDelimiter) { + return this.useDelimiter$java_util_regex_Pattern(java.util.regex.Pattern.compile$java_lang_String(currentDelimiter)); + }; + Scanner.prototype.useDelimiter = function (currentDelimiter) { + if (((typeof currentDelimiter === 'string') || currentDelimiter === null)) { + return this.useDelimiter$java_lang_String(currentDelimiter); + } + else if (((currentDelimiter != null && currentDelimiter instanceof java.util.regex.Pattern) || currentDelimiter === null)) { + return this.useDelimiter$java_util_regex_Pattern(currentDelimiter); + } + else + throw new Error('invalid overload'); + }; + Scanner.prototype.useDelimiter$java_util_regex_Pattern = function (currentDelimiter) { + this.currentDelimiter = currentDelimiter; + return this; + }; + Scanner.prototype.hasNext$ = function () { + if (this.closed && this.currentPosition === this.bufferFilledLength) + return false; + if (this.nextDelimiterStart === -1 || this.nextDelimiterWithPattern !== this.currentDelimiter) { + this.searchNextTo$java_util_regex_Pattern(this.currentDelimiter); + this.nextDelimiterWithPattern = this.currentDelimiter; + } + return this.currentPosition !== this.bufferFilledLength; + }; + /*private*/ Scanner.prototype.searchNextTo$java_util_regex_Pattern = function (pattern) { + this.searchNextTo$java_util_regex_Pattern$boolean(pattern, false); + }; + Scanner.prototype.searchNextTo$java_util_regex_Pattern$boolean = function (pattern, canBeEmpty) { + try { + this.nextTokenStart = 0; + while ((!this.closed || this.bufferFilledLength !== this.currentPosition + this.nextTokenStart)) { + { + this.matcher = pattern.matcher((function (str, index, len) { return str.substring(index, index + len); })((this.buf).join(''), this.currentPosition + this.nextTokenStart, this.bufferFilledLength - this.currentPosition - this.nextTokenStart)); + if (this.matcher.find$()) { + if (this.matcher.start$() > 0 || canBeEmpty) { + this.nextDelimiterStart = this.currentPosition + this.nextTokenStart + this.matcher.start$(); + this.nextDelimiterEnd = this.currentPosition + this.nextTokenStart + this.matcher.end$(); + return; + } + this.nextTokenStart += this.matcher.end$(); + if (this.currentPosition + this.nextTokenStart < this.bufferFilledLength) + continue; + } + if (this.buf.length === this.bufferFilledLength) { + if (this.currentPosition < (this.buf.length / 2 | 0)) { + var chars = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(this.buf.length * 2); + java.lang.System.arraycopy(this.buf, this.currentPosition, chars, 0, this.bufferFilledLength - this.currentPosition); + this.buf = chars; + } + else { + java.lang.System.arraycopy(this.buf, this.currentPosition, this.buf, 0, this.bufferFilledLength - this.currentPosition); + } + this.bufferFilledLength -= this.currentPosition; + this.currentPosition = 0; + this.nextDelimiterStart = this.nextDelimiterEnd = -1; + } + if (this.closed) + break; + var read = this.reader.read$char_A$int$int(this.buf, this.bufferFilledLength, this.buf.length - this.bufferFilledLength); + if (read <= 0) { + try { + this.close(); + } + catch (ignored) { + } + ; + } + else { + this.bufferFilledLength += read; + } + } + } + ; + } + catch (ignored) { + try { + this.close(); + } + catch (ignored2) { + } + ; + } + ; + this.nextDelimiterStart = this.nextDelimiterEnd = this.bufferFilledLength; + }; + Scanner.prototype.searchNextTo = function (pattern, canBeEmpty) { + if (((pattern != null && pattern instanceof java.util.regex.Pattern) || pattern === null) && ((typeof canBeEmpty === 'boolean') || canBeEmpty === null)) { + return this.searchNextTo$java_util_regex_Pattern$boolean(pattern, canBeEmpty); + } + else if (((pattern != null && pattern instanceof java.util.regex.Pattern) || pattern === null) && canBeEmpty === undefined) { + return this.searchNextTo$java_util_regex_Pattern(pattern); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {string} + */ + Scanner.prototype.next = function () { + if (!this.hasNext$()) + throw new java.util.NoSuchElementException("No more token"); + var result = (function (str, index, len) { return str.substring(index, index + len); })((this.buf).join(''), this.currentPosition + this.nextTokenStart, this.nextDelimiterStart - this.currentPosition - this.nextTokenStart); + this.currentPosition = this.nextDelimiterStart; + this.nextDelimiterStart = this.nextDelimiterEnd = -1; + return result; + }; + Scanner.prototype.hasNext$java_util_regex_Pattern = function (pattern) { + return this.hasNext$() && pattern.matcher((function (str, index, len) { return str.substring(index, index + len); })((this.buf).join(''), this.currentPosition + this.nextTokenStart, this.nextDelimiterStart - this.currentPosition - this.nextTokenStart)).matches(); + }; + Scanner.prototype.hasNext = function (pattern) { + if (((pattern != null && pattern instanceof java.util.regex.Pattern) || pattern === null)) { + return this.hasNext$java_util_regex_Pattern(pattern); + } + else if (((typeof pattern === 'string') || pattern === null)) { + return this.hasNext$java_lang_String(pattern); + } + else if (pattern === undefined) { + return this.hasNext$(); + } + else + throw new Error('invalid overload'); + }; + Scanner.prototype.hasNext$java_lang_String = function (pattern) { + return this.hasNext$() && java.util.regex.Pattern.matches(pattern, (function (str, index, len) { return str.substring(index, index + len); })((this.buf).join(''), this.currentPosition + this.nextTokenStart, this.nextDelimiterStart - this.currentPosition - this.nextTokenStart)); + }; + Scanner.prototype.radix = function () { + return this.defaultRadix; + }; + Scanner.prototype.hasNextBoolean = function () { + return this.hasNext$java_util_regex_Pattern(Scanner.booleanPattern_$LI$()); + }; + Scanner.prototype.nextBoolean = function () { + if (!this.hasNextBoolean()) + throw new java.util.InputMismatchException("Next token is not a boolean"); + var firstChar = this.next().charAt(0); + return (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(firstChar) == 't'.charCodeAt(0) || (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(firstChar) == 'T'.charCodeAt(0) || (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(firstChar) == '1'.charCodeAt(0); + }; + Scanner.prototype.hasNextByte = function () { + return this.hasNext$java_util_regex_Pattern(Scanner.integerPattern_$LI$()); + }; + Scanner.prototype.nextByte = function () { + if (!this.hasNextByte()) + throw new java.util.InputMismatchException("Next token is not a byte"); + return javaemul.internal.ByteHelper.parseByte(this.next()); + }; + Scanner.prototype.hasNextDouble = function () { + return this.hasNext$java_util_regex_Pattern(Scanner.floatPattern_$LI$()); + }; + Scanner.prototype.nextDouble = function () { + if (!this.hasNextDouble()) + throw new java.util.InputMismatchException("Next token is not a double"); + return javaemul.internal.DoubleHelper.parseDouble(this.next()); + }; + Scanner.prototype.hasNextFloat = function () { + return this.hasNext$java_util_regex_Pattern(Scanner.floatPattern_$LI$()); + }; + Scanner.prototype.nextFloat = function () { + if (!this.hasNextFloat()) + throw new java.util.InputMismatchException("Next token is not a float"); + return javaemul.internal.FloatHelper.parseFloat(this.next()); + }; + Scanner.prototype.hasNextInt = function () { + return this.hasNext$java_util_regex_Pattern(Scanner.integerPattern_$LI$()); + }; + Scanner.prototype.nextInt = function () { + if (!this.hasNextInt()) + throw new java.util.InputMismatchException("Next token is not a int"); + return javaemul.internal.IntegerHelper.parseInt(this.next()); + }; + Scanner.prototype.hasNextLine = function () { + if (this.closed && this.currentPosition === this.bufferFilledLength) + return false; + if (this.nextDelimiterStart === -1 || this.nextDelimiterWithPattern !== Scanner.endLinePattern_$LI$()) { + this.searchNextTo$java_util_regex_Pattern$boolean(Scanner.endLinePattern_$LI$(), true); + this.nextDelimiterWithPattern = Scanner.endLinePattern_$LI$(); + } + return this.currentPosition !== this.bufferFilledLength; + }; + Scanner.prototype.nextLine = function () { + if (!this.hasNextLine()) + throw new java.util.InputMismatchException("No new line"); + var result = (function (str, index, len) { return str.substring(index, index + len); })((this.buf).join(''), this.currentPosition, this.nextDelimiterStart - this.currentPosition); + this.currentPosition = this.nextDelimiterEnd; + this.nextDelimiterStart = this.nextDelimiterEnd = -1; + return result; + }; + Scanner.prototype.hasNextLong = function () { + return this.hasNext$java_util_regex_Pattern(Scanner.integerPattern_$LI$()); + }; + Scanner.prototype.nextLong = function () { + if (!this.hasNextLong()) + throw new java.util.InputMismatchException("Next token is not a long"); + return javaemul.internal.LongHelper.parseLong(this.next()); + }; + Scanner.prototype.hasNextShort = function () { + return this.hasNext$java_util_regex_Pattern(Scanner.integerPattern_$LI$()); + }; + Scanner.prototype.nextShort = function () { + if (!this.hasNextShort()) + throw new java.util.InputMismatchException("Next token is not a short"); + return javaemul.internal.ShortHelper.parseShort(this.next()); + }; + Scanner.prototype.reset = function () { + return this.useDelimiter$java_util_regex_Pattern(Scanner.whiteSpacePattern_$LI$()); + }; + Scanner.prototype.skip$java_lang_String = function (pattern) { + return this.skip$java_util_regex_Pattern(java.util.regex.Pattern.compile$java_lang_String(pattern)); + }; + Scanner.prototype.skip = function (pattern) { + if (((typeof pattern === 'string') || pattern === null)) { + return this.skip$java_lang_String(pattern); + } + else if (((pattern != null && pattern instanceof java.util.regex.Pattern) || pattern === null)) { + return this.skip$java_util_regex_Pattern(pattern); + } + else + throw new Error('invalid overload'); + }; + Scanner.prototype.skip$java_util_regex_Pattern = function (pattern) { + if (this.closed && this.currentPosition === this.bufferFilledLength) + throw new java.util.NoSuchElementException("No more token"); + this.searchNextTo$java_util_regex_Pattern$boolean(pattern, true); + if (this.nextDelimiterStart !== this.currentPosition) { + throw new java.util.NoSuchElementException("The specified pattern was not found"); + } + this.currentPosition = this.nextDelimiterEnd; + this.nextDelimiterStart = this.nextDelimiterEnd = -1; + return this; + }; + Scanner.prototype.findInLine$java_lang_String = function (pattern) { + return this.findInLine$java_util_regex_Pattern(java.util.regex.Pattern.compile$java_lang_String(pattern)); + }; + Scanner.prototype.findInLine = function (pattern) { + if (((typeof pattern === 'string') || pattern === null)) { + return this.findInLine$java_lang_String(pattern); + } + else if (((pattern != null && pattern instanceof java.util.regex.Pattern) || pattern === null)) { + return this.findInLine$java_util_regex_Pattern(pattern); + } + else + throw new Error('invalid overload'); + }; + Scanner.prototype.findInLine$java_util_regex_Pattern = function (pattern) { + if (!this.hasNextLine()) { + return null; + } + this.matcher = pattern.matcher((function (str, index, len) { return str.substring(index, index + len); })((this.buf).join(''), this.currentPosition, this.nextDelimiterStart - this.currentPosition)); + if (this.matcher.find$()) { + this.nextLine(); + return this.matcher.group$(); + } + else { + this.nextDelimiterStart = this.nextDelimiterEnd = -1; + return null; + } + }; + Scanner.prototype.match = function () { + if (this.matcher == null) + throw new java.lang.IllegalStateException("No match result is available"); + return this.matcher; + }; + Scanner.digit = "[\\d]"; + Scanner.decimalSeparator = "[.,]"; + Scanner.hexFloat = "(?:[-+]?0[xX][0-9a-fA-F]*\\.[0-9a-fA-F]+(?:[pP][-+]?[0-9]+)?)"; + Scanner.nonNumber = "(?:NaN|Infinity)"; + return Scanner; + }()); + util.Scanner = Scanner; + Scanner["__class"] = "java.util.Scanner"; + Scanner["__interfaces"] = ["java.util.Iterator", "java.io.Closeable", "java.lang.AutoCloseable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Skeletal implementation of the Set interface. [Sun + * docs] + * + * @param the element type. + * @class + * @extends java.util.AbstractCollection + */ + var AbstractSet = /** @class */ (function (_super) { + __extends(AbstractSet, _super); + function AbstractSet() { + return _super.call(this) || this; + } + /* Default method injected from java.util.Collection */ + AbstractSet.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_4 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_4(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + AbstractSet.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + AbstractSet.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + AbstractSet.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_5 = function (index131) { + var t = index131.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index131 = this.iterator(); index131.hasNext();) { + _loop_5(index131); + } + }; + /** + * + * @param {*} o + * @return {boolean} + */ + AbstractSet.prototype.equals = function (o) { + if (o === this) { + return true; + } + if (!(o != null && (o["__interfaces"] != null && o["__interfaces"].indexOf("java.util.Set") >= 0 || o.constructor != null && o.constructor["__interfaces"] != null && o.constructor["__interfaces"].indexOf("java.util.Set") >= 0))) { + return false; + } + var other = o; + if (other.size() !== this.size()) { + return false; + } + return this.containsAll(other); + }; + /** + * + * @return {number} + */ + AbstractSet.prototype.hashCode = function () { + return java.util.Collections.hashCode$java_lang_Iterable(this); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + AbstractSet.prototype.removeAll = function (c) { + javaemul.internal.InternalPreconditions.checkNotNull(c); + var size = this.size(); + if (size < c.size()) { + for (var iter = this.iterator(); iter.hasNext();) { + { + var o = iter.next(); + if (c.contains(o)) { + iter.remove(); + } + } + ; + } + } + else { + for (var index132 = c.iterator(); index132.hasNext();) { + var o1 = index132.next(); + { + this.remove(o1); + } + } + } + return (size !== this.size()); + }; + return AbstractSet; + }(java.util.AbstractCollection)); + util.AbstractSet = AbstractSet; + AbstractSet["__class"] = "java.util.AbstractSet"; + AbstractSet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Skeletal implementation of the List interface. [Sun + * docs] + * + * @param the element type. + * @extends java.util.AbstractCollection + * @class + */ + var AbstractList = /** @class */ (function (_super) { + __extends(AbstractList, _super); + function AbstractList() { + var _this = _super.call(this) || this; + if (_this.modCount === undefined) { + _this.modCount = 0; + } + return _this; + } + /* Default method injected from java.util.Collection */ + AbstractList.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_6 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_6(it); + } + return removed; + }; + /* Default method injected from java.util.List */ + AbstractList.prototype.sort = function (c) { + var a = this.toArray(); + java.util.Arrays.sort(a, (c)); + var i = this.listIterator(); + for (var index133 = 0; index133 < a.length; index133++) { + var e = a[index133]; + { + i.next(); + i.set(e); + } + } + }; + /* Default method injected from java.util.Collection */ + AbstractList.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + AbstractList.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + AbstractList.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_7 = function (index134) { + var t = index134.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index134 = this.iterator(); index134.hasNext();) { + _loop_7(index134); + } + }; + AbstractList.prototype.add$java_lang_Object = function (obj) { + this.add(this.size(), obj); + return true; + }; + AbstractList.prototype.add$int$java_lang_Object = function (index, element) { + throw new java.lang.UnsupportedOperationException("Add not supported on this list"); + }; + /** + * + * @param {number} index + * @param {*} element + */ + AbstractList.prototype.add = function (index, element) { + if (((typeof index === 'number') || index === null) && ((element != null) || element === null)) { + return this.add$int$java_lang_Object(index, element); + } + else if (((index != null) || index === null) && element === undefined) { + return this.add$java_lang_Object(index); + } + else + throw new Error('invalid overload'); + }; + AbstractList.prototype.addAll$int$java_util_Collection = function (index, c) { + javaemul.internal.InternalPreconditions.checkNotNull(c); + var changed = false; + for (var index135 = c.iterator(); index135.hasNext();) { + var e = index135.next(); + { + this.add(index++, e); + changed = true; + } + } + return changed; + }; + /** + * + * @param {number} index + * @param {*} c + * @return {boolean} + */ + AbstractList.prototype.addAll = function (index, c) { + if (((typeof index === 'number') || index === null) && ((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.Collection") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || c === null)) { + return this.addAll$int$java_util_Collection(index, c); + } + else if (((index != null && (index["__interfaces"] != null && index["__interfaces"].indexOf("java.util.Collection") >= 0 || index.constructor != null && index.constructor["__interfaces"] != null && index.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || index === null) && c === undefined) { + return _super.prototype.addAll.call(this, index); + } + else + throw new Error('invalid overload'); + }; + /** + * + */ + AbstractList.prototype.clear = function () { + this.removeRange(0, this.size()); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + AbstractList.prototype.equals = function (o) { + if (o === this) { + return true; + } + if (!(o != null && (o["__interfaces"] != null && o["__interfaces"].indexOf("java.util.List") >= 0 || o.constructor != null && o.constructor["__interfaces"] != null && o.constructor["__interfaces"].indexOf("java.util.List") >= 0))) { + return false; + } + var other = o; + if (this.size() !== other.size()) { + return false; + } + var iterOther = other.iterator(); + for (var index136 = this.iterator(); index136.hasNext();) { + var elem = index136.next(); + { + var elemOther = iterOther.next(); + if (!java.util.Objects.equals(elem, elemOther)) { + return false; + } + } + } + return true; + }; + /** + * + * @return {number} + */ + AbstractList.prototype.hashCode = function () { + return java.util.Collections.hashCode$java_lang_Iterable(this); + }; + /** + * + * @param {*} toFind + * @return {number} + */ + AbstractList.prototype.indexOf = function (toFind) { + for (var i = 0, n = this.size(); i < n; ++i) { + { + if (java.util.Objects.equals(toFind, this.get(i))) { + return i; + } + } + ; + } + return -1; + }; + /** + * + * @return {*} + */ + AbstractList.prototype.iterator = function () { + return new AbstractList.IteratorImpl(this); + }; + /** + * + * @param {*} toFind + * @return {number} + */ + AbstractList.prototype.lastIndexOf = function (toFind) { + for (var i = this.size() - 1; i > -1; --i) { + { + if (java.util.Objects.equals(toFind, this.get(i))) { + return i; + } + } + ; + } + return -1; + }; + AbstractList.prototype.listIterator$ = function () { + return this.listIterator$int(0); + }; + AbstractList.prototype.listIterator$int = function (from) { + return new AbstractList.ListIteratorImpl(this, from); + }; + /** + * + * @param {number} from + * @return {*} + */ + AbstractList.prototype.listIterator = function (from) { + if (((typeof from === 'number') || from === null)) { + return this.listIterator$int(from); + } + else if (from === undefined) { + return this.listIterator$(); + } + else + throw new Error('invalid overload'); + }; + AbstractList.prototype.remove$int = function (index) { + throw new java.lang.UnsupportedOperationException("Remove not supported on this list"); + }; + /** + * + * @param {number} index + * @return {*} + */ + AbstractList.prototype.remove = function (index) { + if (((typeof index === 'number') || index === null)) { + return this.remove$int(index); + } + else if (((index != null) || index === null)) { + return _super.prototype.remove.call(this, index); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {number} index + * @param {*} o + * @return {*} + */ + AbstractList.prototype.set = function (index, o) { + throw new java.lang.UnsupportedOperationException("Set not supported on this list"); + }; + /** + * + * @param {number} fromIndex + * @param {number} toIndex + * @return {*} + */ + AbstractList.prototype.subList = function (fromIndex, toIndex) { + return (new AbstractList.SubList(this, fromIndex, toIndex)); + }; + AbstractList.prototype.removeRange = function (fromIndex, endIndex) { + var iter = this.listIterator$int(fromIndex); + for (var i = fromIndex; i < endIndex; ++i) { + { + iter.next(); + iter.remove(); + } + ; + } + }; + return AbstractList; + }(java.util.AbstractCollection)); + util.AbstractList = AbstractList; + AbstractList["__class"] = "java.util.AbstractList"; + AbstractList["__interfaces"] = ["java.util.List", "java.util.Collection", "java.lang.Iterable"]; + (function (AbstractList) { + var IteratorImpl = /** @class */ (function () { + function IteratorImpl(__parent) { + this.__parent = __parent; + if (this.i === undefined) { + this.i = 0; + } + if (this.last === undefined) { + this.last = 0; + } + this.i = 0; + this.last = -1; + } + /* Default method injected from java.util.Iterator */ + IteratorImpl.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + IteratorImpl.prototype.hasNext = function () { + return this.i < this.__parent.size(); + }; + /** + * + * @return {*} + */ + IteratorImpl.prototype.next = function () { + javaemul.internal.InternalPreconditions.checkElement(this.hasNext()); + return this.__parent.get(this.last = this.i++); + }; + /** + * + */ + IteratorImpl.prototype.remove = function () { + javaemul.internal.InternalPreconditions.checkState(this.last !== -1); + this.__parent.remove$int(this.last); + this.i = this.last; + this.last = -1; + }; + return IteratorImpl; + }()); + AbstractList.IteratorImpl = IteratorImpl; + IteratorImpl["__class"] = "java.util.AbstractList.IteratorImpl"; + IteratorImpl["__interfaces"] = ["java.util.Iterator"]; + var SubList = /** @class */ (function (_super) { + __extends(SubList, _super); + function SubList(wrapped, fromIndex, toIndex) { + var _this = _super.call(this) || this; + if (_this.wrapped === undefined) { + _this.wrapped = null; + } + if (_this.fromIndex === undefined) { + _this.fromIndex = 0; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + javaemul.internal.InternalPreconditions.checkCriticalPositionIndexes(fromIndex, toIndex, wrapped.size()); + _this.wrapped = wrapped; + _this.fromIndex = fromIndex; + _this.__size = toIndex - fromIndex; + return _this; + } + SubList.prototype.add$int$java_lang_Object = function (index, element) { + javaemul.internal.InternalPreconditions.checkPositionIndex(index, this.__size); + this.wrapped.add(this.fromIndex + index, element); + this.__size++; + }; + /** + * + * @param {number} index + * @param {*} element + */ + SubList.prototype.add = function (index, element) { + if (((typeof index === 'number') || index === null) && ((element != null) || element === null)) { + return this.add$int$java_lang_Object(index, element); + } + else if (((index != null) || index === null) && element === undefined) { + return this.add$java_lang_Object(index); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {number} index + * @return {*} + */ + SubList.prototype.get = function (index) { + javaemul.internal.InternalPreconditions.checkElementIndex(index, this.__size); + return this.wrapped.get(this.fromIndex + index); + }; + SubList.prototype.remove$int = function (index) { + javaemul.internal.InternalPreconditions.checkElementIndex(index, this.__size); + var result = this.wrapped['remove$int'](this.fromIndex + index); + this.__size--; + return result; + }; + /** + * + * @param {number} index + * @return {*} + */ + SubList.prototype.remove = function (index) { + if (((typeof index === 'number') || index === null)) { + return this.remove$int(index); + } + else if (((index != null) || index === null)) { + return _super.prototype.remove.call(this, index); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {number} index + * @param {*} element + * @return {*} + */ + SubList.prototype.set = function (index, element) { + javaemul.internal.InternalPreconditions.checkElementIndex(index, this.__size); + return this.wrapped.set(this.fromIndex + index, element); + }; + /** + * + * @return {number} + */ + SubList.prototype.size = function () { + return this.__size; + }; + return SubList; + }(java.util.AbstractList)); + AbstractList.SubList = SubList; + SubList["__class"] = "java.util.AbstractList.SubList"; + SubList["__interfaces"] = ["java.util.List", "java.util.Collection", "java.lang.Iterable"]; + /** + * Implementation of ListIterator for abstract lists. + * @extends java.util.AbstractList.IteratorImpl + * @class + */ + var ListIteratorImpl = /** @class */ (function (_super) { + __extends(ListIteratorImpl, _super); + function ListIteratorImpl(__parent, start) { + var _this = this; + if (((typeof start === 'number') || start === null)) { + var __args = Array.prototype.slice.call(arguments, [1]); + _this = _super.call(this, __parent) || this; + javaemul.internal.InternalPreconditions.checkPositionIndex(start, __parent.size()); + _this.i = start; + } + else if (start === undefined) { + var __args = Array.prototype.slice.call(arguments, [1]); + _this = _super.call(this, __parent) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + /* Default method injected from java.util.Iterator */ + ListIteratorImpl.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @param {*} o + */ + ListIteratorImpl.prototype.add = function (o) { + this.__parent.add(this.i, o); + this.i++; + this.last = -1; + }; + /** + * + * @return {boolean} + */ + ListIteratorImpl.prototype.hasPrevious = function () { + return this.i > 0; + }; + /** + * + * @return {number} + */ + ListIteratorImpl.prototype.nextIndex = function () { + return this.i; + }; + /** + * + * @return {*} + */ + ListIteratorImpl.prototype.previous = function () { + javaemul.internal.InternalPreconditions.checkElement(this.hasPrevious()); + return this.__parent.get(this.last = --this.i); + }; + /** + * + * @return {number} + */ + ListIteratorImpl.prototype.previousIndex = function () { + return this.i - 1; + }; + /** + * + * @param {*} o + */ + ListIteratorImpl.prototype.set = function (o) { + javaemul.internal.InternalPreconditions.checkState(this.last !== -1); + this.__parent.set(this.last, o); + }; + return ListIteratorImpl; + }(AbstractList.IteratorImpl)); + AbstractList.ListIteratorImpl = ListIteratorImpl; + ListIteratorImpl["__class"] = "java.util.AbstractList.ListIteratorImpl"; + ListIteratorImpl["__interfaces"] = ["java.util.Iterator", "java.util.ListIterator"]; + })(AbstractList = util.AbstractList || (util.AbstractList = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Skeletal implementation of the Queue interface. [Sun + * docs] + * + * @param element type. + * @extends java.util.AbstractCollection + * @class + */ + var AbstractQueue = /** @class */ (function (_super) { + __extends(AbstractQueue, _super); + function AbstractQueue() { + return _super.call(this) || this; + } + /* Default method injected from java.util.Collection */ + AbstractQueue.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_8 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_8(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + AbstractQueue.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + AbstractQueue.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + AbstractQueue.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_9 = function (index137) { + var t = index137.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index137 = this.iterator(); index137.hasNext();) { + _loop_9(index137); + } + }; + /** + * + * @param {*} o + * @return {boolean} + */ + AbstractQueue.prototype.add = function (o) { + javaemul.internal.InternalPreconditions.checkState(this.offer(o), "Unable to add element to queue"); + return true; + }; + /** + * + * @param {*} c + * @return {boolean} + */ + AbstractQueue.prototype.addAll = function (c) { + javaemul.internal.InternalPreconditions.checkNotNull(c); + javaemul.internal.InternalPreconditions.checkArgument(c !== this, "Can\'t add a queue to itself"); + return _super.prototype.addAll.call(this, c); + }; + /** + * + */ + AbstractQueue.prototype.clear = function () { + while ((this.poll() != null)) { + { + } + } + ; + }; + /** + * + * @return {*} + */ + AbstractQueue.prototype.element = function () { + var e = this.peek(); + javaemul.internal.InternalPreconditions.checkElement(e != null, "Queue is empty"); + return e; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + AbstractQueue.prototype.remove = function (o) { + if (((o != null) || o === null)) { + return _super.prototype.remove.call(this, o); + } + else if (o === undefined) { + return this.remove$(); + } + else + throw new Error('invalid overload'); + }; + AbstractQueue.prototype.remove$ = function () { + var e = this.poll(); + javaemul.internal.InternalPreconditions.checkElement(e != null, "Queue is empty"); + return e; + }; + return AbstractQueue; + }(java.util.AbstractCollection)); + util.AbstractQueue = AbstractQueue; + AbstractQueue["__class"] = "java.util.AbstractQueue"; + AbstractQueue["__interfaces"] = ["java.util.Collection", "java.util.Queue", "java.lang.Iterable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var Timer = /** @class */ (function () { + function Timer(name, daemon) { + if (((typeof name === 'string') || name === null) && ((typeof daemon === 'boolean') || daemon === null)) { + var __args = arguments; + if (this.name === undefined) { + this.name = null; + } + this.timeouts = (new Array()); + this.intervals = (new Array()); + this.name = name; + } + else if (((typeof name === 'string') || name === null) && daemon === undefined) { + var __args = arguments; + { + var __args_18 = arguments; + var daemon_1 = true; + if (this.name === undefined) { + this.name = null; + } + this.timeouts = (new Array()); + this.intervals = (new Array()); + this.name = name; + } + if (this.name === undefined) { + this.name = null; + } + this.timeouts = (new Array()); + this.intervals = (new Array()); + } + else if (((typeof name === 'boolean') || name === null) && daemon === undefined) { + var __args = arguments; + var daemon_2 = __args[0]; + { + var __args_19 = arguments; + { + var __args_20 = arguments; + var name_1 = "Timer-" + ++Timer.nextSerialNumber; + var daemon_3 = true; + if (this.name === undefined) { + this.name = null; + } + this.timeouts = (new Array()); + this.intervals = (new Array()); + this.name = name_1; + } + if (this.name === undefined) { + this.name = null; + } + this.timeouts = (new Array()); + this.intervals = (new Array()); + } + if (this.name === undefined) { + this.name = null; + } + this.timeouts = (new Array()); + this.intervals = (new Array()); + } + else if (name === undefined && daemon === undefined) { + var __args = arguments; + { + var __args_21 = arguments; + var name_2 = "Timer-" + ++Timer.nextSerialNumber; + var daemon_4 = true; + if (this.name === undefined) { + this.name = null; + } + this.timeouts = (new Array()); + this.intervals = (new Array()); + this.name = name_2; + } + if (this.name === undefined) { + this.name = null; + } + this.timeouts = (new Array()); + this.intervals = (new Array()); + } + else + throw new Error('invalid overload'); + } + Timer.prototype.schedule$java_util_TimerTask$long = function (task, delay) { + if (delay < 0) { + throw new java.lang.IllegalArgumentException("Negative delay."); + } + else { + this.schedule$java_util_TimerTask$java_util_Date(task, new util.Date(java.lang.System.currentTimeMillis() + delay)); + } + }; + Timer.prototype.schedule$java_util_TimerTask$java_util_Date = function (task, time) { + var _this = this; + task.nextExecutionTime = time.getTime(); + task.handle = (window.setTimeout((function () { + if (task.state !== java.util.TimerTask.CANCELLED) { + task.run(); + task.state = java.util.TimerTask.EXECUTED; + } + _this.timeouts.splice(_this.timeouts.indexOf(task), 1); + }), time.getTime() - java.lang.System.currentTimeMillis()) | 0); + this.timeouts.push(task); + task.state = java.util.TimerTask.SCHEDULED; + }; + Timer.prototype.schedule$java_util_TimerTask$long$long = function (task, delay, period) { + if (delay < 0) { + throw new java.lang.IllegalArgumentException("Negative delay."); + } + else { + this.schedule$java_util_TimerTask$java_util_Date$long(task, new util.Date(java.lang.System.currentTimeMillis() + delay), period); + } + }; + Timer.prototype.schedule$java_util_TimerTask$java_util_Date$long = function (task, time, period) { + var _this = this; + if (period <= 0) { + throw new java.lang.IllegalArgumentException("Non-positive period."); + } + else { + task.period = period; + task.nextExecutionTime = time.getTime(); + task.handle = (window.setTimeout((function () { + if (task.state !== java.util.TimerTask.CANCELLED) { + task.run(); + _this.schedule$java_util_TimerTask$long$long(task, period, period); + } + else { + _this.timeouts.splice(_this.timeouts.indexOf(task), 1); + } + }), time.getTime() - java.lang.System.currentTimeMillis()) | 0); + this.timeouts.push(task); + task.state = java.util.TimerTask.SCHEDULED; + } + }; + Timer.prototype.schedule = function (task, time, period) { + if (((task != null && task instanceof java.util.TimerTask) || task === null) && ((time != null && time instanceof util.Date) || time === null) && ((typeof period === 'number') || period === null)) { + return this.schedule$java_util_TimerTask$java_util_Date$long(task, time, period); + } + else if (((task != null && task instanceof java.util.TimerTask) || task === null) && ((typeof time === 'number') || time === null) && ((typeof period === 'number') || period === null)) { + return this.schedule$java_util_TimerTask$long$long(task, time, period); + } + else if (((task != null && task instanceof java.util.TimerTask) || task === null) && ((time != null && time instanceof util.Date) || time === null) && period === undefined) { + return this.schedule$java_util_TimerTask$java_util_Date(task, time); + } + else if (((task != null && task instanceof java.util.TimerTask) || task === null) && ((typeof time === 'number') || time === null) && period === undefined) { + return this.schedule$java_util_TimerTask$long(task, time); + } + else + throw new Error('invalid overload'); + }; + Timer.prototype.scheduleAtFixedRate$java_util_TimerTask$long$long = function (task, delay, period) { + if (delay < 0) { + throw new java.lang.IllegalArgumentException("Negative delay."); + } + else { + this.scheduleAtFixedRate$java_util_TimerTask$java_util_Date$long(task, new util.Date(java.lang.System.currentTimeMillis() + delay), period); + } + }; + Timer.prototype.scheduleAtFixedRate$java_util_TimerTask$java_util_Date$long = function (task, time, period) { + if (period <= 0) { + throw new java.lang.IllegalArgumentException("Non-positive period."); + } + else { + task.period = period; + task.nextExecutionTime = time.getTime(); + var start = new Timer.Timer$0(this, task); + this.schedule$java_util_TimerTask$java_util_Date(start, time); + task.handle = start.handle; + } + }; + Timer.prototype.scheduleAtFixedRate = function (task, time, period) { + if (((task != null && task instanceof java.util.TimerTask) || task === null) && ((time != null && time instanceof util.Date) || time === null) && ((typeof period === 'number') || period === null)) { + return this.scheduleAtFixedRate$java_util_TimerTask$java_util_Date$long(task, time, period); + } + else if (((task != null && task instanceof java.util.TimerTask) || task === null) && ((typeof time === 'number') || time === null) && ((typeof period === 'number') || period === null)) { + return this.scheduleAtFixedRate$java_util_TimerTask$long$long(task, time, period); + } + else + throw new Error('invalid overload'); + }; + Timer.prototype.cancel = function () { + for (var index138 = 0; index138 < this.timeouts.length; index138++) { + var task = this.timeouts[index138]; + { + clearTimeout(task.handle); + } + } + for (var index139 = 0; index139 < this.intervals.length; index139++) { + var task = this.intervals[index139]; + { + clearInterval(task.handle); + } + } + this.intervals = (new Array()); + this.timeouts = (new Array()); + }; + Timer.prototype.purge = function () { + var newTimeouts = this.timeouts.filter(function (timerTask) { return timerTask.handle !== java.util.TimerTask.EXECUTED && timerTask.handle !== java.util.TimerTask.CANCELLED; }); + var newIntervals = this.intervals.filter(function (timerTask) { return timerTask.handle !== java.util.TimerTask.EXECUTED && timerTask.handle !== java.util.TimerTask.CANCELLED; }); + var purged = this.timeouts.length - newTimeouts.length + this.intervals.length - newIntervals.length; + this.timeouts = newTimeouts; + this.intervals = newIntervals; + return purged; + }; + Timer.nextSerialNumber = 0; + return Timer; + }()); + util.Timer = Timer; + Timer["__class"] = "java.util.Timer"; + (function (Timer) { + var Timer$0 = /** @class */ (function (_super) { + __extends(Timer$0, _super); + function Timer$0(__parent, task) { + var _this = _super.call(this) || this; + _this.task = task; + _this.__parent = __parent; + return _this; + } + /** + * + */ + Timer$0.prototype.run = function () { + var _this = this; + if (this.task.state !== java.util.TimerTask.CANCELLED) { + this.task.nextExecutionTime = java.lang.System.currentTimeMillis() + this.task.period; + this.task.handle = (window.setInterval((function () { + if (_this.task.state !== java.util.TimerTask.CANCELLED) { + _this.task.nextExecutionTime = java.lang.System.currentTimeMillis() + _this.task.period; + _this.task.run(); + } + else { + clearInterval(_this.task.handle); + _this.__parent.intervals.splice(_this.__parent.intervals.indexOf(_this.task), 1); + } + }), this.task.period) | 0); + this.__parent.intervals.push(this.task); + this.task.run(); + } + }; + return Timer$0; + }(java.util.TimerTask)); + Timer.Timer$0 = Timer$0; + Timer$0["__interfaces"] = ["java.lang.Runnable"]; + })(Timer = util.Timer || (util.Timer = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Intrinsic string class. + * @class + */ + var StringHelper = /** @class */ (function () { + function StringHelper() { + } + StringHelper.CASE_INSENSITIVE_ORDER_$LI$ = function () { + if (StringHelper.CASE_INSENSITIVE_ORDER == null) { + StringHelper.CASE_INSENSITIVE_ORDER = function (a, b) { + return /* compareToIgnoreCase */ a.toUpperCase().localeCompare(b.toUpperCase()); + }; + } + return StringHelper.CASE_INSENSITIVE_ORDER; + }; + ; + StringHelper.copyValueOf$char_A = function (v) { + return StringHelper.valueOf$char_A(v); + }; + StringHelper.copyValueOf$char_A$int$int = function (v, offset, count) { + return StringHelper.valueOf$char_A$int$int(v, offset, count); + }; + StringHelper.copyValueOf = function (v, offset, count) { + if (((v != null && v instanceof Array && (v.length == 0 || v[0] == null || (typeof v[0] === 'string'))) || v === null) && ((typeof offset === 'number') || offset === null) && ((typeof count === 'number') || count === null)) { + return javaemul.internal.StringHelper.copyValueOf$char_A$int$int(v, offset, count); + } + else if (((v != null && v instanceof Array && (v.length == 0 || v[0] == null || (typeof v[0] === 'string'))) || v === null) && offset === undefined && count === undefined) { + return javaemul.internal.StringHelper.copyValueOf$char_A(v); + } + else + throw new Error('invalid overload'); + }; + StringHelper.valueOf$boolean = function (x) { + return "" + x; + }; + StringHelper.valueOf$char = function (x) { + return "" + x; + }; + StringHelper.valueOf$char_A$int$int = function (x, offset, count) { + var end = offset + count; + javaemul.internal.InternalPreconditions.checkStringBounds(offset, end, x.length); + var batchSize = javaemul.internal.ArrayHelper.ARRAY_PROCESS_BATCH_SIZE; + var s = ""; + for (var batchStart = offset; batchStart < end;) { + { + var batchEnd = Math.min(batchStart + batchSize, end); + s += (javaemul.internal.ArrayHelper.unsafeClone(x, batchStart, batchEnd)).join(""); + batchStart = batchEnd; + } + ; + } + return s; + }; + StringHelper.valueOf = function (x, offset, count) { + if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && ((typeof offset === 'number') || offset === null) && ((typeof count === 'number') || count === null)) { + return javaemul.internal.StringHelper.valueOf$char_A$int$int(x, offset, count); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && offset === undefined && count === undefined) { + return javaemul.internal.StringHelper.valueOf$char_A(x); + } + else if (((typeof x === 'boolean') || x === null) && offset === undefined && count === undefined) { + return javaemul.internal.StringHelper.valueOf$boolean(x); + } + else if (((typeof x === 'string') || x === null) && offset === undefined && count === undefined) { + return javaemul.internal.StringHelper.valueOf$char(x); + } + else if (((typeof x === 'number') || x === null) && offset === undefined && count === undefined) { + return javaemul.internal.StringHelper.valueOf$int(x); + } + else if (((typeof x === 'number') || x === null) && offset === undefined && count === undefined) { + return javaemul.internal.StringHelper.valueOf$long(x); + } + else if (((typeof x === 'number') || x === null) && offset === undefined && count === undefined) { + return javaemul.internal.StringHelper.valueOf$float(x); + } + else if (((typeof x === 'number') || x === null) && offset === undefined && count === undefined) { + return javaemul.internal.StringHelper.valueOf$double(x); + } + else if (((x != null) || x === null) && offset === undefined && count === undefined) { + return javaemul.internal.StringHelper.valueOf$java_lang_Object(x); + } + else + throw new Error('invalid overload'); + }; + /*private*/ StringHelper.fromCharCode = function (array) { + return String.fromCharCode((array | 0)); + }; + StringHelper.valueOf$char_A = function (x) { + return StringHelper.valueOf$char_A$int$int(x, 0, x.length); + }; + StringHelper.valueOf$double = function (x) { + return "" + x; + }; + StringHelper.valueOf$float = function (x) { + return "" + x; + }; + StringHelper.valueOf$int = function (x) { + return "" + x; + }; + StringHelper.valueOf$long = function (x) { + return "" + x; + }; + StringHelper.valueOf$java_lang_Object = function (x) { + return x == null ? "null" : x.toString(); + }; + /** + * This method converts Java-escaped dollar signs "\$" into + * JavaScript-escaped dollar signs "$$", and removes all other lone + * backslashes, which serve as escapes in Java but are passed through + * literally in JavaScript. + * + * @skip + * @param {string} replaceStr + * @return {string} + * @private + */ + /*private*/ StringHelper.translateReplaceString = function (replaceStr) { + var pos = 0; + while ((0 <= (pos = replaceStr.indexOf("\\", pos)))) { + { + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(replaceStr.charAt(pos + 1)) == '$'.charCodeAt(0)) { + replaceStr = replaceStr.substring(0, pos) + "$" + replaceStr.substring(++pos); + } + else { + replaceStr = replaceStr.substring(0, pos) + replaceStr.substring(++pos); + } + } + } + ; + return replaceStr; + }; + /*private*/ StringHelper.compareTo = function (thisStr, otherStr) { + if (thisStr == otherStr) { + return 0; + } + ; + return (thisStr < otherStr ? -1 : 1); + }; + /*private*/ StringHelper.getCharset = function (charsetName) { + try { + return java.nio.charset.Charset.forName(charsetName); + } + catch (e) { + throw new java.io.UnsupportedEncodingException(charsetName); + } + ; + }; + StringHelper.fromCodePoint = function (codePoint) { + if (codePoint >= javaemul.internal.CharacterHelper.MIN_SUPPLEMENTARY_CODE_POINT) { + var hiSurrogate = javaemul.internal.CharacterHelper.getHighSurrogate(codePoint); + var loSurrogate = javaemul.internal.CharacterHelper.getLowSurrogate(codePoint); + return /* valueOf */ new String(hiSurrogate).toString() + /* valueOf */ new String(loSurrogate).toString(); + } + else { + return /* valueOf */ new String(String.fromCharCode(codePoint)).toString(); + } + }; + StringHelper.format = function (formatString) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return ""; + }; + StringHelper.join = function (delimiter) { + var elements = []; + for (var _i = 1; _i < arguments.length; _i++) { + elements[_i - 1] = arguments[_i]; + } + java.util.Objects.requireNonNull(delimiter); + java.util.Objects.requireNonNull(elements); + var joiner = new java.util.StringJoiner(delimiter); + for (var index140 = 0; index140 < elements.length; index140++) { + var cs = elements[index140]; + { + joiner.add(cs); + } + } + return joiner.toString(); + }; + return StringHelper; + }()); + internal.StringHelper = StringHelper; + StringHelper["__class"] = "javaemul.internal.StringHelper"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (java) { + var sql; + (function (sql) { + /** + * An implementation of java.sql.Timestame. Derived from + * http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Timestamp.html. This is + * basically just regular Date decorated with a nanoseconds field. + * @param {number} year + * @param {number} month + * @param {number} date + * @param {number} hour + * @param {number} minute + * @param {number} second + * @param {number} nano + * @class + * @extends java.util.Date + */ + var Timestamp = /** @class */ (function (_super) { + __extends(Timestamp, _super); + function Timestamp(year, month, date, hour, minute, second, nano) { + var _this = this; + if (((typeof year === 'number') || year === null) && ((typeof month === 'number') || month === null) && ((typeof date === 'number') || date === null) && ((typeof hour === 'number') || hour === null) && ((typeof minute === 'number') || minute === null) && ((typeof second === 'number') || second === null) && ((typeof nano === 'number') || nano === null)) { + var __args = arguments; + _this = _super.call(this, year, month, date, hour, minute, second) || this; + if (_this.nanos === undefined) { + _this.nanos = 0; + } + _this.setNanos(nano); + } + else if (((typeof year === 'number') || year === null) && month === undefined && date === undefined && hour === undefined && minute === undefined && second === undefined && nano === undefined) { + var __args = arguments; + var time = __args[0]; + _this = _super.call(this, time) || this; + if (_this.nanos === undefined) { + _this.nanos = 0; + } + _this.nanos = ((((time % 1000) | 0)) * 1000000); + } + else + throw new Error('invalid overload'); + return _this; + } + Timestamp.valueOf = function (s) { + var components = s.split(" "); + if (components.length !== 2) { + throw new java.lang.IllegalArgumentException("Invalid escape format: " + s); + } + var timeComponents = components[1].split("\\."); + var hasNanos = true; + var nanos = 0; + if (timeComponents.length === 1) { + hasNanos = false; + } + else if (timeComponents.length !== 2) { + throw new java.lang.IllegalArgumentException("Invalid escape format: " + s); + } + var d = java.sql.Date.valueOf(components[0]); + var t = java.sql.Time.valueOf(timeComponents[0]); + if (hasNanos) { + var nanosString = timeComponents[1]; + var len = nanosString.length; + if (len > 9) { + throw new java.lang.IllegalArgumentException("Invalid escape format: " + s); + } + if (len < 9) { + nanosString += "00000000".substring(len - 1); + } + try { + nanos = javaemul.internal.IntegerHelper.valueOf(nanosString); + } + catch (e) { + throw new java.lang.IllegalArgumentException("Invalid escape format: " + s); + } + ; + } + return new Timestamp(d.getYear(), d.getMonth(), d.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), nanos); + }; + /*private*/ Timestamp.padNine = function (value) { + var toReturn = new java.lang.StringBuilder("000000000"); + var asString = new String(value).toString(); + toReturn = toReturn.replace(9 - asString.length, 9, asString); + return toReturn.toString(); + }; + Timestamp.prototype.after$java_sql_Timestamp = function (ts) { + return (this.getTime() > ts.getTime()) || (this.getTime() === ts.getTime() && this.getNanos() > ts.getNanos()); + }; + Timestamp.prototype.after = function (ts) { + if (((ts != null && ts instanceof java.sql.Timestamp) || ts === null)) { + return this.after$java_sql_Timestamp(ts); + } + else if (((ts != null && ts instanceof sql.Date) || ts === null)) { + return _super.prototype.after.call(this, ts); + } + else + throw new Error('invalid overload'); + }; + Timestamp.prototype.before$java_sql_Timestamp = function (ts) { + return (this.getTime() < ts.getTime()) || (this.getTime() === ts.getTime() && this.getNanos() < ts.getNanos()); + }; + Timestamp.prototype.before = function (ts) { + if (((ts != null && ts instanceof java.sql.Timestamp) || ts === null)) { + return this.before$java_sql_Timestamp(ts); + } + else if (((ts != null && ts instanceof sql.Date) || ts === null)) { + return _super.prototype.before.call(this, ts); + } + else + throw new Error('invalid overload'); + }; + Timestamp.prototype.compareTo$java_util_Date = function (o) { + if (o != null && o instanceof java.sql.Timestamp) { + return this.compareTo$java_sql_Timestamp(o); + } + else { + return this.compareTo$java_sql_Timestamp(new Timestamp(o.getTime())); + } + }; + Timestamp.prototype.compareTo$java_sql_Timestamp = function (o) { + var cmp = (this.getTime() - o.getTime()); + return cmp === 0 ? /* compare */ (this.getNanos() - o.getNanos()) : cmp; + }; + Timestamp.prototype.compareTo = function (o) { + if (((o != null && o instanceof java.sql.Timestamp) || o === null)) { + return this.compareTo$java_sql_Timestamp(o); + } + else if (((o != null && o instanceof sql.Date) || o === null)) { + return this.compareTo$java_util_Date(o); + } + else + throw new Error('invalid overload'); + }; + Timestamp.prototype.equals$java_lang_Object = function (ts) { + return (ts != null && ts instanceof java.sql.Timestamp) && this.equals$java_sql_Timestamp(ts); + }; + Timestamp.prototype.equals$java_sql_Timestamp = function (ts) { + return ts != null && this.getTime() === ts.getTime() && this.getNanos() === ts.getNanos(); + }; + Timestamp.prototype.equals = function (ts) { + if (((ts != null && ts instanceof java.sql.Timestamp) || ts === null)) { + return this.equals$java_sql_Timestamp(ts); + } + else if (((ts != null) || ts === null)) { + return this.equals$java_lang_Object(ts); + } + else + throw new Error('invalid overload'); + }; + Timestamp.prototype.getNanos = function () { + return this.nanos; + }; + /** + * + * @return {number} + */ + Timestamp.prototype.getTime = function () { + return _super.prototype.getTime.call(this); + }; + /** + * + * @return {number} + */ + Timestamp.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this); + }; + Timestamp.prototype.setNanos = function (n) { + if (n < 0 || n > 999999999) { + throw new java.lang.IllegalArgumentException("nanos out of range " + n); + } + this.nanos = n; + _super.prototype.setTime.call(this, ((function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(this.getTime() / 1000)) * 1000 + ((this.nanos / 1000000 | 0))); + }; + /** + * + * @param {number} time + */ + Timestamp.prototype.setTime = function (time) { + _super.prototype.setTime.call(this, time); + this.nanos = ((((time % 1000) | 0)) * 1000000); + }; + return Timestamp; + }(java.util.Date)); + sql.Timestamp = Timestamp; + Timestamp["__class"] = "java.sql.Timestamp"; + Timestamp["__interfaces"] = ["java.lang.Cloneable", "java.lang.Comparable", "java.io.Serializable"]; + })(sql = java.sql || (java.sql = {})); +})(java || (java = {})); +(function (java) { + var sql; + (function (sql) { + /** + * An implementation of java.sql.Time. Derived from + * http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Time.html + * @param {number} hour + * @param {number} minute + * @param {number} second + * @class + * @extends java.util.Date + */ + var Time = /** @class */ (function (_super) { + __extends(Time, _super); + function Time(hour, minute, second) { + var _this = this; + if (((typeof hour === 'number') || hour === null) && ((typeof minute === 'number') || minute === null) && ((typeof second === 'number') || second === null)) { + var __args = arguments; + _this = _super.call(this, 70, 0, 1, hour, minute, second) || this; + } + else if (((typeof hour === 'number') || hour === null) && minute === undefined && second === undefined) { + var __args = arguments; + var time = __args[0]; + _this = _super.call(this, time) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + Time.valueOf = function (s) { + var split = s.split(":"); + if (split.length !== 3) { + throw new java.lang.IllegalArgumentException("Invalid escape format: " + s); + } + try { + var hh = javaemul.internal.IntegerHelper.parseInt(split[0]); + var mm = javaemul.internal.IntegerHelper.parseInt(split[1]); + var ss = javaemul.internal.IntegerHelper.parseInt(split[2]); + return new Time(hh, mm, ss); + } + catch (e) { + throw new java.lang.IllegalArgumentException("Invalid escape format: " + s); + } + ; + }; + /** + * + * @return {number} + */ + Time.prototype.getDate = function () { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @return {number} + */ + Time.prototype.getDay = function () { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @return {number} + */ + Time.prototype.getMonth = function () { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @return {number} + */ + Time.prototype.getYear = function () { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @param {number} i + */ + Time.prototype.setDate = function (i) { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @param {number} i + */ + Time.prototype.setMonth = function (i) { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @param {number} i + */ + Time.prototype.setYear = function (i) { + throw new java.lang.IllegalArgumentException(); + }; + return Time; + }(java.util.Date)); + sql.Time = Time; + Time["__class"] = "java.sql.Time"; + Time["__interfaces"] = ["java.lang.Cloneable", "java.lang.Comparable", "java.io.Serializable"]; + })(sql = java.sql || (java.sql = {})); +})(java || (java = {})); +(function (java) { + var sql; + (function (sql) { + /** + * An implementation of java.sql.Date. Derived from + * http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Date.html + * @param {number} year + * @param {number} month + * @param {number} day + * @class + * @extends java.util.Date + */ + var Date = /** @class */ (function (_super) { + __extends(Date, _super); + function Date(year, month, day) { + var _this = this; + if (((typeof year === 'number') || year === null) && ((typeof month === 'number') || month === null) && ((typeof day === 'number') || day === null)) { + var __args = arguments; + _this = _super.call(this, year, month, day) || this; + } + else if (((typeof year === 'number') || year === null) && month === undefined && day === undefined) { + var __args = arguments; + var date = __args[0]; + _this = _super.call(this, date) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + Date.valueOf = function (s) { + var split = s.split("-"); + if (split.length !== 3) { + throw new java.lang.IllegalArgumentException("Invalid escape format: " + s); + } + try { + var y = javaemul.internal.IntegerHelper.parseInt(split[0]) - 1900; + var m = javaemul.internal.IntegerHelper.parseInt(split[1]) - 1; + var d = javaemul.internal.IntegerHelper.parseInt(split[2]); + return new Date(y, m, d); + } + catch (e) { + throw new java.lang.IllegalArgumentException("Invalid escape format: " + s); + } + ; + }; + /** + * + * @return {number} + */ + Date.prototype.getHours = function () { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @return {number} + */ + Date.prototype.getMinutes = function () { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @return {number} + */ + Date.prototype.getSeconds = function () { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @param {number} i + */ + Date.prototype.setHours = function (i) { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @param {number} i + */ + Date.prototype.setMinutes = function (i) { + throw new java.lang.IllegalArgumentException(); + }; + /** + * + * @param {number} i + */ + Date.prototype.setSeconds = function (i) { + throw new java.lang.IllegalArgumentException(); + }; + return Date; + }(java.util.Date)); + sql.Date = Date; + Date["__class"] = "java.sql.Date"; + Date["__interfaces"] = ["java.lang.Cloneable", "java.lang.Comparable", "java.io.Serializable"]; + })(sql = java.sql || (java.sql = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var logging; + (function (logging) { + /** + * A simple console logger used in super dev mode. + * @extends java.util.logging.Handler + * @class + */ + var SimpleConsoleLogHandler = /** @class */ (function (_super) { + __extends(SimpleConsoleLogHandler, _super); + function SimpleConsoleLogHandler() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * + * @param {java.util.logging.LogRecord} record + */ + SimpleConsoleLogHandler.prototype.publish = function (record) { + if (!this.isLoggable(record)) { + return; + } + var level = this.toConsoleLogLevel(record.getLevel()); + console.log(level, record.getMessage()); + if (record.getThrown() != null) { + console.log(level, record.getThrown()); + } + }; + /*private*/ SimpleConsoleLogHandler.prototype.toConsoleLogLevel = function (level) { + var val = level.intValue(); + if (val >= java.util.logging.Level.SEVERE_$LI$().intValue()) { + return "error"; + } + else if (val >= java.util.logging.Level.WARNING_$LI$().intValue()) { + return "warn"; + } + else if (val >= java.util.logging.Level.INFO_$LI$().intValue()) { + return "info"; + } + else { + return "log"; + } + }; + /** + * + */ + SimpleConsoleLogHandler.prototype.close = function () { + }; + /** + * + */ + SimpleConsoleLogHandler.prototype.flush = function () { + }; + return SimpleConsoleLogHandler; + }(java.util.logging.Handler)); + logging.SimpleConsoleLogHandler = SimpleConsoleLogHandler; + SimpleConsoleLogHandler["__class"] = "java.util.logging.SimpleConsoleLogHandler"; + })(logging = util.logging || (util.logging = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * A simple wrapper around JavaScript Map for key type is string. + * @param {java.util.AbstractHashMap} host + * @class + */ + var InternalStringMap = /** @class */ (function () { + function InternalStringMap(host) { + this.backingMap = java.util.InternalJsMapFactory.newJsMap(); + if (this.host === undefined) { + this.host = null; + } + if (this.size === undefined) { + this.size = 0; + } + if (this.valueMod === undefined) { + this.valueMod = 0; + } + this.host = host; + } + /* Default method injected from java.lang.Iterable */ + InternalStringMap.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_10 = function (index141) { + var t = index141.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index141 = this.iterator(); index141.hasNext();) { + _loop_10(index141); + } + }; + InternalStringMap.prototype.contains = function (key) { + return !javaemul.internal.JsUtils.isUndefined(this.backingMap.get(key)); + }; + InternalStringMap.prototype.get = function (key) { + return this.backingMap.get(key); + }; + InternalStringMap.prototype.put = function (key, value) { + var oldValue = this.backingMap.get(key); + this.backingMap.set(key, (InternalStringMap.toNullIfUndefined(value))); + if (javaemul.internal.JsUtils.isUndefined(oldValue)) { + this.size++; + java.util.ConcurrentModificationDetector.structureChanged(this.host); + } + else { + this.valueMod++; + } + return oldValue; + }; + InternalStringMap.prototype.remove = function (key) { + var value = this.backingMap.get(key); + if (!javaemul.internal.JsUtils.isUndefined(value)) { + this.backingMap["delete"](key); + this.size--; + java.util.ConcurrentModificationDetector.structureChanged(this.host); + } + else { + this.valueMod++; + } + return value; + }; + InternalStringMap.prototype.getSize = function () { + return this.size; + }; + /** + * + * @return {*} + */ + InternalStringMap.prototype.iterator = function () { + return new InternalStringMap.InternalStringMap$0(this); + }; + /*private*/ InternalStringMap.prototype.newMapEntry = function (entry, lastValueMod) { + return new InternalStringMap.InternalStringMap$1(this, entry, lastValueMod); + }; + /*private*/ InternalStringMap.toNullIfUndefined = function (value) { + return javaemul.internal.JsUtils.isUndefined(value) ? null : value; + }; + return InternalStringMap; + }()); + util.InternalStringMap = InternalStringMap; + InternalStringMap["__class"] = "java.util.InternalStringMap"; + InternalStringMap["__interfaces"] = ["java.lang.Iterable"]; + (function (InternalStringMap) { + var InternalStringMap$0 = /** @class */ (function () { + function InternalStringMap$0(__parent) { + this.__parent = __parent; + this.entries = this.__parent.backingMap.entries(); + this.current = this.entries.next(); + if (this.last === undefined) { + this.last = null; + } + } + /* Default method injected from java.util.Iterator */ + InternalStringMap$0.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + InternalStringMap$0.prototype.hasNext = function () { + return !this.current.done; + }; + /** + * + * @return {*} + */ + InternalStringMap$0.prototype.next = function () { + this.last = this.current; + this.current = this.entries.next(); + return this.__parent.newMapEntry(this.last, this.__parent.valueMod); + }; + /** + * + */ + InternalStringMap$0.prototype.remove = function () { + this.__parent.remove(this.last.value[0]); + }; + return InternalStringMap$0; + }()); + InternalStringMap.InternalStringMap$0 = InternalStringMap$0; + InternalStringMap$0["__interfaces"] = ["java.util.Iterator"]; + var InternalStringMap$1 = /** @class */ (function (_super) { + __extends(InternalStringMap$1, _super); + function InternalStringMap$1(__parent, entry, lastValueMod) { + var _this = _super.call(this) || this; + _this.entry = entry; + _this.lastValueMod = lastValueMod; + _this.__parent = __parent; + return _this; + } + /** + * + * @return {*} + */ + InternalStringMap$1.prototype.getKey = function () { + return this.entry.value[0]; + }; + /** + * + * @return {*} + */ + InternalStringMap$1.prototype.getValue = function () { + if (this.__parent.valueMod !== this.lastValueMod) { + return this.__parent.get(this.entry.value[0]); + } + return this.entry.value[1]; + }; + /** + * + * @param {*} object + * @return {*} + */ + InternalStringMap$1.prototype.setValue = function (object) { + return this.__parent.put(this.entry.value[0], object); + }; + return InternalStringMap$1; + }(java.util.AbstractMapEntry)); + InternalStringMap.InternalStringMap$1 = InternalStringMap$1; + InternalStringMap$1["__interfaces"] = ["java.util.Map.Entry"]; + })(InternalStringMap = util.InternalStringMap || (util.InternalStringMap = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var security; + (function (security) { + /** + * Message Digest algorithm - [Sun's docs]. + * @extends java.security.MessageDigestSpi + * @class + */ + var MessageDigest = /** @class */ (function (_super) { + __extends(MessageDigest, _super); + function MessageDigest(algorithm) { + var _this = _super.call(this) || this; + if (_this.algorithm === undefined) { + _this.algorithm = null; + } + _this.algorithm = algorithm; + return _this; + } + MessageDigest.getInstance = function (algorithm) { + if ("MD5" === algorithm) { + return new MessageDigest.Md5Digest(); + } + throw new java.security.NoSuchAlgorithmException(algorithm + " not supported"); + }; + MessageDigest.isEqual = function (digestA, digestB) { + var n = digestA.length; + if (n !== digestB.length) { + return false; + } + for (var i = 0; i < n; ++i) { + { + if (digestA[i] !== digestB[i]) { + return false; + } + } + ; + } + return true; + }; + MessageDigest.prototype.digest$ = function () { + return this.engineDigest$(); + }; + MessageDigest.prototype.digest$byte_A = function (input) { + this.update$byte_A(input); + return this.digest$(); + }; + MessageDigest.prototype.digest$byte_A$int$int = function (buf, offset, len) { + return this.engineDigest$byte_A$int$int(buf, offset, len); + }; + MessageDigest.prototype.digest = function (buf, offset, len) { + if (((buf != null && buf instanceof Array && (buf.length == 0 || buf[0] == null || (typeof buf[0] === 'number'))) || buf === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.digest$byte_A$int$int(buf, offset, len); + } + else if (((buf != null && buf instanceof Array && (buf.length == 0 || buf[0] == null || (typeof buf[0] === 'number'))) || buf === null) && offset === undefined && len === undefined) { + return this.digest$byte_A(buf); + } + else if (buf === undefined && offset === undefined && len === undefined) { + return this.digest$(); + } + else + throw new Error('invalid overload'); + }; + MessageDigest.prototype.getAlgorithm = function () { + return this.algorithm; + }; + MessageDigest.prototype.getDigestLength = function () { + return this.engineGetDigestLength(); + }; + MessageDigest.prototype.reset = function () { + this.engineReset(); + }; + MessageDigest.prototype.update$byte = function (input) { + this.engineUpdate$byte(input); + }; + MessageDigest.prototype.update$byte_A = function (input) { + this.engineUpdate$byte_A$int$int(input, 0, input.length); + }; + MessageDigest.prototype.update$byte_A$int$int = function (input, offset, len) { + this.engineUpdate$byte_A$int$int(input, offset, len); + }; + MessageDigest.prototype.update = function (input, offset, len) { + if (((input != null && input instanceof Array && (input.length == 0 || input[0] == null || (typeof input[0] === 'number'))) || input === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.update$byte_A$int$int(input, offset, len); + } + else if (((input != null && input instanceof Array && (input.length == 0 || input[0] == null || (typeof input[0] === 'number'))) || input === null) && offset === undefined && len === undefined) { + return this.update$byte_A(input); + } + else if (((typeof input === 'number') || input === null) && offset === undefined && len === undefined) { + return this.update$byte(input); + } + else + throw new Error('invalid overload'); + }; + return MessageDigest; + }(java.security.MessageDigestSpi)); + security.MessageDigest = MessageDigest; + MessageDigest["__class"] = "java.security.MessageDigest"; + (function (MessageDigest) { + var Md5Digest = /** @class */ (function (_super) { + __extends(Md5Digest, _super); + function Md5Digest() { + var _this = _super.call(this, "MD5") || this; + if (_this.buffer === undefined) { + _this.buffer = null; + } + if (_this.counter === undefined) { + _this.counter = 0; + } + _this.oneByte = [0]; + if (_this.remainder === undefined) { + _this.remainder = 0; + } + if (_this.state === undefined) { + _this.state = null; + } + if (_this.x === undefined) { + _this.x = null; + } + _this.engineReset(); + return _this; + } + Md5Digest.padding_$LI$ = function () { if (Md5Digest.padding == null) { + Md5Digest.padding = [(128 | 0), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + } return Md5Digest.padding; }; + ; + /** + * Converts a long to a 8-byte array using low order first. + * + * @param {number} n A long. + * @return {Array} A byte[]. + */ + Md5Digest.toBytes = function (n) { + var b = [0, 0, 0, 0, 0, 0, 0, 0]; + b[0] = ((n) | 0); + n >>>= 8; + b[1] = ((n) | 0); + n >>>= 8; + b[2] = ((n) | 0); + n >>>= 8; + b[3] = ((n) | 0); + n >>>= 8; + b[4] = ((n) | 0); + n >>>= 8; + b[5] = ((n) | 0); + n >>>= 8; + b[6] = ((n) | 0); + n >>>= 8; + b[7] = ((n) | 0); + return b; + }; + /** + * Converts a 64-byte array into a 16-int array. + * + * @param {Array} in A byte[]. + * @param {Array} out An int[]. + * @private + */ + Md5Digest.byte2int = function (__in, out) { + for (var inpos = 0, outpos = 0; outpos < 16; outpos++) { + { + out[outpos] = ((__in[inpos++] & 255) | ((__in[inpos++] & 255) << 8) | ((__in[inpos++] & 255) << 16) | ((__in[inpos++] & 255) << 24)); + } + ; + } + }; + Md5Digest.f = function (x, y, z) { + return (z ^ (x & (y ^ z))); + }; + Md5Digest.ff = function (a, b, c, d, x, s, ac) { + a += x + ac + Md5Digest.f(b, c, d); + a = (a << s | a >>> -s); + return a + b; + }; + Md5Digest.g = function (x, y, z) { + return (y ^ (z & (x ^ y))); + }; + Md5Digest.gg = function (a, b, c, d, x, s, ac) { + a += x + ac + Md5Digest.g(b, c, d); + a = (a << s | a >>> -s); + return a + b; + }; + Md5Digest.h = function (x, y, z) { + return (x ^ y ^ z); + }; + Md5Digest.hh = function (a, b, c, d, x, s, ac) { + a += x + ac + Md5Digest.h(b, c, d); + a = (a << s | a >>> -s); + return a + b; + }; + Md5Digest.i = function (x, y, z) { + return (y ^ (x | ~z)); + }; + Md5Digest.ii = function (a, b, c, d, x, s, ac) { + a += x + ac + Md5Digest.i(b, c, d); + a = (a << s | a >>> -s); + return a + b; + }; + /** + * Converts a 4-int array into a 16-byte array. + * + * @param {Array} in An int[]. + * @param {Array} out A byte[]. + * @private + */ + Md5Digest.int2byte = function (__in, out) { + for (var inpos = 0, outpos = 0; inpos < 4; inpos++) { + { + out[outpos++] = ((__in[inpos] & 255) | 0); + out[outpos++] = (((__in[inpos] >>> 8) & 255) | 0); + out[outpos++] = (((__in[inpos] >>> 16) & 255) | 0); + out[outpos++] = (((__in[inpos] >>> 24) & 255) | 0); + } + ; + } + }; + Md5Digest.prototype.engineDigest = function (buf, offset, len) { + if (((buf != null && buf instanceof Array && (buf.length == 0 || buf[0] == null || (typeof buf[0] === 'number'))) || buf === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return _super.prototype.engineDigest.call(this, buf, offset, len); + } + else if (buf === undefined && offset === undefined && len === undefined) { + return this.engineDigest$(); + } + else + throw new Error('invalid overload'); + }; + Md5Digest.prototype.engineDigest$ = function () { + var bits = Md5Digest.toBytes(this.counter << 3); + var digest = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(16); + if (this.remainder > 8) { + this.engineUpdate$byte_A$int$int(Md5Digest.padding_$LI$(), 0, this.remainder - 8); + } + else { + this.engineUpdate$byte_A$int$int(Md5Digest.padding_$LI$(), 0, 64 + (this.remainder - 8)); + } + this.engineUpdate$byte_A$int$int(bits, 0, 8); + Md5Digest.int2byte(this.state, digest); + this.reset(); + return digest; + }; + /** + * + * @return {number} + */ + Md5Digest.prototype.engineGetDigestLength = function () { + return 16; + }; + /** + * + */ + Md5Digest.prototype.engineReset = function () { + this.buffer = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(64); + this.state = [0, 0, 0, 0]; + this.x = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(16); + this.state[0] = 1732584193; + this.state[1] = -271733879; + this.state[2] = -1732584194; + this.state[3] = 271733878; + this.counter = 0; + this.remainder = 64; + }; + Md5Digest.prototype.engineUpdate$byte = function (input) { + this.oneByte[0] = input; + this.engineUpdate$byte_A$int$int(this.oneByte, 0, 1); + }; + Md5Digest.prototype.engineUpdate$byte_A$int$int = function (input, offset, len) { + while ((true)) { + { + if (len >= this.remainder) { + java.lang.System.arraycopy(input, offset, this.buffer, ((this.counter & 63) | 0), this.remainder); + this.transform(this.buffer); + this.counter += this.remainder; + offset += this.remainder; + len -= this.remainder; + this.remainder = 64; + } + else { + java.lang.System.arraycopy(input, offset, this.buffer, ((this.counter & 63) | 0), len); + this.counter += len; + this.remainder -= len; + break; + } + } + } + ; + }; + /** + * + * @param {Array} input + * @param {number} offset + * @param {number} len + */ + Md5Digest.prototype.engineUpdate = function (input, offset, len) { + if (((input != null && input instanceof Array && (input.length == 0 || input[0] == null || (typeof input[0] === 'number'))) || input === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.engineUpdate$byte_A$int$int(input, offset, len); + } + else if (((typeof input === 'number') || input === null) && offset === undefined && len === undefined) { + return this.engineUpdate$byte(input); + } + else + throw new Error('invalid overload'); + }; + Md5Digest.prototype.transform = function (buffer) { + var a; + var b; + var c; + var d; + Md5Digest.byte2int(buffer, this.x); + a = this.state[0]; + b = this.state[1]; + c = this.state[2]; + d = this.state[3]; + a = Md5Digest.ff(a, b, c, d, this.x[0], 7, -680876936); + d = Md5Digest.ff(d, a, b, c, this.x[1], 12, -389564586); + c = Md5Digest.ff(c, d, a, b, this.x[2], 17, 606105819); + b = Md5Digest.ff(b, c, d, a, this.x[3], 22, -1044525330); + a = Md5Digest.ff(a, b, c, d, this.x[4], 7, -176418897); + d = Md5Digest.ff(d, a, b, c, this.x[5], 12, 1200080426); + c = Md5Digest.ff(c, d, a, b, this.x[6], 17, -1473231341); + b = Md5Digest.ff(b, c, d, a, this.x[7], 22, -45705983); + a = Md5Digest.ff(a, b, c, d, this.x[8], 7, 1770035416); + d = Md5Digest.ff(d, a, b, c, this.x[9], 12, -1958414417); + c = Md5Digest.ff(c, d, a, b, this.x[10], 17, -42063); + b = Md5Digest.ff(b, c, d, a, this.x[11], 22, -1990404162); + a = Md5Digest.ff(a, b, c, d, this.x[12], 7, 1804603682); + d = Md5Digest.ff(d, a, b, c, this.x[13], 12, -40341101); + c = Md5Digest.ff(c, d, a, b, this.x[14], 17, -1502002290); + b = Md5Digest.ff(b, c, d, a, this.x[15], 22, 1236535329); + a = Md5Digest.gg(a, b, c, d, this.x[1], 5, -165796510); + d = Md5Digest.gg(d, a, b, c, this.x[6], 9, -1069501632); + c = Md5Digest.gg(c, d, a, b, this.x[11], 14, 643717713); + b = Md5Digest.gg(b, c, d, a, this.x[0], 20, -373897302); + a = Md5Digest.gg(a, b, c, d, this.x[5], 5, -701558691); + d = Md5Digest.gg(d, a, b, c, this.x[10], 9, 38016083); + c = Md5Digest.gg(c, d, a, b, this.x[15], 14, -660478335); + b = Md5Digest.gg(b, c, d, a, this.x[4], 20, -405537848); + a = Md5Digest.gg(a, b, c, d, this.x[9], 5, 568446438); + d = Md5Digest.gg(d, a, b, c, this.x[14], 9, -1019803690); + c = Md5Digest.gg(c, d, a, b, this.x[3], 14, -187363961); + b = Md5Digest.gg(b, c, d, a, this.x[8], 20, 1163531501); + a = Md5Digest.gg(a, b, c, d, this.x[13], 5, -1444681467); + d = Md5Digest.gg(d, a, b, c, this.x[2], 9, -51403784); + c = Md5Digest.gg(c, d, a, b, this.x[7], 14, 1735328473); + b = Md5Digest.gg(b, c, d, a, this.x[12], 20, -1926607734); + a = Md5Digest.hh(a, b, c, d, this.x[5], 4, -378558); + d = Md5Digest.hh(d, a, b, c, this.x[8], 11, -2022574463); + c = Md5Digest.hh(c, d, a, b, this.x[11], 16, 1839030562); + b = Md5Digest.hh(b, c, d, a, this.x[14], 23, -35309556); + a = Md5Digest.hh(a, b, c, d, this.x[1], 4, -1530992060); + d = Md5Digest.hh(d, a, b, c, this.x[4], 11, 1272893353); + c = Md5Digest.hh(c, d, a, b, this.x[7], 16, -155497632); + b = Md5Digest.hh(b, c, d, a, this.x[10], 23, -1094730640); + a = Md5Digest.hh(a, b, c, d, this.x[13], 4, 681279174); + d = Md5Digest.hh(d, a, b, c, this.x[0], 11, -358537222); + c = Md5Digest.hh(c, d, a, b, this.x[3], 16, -722521979); + b = Md5Digest.hh(b, c, d, a, this.x[6], 23, 76029189); + a = Md5Digest.hh(a, b, c, d, this.x[9], 4, -640364487); + d = Md5Digest.hh(d, a, b, c, this.x[12], 11, -421815835); + c = Md5Digest.hh(c, d, a, b, this.x[15], 16, 530742520); + b = Md5Digest.hh(b, c, d, a, this.x[2], 23, -995338651); + a = Md5Digest.ii(a, b, c, d, this.x[0], 6, -198630844); + d = Md5Digest.ii(d, a, b, c, this.x[7], 10, 1126891415); + c = Md5Digest.ii(c, d, a, b, this.x[14], 15, -1416354905); + b = Md5Digest.ii(b, c, d, a, this.x[5], 21, -57434055); + a = Md5Digest.ii(a, b, c, d, this.x[12], 6, 1700485571); + d = Md5Digest.ii(d, a, b, c, this.x[3], 10, -1894986606); + c = Md5Digest.ii(c, d, a, b, this.x[10], 15, -1051523); + b = Md5Digest.ii(b, c, d, a, this.x[1], 21, -2054922799); + a = Md5Digest.ii(a, b, c, d, this.x[8], 6, 1873313359); + d = Md5Digest.ii(d, a, b, c, this.x[15], 10, -30611744); + c = Md5Digest.ii(c, d, a, b, this.x[6], 15, -1560198380); + b = Md5Digest.ii(b, c, d, a, this.x[13], 21, 1309151649); + a = Md5Digest.ii(a, b, c, d, this.x[4], 6, -145523070); + d = Md5Digest.ii(d, a, b, c, this.x[11], 10, -1120210379); + c = Md5Digest.ii(c, d, a, b, this.x[2], 15, 718787259); + b = Md5Digest.ii(b, c, d, a, this.x[9], 21, -343485551); + this.state[0] = javaemul.internal.Coercions.ensureInt(this.state[0] + a); + this.state[1] = javaemul.internal.Coercions.ensureInt(this.state[1] + b); + this.state[2] = javaemul.internal.Coercions.ensureInt(this.state[2] + c); + this.state[3] = javaemul.internal.Coercions.ensureInt(this.state[3] + d); + }; + return Md5Digest; + }(java.security.MessageDigest)); + MessageDigest.Md5Digest = Md5Digest; + Md5Digest["__class"] = "java.security.MessageDigest.Md5Digest"; + })(MessageDigest = security.MessageDigest || (security.MessageDigest = {})); + })(security = java.security || (java.security = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * JSweet implementation (partial). + * + * TODO: actual support of charsets. + * @param {java.io.OutputStream} out + * @param {string} charsetName + * @class + * @extends java.io.Writer + */ + var OutputStreamWriter = /** @class */ (function (_super) { + __extends(OutputStreamWriter, _super); + function OutputStreamWriter(out, charsetName) { + var _this = this; + if (((out != null && out instanceof java.io.OutputStream) || out === null) && ((typeof charsetName === 'string') || charsetName === null)) { + var __args = arguments; + _this = _super.call(this, out) || this; + if (_this.out === undefined) { + _this.out = null; + } + if (charsetName == null) + throw new java.lang.NullPointerException("charsetName"); + _this.out = out; + } + else if (((out != null && out instanceof java.io.OutputStream) || out === null) && ((charsetName != null && charsetName instanceof java.nio.charset.Charset) || charsetName === null)) { + var __args = arguments; + var cs = __args[1]; + _this = _super.call(this, out) || this; + if (_this.out === undefined) { + _this.out = null; + } + if (cs == null) + throw new java.lang.NullPointerException("charset"); + _this.out = out; + } + else if (((out != null && out instanceof java.io.OutputStream) || out === null) && charsetName === undefined) { + var __args = arguments; + _this = _super.call(this, out) || this; + if (_this.out === undefined) { + _this.out = null; + } + _this.out = out; + } + else + throw new Error('invalid overload'); + return _this; + } + OutputStreamWriter.prototype.flushBuffer = function () { + this.out.flush(); + }; + OutputStreamWriter.prototype.write$int = function (c) { + this.out.write$int(c); + }; + OutputStreamWriter.prototype.write$char_A$int$int = function (cbuf, off, len) { + var buf = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(len); + for (var i = 0; i < len; ++i) { + buf[i] = ((cbuf[i + off]).charCodeAt(0) | 0); + } + this.out.write$byte_A$int$int(buf, 0, len); + }; + OutputStreamWriter.prototype.write = function (cbuf, off, len) { + if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && ((typeof off === 'number') || off === null) && ((typeof len === 'number') || len === null)) { + return this.write$char_A$int$int(cbuf, off, len); + } + else if (((typeof cbuf === 'string') || cbuf === null) && ((typeof off === 'number') || off === null) && ((typeof len === 'number') || len === null)) { + return this.write$java_lang_String$int$int(cbuf, off, len); + } + else if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && off === undefined && len === undefined) { + return this.write$char_A(cbuf); + } + else if (((typeof cbuf === 'string') || cbuf === null) && off === undefined && len === undefined) { + return this.write$java_lang_String(cbuf); + } + else if (((typeof cbuf === 'number') || cbuf === null) && off === undefined && len === undefined) { + return this.write$int(cbuf); + } + else + throw new Error('invalid overload'); + }; + OutputStreamWriter.prototype.write$java_lang_String$int$int = function (str, off, len) { + this.out.write$byte_A$int$int(/* getBytes */ (str).split('').map(function (s) { return s.charCodeAt(0); }), off, len); + }; + OutputStreamWriter.prototype.flush = function () { + this.out.flush(); + }; + OutputStreamWriter.prototype.close = function () { + this.out.close(); + }; + return OutputStreamWriter; + }(java.io.Writer)); + io.OutputStreamWriter = OutputStreamWriter; + OutputStreamWriter["__class"] = "java.io.OutputStreamWriter"; + OutputStreamWriter["__interfaces"] = ["java.lang.Appendable", "java.io.Closeable", "java.lang.AutoCloseable", "java.io.Flushable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * Wraps an existing {@link InputStream} and performs some transformation on + * the input data while it is being read. Transformations can be anything from a + * simple byte-wise filtering input data to an on-the-fly compression or + * decompression of the underlying stream. Input streams that wrap another input + * stream and provide some additional functionality on top of it usually inherit + * from this class. + * + * @see FilterOutputStream + * @extends java.io.InputStream + * @class + */ + var FilterInputStream = /** @class */ (function (_super) { + __extends(FilterInputStream, _super); + function FilterInputStream(__in) { + var _this = _super.call(this) || this; + if (_this["in"] === undefined) { + _this["in"] = null; + } + _this["in"] = __in; + return _this; + } + /** + * + * @return {number} + */ + FilterInputStream.prototype.available = function () { + return this["in"].available(); + }; + /** + * Closes this stream. This implementation closes the filtered stream. + * + * @throws IOException + * if an error occurs while closing this stream. + */ + FilterInputStream.prototype.close = function () { + this["in"].close(); + }; + /** + * Sets a mark position in this stream. The parameter {@code readlimit} + * indicates how many bytes can be read before the mark is invalidated. + * Sending {@code reset()} will reposition this stream back to the marked + * position, provided that {@code readlimit} has not been surpassed. + *

+ * This implementation sets a mark in the filtered stream. + * + * @param {number} readlimit + * the number of bytes that can be read from this stream before + * the mark is invalidated. + * @see #markSupported() + * @see #reset() + */ + FilterInputStream.prototype.mark = function (readlimit) { + this["in"].mark(readlimit); + }; + /** + * Indicates whether this stream supports {@code mark()} and {@code reset()}. + * This implementation returns whether or not the filtered stream supports + * marking. + * + * @return {boolean} {@code true} if {@code mark()} and {@code reset()} are supported, + * {@code false} otherwise. + * @see #mark(int) + * @see #reset() + * @see #skip(long) + */ + FilterInputStream.prototype.markSupported = function () { + return this["in"].markSupported(); + }; + FilterInputStream.prototype.read = function (buffer, byteOffset, byteCount) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof byteOffset === 'number') || byteOffset === null) && ((typeof byteCount === 'number') || byteCount === null)) { + return _super.prototype.read.call(this, buffer, byteOffset, byteCount); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && byteOffset === undefined && byteCount === undefined) { + return this.read$byte_A(buffer); + } + else if (buffer === undefined && byteOffset === undefined && byteCount === undefined) { + return this.read$(); + } + else + throw new Error('invalid overload'); + }; + FilterInputStream.prototype.read$ = function () { + return this["in"].read$(); + }; + /** + * Resets this stream to the last marked location. This implementation + * resets the target stream. + * + * @throws IOException + * if this stream is already closed, no mark has been set or the + * mark is no longer valid because more than {@code readlimit} + * bytes have been read since setting the mark. + * @see #mark(int) + * @see #markSupported() + */ + FilterInputStream.prototype.reset = function () { + this["in"].reset(); + }; + /** + * Skips {@code byteCount} bytes in this stream. Subsequent + * calls to {@code read} will not return these bytes unless {@code reset} is + * used. This implementation skips {@code byteCount} bytes in the + * filtered stream. + * + * @return {number} the number of bytes actually skipped. + * @throws IOException + * if this stream is closed or another IOException occurs. + * @see #mark(int) + * @see #reset() + * @param {number} byteCount + */ + FilterInputStream.prototype.skip = function (byteCount) { + return this["in"].skip(byteCount); + }; + return FilterInputStream; + }(java.io.InputStream)); + io.FilterInputStream = FilterInputStream; + FilterInputStream["__class"] = "java.io.FilterInputStream"; + FilterInputStream["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * Constructs a new {@code ByteArrayInputStream} on the byte array + * {@code buf} with the initial position set to {@code offset} and the + * number of bytes available set to {@code offset} + {@code length}. + * + * @param {Array} buf + * the byte array to stream over. + * @param {number} offset + * the initial position in {@code buf} to start streaming from. + * @param {number} length + * the number of bytes available for streaming. + * @class + * @extends java.io.InputStream + */ + var ByteArrayInputStream = /** @class */ (function (_super) { + __extends(ByteArrayInputStream, _super); + function ByteArrayInputStream(buf, offset, length) { + var _this = this; + if (((buf != null && buf instanceof Array && (buf.length == 0 || buf[0] == null || (typeof buf[0] === 'number'))) || buf === null) && ((typeof offset === 'number') || offset === null) && ((typeof length === 'number') || length === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.buf === undefined) { + _this.buf = null; + } + if (_this.pos === undefined) { + _this.pos = 0; + } + if (_this._mark === undefined) { + _this._mark = 0; + } + if (_this.count === undefined) { + _this.count = 0; + } + if (length === -1) { + length = buf.length; + } + _this.buf = buf; + _this.pos = offset; + _this._mark = offset; + _this.count = offset + length > buf.length ? buf.length : offset + length; + } + else if (((buf != null && buf instanceof Array && (buf.length == 0 || buf[0] == null || (typeof buf[0] === 'number'))) || buf === null) && offset === undefined && length === undefined) { + var __args = arguments; + { + var __args_22 = arguments; + var offset_1 = 0; + var length_1 = -1; + _this = _super.call(this) || this; + if (_this.buf === undefined) { + _this.buf = null; + } + if (_this.pos === undefined) { + _this.pos = 0; + } + if (_this._mark === undefined) { + _this._mark = 0; + } + if (_this.count === undefined) { + _this.count = 0; + } + if (length_1 === -1) { + length_1 = buf.length; + } + _this.buf = buf; + _this.pos = offset_1; + _this._mark = offset_1; + _this.count = offset_1 + length_1 > buf.length ? buf.length : offset_1 + length_1; + } + if (_this.buf === undefined) { + _this.buf = null; + } + if (_this.pos === undefined) { + _this.pos = 0; + } + if (_this._mark === undefined) { + _this._mark = 0; + } + if (_this.count === undefined) { + _this.count = 0; + } + } + else + throw new Error('invalid overload'); + return _this; + } + /** + * Returns the number of remaining bytes. + * + * @return {number} {@code count - pos} + */ + ByteArrayInputStream.prototype.available = function () { + return this.count - this.pos; + }; + /** + * Closes this stream and frees resources associated with this stream. + * + * @throws IOException + * if an I/O error occurs while closing this stream. + */ + ByteArrayInputStream.prototype.close = function () { + }; + /** + * Sets a mark position in this ByteArrayInputStream. The parameter + * {@code readlimit} is ignored. Sending {@code reset()} will reposition the + * stream back to the marked position. + * + * @param {number} readlimit + * ignored. + * @see #markSupported() + * @see #reset() + */ + ByteArrayInputStream.prototype.mark = function (readlimit) { + this._mark = this.pos; + }; + /** + * Indicates whether this stream supports the {@code mark()} and + * {@code reset()} methods. Returns {@code true} since this class supports + * these methods. + * + * @return {boolean} always {@code true}. + * @see #mark(int) + * @see #reset() + */ + ByteArrayInputStream.prototype.markSupported = function () { + return true; + }; + ByteArrayInputStream.prototype.read$ = function () { + return this.read$byte_A$int$int(null, 0, 0); + }; + ByteArrayInputStream.prototype.read$byte_A$int$int = function (buffer, byteOffset, byteCount) { + if (buffer == null) { + return this.pos < this.count ? this.buf[this.pos++] & 255 : -1; + } + java.io.IOUtils.checkOffsetAndCount$byte_A$int$int(buffer, byteOffset, byteCount); + if (this.pos >= this.count) { + return -1; + } + if (byteCount === 0) { + return 0; + } + var copylen = this.count - this.pos < byteCount ? this.count - this.pos : byteCount; + java.lang.System.arraycopy(this.buf, this.pos, buffer, byteOffset, copylen); + this.pos += copylen; + return copylen; + }; + /** + * + * @param {Array} buffer + * @param {number} byteOffset + * @param {number} byteCount + * @return {number} + */ + ByteArrayInputStream.prototype.read = function (buffer, byteOffset, byteCount) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof byteOffset === 'number') || byteOffset === null) && ((typeof byteCount === 'number') || byteCount === null)) { + return this.read$byte_A$int$int(buffer, byteOffset, byteCount); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && byteOffset === undefined && byteCount === undefined) { + return this.read$byte_A(buffer); + } + else if (buffer === undefined && byteOffset === undefined && byteCount === undefined) { + return this.read$(); + } + else + throw new Error('invalid overload'); + }; + /** + * Resets this stream to the last marked location. This implementation + * resets the position to either the marked position, the start position + * supplied in the constructor or 0 if neither has been provided. + * + * @see #mark(int) + */ + ByteArrayInputStream.prototype.reset = function () { + this.pos = this._mark; + }; + /** + * Skips {@code byteCount} bytes in this InputStream. Subsequent calls to + * {@code read} will not return these bytes unless {@code reset} is used. + * This implementation skips {@code byteCount} number of bytes in the target + * stream. It does nothing and returns 0 if {@code byteCount} is negative. + * + * @return {number} the number of bytes actually skipped. + * @param {number} byteCount + */ + ByteArrayInputStream.prototype.skip = function (byteCount) { + if (byteCount <= 0) { + return 0; + } + var temp = this.pos; + this.pos = this.count - this.pos < byteCount ? this.count : ((this.pos + byteCount) | 0); + return this.pos - temp; + }; + return ByteArrayInputStream; + }(java.io.InputStream)); + io.ByteArrayInputStream = ByteArrayInputStream; + ByteArrayInputStream["__class"] = "java.io.ByteArrayInputStream"; + ByteArrayInputStream["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * JSweet implementation. + * @param {java.io.Reader} in + * @param {number} sz + * @class + * @extends java.io.Reader + */ + var BufferedReader = /** @class */ (function (_super) { + __extends(BufferedReader, _super); + function BufferedReader(__in, sz) { + var _this = this; + if (((__in != null && __in instanceof java.io.Reader) || __in === null) && ((typeof sz === 'number') || sz === null)) { + var __args = arguments; + _this = _super.call(this, __in) || this; + if (_this["in"] === undefined) { + _this["in"] = null; + } + if (_this.cb === undefined) { + _this.cb = null; + } + if (_this.nChars === undefined) { + _this.nChars = 0; + } + if (_this.nextChar === undefined) { + _this.nextChar = 0; + } + if (_this.markedChar === undefined) { + _this.markedChar = 0; + } + if (_this.readAheadLimit === undefined) { + _this.readAheadLimit = 0; + } + if (_this.skipLF === undefined) { + _this.skipLF = false; + } + if (_this.markedSkipLF === undefined) { + _this.markedSkipLF = false; + } + _this.markedChar = BufferedReader.UNMARKED; + _this.readAheadLimit = 0; + _this.skipLF = false; + _this.markedSkipLF = false; + if (sz <= 0) + throw new java.lang.IllegalArgumentException("Buffer size <= 0"); + _this["in"] = __in; + _this.cb = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(sz); + _this.nextChar = _this.nChars = 0; + } + else if (((__in != null && __in instanceof java.io.Reader) || __in === null) && sz === undefined) { + var __args = arguments; + { + var __args_23 = arguments; + var sz_1 = BufferedReader.defaultCharBufferSize; + _this = _super.call(this, __in) || this; + if (_this["in"] === undefined) { + _this["in"] = null; + } + if (_this.cb === undefined) { + _this.cb = null; + } + if (_this.nChars === undefined) { + _this.nChars = 0; + } + if (_this.nextChar === undefined) { + _this.nextChar = 0; + } + if (_this.markedChar === undefined) { + _this.markedChar = 0; + } + if (_this.readAheadLimit === undefined) { + _this.readAheadLimit = 0; + } + if (_this.skipLF === undefined) { + _this.skipLF = false; + } + if (_this.markedSkipLF === undefined) { + _this.markedSkipLF = false; + } + _this.markedChar = BufferedReader.UNMARKED; + _this.readAheadLimit = 0; + _this.skipLF = false; + _this.markedSkipLF = false; + if (sz_1 <= 0) + throw new java.lang.IllegalArgumentException("Buffer size <= 0"); + _this["in"] = __in; + _this.cb = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(sz_1); + _this.nextChar = _this.nChars = 0; + } + if (_this["in"] === undefined) { + _this["in"] = null; + } + if (_this.cb === undefined) { + _this.cb = null; + } + if (_this.nChars === undefined) { + _this.nChars = 0; + } + if (_this.nextChar === undefined) { + _this.nextChar = 0; + } + if (_this.markedChar === undefined) { + _this.markedChar = 0; + } + if (_this.readAheadLimit === undefined) { + _this.readAheadLimit = 0; + } + if (_this.skipLF === undefined) { + _this.skipLF = false; + } + if (_this.markedSkipLF === undefined) { + _this.markedSkipLF = false; + } + } + else + throw new Error('invalid overload'); + return _this; + } + /*private*/ BufferedReader.prototype.ensureOpen = function () { + if (this["in"] == null) + throw new java.io.IOException("Stream closed"); + }; + /*private*/ BufferedReader.prototype.fill = function () { + var dst; + if (this.markedChar <= BufferedReader.UNMARKED) { + dst = 0; + } + else { + var delta = this.nextChar - this.markedChar; + if (delta >= this.readAheadLimit) { + this.markedChar = BufferedReader.INVALIDATED; + this.readAheadLimit = 0; + dst = 0; + } + else { + if (this.readAheadLimit <= this.cb.length) { + java.lang.System.arraycopy(this.cb, this.markedChar, this.cb, 0, delta); + this.markedChar = 0; + dst = delta; + } + else { + var ncb = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(this.readAheadLimit); + java.lang.System.arraycopy(this.cb, this.markedChar, ncb, 0, delta); + this.cb = ncb; + this.markedChar = 0; + dst = delta; + } + this.nextChar = this.nChars = delta; + } + } + var n; + do { + { + n = this["in"].read$char_A$int$int(this.cb, dst, this.cb.length - dst); + } + } while ((n === 0)); + if (n > 0) { + this.nChars = dst + n; + this.nextChar = dst; + } + }; + BufferedReader.prototype.read$ = function () { + { + this.ensureOpen(); + for (;;) { + { + if (this.nextChar >= this.nChars) { + this.fill(); + if (this.nextChar >= this.nChars) + return -1; + } + if (this.skipLF) { + this.skipLF = false; + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(this.cb[this.nextChar]) == '\n'.charCodeAt(0)) { + this.nextChar++; + continue; + } + } + return (this.cb[this.nextChar++]).charCodeAt(0); + } + ; + } + } + ; + }; + /*private*/ BufferedReader.prototype.read1 = function (cbuf, off, len) { + if (this.nextChar >= this.nChars) { + if (len >= this.cb.length && this.markedChar <= BufferedReader.UNMARKED && !this.skipLF) { + return this["in"].read$char_A$int$int(cbuf, off, len); + } + this.fill(); + } + if (this.nextChar >= this.nChars) + return -1; + if (this.skipLF) { + this.skipLF = false; + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(this.cb[this.nextChar]) == '\n'.charCodeAt(0)) { + this.nextChar++; + if (this.nextChar >= this.nChars) + this.fill(); + if (this.nextChar >= this.nChars) + return -1; + } + } + var n = Math.min(len, this.nChars - this.nextChar); + java.lang.System.arraycopy(this.cb, this.nextChar, cbuf, off, n); + this.nextChar += n; + return n; + }; + BufferedReader.prototype.read$char_A$int$int = function (cbuf, off, len) { + { + this.ensureOpen(); + if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) { + throw new java.lang.IndexOutOfBoundsException(); + } + else if (len === 0) { + return 0; + } + var n = this.read1(cbuf, off, len); + if (n <= 0) + return n; + while (((n < len) && this["in"].ready())) { + { + var n1 = this.read1(cbuf, off + n, len - n); + if (n1 <= 0) + break; + n += n1; + } + } + ; + return n; + } + ; + }; + BufferedReader.prototype.read = function (cbuf, off, len) { + if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && ((typeof off === 'number') || off === null) && ((typeof len === 'number') || len === null)) { + return this.read$char_A$int$int(cbuf, off, len); + } + else if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && off === undefined && len === undefined) { + return this.read$char_A(cbuf); + } + else if (cbuf === undefined && off === undefined && len === undefined) { + return this.read$(); + } + else + throw new Error('invalid overload'); + }; + BufferedReader.prototype.readLine$boolean = function (ignoreLF) { + var s = null; + var startChar; + { + this.ensureOpen(); + var omitLF = ignoreLF || this.skipLF; + for (;;) { + { + if (this.nextChar >= this.nChars) + this.fill(); + if (this.nextChar >= this.nChars) { + if (s != null && s.length() > 0) + return s.toString(); + else + return null; + } + var eol = false; + var c = String.fromCharCode(0); + var i = void 0; + if (omitLF && ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(this.cb[this.nextChar]) == '\n'.charCodeAt(0))) + this.nextChar++; + this.skipLF = false; + omitLF = false; + charLoop: for (i = this.nextChar; i < this.nChars; i++) { + { + c = this.cb[i]; + if (((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) == '\n'.charCodeAt(0)) || ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) == '\r'.charCodeAt(0))) { + eol = true; + break charLoop; + } + } + ; + } + startChar = this.nextChar; + this.nextChar = i; + if (eol) { + var str = void 0; + if (s == null) { + str = (function (str, index, len) { return str.substring(index, index + len); })((this.cb).join(''), startChar, i - startChar); + } + else { + s.append$char_A$int$int(this.cb, startChar, i - startChar); + str = s.toString(); + } + this.nextChar++; + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) == '\r'.charCodeAt(0)) { + this.skipLF = true; + } + return str; + } + if (s == null) + s = new java.lang.StringBuffer(BufferedReader.defaultExpectedLineLength); + s.append$char_A$int$int(this.cb, startChar, i - startChar); + } + ; + } + } + ; + }; + BufferedReader.prototype.readLine = function (ignoreLF) { + if (((typeof ignoreLF === 'boolean') || ignoreLF === null)) { + return this.readLine$boolean(ignoreLF); + } + else if (ignoreLF === undefined) { + return this.readLine$(); + } + else + throw new Error('invalid overload'); + }; + BufferedReader.prototype.readLine$ = function () { + return this.readLine$boolean(false); + }; + BufferedReader.prototype.skip = function (n) { + if (n < 0) { + throw new java.lang.IllegalArgumentException("skip value is negative"); + } + { + this.ensureOpen(); + var r = n; + while ((r > 0)) { + { + if (this.nextChar >= this.nChars) + this.fill(); + if (this.nextChar >= this.nChars) + break; + if (this.skipLF) { + this.skipLF = false; + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(this.cb[this.nextChar]) == '\n'.charCodeAt(0)) { + this.nextChar++; + } + } + var d = this.nChars - this.nextChar; + if (r <= d) { + this.nextChar += r; + r = 0; + break; + } + else { + r -= d; + this.nextChar = this.nChars; + } + } + } + ; + return n - r; + } + ; + }; + BufferedReader.prototype.ready = function () { + this.ensureOpen(); + if (this.skipLF) { + if (this.nextChar >= this.nChars && this["in"].ready()) { + this.fill(); + } + if (this.nextChar < this.nChars) { + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(this.cb[this.nextChar]) == '\n'.charCodeAt(0)) + this.nextChar++; + this.skipLF = false; + } + } + return (this.nextChar < this.nChars) || this["in"].ready(); + }; + BufferedReader.prototype.markSupported = function () { + return true; + }; + BufferedReader.prototype.mark = function (readAheadLimit) { + if (readAheadLimit < 0) { + throw new java.lang.IllegalArgumentException("Read-ahead limit < 0"); + } + this.ensureOpen(); + this.readAheadLimit = readAheadLimit; + this.markedChar = this.nextChar; + this.markedSkipLF = this.skipLF; + }; + BufferedReader.prototype.reset = function () { + this.ensureOpen(); + if (this.markedChar < 0) + throw new java.io.IOException((this.markedChar === BufferedReader.INVALIDATED) ? "Mark invalid" : "Stream not marked"); + this.nextChar = this.markedChar; + this.skipLF = this.markedSkipLF; + }; + BufferedReader.prototype.close = function () { + if (this["in"] == null) + return; + try { + this["in"].close(); + } + finally { + this["in"] = null; + this.cb = null; + } + ; + }; + BufferedReader.INVALIDATED = -2; + BufferedReader.UNMARKED = -1; + BufferedReader.defaultCharBufferSize = 8192; + BufferedReader.defaultExpectedLineLength = 80; + return BufferedReader; + }(java.io.Reader)); + io.BufferedReader = BufferedReader; + BufferedReader["__class"] = "java.io.BufferedReader"; + BufferedReader["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * JSweet implementation. + * @param {java.io.InputStream} in + * @param {string} charsetName + * @class + * @extends java.io.Reader + */ + var InputStreamReader = /** @class */ (function (_super) { + __extends(InputStreamReader, _super); + function InputStreamReader(__in, charsetName) { + var _this = this; + if (((__in != null && __in instanceof java.io.InputStream) || __in === null) && ((typeof charsetName === 'string') || charsetName === null)) { + var __args = arguments; + _this = _super.call(this, __in) || this; + if (_this["in"] === undefined) { + _this["in"] = null; + } + _this["in"] = __in; + } + else if (((__in != null && __in instanceof java.io.InputStream) || __in === null) && ((charsetName != null && charsetName instanceof java.nio.charset.Charset) || charsetName === null)) { + var __args = arguments; + var cs = __args[1]; + _this = _super.call(this, __in) || this; + if (_this["in"] === undefined) { + _this["in"] = null; + } + _this["in"] = __in; + if (cs == null) + throw new java.lang.NullPointerException("charset"); + } + else if (((__in != null && __in instanceof java.io.InputStream) || __in === null) && charsetName === undefined) { + var __args = arguments; + _this = _super.call(this, __in) || this; + if (_this["in"] === undefined) { + _this["in"] = null; + } + _this["in"] = __in; + } + else + throw new Error('invalid overload'); + return _this; + } + InputStreamReader.prototype.read$char_A$int$int = function (cbuf, offset, length) { + var buf = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(length - offset); + var success = this["in"].read$byte_A$int$int(buf, 0, length); + if (success > 0) { + for (var i = 0; i < success; ++i) { + { + cbuf[i + offset] = (String.fromCharCode(buf[i])).charAt(0); + } + ; + } + } + return success; + }; + InputStreamReader.prototype.read = function (cbuf, offset, length) { + if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && ((typeof offset === 'number') || offset === null) && ((typeof length === 'number') || length === null)) { + return this.read$char_A$int$int(cbuf, offset, length); + } + else if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && offset === undefined && length === undefined) { + return this.read$char_A(cbuf); + } + else if (cbuf === undefined && offset === undefined && length === undefined) { + return this.read$(); + } + else + throw new Error('invalid overload'); + }; + InputStreamReader.prototype.ready = function () { + return this["in"].available() > 0; + }; + InputStreamReader.prototype.close = function () { + this["in"].close(); + }; + return InputStreamReader; + }(java.io.Reader)); + io.InputStreamReader = InputStreamReader; + InputStreamReader["__class"] = "java.io.InputStreamReader"; + InputStreamReader["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + var StringReader = /** @class */ (function (_super) { + __extends(StringReader, _super); + function StringReader(start) { + var _this = _super.call(this) || this; + if (_this.charArray === undefined) { + _this.charArray = null; + } + if (_this.where === undefined) { + _this.where = 0; + } + _this.marked = -1; + if (_this.markedLen === undefined) { + _this.markedLen = 0; + } + _this.charArray = /* toCharArray */ (start).split(''); + return _this; + } + StringReader.prototype.read$char_A$int$int = function (cbuf, off, len) { + if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) { + throw new java.lang.IndexOutOfBoundsException(); + } + else if (len === 0) { + return 0; + } + if (this.where === this.charArray.length) + return -1; + var size = Math.min(this.charArray.length - this.where, len); + java.lang.System.arraycopy(this.charArray, this.where, cbuf, off, size); + this.where += size; + return size; + }; + /** + * + * @param {Array} cbuf + * @param {number} off + * @param {number} len + * @return {number} + */ + StringReader.prototype.read = function (cbuf, off, len) { + if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && ((typeof off === 'number') || off === null) && ((typeof len === 'number') || len === null)) { + return this.read$char_A$int$int(cbuf, off, len); + } + else if (((cbuf != null && cbuf instanceof Array && (cbuf.length == 0 || cbuf[0] == null || (typeof cbuf[0] === 'string'))) || cbuf === null) && off === undefined && len === undefined) { + return this.read$char_A(cbuf); + } + else if (cbuf === undefined && off === undefined && len === undefined) { + return this.read$(); + } + else + throw new Error('invalid overload'); + }; + /** + * + */ + StringReader.prototype.close = function () { + this.where = this.charArray.length; + }; + /** + * + * @return {boolean} + */ + StringReader.prototype.ready = function () { + return this.where < this.charArray.length; + }; + /** + * + * @return {boolean} + */ + StringReader.prototype.markSupported = function () { + return true; + }; + /** + * + * @param {number} readAheadLimit + */ + StringReader.prototype.mark = function (readAheadLimit) { + this.marked = this.where; + this.markedLen = readAheadLimit; + }; + /** + * + */ + StringReader.prototype.reset = function () { + if (this.marked === -1 || this.where > this.marked + this.markedLen) { + throw new java.io.IOException("The stream not been marked or mark has been invalidated"); + } + this.where = this.marked; + }; + return StringReader; + }(java.io.Reader)); + io.StringReader = StringReader; + StringReader["__class"] = "java.io.StringReader"; + StringReader["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * Constructs a new {@code FilterOutputStream} with {@code out} as its + * target stream. + * + * @param {java.io.OutputStream} out + * the target stream that this stream writes to. + * @class + * @extends java.io.OutputStream + */ + var FilterOutputStream = /** @class */ (function (_super) { + __extends(FilterOutputStream, _super); + function FilterOutputStream(out) { + var _this = _super.call(this) || this; + if (_this.out === undefined) { + _this.out = null; + } + _this.out = out; + return _this; + } + /** + * Closes this stream. This implementation closes the target stream. + * + * @throws IOException + * if an error occurs attempting to close this stream. + */ + FilterOutputStream.prototype.close = function () { + var thrown = null; + try { + this.flush(); + } + catch (e) { + thrown = e; + } + ; + try { + this.out.close(); + } + catch (e) { + if (thrown == null) { + thrown = e; + } + } + ; + if (thrown != null) { + throw new java.io.IOException(thrown); + } + }; + /** + * Ensures that all pending data is sent out to the target stream. This + * implementation flushes the target stream. + * + * @throws IOException + * if an error occurs attempting to flush this stream. + */ + FilterOutputStream.prototype.flush = function () { + this.out.flush(); + }; + FilterOutputStream.prototype.write = function (buffer, offset, count) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof offset === 'number') || offset === null) && ((typeof count === 'number') || count === null)) { + _super.prototype.write.call(this, buffer, offset, count); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && offset === undefined && count === undefined) { + return this.write$byte_A(buffer); + } + else if (((typeof buffer === 'number') || buffer === null) && offset === undefined && count === undefined) { + return this.write$int(buffer); + } + else + throw new Error('invalid overload'); + }; + FilterOutputStream.prototype.write$int = function (oneByte) { + this.out.write$int(oneByte); + }; + return FilterOutputStream; + }(java.io.OutputStream)); + io.FilterOutputStream = FilterOutputStream; + FilterOutputStream["__class"] = "java.io.FilterOutputStream"; + FilterOutputStream["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable", "java.io.Flushable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * Constructs a new {@code ByteArrayOutputStream} with a default size of + * {@code size} bytes. If more than {@code size} bytes are written to this + * instance, the underlying byte array will expand. + * + * @param {number} size + * initial size for the underlying byte array, must be + * non-negative. + * @throws IllegalArgumentException + * if {@code size} < 0. + * @class + * @extends java.io.OutputStream + */ + var ByteArrayOutputStream = /** @class */ (function (_super) { + __extends(ByteArrayOutputStream, _super); + function ByteArrayOutputStream(size) { + var _this = this; + if (((typeof size === 'number') || size === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.buf === undefined) { + _this.buf = null; + } + if (_this.count === undefined) { + _this.count = 0; + } + if (size >= 0) { + _this.buf = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(size); + } + else { + throw new java.lang.IllegalArgumentException("size < 0"); + } + } + else if (size === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.buf === undefined) { + _this.buf = null; + } + if (_this.count === undefined) { + _this.count = 0; + } + _this.buf = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(32); + } + else + throw new Error('invalid overload'); + return _this; + } + /** + * Closes this stream. This releases system resources used for this stream. + * + * @throws IOException + * if an error occurs while attempting to close this stream. + */ + ByteArrayOutputStream.prototype.close = function () { + _super.prototype.close.call(this); + }; + /*private*/ ByteArrayOutputStream.prototype.expand = function (i) { + if (this.count + i <= this.buf.length) { + return; + } + var newbuf = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })((this.count + i) * 2); + java.lang.System.arraycopy(this.buf, 0, newbuf, 0, this.count); + this.buf = newbuf; + }; + /** + * Resets this stream to the beginning of the underlying byte array. All + * subsequent writes will overwrite any bytes previously stored in this + * stream. + */ + ByteArrayOutputStream.prototype.reset = function () { + this.count = 0; + }; + /** + * Returns the total number of bytes written to this stream so far. + * + * @return {number} the number of bytes written to this stream. + */ + ByteArrayOutputStream.prototype.size = function () { + return this.count; + }; + /** + * Returns the contents of this ByteArrayOutputStream as a byte array. Any + * changes made to the receiver after returning will not be reflected in the + * byte array returned to the caller. + * + * @return {Array} this stream's current contents as a byte array. + */ + ByteArrayOutputStream.prototype.toByteArray = function () { + var newArray = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(this.count); + java.lang.System.arraycopy(this.buf, 0, newArray, 0, this.count); + return newArray; + }; + ByteArrayOutputStream.prototype.toString$ = function () { + return (function (str, index, len) { return str.substring(index, index + len); })((this.buf).map(function (s) { return String.fromCharCode(s); }).join(''), 0, this.count); + }; + ByteArrayOutputStream.prototype.toString$int = function (hibyte) { + var newBuf = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(this.size()); + for (var i = 0; i < newBuf.length; i++) { + { + newBuf[i] = String.fromCharCode((((hibyte & 255) << 8) | (this.buf[i] & 255))); + } + ; + } + return new String(newBuf); + }; + ByteArrayOutputStream.prototype.toString$java_lang_String = function (charsetName) { + return (function (str, index, len) { return str.substring(index, index + len); })((this.buf).map(function (s) { return String.fromCharCode(s); }).join(''), 0, this.count); + }; + /** + * Returns the contents of this ByteArrayOutputStream as a string converted + * according to the encoding declared in {@code charsetName}. + * + * @param {string} charsetName + * a string representing the encoding to use when translating + * this stream to a string. + * @return {string} this stream's current contents as an encoded string. + * @throws UnsupportedEncodingException + * if the provided encoding is not supported. + */ + ByteArrayOutputStream.prototype.toString = function (charsetName) { + if (((typeof charsetName === 'string') || charsetName === null)) { + return this.toString$java_lang_String(charsetName); + } + else if (((typeof charsetName === 'number') || charsetName === null)) { + return this.toString$int(charsetName); + } + else if (charsetName === undefined) { + return this.toString$(); + } + else + throw new Error('invalid overload'); + }; + ByteArrayOutputStream.prototype.write$byte_A$int$int = function (buffer, offset, len) { + java.io.IOUtils.checkOffsetAndCount$byte_A$int$int(buffer, offset, len); + if (len === 0) { + return; + } + this.expand(len); + java.lang.System.arraycopy(buffer, offset, this.buf, this.count, len); + this.count += len; + }; + /** + * Writes {@code count} bytes from the byte array {@code buffer} starting at + * offset {@code index} to this stream. + * + * @param {Array} buffer + * the buffer to be written. + * @param {number} offset + * the initial position in {@code buffer} to retrieve bytes. + * @param {number} len + * the number of bytes of {@code buffer} to write. + * @throws NullPointerException + * if {@code buffer} is {@code null}. + * @throws IndexOutOfBoundsException + * if {@code offset < 0} or {@code len < 0}, or if + * {@code offset + len} is greater than the length of + * {@code buffer}. + */ + ByteArrayOutputStream.prototype.write = function (buffer, offset, len) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.write$byte_A$int$int(buffer, offset, len); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && offset === undefined && len === undefined) { + return this.write$byte_A(buffer); + } + else if (((typeof buffer === 'number') || buffer === null) && offset === undefined && len === undefined) { + return this.write$int(buffer); + } + else + throw new Error('invalid overload'); + }; + ByteArrayOutputStream.prototype.write$int = function (oneByte) { + if (this.count === this.buf.length) { + this.expand(1); + } + this.buf[this.count++] = (oneByte | 0); + }; + /** + * Takes the contents of this stream and writes it to the output stream + * {@code out}. + * + * @param {java.io.OutputStream} out + * an OutputStream on which to write the contents of this stream. + * @throws IOException + * if an error occurs while writing to {@code out}. + */ + ByteArrayOutputStream.prototype.writeTo = function (out) { + out.write$byte_A$int$int(this.buf, 0, this.count); + }; + return ByteArrayOutputStream; + }(java.io.OutputStream)); + io.ByteArrayOutputStream = ByteArrayOutputStream; + ByteArrayOutputStream["__class"] = "java.io.ByteArrayOutputStream"; + ByteArrayOutputStream["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable", "java.io.Flushable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var ref; + (function (ref) { + /** + * This implements the reference API in a minimal way. In JavaScript, there is + * no control over the reference and the GC. So this implementation's only + * purpose is for compilation. + * @param {*} referent + * @class + * @extends java.lang.ref.Reference + */ + var WeakReference = /** @class */ (function (_super) { + __extends(WeakReference, _super); + function WeakReference(referent) { + return _super.call(this, referent) || this; + } + return WeakReference; + }(java.lang.ref.Reference)); + ref.WeakReference = WeakReference; + WeakReference["__class"] = "java.lang.ref.WeakReference"; + })(ref = lang.ref || (lang.ref = {})); + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * Constructs an {@code InternalError} with the specified detail + * message and cause.

Note that the detail message associated + * with {@code cause} is not automatically incorporated in + * this error's detail message. + * + * @param {string} message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param {java.lang.Throwable} cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.8 + * @class + * @extends java.lang.VirtualMachineError + * @author unascribed + */ + var InternalError = /** @class */ (function (_super) { + __extends(InternalError, _super); + function InternalError(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message, cause) || this; + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined) { + var __args = arguments; + var cause_5 = __args[0]; + _this = _super.call(this, cause_5) || this; + } + else if (message === undefined && cause === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + InternalError.__java_lang_InternalError_serialVersionUID = -9062593416125562365; + return InternalError; + }(java.lang.VirtualMachineError)); + lang.InternalError = InternalError; + InternalError["__class"] = "java.lang.InternalError"; + InternalError["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Thrown when the subject of an observer cannot support additional observers. + * + * @param {string} message + * @class + * @extends java.lang.Exception + */ + var TooManyListenersException = /** @class */ (function (_super) { + __extends(TooManyListenersException, _super); + function TooManyListenersException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return TooManyListenersException; + }(Error)); + util.TooManyListenersException = TooManyListenersException; + TooManyListenersException["__class"] = "java.util.TooManyListenersException"; + TooManyListenersException["__interfaces"] = ["java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var security; + (function (security) { + /** + * A generic security exception type - [Sun's + * docs]. + * @param {string} msg + * @class + * @extends java.lang.Exception + */ + var GeneralSecurityException = /** @class */ (function (_super) { + __extends(GeneralSecurityException, _super); + function GeneralSecurityException(msg) { + var _this = this; + if (((typeof msg === 'string') || msg === null)) { + var __args = arguments; + _this = _super.call(this, msg) || this; + _this.message = msg; + } + else if (msg === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return GeneralSecurityException; + }(Error)); + security.GeneralSecurityException = GeneralSecurityException; + GeneralSecurityException["__class"] = "java.security.GeneralSecurityException"; + GeneralSecurityException["__interfaces"] = ["java.io.Serializable"]; + })(security = java.security || (java.security = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @param {java.lang.Throwable} throwable + * @class + * @extends java.lang.Exception + */ + var IOException = /** @class */ (function (_super) { + __extends(IOException, _super); + function IOException(message, throwable) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((throwable != null && throwable instanceof Error) || throwable === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'string') || message === null) && throwable === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((message != null && message instanceof Error) || message === null) && throwable === undefined) { + var __args = arguments; + var throwable_1 = __args[0]; + _this = _super.call(this, throwable_1) || this; + _this.message = throwable_1; + } + else if (message === undefined && throwable === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return IOException; + }(Error)); + io.IOException = IOException; + IOException["__class"] = "java.io.IOException"; + IOException["__interfaces"] = ["java.io.Serializable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @param {java.lang.Throwable} cause + * @class + * @extends java.lang.Exception + */ + var RuntimeException = /** @class */ (function (_super) { + __extends(RuntimeException, _super); + function RuntimeException(message, cause, enableSuppression, writableStackTrace) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null) && ((typeof enableSuppression === 'boolean') || enableSuppression === null) && ((typeof writableStackTrace === 'boolean') || writableStackTrace === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null) && enableSuppression === undefined && writableStackTrace === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((typeof message === 'string') || message === null) && cause === undefined && enableSuppression === undefined && writableStackTrace === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined && enableSuppression === undefined && writableStackTrace === undefined) { + var __args = arguments; + var cause_6 = __args[0]; + _this = _super.call(this, cause_6) || this; + _this.message = cause_6; + } + else if (message === undefined && cause === undefined && enableSuppression === undefined && writableStackTrace === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return RuntimeException; + }(Error)); + lang.RuntimeException = RuntimeException; + RuntimeException["__class"] = "java.lang.RuntimeException"; + RuntimeException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See + * the official Java API doc for details. + * @param {string} msg + * @class + * @extends java.lang.Exception + */ + var CloneNotSupportedException = /** @class */ (function (_super) { + __extends(CloneNotSupportedException, _super); + function CloneNotSupportedException(msg) { + var _this = this; + if (((typeof msg === 'string') || msg === null)) { + var __args = arguments; + _this = _super.call(this, msg) || this; + _this.message = msg; + } + else if (msg === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return CloneNotSupportedException; + }(Error)); + lang.CloneNotSupportedException = CloneNotSupportedException; + CloneNotSupportedException["__class"] = "java.lang.CloneNotSupportedException"; + CloneNotSupportedException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * Constructs an InterruptedException with the + * specified detail message. + * + * @param {string} s the detail message. + * @class + * @extends java.lang.Exception + */ + var InterruptedException = /** @class */ (function (_super) { + __extends(InterruptedException, _super); + function InterruptedException(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this, s) || this; + _this.message = s; + } + else if (s === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return InterruptedException; + }(Error)); + lang.InterruptedException = InterruptedException; + InterruptedException["__class"] = "java.lang.InterruptedException"; + InterruptedException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var ReflectiveOperationException = /** @class */ (function (_super) { + __extends(ReflectiveOperationException, _super); + function ReflectiveOperationException(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this, s) || this; + _this.message = s; + } + else if (s === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return ReflectiveOperationException; + }(Error)); + lang.ReflectiveOperationException = ReflectiveOperationException; + ReflectiveOperationException["__class"] = "java.lang.ReflectiveOperationException"; + ReflectiveOperationException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * + * This exception is never thrown by GWT or GWT's libraries, as GWT does not support reflection. It + * is provided in GWT only for compatibility with user code that explicitly throws or catches it for + * non-reflection purposes. + * @param {string} message + * @class + * @extends java.lang.Exception + */ + var NoSuchMethodException = /** @class */ (function (_super) { + __extends(NoSuchMethodException, _super); + function NoSuchMethodException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + _this.message = message; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return NoSuchMethodException; + }(Error)); + lang.NoSuchMethodException = NoSuchMethodException; + NoSuchMethodException["__class"] = "java.lang.NoSuchMethodException"; + NoSuchMethodException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var text; + (function (text) { + /** + * Emulation of {@code java.text.ParseException}. + * @param {string} s + * @param {number} errorOffset + * @class + * @extends java.lang.Exception + */ + var ParseException = /** @class */ (function (_super) { + __extends(ParseException, _super); + function ParseException(s, errorOffset) { + var _this = _super.call(this, s) || this; + _this.message = s; + Object.setPrototypeOf(_this, ParseException.prototype); + if (_this.errorOffset === undefined) { + _this.errorOffset = 0; + } + _this.errorOffset = errorOffset; + return _this; + } + ParseException.prototype.getErrorOffset = function () { + return this.errorOffset; + }; + return ParseException; + }(Error)); + text.ParseException = ParseException; + ParseException["__class"] = "java.text.ParseException"; + ParseException["__interfaces"] = ["java.io.Serializable"]; + })(text = java.text || (java.text = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var InheritableThreadLocal = /** @class */ (function (_super) { + __extends(InheritableThreadLocal, _super); + function InheritableThreadLocal() { + return _super !== null && _super.apply(this, arguments) || this; + } + InheritableThreadLocal.prototype.childValue = function (parentValue) { + return parentValue; + }; + return InheritableThreadLocal; + }(java.lang.ThreadLocal)); + lang.InheritableThreadLocal = InheritableThreadLocal; + InheritableThreadLocal["__class"] = "java.lang.InheritableThreadLocal"; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * A fast way to create strings using multiple appends. + * + * This class is an exact clone of {@link StringBuffer} except for the name. Any + * change made to one should be mirrored in the other. + * @param {*} s + * @class + * @extends java.lang.AbstractStringBuilder + */ + var StringBuilder = /** @class */ (function (_super) { + __extends(StringBuilder, _super); + function StringBuilder(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this, s) || this; + } + else if (((s != null && (s["__interfaces"] != null && s["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || s.constructor != null && s.constructor["__interfaces"] != null && s.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof s === "string")) || s === null)) { + var __args = arguments; + _this = _super.call(this, /* valueOf */ new String(s).toString()) || this; + } + else if (((typeof s === 'number') || s === null)) { + var __args = arguments; + var ignoredCapacity = __args[0]; + _this = _super.call(this, "") || this; + } + else if (s === undefined) { + var __args = arguments; + _this = _super.call(this, "") || this; + } + else + throw new Error('invalid overload'); + return _this; + } + StringBuilder.prototype.append$boolean = function (x) { + this.string += x; + return this; + }; + StringBuilder.prototype.append$char = function (x) { + this.string += /* valueOf */ new String(x).toString(); + return this; + }; + StringBuilder.prototype.append$char_A = function (x) { + this.string += /* valueOf */ new String(x).toString(); + return this; + }; + StringBuilder.prototype.append$char_A$int$int = function (x, start, len) { + this.string += /* valueOf */ (function (str, index, len) { return str.join('').substring(index, index + len); })(x, start, len); + return this; + }; + StringBuilder.prototype.append = function (x, start, len) { + if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && ((typeof start === 'number') || start === null) && ((typeof len === 'number') || len === null)) { + return this.append$char_A$int$int(x, start, len); + } + else if (((x != null && (x["__interfaces"] != null && x["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || x.constructor != null && x.constructor["__interfaces"] != null && x.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof x === "string")) || x === null) && ((typeof start === 'number') || start === null) && ((typeof len === 'number') || len === null)) { + return this.append$java_lang_CharSequence$int$int(x, start, len); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && start === undefined && len === undefined) { + return this.append$char_A(x); + } + else if (((typeof x === 'string') || x === null) && start === undefined && len === undefined) { + return this.append$java_lang_String(x); + } + else if (((x != null && x instanceof java.lang.StringBuffer) || x === null) && start === undefined && len === undefined) { + return this.append$java_lang_StringBuffer(x); + } + else if (((x != null && (x["__interfaces"] != null && x["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || x.constructor != null && x.constructor["__interfaces"] != null && x.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof x === "string")) || x === null) && start === undefined && len === undefined) { + return this.append$java_lang_CharSequence(x); + } + else if (((typeof x === 'boolean') || x === null) && start === undefined && len === undefined) { + return this.append$boolean(x); + } + else if (((typeof x === 'string') || x === null) && start === undefined && len === undefined) { + return this.append$char(x); + } + else if (((typeof x === 'number') || x === null) && start === undefined && len === undefined) { + return this.append$int(x); + } + else if (((typeof x === 'number') || x === null) && start === undefined && len === undefined) { + return this.append$long(x); + } + else if (((typeof x === 'number') || x === null) && start === undefined && len === undefined) { + return this.append$float(x); + } + else if (((typeof x === 'number') || x === null) && start === undefined && len === undefined) { + return this.append$double(x); + } + else if (((x != null) || x === null) && start === undefined && len === undefined) { + return this.append$java_lang_Object(x); + } + else + throw new Error('invalid overload'); + }; + StringBuilder.prototype.append$java_lang_CharSequence = function (x) { + this.string += x; + return this; + }; + StringBuilder.prototype.append$java_lang_CharSequence$int$int = function (x, start, end) { + this.append0(x, start, end); + return this; + }; + StringBuilder.prototype.append$double = function (x) { + this.string += x; + return this; + }; + StringBuilder.prototype.append$float = function (x) { + this.string += x; + return this; + }; + StringBuilder.prototype.append$int = function (x) { + this.string += x; + return this; + }; + StringBuilder.prototype.append$long = function (x) { + this.string += x; + return this; + }; + StringBuilder.prototype.append$java_lang_Object = function (x) { + this.string += x; + return this; + }; + StringBuilder.prototype.append$java_lang_String = function (x) { + this.string += x; + return this; + }; + StringBuilder.prototype.append$java_lang_StringBuffer = function (x) { + this.string += x; + return this; + }; + StringBuilder.prototype.appendCodePoint = function (x) { + this.appendCodePoint0(x); + return this; + }; + StringBuilder.prototype["delete"] = function (start, end) { + this.replace0(start, end, ""); + return this; + }; + StringBuilder.prototype.deleteCharAt = function (start) { + this.replace0(start, start + 1, ""); + return this; + }; + StringBuilder.prototype.insert$int$boolean = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuilder.prototype.insert$int$char = function (index, x) { + this.replace0(index, index, /* valueOf */ new String(x).toString()); + return this; + }; + StringBuilder.prototype.insert$int$char_A = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuilder.prototype.insert$int$char_A$int$int = function (index, x, offset, len) { + return this.insert$int$java_lang_String(index, /* valueOf */ (function (str, index, len) { return str.join('').substring(index, index + len); })(x, offset, len)); + }; + StringBuilder.prototype.insert = function (index, x, offset, len) { + if (((typeof index === 'number') || index === null) && ((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.insert$int$char_A$int$int(index, x, offset, len); + } + else if (((typeof index === 'number') || index === null) && ((x != null && (x["__interfaces"] != null && x["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || x.constructor != null && x.constructor["__interfaces"] != null && x.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof x === "string")) || x === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.insert$int$java_lang_CharSequence$int$int(index, x, offset, len); + } + else if (((typeof index === 'number') || index === null) && ((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && offset === undefined && len === undefined) { + return this.insert$int$char_A(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'string') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$java_lang_String(index, x); + } + else if (((typeof index === 'number') || index === null) && ((x != null && (x["__interfaces"] != null && x["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || x.constructor != null && x.constructor["__interfaces"] != null && x.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof x === "string")) || x === null) && offset === undefined && len === undefined) { + return this.insert$int$java_lang_CharSequence(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'boolean') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$boolean(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'string') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$char(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'number') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$int(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'number') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$long(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'number') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$float(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'number') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$double(index, x); + } + else if (((typeof index === 'number') || index === null) && ((x != null) || x === null) && offset === undefined && len === undefined) { + return this.insert$int$java_lang_Object(index, x); + } + else + throw new Error('invalid overload'); + }; + StringBuilder.prototype.insert$int$java_lang_CharSequence = function (index, chars) { + return this.insert$int$java_lang_String(index, chars.toString()); + }; + StringBuilder.prototype.insert$int$java_lang_CharSequence$int$int = function (index, chars, start, end) { + return this.insert$int$java_lang_String(index, /* subSequence */ chars.substring(start, end).toString()); + }; + StringBuilder.prototype.insert$int$double = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuilder.prototype.insert$int$float = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuilder.prototype.insert$int$int = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuilder.prototype.insert$int$long = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuilder.prototype.insert$int$java_lang_Object = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuilder.prototype.insert$int$java_lang_String = function (index, x) { + this.replace0(index, index, x); + return this; + }; + StringBuilder.prototype.replace = function (start, end, toInsert) { + this.replace0(start, end, toInsert); + return this; + }; + StringBuilder.prototype.reverse = function () { + this.reverse0(); + return this; + }; + return StringBuilder; + }(java.lang.AbstractStringBuilder)); + lang.StringBuilder = StringBuilder; + StringBuilder["__class"] = "java.lang.StringBuilder"; + StringBuilder["__interfaces"] = ["java.lang.CharSequence", "java.lang.Appendable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * A fast way to create strings using multiple appends. + * + * This class is an exact clone of {@link StringBuilder} except for the name. + * Any change made to one should be mirrored in the other. + * @param {*} s + * @class + * @extends java.lang.AbstractStringBuilder + */ + var StringBuffer = /** @class */ (function (_super) { + __extends(StringBuffer, _super); + function StringBuffer(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this, s) || this; + } + else if (((s != null && (s["__interfaces"] != null && s["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || s.constructor != null && s.constructor["__interfaces"] != null && s.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof s === "string")) || s === null)) { + var __args = arguments; + _this = _super.call(this, /* valueOf */ new String(s).toString()) || this; + } + else if (((typeof s === 'number') || s === null)) { + var __args = arguments; + var ignoredCapacity = __args[0]; + _this = _super.call(this, "") || this; + } + else if (s === undefined) { + var __args = arguments; + _this = _super.call(this, "") || this; + } + else + throw new Error('invalid overload'); + return _this; + } + StringBuffer.prototype.append$boolean = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.append$char = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.append$char_A = function (x) { + this.string += /* valueOf */ new String(x).toString(); + return this; + }; + StringBuffer.prototype.append$char_A$int$int = function (x, start, len) { + this.string += /* valueOf */ (function (str, index, len) { return str.join('').substring(index, index + len); })(x, start, len); + return this; + }; + StringBuffer.prototype.append = function (x, start, len) { + if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && ((typeof start === 'number') || start === null) && ((typeof len === 'number') || len === null)) { + return this.append$char_A$int$int(x, start, len); + } + else if (((x != null && (x["__interfaces"] != null && x["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || x.constructor != null && x.constructor["__interfaces"] != null && x.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof x === "string")) || x === null) && ((typeof start === 'number') || start === null) && ((typeof len === 'number') || len === null)) { + return this.append$java_lang_CharSequence$int$int(x, start, len); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && start === undefined && len === undefined) { + return this.append$char_A(x); + } + else if (((typeof x === 'string') || x === null) && start === undefined && len === undefined) { + return this.append$java_lang_String(x); + } + else if (((x != null && x instanceof java.lang.StringBuffer) || x === null) && start === undefined && len === undefined) { + return this.append$java_lang_StringBuffer(x); + } + else if (((x != null && (x["__interfaces"] != null && x["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || x.constructor != null && x.constructor["__interfaces"] != null && x.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof x === "string")) || x === null) && start === undefined && len === undefined) { + return this.append$java_lang_CharSequence(x); + } + else if (((typeof x === 'boolean') || x === null) && start === undefined && len === undefined) { + return this.append$boolean(x); + } + else if (((typeof x === 'string') || x === null) && start === undefined && len === undefined) { + return this.append$char(x); + } + else if (((typeof x === 'number') || x === null) && start === undefined && len === undefined) { + return this.append$int(x); + } + else if (((typeof x === 'number') || x === null) && start === undefined && len === undefined) { + return this.append$long(x); + } + else if (((typeof x === 'number') || x === null) && start === undefined && len === undefined) { + return this.append$float(x); + } + else if (((typeof x === 'number') || x === null) && start === undefined && len === undefined) { + return this.append$double(x); + } + else if (((x != null) || x === null) && start === undefined && len === undefined) { + return this.append$java_lang_Object(x); + } + else + throw new Error('invalid overload'); + }; + StringBuffer.prototype.append$java_lang_CharSequence = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.append$java_lang_CharSequence$int$int = function (x, start, end) { + this.append0(x, start, end); + return this; + }; + StringBuffer.prototype.append$double = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.append$float = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.append$int = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.append$long = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.append$java_lang_Object = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.append$java_lang_String = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.append$java_lang_StringBuffer = function (x) { + this.string += x; + return this; + }; + StringBuffer.prototype.appendCodePoint = function (x) { + this.appendCodePoint0(x); + return this; + }; + StringBuffer.prototype["delete"] = function (start, end) { + this.replace0(start, end, ""); + return this; + }; + StringBuffer.prototype.deleteCharAt = function (start) { + this.replace0(start, start + 1, ""); + return this; + }; + StringBuffer.prototype.insert$int$boolean = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuffer.prototype.insert$int$char = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuffer.prototype.insert$int$char_A = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuffer.prototype.insert$int$char_A$int$int = function (index, x, offset, len) { + return this.insert$int$java_lang_String(index, /* valueOf */ (function (str, index, len) { return str.join('').substring(index, index + len); })(x, offset, len)); + }; + StringBuffer.prototype.insert = function (index, x, offset, len) { + if (((typeof index === 'number') || index === null) && ((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.insert$int$char_A$int$int(index, x, offset, len); + } + else if (((typeof index === 'number') || index === null) && ((x != null && (x["__interfaces"] != null && x["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || x.constructor != null && x.constructor["__interfaces"] != null && x.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof x === "string")) || x === null) && ((typeof offset === 'number') || offset === null) && ((typeof len === 'number') || len === null)) { + return this.insert$int$java_lang_CharSequence$int$int(index, x, offset, len); + } + else if (((typeof index === 'number') || index === null) && ((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && offset === undefined && len === undefined) { + return this.insert$int$char_A(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'string') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$java_lang_String(index, x); + } + else if (((typeof index === 'number') || index === null) && ((x != null && (x["__interfaces"] != null && x["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || x.constructor != null && x.constructor["__interfaces"] != null && x.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof x === "string")) || x === null) && offset === undefined && len === undefined) { + return this.insert$int$java_lang_CharSequence(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'boolean') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$boolean(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'string') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$char(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'number') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$int(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'number') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$long(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'number') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$float(index, x); + } + else if (((typeof index === 'number') || index === null) && ((typeof x === 'number') || x === null) && offset === undefined && len === undefined) { + return this.insert$int$double(index, x); + } + else if (((typeof index === 'number') || index === null) && ((x != null) || x === null) && offset === undefined && len === undefined) { + return this.insert$int$java_lang_Object(index, x); + } + else + throw new Error('invalid overload'); + }; + StringBuffer.prototype.insert$int$java_lang_CharSequence = function (index, chars) { + return this.insert$int$java_lang_String(index, chars.toString()); + }; + StringBuffer.prototype.insert$int$java_lang_CharSequence$int$int = function (index, chars, start, end) { + return this.insert$int$java_lang_String(index, /* subSequence */ chars.substring(start, end).toString()); + }; + StringBuffer.prototype.insert$int$double = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuffer.prototype.insert$int$float = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuffer.prototype.insert$int$int = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuffer.prototype.insert$int$long = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuffer.prototype.insert$int$java_lang_Object = function (index, x) { + return this.insert$int$java_lang_String(index, /* valueOf */ new String(x).toString()); + }; + StringBuffer.prototype.insert$int$java_lang_String = function (index, x) { + this.replace0(index, index, x); + return this; + }; + StringBuffer.prototype.replace = function (start, end, toInsert) { + this.replace0(start, end, toInsert); + return this; + }; + StringBuffer.prototype.reverse = function () { + this.reverse0(); + return this; + }; + return StringBuffer; + }(java.lang.AbstractStringBuilder)); + lang.StringBuffer = StringBuffer; + StringBuffer["__class"] = "java.lang.StringBuffer"; + StringBuffer["__interfaces"] = ["java.lang.CharSequence", "java.lang.Appendable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var ByteBuffer = /** @class */ (function (_super) { + __extends(ByteBuffer, _super); + function ByteBuffer(_buffer, readOnly) { + var _this = _super.call(this, (_buffer.byteLength | 0), readOnly) || this; + if (_this._buffer === undefined) { + _this._buffer = null; + } + if (_this._array === undefined) { + _this._array = null; + } + if (_this._data === undefined) { + _this._data = null; + } + _this._order = java.nio.ByteOrder.BIG_ENDIAN_$LI$(); + _this._buffer = _buffer; + _this._array = new Int8Array(_buffer); + _this._data = new DataView(_buffer); + return _this; + } + ByteBuffer.allocate = function (capacity) { + return new ByteBuffer(new ArrayBuffer(capacity), false); + }; + /** + * + * @return {Array} + */ + ByteBuffer.prototype.array = function () { + return this._array; + }; + ByteBuffer.prototype.asReadOnlyBuffer = function () { + var byteBuffer = new ByteBuffer(this._buffer, true); + byteBuffer.limit$int(this.limit$()); + byteBuffer.position$int(this.position$()); + byteBuffer._mark = this._mark; + return byteBuffer; + }; + ByteBuffer.prototype.compact = function () { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + var current = this.position$(); + for (var i = current; i < this.limit$(); ++i) { + { + this.put$int$byte(i - current, this.get$int(i)); + } + ; + } + this.position$int(this.limit$() - this.position$()); + this.limit$int(this.capacity()); + this._mark = -1; + return this; + }; + ByteBuffer.prototype.compareTo$java_nio_ByteBuffer = function (byteBuffer) { + return /* compareTo */ this._array.toString().localeCompare(byteBuffer.toString()); + }; + /** + * + * @param {java.nio.ByteBuffer} byteBuffer + * @return {number} + */ + ByteBuffer.prototype.compareTo = function (byteBuffer) { + if (((byteBuffer != null && byteBuffer instanceof java.nio.ByteBuffer) || byteBuffer === null)) { + return this.compareTo$java_nio_ByteBuffer(byteBuffer); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.duplicate = function () { + var byteBuffer = new ByteBuffer(this._buffer, this.isReadOnly()); + byteBuffer.limit$int(this.limit$()); + byteBuffer.position$int(this.position$()); + byteBuffer._mark = this._mark; + return byteBuffer; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + ByteBuffer.prototype.equals = function (o) { + return this === o || (o != null && o instanceof java.nio.ByteBuffer) && java.util.Objects.equals(this._array, o._array); + }; + ByteBuffer.prototype.get$ = function () { + if (this.position$() === this.limit$()) + throw new java.nio.BufferUnderflowException(); + var b = this._array[this.position$()]; + this.position$int(this.position$() + 1); + return b; + }; + ByteBuffer.prototype.get$byte_A = function (dest) { + return this.get$byte_A$int$int(dest, 0, dest.length); + }; + ByteBuffer.prototype.get$byte_A$int$int = function (dest, offset, length) { + if (this.remaining() < length) + throw new java.nio.BufferUnderflowException(); + for (var i = offset; i < offset + length; i++) { + dest[i] = this.get$(); + } + return this; + }; + ByteBuffer.prototype.get = function (dest, offset, length) { + if (((dest != null && dest instanceof Array && (dest.length == 0 || dest[0] == null || (typeof dest[0] === 'number'))) || dest === null) && ((typeof offset === 'number') || offset === null) && ((typeof length === 'number') || length === null)) { + return this.get$byte_A$int$int(dest, offset, length); + } + else if (((dest != null && dest instanceof Array && (dest.length == 0 || dest[0] == null || (typeof dest[0] === 'number'))) || dest === null) && offset === undefined && length === undefined) { + return this.get$byte_A(dest); + } + else if (((typeof dest === 'number') || dest === null) && offset === undefined && length === undefined) { + return this.get$int(dest); + } + else if (dest === undefined && offset === undefined && length === undefined) { + return this.get$(); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.get$int = function (from) { + if (from < 0 || from > this.limit$()) + throw new java.lang.IndexOutOfBoundsException(); + return this._array[from]; + }; + ByteBuffer.prototype.getChar$ = function () { + if (this.remaining() < 2) + throw new java.nio.BufferUnderflowException(); + var res = (String.fromCharCode((this._data.getInt16(this.position$(), this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()) | 0))).charAt(0); + this.position$int(this.position$() + 2); + return res; + }; + ByteBuffer.prototype.getChar$int = function (from) { + if (from < 0 || from > this.limit$() - 1) + throw new java.lang.IndexOutOfBoundsException(); + return (String.fromCharCode((this._data.getInt16(from, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()) | 0))).charAt(0); + }; + ByteBuffer.prototype.getChar = function (from) { + if (((typeof from === 'number') || from === null)) { + return this.getChar$int(from); + } + else if (from === undefined) { + return this.getChar$(); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.getDouble$ = function () { + if (this.remaining() < 8) + throw new java.nio.BufferUnderflowException(); + var res = this._data.getFloat64(this.position$(), this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 8); + return res; + }; + ByteBuffer.prototype.getDouble$int = function (from) { + if (from < 0 || from > this.limit$() - 7) + throw new java.lang.IndexOutOfBoundsException(); + return this._data.getFloat64(from, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + }; + ByteBuffer.prototype.getDouble = function (from) { + if (((typeof from === 'number') || from === null)) { + return this.getDouble$int(from); + } + else if (from === undefined) { + return this.getDouble$(); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.getFloat$ = function () { + if (this.remaining() < 4) + throw new java.nio.BufferUnderflowException(); + var res = this._data.getFloat32(this.position$(), this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 4); + return res; + }; + ByteBuffer.prototype.getFloat$int = function (from) { + if (from < 0 || from > this.limit$() - 3) + throw new java.lang.IndexOutOfBoundsException(); + return this._data.getFloat32(from, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + }; + ByteBuffer.prototype.getFloat = function (from) { + if (((typeof from === 'number') || from === null)) { + return this.getFloat$int(from); + } + else if (from === undefined) { + return this.getFloat$(); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.getInt$ = function () { + if (this.remaining() < 4) + throw new java.nio.BufferUnderflowException(); + var res = this._data.getInt32(this.position$(), this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 4); + return res; + }; + ByteBuffer.prototype.getInt$int = function (from) { + if (from < 0 || from > this.limit$() - 3) + throw new java.lang.IndexOutOfBoundsException(); + return this._data.getInt32(from, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + }; + ByteBuffer.prototype.getInt = function (from) { + if (((typeof from === 'number') || from === null)) { + return this.getInt$int(from); + } + else if (from === undefined) { + return this.getInt$(); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.getLong$ = function () { + if (this.remaining() < 8) + throw new java.nio.BufferUnderflowException(); + var res1 = this._data.getInt32(this.position$(), this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + var res2 = this._data.getInt32(this.position$() + 4, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + if (this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()) { + var tmp = res1; + res1 = res2; + res2 = tmp; + } + this.position$int(this.position$() + 8); + return res1 * 4294967296 + res2; + }; + ByteBuffer.prototype.getLong$int = function (from) { + if (from < 0 || from > this.limit$() - 7) + throw new java.lang.IndexOutOfBoundsException(); + var res1 = this._data.getInt32(from, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + var res2 = this._data.getInt32(from + 4, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + if (this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()) { + var tmp = res1; + res1 = res2; + res2 = tmp; + } + return res1 * 4294967296 + res2; + }; + ByteBuffer.prototype.getLong = function (from) { + if (((typeof from === 'number') || from === null)) { + return this.getLong$int(from); + } + else if (from === undefined) { + return this.getLong$(); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.getShort$ = function () { + if (this.remaining() < 2) + throw new java.nio.BufferUnderflowException(); + var res = this._data.getInt16(this.position$(), this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 2); + return res; + }; + ByteBuffer.prototype.getShort$int = function (from) { + if (from < 0 || from > this.limit$() - 1) + throw new java.lang.IndexOutOfBoundsException(); + return this._data.getInt16(from, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + }; + ByteBuffer.prototype.getShort = function (from) { + if (((typeof from === 'number') || from === null)) { + return this.getShort$int(from); + } + else if (from === undefined) { + return this.getShort$(); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.order$ = function () { + return this._order; + }; + ByteBuffer.prototype.order$java_nio_ByteOrder = function (newOrder) { + this._order = newOrder; + return this; + }; + ByteBuffer.prototype.order = function (newOrder) { + if (((newOrder != null && newOrder instanceof java.nio.ByteOrder) || newOrder === null)) { + return this.order$java_nio_ByteOrder(newOrder); + } + else if (newOrder === undefined) { + return this.order$(); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.put$byte = function (b) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (this.position$() === this.limit$()) + throw new java.nio.BufferOverflowException(); + this._array[this.position$()] = b; + this.position$int(this.position$() + 1); + return this; + }; + ByteBuffer.prototype.put$byte_A = function (src) { + return this.put$byte_A$int$int(src, 0, src.length); + }; + ByteBuffer.prototype.put$byte_A$int$int = function (src, offset, length) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (this.remaining() < length) + throw new java.nio.BufferOverflowException(); + for (var i = offset; i < offset + length; i++) { + this.put$byte(src[i]); + } + return this; + }; + ByteBuffer.prototype.put = function (src, offset, length) { + if (((src != null && src instanceof Array && (src.length == 0 || src[0] == null || (typeof src[0] === 'number'))) || src === null) && ((typeof offset === 'number') || offset === null) && ((typeof length === 'number') || length === null)) { + return this.put$byte_A$int$int(src, offset, length); + } + else if (((typeof src === 'number') || src === null) && ((typeof offset === 'number') || offset === null) && length === undefined) { + return this.put$int$byte(src, offset); + } + else if (((src != null && src instanceof Array && (src.length == 0 || src[0] == null || (typeof src[0] === 'number'))) || src === null) && offset === undefined && length === undefined) { + return this.put$byte_A(src); + } + else if (((typeof src === 'number') || src === null) && offset === undefined && length === undefined) { + return this.put$byte(src); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.put$int$byte = function (to, b) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (to < 0 || to > this.limit$()) + throw new java.lang.IndexOutOfBoundsException(); + this._array[to] = b; + return this; + }; + ByteBuffer.prototype.putChar$char = function (value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (this.remaining() < 2) + throw new java.nio.BufferOverflowException(); + this._data.setInt16(this.position$(), (value).charCodeAt(0), this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 2); + return this; + }; + ByteBuffer.prototype.putChar$int$char = function (to, value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (to < 0 || to > this.limit$() - 1) + throw new java.lang.IndexOutOfBoundsException(); + this._data.setInt16(to, (value).charCodeAt(0), this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + return this; + }; + ByteBuffer.prototype.putChar = function (to, value) { + if (((typeof to === 'number') || to === null) && ((typeof value === 'string') || value === null)) { + return this.putChar$int$char(to, value); + } + else if (((typeof to === 'string') || to === null) && value === undefined) { + return this.putChar$char(to); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.putDouble$double = function (value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (this.remaining() < 8) + throw new java.nio.BufferOverflowException(); + this._data.setFloat64(this.position$(), value, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 8); + return this; + }; + ByteBuffer.prototype.putDouble$int$double = function (to, value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (to < 0 || to > this.limit$() - 7) + throw new java.lang.IndexOutOfBoundsException(); + this._data.setFloat64(to, value, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + return this; + }; + ByteBuffer.prototype.putDouble = function (to, value) { + if (((typeof to === 'number') || to === null) && ((typeof value === 'number') || value === null)) { + return this.putDouble$int$double(to, value); + } + else if (((typeof to === 'number') || to === null) && value === undefined) { + return this.putDouble$double(to); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.putFloat$float = function (value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (this.remaining() < 4) + throw new java.nio.BufferOverflowException(); + this._data.setFloat32(this.position$(), value, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 4); + return this; + }; + ByteBuffer.prototype.putFloat$int$float = function (to, value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (to < 0 || to > this.limit$() - 3) + throw new java.lang.IndexOutOfBoundsException(); + this._data.setFloat32(to, value, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + return this; + }; + ByteBuffer.prototype.putFloat = function (to, value) { + if (((typeof to === 'number') || to === null) && ((typeof value === 'number') || value === null)) { + return this.putFloat$int$float(to, value); + } + else if (((typeof to === 'number') || to === null) && value === undefined) { + return this.putFloat$float(to); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.putInt$int = function (value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (this.remaining() < 4) + throw new java.nio.BufferOverflowException(); + this._data.setInt32(this.position$(), value, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 4); + return this; + }; + ByteBuffer.prototype.putInt$int$int = function (to, value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (to < 0 || to > this.limit$() - 3) + throw new java.lang.IndexOutOfBoundsException(); + this._data.setInt32(to, value, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + return this; + }; + ByteBuffer.prototype.putInt = function (to, value) { + if (((typeof to === 'number') || to === null) && ((typeof value === 'number') || value === null)) { + return this.putInt$int$int(to, value); + } + else if (((typeof to === 'number') || to === null) && value === undefined) { + return this.putInt$int(to); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.putLong$long = function (value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (this.remaining() < 8) + throw new java.nio.BufferOverflowException(); + var big = (((function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(value / 4294967296)) | 0); + var small = ((value % 4294967296) | 0); + if (this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()) { + var tmp = big; + big = small; + small = tmp; + } + this._data.setInt32(this.position$(), big, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this._data.setInt32(this.position$() + 4, small, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 8); + return this; + }; + ByteBuffer.prototype.putLong$int$long = function (to, value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (to < 0 || to > this.limit$() - 7) + throw new java.lang.IndexOutOfBoundsException(); + var big = (((function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(value / 4294967296)) | 0); + var small = ((value % 4294967296) | 0); + if (this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()) { + var tmp = big; + big = small; + small = tmp; + } + this._data.setInt32(to, big, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this._data.setInt32(to + 4, small, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + return this; + }; + ByteBuffer.prototype.putLong = function (to, value) { + if (((typeof to === 'number') || to === null) && ((typeof value === 'number') || value === null)) { + return this.putLong$int$long(to, value); + } + else if (((typeof to === 'number') || to === null) && value === undefined) { + return this.putLong$long(to); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.putShort$short = function (value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (this.remaining() < 2) + throw new java.nio.BufferOverflowException(); + this._data.setInt16(this.position$(), value, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + this.position$int(this.position$() + 2); + return this; + }; + ByteBuffer.prototype.putShort$int$short = function (to, value) { + if (this.isReadOnly()) + throw new java.nio.ReadOnlyBufferException(); + if (to < 0 || to > this.limit$() - 1) + throw new java.lang.IndexOutOfBoundsException(); + this._data.setInt16(to, value, this._order === java.nio.ByteOrder.LITTLE_ENDIAN_$LI$()); + return this; + }; + ByteBuffer.prototype.putShort = function (to, value) { + if (((typeof to === 'number') || to === null) && ((typeof value === 'number') || value === null)) { + return this.putShort$int$short(to, value); + } + else if (((typeof to === 'number') || to === null) && value === undefined) { + return this.putShort$short(to); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.prototype.slice = function () { + return new ByteBuffer(this._buffer, this.isReadOnly()); + }; + /** + * + * @return {number} + */ + ByteBuffer.prototype.hashCode = function () { + return java.util.Objects.hash(this._array); + }; + ByteBuffer.wrap$byte_A = function (array) { + return ByteBuffer.wrap$byte_A$int$int(array, 0, array.length); + }; + ByteBuffer.wrap$byte_A$int$int = function (array, offset, length) { + var buffer = new ArrayBuffer(length); + var bytes = new Int8Array(buffer); + bytes.set(Int8Array.from((array).slice(offset, offset + length))); + return new ByteBuffer(buffer, true); + }; + ByteBuffer.wrap = function (array, offset, length) { + if (((array != null && array instanceof Array && (array.length == 0 || array[0] == null || (typeof array[0] === 'number'))) || array === null) && ((typeof offset === 'number') || offset === null) && ((typeof length === 'number') || length === null)) { + return java.nio.ByteBuffer.wrap$byte_A$int$int(array, offset, length); + } + else if (((array != null && array instanceof ArrayBuffer) || array === null) && ((typeof offset === 'number') || offset === null) && ((typeof length === 'number') || length === null)) { + return java.nio.ByteBuffer.wrap$def_js_ArrayBuffer$int$double(array, offset, length); + } + else if (((array != null && array instanceof Array && (array.length == 0 || array[0] == null || (typeof array[0] === 'number'))) || array === null) && offset === undefined && length === undefined) { + return java.nio.ByteBuffer.wrap$byte_A(array); + } + else if (((array != null && array instanceof ArrayBuffer) || array === null) && offset === undefined && length === undefined) { + return java.nio.ByteBuffer.wrap$def_js_ArrayBuffer(array); + } + else + throw new Error('invalid overload'); + }; + ByteBuffer.wrap$def_js_ArrayBuffer = function (array) { + return ByteBuffer.wrap$def_js_ArrayBuffer$int$double(array, 0, array.byteLength); + }; + /*private*/ ByteBuffer.wrap$def_js_ArrayBuffer$int$double = function (array, offset, length) { + return new ByteBuffer(array.slice(offset, offset + length), false); + }; + return ByteBuffer; + }(java.nio.Buffer)); + nio.ByteBuffer = ByteBuffer; + ByteBuffer["__class"] = "java.nio.ByteBuffer"; + ByteBuffer["__interfaces"] = ["java.lang.Comparable"]; + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * Provides Charset implementations. + * @param {string} name + * @class + * @extends java.nio.charset.Charset + */ + var EmulatedCharset = /** @class */ (function (_super) { + __extends(EmulatedCharset, _super); + function EmulatedCharset(name) { + return _super.call(this, name, null) || this; + } + EmulatedCharset.UTF_8_$LI$ = function () { if (EmulatedCharset.UTF_8 == null) { + EmulatedCharset.UTF_8 = new EmulatedCharset.UtfCharset("UTF-8"); + } return EmulatedCharset.UTF_8; }; + ; + EmulatedCharset.ISO_LATIN_1_$LI$ = function () { if (EmulatedCharset.ISO_LATIN_1 == null) { + EmulatedCharset.ISO_LATIN_1 = new EmulatedCharset.LatinCharset("ISO-LATIN-1"); + } return EmulatedCharset.ISO_LATIN_1; }; + ; + EmulatedCharset.ISO_8859_1_$LI$ = function () { if (EmulatedCharset.ISO_8859_1 == null) { + EmulatedCharset.ISO_8859_1 = new EmulatedCharset.LatinCharset("ISO-8859-1"); + } return EmulatedCharset.ISO_8859_1; }; + ; + return EmulatedCharset; + }(java.nio.charset.Charset)); + internal.EmulatedCharset = EmulatedCharset; + EmulatedCharset["__class"] = "javaemul.internal.EmulatedCharset"; + EmulatedCharset["__interfaces"] = ["java.lang.Comparable"]; + (function (EmulatedCharset) { + var LatinCharset = /** @class */ (function (_super) { + __extends(LatinCharset, _super); + function LatinCharset(name) { + return _super.call(this, name) || this; + } + /** + * + * @param {string} str + * @return {Array} + */ + LatinCharset.prototype.getBytes = function (str) { + var n = str.length; + var bytes = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(n); + for (var i = 0; i < n; ++i) { + { + bytes[i] = (((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(str.charAt(i)) & 255) | 0); + } + ; + } + return bytes; + }; + /** + * + * @param {Array} bytes + * @param {number} ofs + * @param {number} len + * @return {Array} + */ + LatinCharset.prototype.decodeString = function (bytes, ofs, len) { + var chars = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(len); + for (var i = 0; i < len; ++i) { + { + chars[i] = String.fromCharCode((bytes[ofs + i] & 255)); + } + ; + } + return chars; + }; + return LatinCharset; + }(javaemul.internal.EmulatedCharset)); + EmulatedCharset.LatinCharset = LatinCharset; + LatinCharset["__class"] = "javaemul.internal.EmulatedCharset.LatinCharset"; + LatinCharset["__interfaces"] = ["java.lang.Comparable"]; + var UtfCharset = /** @class */ (function (_super) { + __extends(UtfCharset, _super); + function UtfCharset(name) { + return _super.call(this, name) || this; + } + /** + * + * @param {Array} bytes + * @param {number} ofs + * @param {number} len + * @return {Array} + */ + UtfCharset.prototype.decodeString = function (bytes, ofs, len) { + var charCount = 0; + for (var i = 0; i < len;) { + { + ++charCount; + var ch = bytes[ofs + i]; + if ((ch & 192) === 128) { + throw new java.lang.IllegalArgumentException("Invalid UTF8 sequence"); + } + else if ((ch & 128) === 0) { + ++i; + } + else if ((ch & 224) === 192) { + i += 2; + } + else if ((ch & 240) === 224) { + i += 3; + } + else if ((ch & 248) === 240) { + i += 4; + } + else { + throw new java.lang.IllegalArgumentException("Invalid UTF8 sequence"); + } + if (i > len) { + throw new java.lang.IndexOutOfBoundsException("Invalid UTF8 sequence"); + } + } + ; + } + var chars = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(charCount); + var outIdx = 0; + var count = 0; + for (var i = 0; i < len;) { + { + var ch = bytes[ofs + i++]; + if ((ch & 128) === 0) { + count = 1; + ch &= 127; + } + else if ((ch & 224) === 192) { + count = 2; + ch &= 31; + } + else if ((ch & 240) === 224) { + count = 3; + ch &= 15; + } + else if ((ch & 248) === 240) { + count = 4; + ch &= 7; + } + else if ((ch & 252) === 248) { + count = 5; + ch &= 3; + } + while ((--count > 0)) { + { + var b = bytes[ofs + i++]; + if ((b & 192) !== 128) { + throw new java.lang.IllegalArgumentException("Invalid UTF8 sequence at " + (ofs + i - 1) + ", byte=" + javaemul.internal.IntegerHelper.toHexString(b)); + } + ch = (ch << 6) | (b & 63); + } + } + ; + outIdx += javaemul.internal.CharacterHelper.toChars$int$char_A$int(ch, chars, outIdx); + } + ; + } + return chars; + }; + /** + * + * @param {string} str + * @return {Array} + */ + UtfCharset.prototype.getBytes = function (str) { + var n = str.length; + var byteCount = 0; + for (var i = 0; i < n;) { + { + var ch = str.charCodeAt(i); + i += javaemul.internal.CharacterHelper.charCount(ch); + if (ch < (1 << 7)) { + byteCount++; + } + else if (ch < (1 << 11)) { + byteCount += 2; + } + else if (ch < (1 << 16)) { + byteCount += 3; + } + else if (ch < (1 << 21)) { + byteCount += 4; + } + else if (ch < (1 << 26)) { + byteCount += 5; + } + } + ; + } + var bytes = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(byteCount); + var out = 0; + for (var i = 0; i < n;) { + { + var ch = str.charCodeAt(i); + i += javaemul.internal.CharacterHelper.charCount(ch); + out += this.encodeUtf8(bytes, out, ch); + } + ; + } + return bytes; + }; + /** + * Encode a single character in UTF8. + * + * @param {Array} bytes byte array to store character in + * @param {number} ofs offset into byte array to store first byte + * @param {number} codePoint character to encode + * @return {number} number of bytes consumed by encoding the character + * @throws IllegalArgumentException if codepoint >= 2^26 + * @private + */ + UtfCharset.prototype.encodeUtf8 = function (bytes, ofs, codePoint) { + if (codePoint < (1 << 7)) { + bytes[ofs] = ((codePoint & 127) | 0); + return 1; + } + else if (codePoint < (1 << 11)) { + bytes[ofs++] = ((((codePoint >> 6) & 31) | 192) | 0); + bytes[ofs] = (((codePoint & 63) | 128) | 0); + return 2; + } + else if (codePoint < (1 << 16)) { + bytes[ofs++] = ((((codePoint >> 12) & 15) | 224) | 0); + bytes[ofs++] = ((((codePoint >> 6) & 63) | 128) | 0); + bytes[ofs] = (((codePoint & 63) | 128) | 0); + return 3; + } + else if (codePoint < (1 << 21)) { + bytes[ofs++] = ((((codePoint >> 18) & 7) | 240) | 0); + bytes[ofs++] = ((((codePoint >> 12) & 63) | 128) | 0); + bytes[ofs++] = ((((codePoint >> 6) & 63) | 128) | 0); + bytes[ofs] = (((codePoint & 63) | 128) | 0); + return 4; + } + else if (codePoint < (1 << 26)) { + bytes[ofs++] = ((((codePoint >> 24) & 3) | 248) | 0); + bytes[ofs++] = ((((codePoint >> 18) & 63) | 128) | 0); + bytes[ofs++] = ((((codePoint >> 12) & 63) | 128) | 0); + bytes[ofs++] = ((((codePoint >> 6) & 63) | 128) | 0); + bytes[ofs] = (((codePoint & 63) | 128) | 0); + return 5; + } + throw new java.lang.IllegalArgumentException("Character out of range: " + codePoint); + }; + return UtfCharset; + }(javaemul.internal.EmulatedCharset)); + EmulatedCharset.UtfCharset = UtfCharset; + UtfCharset["__class"] = "javaemul.internal.EmulatedCharset.UtfCharset"; + UtfCharset["__interfaces"] = ["java.lang.Comparable"]; + })(EmulatedCharset = internal.EmulatedCharset || (internal.EmulatedCharset = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StreamRowSortingCollector = /** @class */ (function (_super) { + __extends(StreamRowSortingCollector, _super); + function StreamRowSortingCollector(collection, comparator) { + var _this = _super.call(this, collection) || this; + if (_this.comparator === undefined) { + _this.comparator = null; + } + _this.comparator = (comparator); + return _this; + } + /** + * + */ + StreamRowSortingCollector.prototype.end = function () { + java.util.Collections.sort$java_util_List$java_util_Comparator(this.collection, (this.comparator)); + _super.prototype.end.call(this); + }; + return StreamRowSortingCollector; + }(javaemul.internal.stream.StreamRowCollector)); + stream.StreamRowSortingCollector = StreamRowSortingCollector; + StreamRowSortingCollector["__class"] = "javaemul.internal.stream.StreamRowSortingCollector"; + StreamRowSortingCollector["__interfaces"] = ["javaemul.internal.stream.StreamRow"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (java) { + var util; + (function (util) { + /** + * Skeletal implementation of the Map interface. + * + * [Sun docs] + * + * @param + * the key type. + * @param + * the value type. + * @class + */ + var AbstractMap = /** @class */ (function () { + function AbstractMap() { + } + /* Default method injected from java.util.Map */ + AbstractMap.prototype.getOrDefault = function (key, defaultValue) { + var v; + return (((v = this.get(key)) != null) || this.containsKey(key)) ? v : defaultValue; + }; + /* Default method injected from java.util.Map */ + AbstractMap.prototype.putIfAbsent = function (key, value) { + var v = this.get(key); + if (v == null) { + v = this.put(key, value); + } + return v; + }; + /* Default method injected from java.util.Map */ + AbstractMap.prototype.merge = function (key, value, map) { + var old = this.get(key); + var next = (old == null) ? value : (function (target) { return (typeof target === 'function') ? target(old, value) : target.apply(old, value); })(map); + if (next == null) { + this.remove(key); + } + else { + this.put(key, next); + } + return next; + }; + /* Default method injected from java.util.Map */ + AbstractMap.prototype.computeIfAbsent = function (key, mappingFunction) { + var result; + if ((result = this.get(key)) == null) { + result = (function (target) { return (typeof target === 'function') ? target(key) : target.apply(key); })(mappingFunction); + if (result != null) + this.put(key, result); + } + return result; + }; + /* Default method injected from java.util.Map */ + AbstractMap.prototype.replaceAll = function (__function) { + java.util.Objects.requireNonNull((__function)); + var _loop_11 = function (index142) { + var entry = index142.next(); + { + var k_1; + var v_1; + try { + k_1 = entry.getKey(); + v_1 = entry.getValue(); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + v_1 = (function (target) { return (typeof target === 'function') ? target(k_1, v_1) : target.apply(k_1, v_1); })(__function); + try { + entry.setValue(v_1); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + } + }; + for (var index142 = this.entrySet().iterator(); index142.hasNext();) { + _loop_11(index142); + } + }; + /** + * + */ + AbstractMap.prototype.clear = function () { + this.entrySet().clear(); + }; + /** + * + * @param {*} key + * @return {boolean} + */ + AbstractMap.prototype.containsKey = function (key) { + return this.implFindEntry(key, false) != null; + }; + /** + * + * @param {*} value + * @return {boolean} + */ + AbstractMap.prototype.containsValue = function (value) { + for (var index143 = this.entrySet().iterator(); index143.hasNext();) { + var entry = index143.next(); + { + var v = entry.getValue(); + if (java.util.Objects.equals(value, v)) { + return true; + } + } + } + return false; + }; + AbstractMap.prototype.containsEntry = function (entry) { + var key = entry.getKey(); + var value = entry.getValue(); + var ourValue = this.get(key); + if (!java.util.Objects.equals(value, ourValue)) { + return false; + } + if (ourValue == null && !this.containsKey(key)) { + return false; + } + return true; + }; + /** + * + * @param {*} obj + * @return {boolean} + */ + AbstractMap.prototype.equals = function (obj) { + if (obj === this) { + return true; + } + if (!(obj != null && (obj["__interfaces"] != null && obj["__interfaces"].indexOf("java.util.Map") >= 0 || obj.constructor != null && obj.constructor["__interfaces"] != null && obj.constructor["__interfaces"].indexOf("java.util.Map") >= 0))) { + return false; + } + var otherMap = obj; + if (this.size() !== otherMap.size()) { + return false; + } + for (var index144 = otherMap.entrySet().iterator(); index144.hasNext();) { + var entry = index144.next(); + { + if (!this.containsEntry(entry)) { + return false; + } + } + } + return true; + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractMap.prototype.get = function (key) { + return (AbstractMap.getEntryValueOrNull(this.implFindEntry(key, false))); + }; + /** + * + * @return {number} + */ + AbstractMap.prototype.hashCode = function () { + return java.util.Collections.hashCode$java_lang_Iterable(this.entrySet()); + }; + /** + * + * @return {boolean} + */ + AbstractMap.prototype.isEmpty = function () { + return this.size() === 0; + }; + /** + * + * @return {*} + */ + AbstractMap.prototype.keySet = function () { + return new AbstractMap.AbstractMap$0(this); + }; + /** + * + * @param {*} key + * @param {*} value + * @return {*} + */ + AbstractMap.prototype.put = function (key, value) { + throw new java.lang.UnsupportedOperationException("Put not supported on this map"); + }; + /** + * + * @param {*} map + */ + AbstractMap.prototype.putAll = function (map) { + javaemul.internal.InternalPreconditions.checkNotNull(map); + for (var index145 = map.entrySet().iterator(); index145.hasNext();) { + var e = index145.next(); + { + this.put(e.getKey(), e.getValue()); + } + } + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractMap.prototype.remove = function (key) { + return (AbstractMap.getEntryValueOrNull(this.implFindEntry(key, true))); + }; + /** + * + * @return {number} + */ + AbstractMap.prototype.size = function () { + return this.entrySet().size(); + }; + AbstractMap.prototype.toString$ = function () { + var joiner = new java.util.StringJoiner(", ", "{", "}"); + for (var index146 = this.entrySet().iterator(); index146.hasNext();) { + var entry = index146.next(); + { + joiner.add(this.toString$java_util_Map_Entry(entry)); + } + } + return joiner.toString(); + }; + AbstractMap.prototype.toString$java_util_Map_Entry = function (entry) { + return this.toString$java_lang_Object(entry.getKey()) + "=" + this.toString$java_lang_Object(entry.getValue()); + }; + AbstractMap.prototype.toString = function (entry) { + if (((entry != null && (entry["__interfaces"] != null && entry["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || entry.constructor != null && entry.constructor["__interfaces"] != null && entry.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0)) || entry === null)) { + return this.toString$java_util_Map_Entry(entry); + } + else if (((entry != null) || entry === null)) { + return this.toString$java_lang_Object(entry); + } + else if (entry === undefined) { + return this.toString$(); + } + else + throw new Error('invalid overload'); + }; + AbstractMap.prototype.toString$java_lang_Object = function (o) { + return o === this ? "(this Map)" : /* valueOf */ new String(o).toString(); + }; + /** + * + * @return {*} + */ + AbstractMap.prototype.values = function () { + return new AbstractMap.AbstractMap$1(this); + }; + AbstractMap.getEntryKeyOrNull = function (entry) { + return entry == null ? null : entry.getKey(); + }; + AbstractMap.getEntryValueOrNull = function (entry) { + return entry == null ? null : entry.getValue(); + }; + AbstractMap.prototype.implFindEntry = function (key, remove) { + for (var iter = this.entrySet().iterator(); iter.hasNext();) { + { + var entry = iter.next(); + var k = entry.getKey(); + if (java.util.Objects.equals(key, k)) { + if (remove) { + entry = (new AbstractMap.SimpleEntry(entry.getKey(), entry.getValue())); + iter.remove(); + } + return entry; + } + } + ; + } + return null; + }; + return AbstractMap; + }()); + util.AbstractMap = AbstractMap; + AbstractMap["__class"] = "java.util.AbstractMap"; + AbstractMap["__interfaces"] = ["java.util.Map"]; + (function (AbstractMap) { + /** + * Basic {@link Map.Entry} implementation used by {@link SimpleEntry} and + * {@link SimpleImmutableEntry}. + * @class + */ + var AbstractEntry = /** @class */ (function () { + function AbstractEntry(key, value) { + if (this.key === undefined) { + this.key = null; + } + if (this.value === undefined) { + this.value = null; + } + this.key = key; + this.value = value; + } + /** + * + * @return {*} + */ + AbstractEntry.prototype.getKey = function () { + return this.key; + }; + /** + * + * @return {*} + */ + AbstractEntry.prototype.getValue = function () { + return this.value; + }; + /** + * + * @param {*} value + * @return {*} + */ + AbstractEntry.prototype.setValue = function (value) { + var oldValue = this.value; + this.value = value; + return oldValue; + }; + /** + * + * @param {*} other + * @return {boolean} + */ + AbstractEntry.prototype.equals = function (other) { + if (!(other != null && (other["__interfaces"] != null && other["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || other.constructor != null && other.constructor["__interfaces"] != null && other.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0))) { + return false; + } + var entry = other; + return java.util.Objects.equals(this.key, entry.getKey()) && java.util.Objects.equals(this.value, entry.getValue()); + }; + /** + * Calculate the hash code using Sun's specified algorithm. + * @return {number} + */ + AbstractEntry.prototype.hashCode = function () { + return java.util.Objects.hashCode(this.key) ^ java.util.Objects.hashCode(this.value); + }; + /** + * + * @return {string} + */ + AbstractEntry.prototype.toString = function () { + return this.key + "=" + this.value; + }; + return AbstractEntry; + }()); + AbstractMap.AbstractEntry = AbstractEntry; + AbstractEntry["__class"] = "java.util.AbstractMap.AbstractEntry"; + AbstractEntry["__interfaces"] = ["java.util.Map.Entry"]; + /** + * A mutable {@link Map.Entry} shared by several {@link Map} + * implementations. + * @param {*} key + * @param {*} value + * @class + * @extends java.util.AbstractMap.AbstractEntry + */ + var SimpleEntry = /** @class */ (function (_super) { + __extends(SimpleEntry, _super); + function SimpleEntry(key, value) { + var _this = this; + if (((key != null) || key === null) && ((value != null) || value === null)) { + var __args = arguments; + _this = _super.call(this, key, value) || this; + } + else if (((key != null && (key["__interfaces"] != null && key["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || key.constructor != null && key.constructor["__interfaces"] != null && key.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0)) || key === null) && value === undefined) { + var __args = arguments; + var entry = __args[0]; + _this = _super.call(this, entry.getKey(), entry.getValue()) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return SimpleEntry; + }(AbstractMap.AbstractEntry)); + AbstractMap.SimpleEntry = SimpleEntry; + SimpleEntry["__class"] = "java.util.AbstractMap.SimpleEntry"; + SimpleEntry["__interfaces"] = ["java.util.Map.Entry"]; + /** + * An immutable {@link Map.Entry} shared by several {@link Map} + * implementations. + * @param {*} key + * @param {*} value + * @class + * @extends java.util.AbstractMap.AbstractEntry + */ + var SimpleImmutableEntry = /** @class */ (function (_super) { + __extends(SimpleImmutableEntry, _super); + function SimpleImmutableEntry(key, value) { + var _this = this; + if (((key != null) || key === null) && ((value != null) || value === null)) { + var __args = arguments; + _this = _super.call(this, key, value) || this; + } + else if (((key != null && (key["__interfaces"] != null && key["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || key.constructor != null && key.constructor["__interfaces"] != null && key.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0)) || key === null) && value === undefined) { + var __args = arguments; + var entry = __args[0]; + _this = _super.call(this, entry.getKey(), entry.getValue()) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + /** + * + * @param {*} value + * @return {*} + */ + SimpleImmutableEntry.prototype.setValue = function (value) { + throw new java.lang.UnsupportedOperationException(); + }; + return SimpleImmutableEntry; + }(AbstractMap.AbstractEntry)); + AbstractMap.SimpleImmutableEntry = SimpleImmutableEntry; + SimpleImmutableEntry["__class"] = "java.util.AbstractMap.SimpleImmutableEntry"; + SimpleImmutableEntry["__interfaces"] = ["java.util.Map.Entry"]; + var AbstractMap$0 = /** @class */ (function (_super) { + __extends(AbstractMap$0, _super); + function AbstractMap$0(__parent) { + var _this = _super.call(this) || this; + _this.__parent = __parent; + return _this; + } + /** + * + */ + AbstractMap$0.prototype.clear = function () { + this.clear(); + }; + /** + * + * @param {*} key + * @return {boolean} + */ + AbstractMap$0.prototype.contains = function (key) { + return this.__parent.containsKey(key); + }; + /** + * + * @return {*} + */ + AbstractMap$0.prototype.iterator = function () { + var outerIter = this.__parent.entrySet().iterator(); + return new AbstractMap$0.AbstractMap$0$0(this, outerIter); + }; + /** + * + * @param {*} key + * @return {boolean} + */ + AbstractMap$0.prototype.remove = function (key) { + if (this.__parent.containsKey(key)) { + this.remove(key); + return true; + } + return false; + }; + /** + * + * @return {number} + */ + AbstractMap$0.prototype.size = function () { + return this.size(); + }; + return AbstractMap$0; + }(java.util.AbstractSet)); + AbstractMap.AbstractMap$0 = AbstractMap$0; + AbstractMap$0["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + (function (AbstractMap$0) { + var AbstractMap$0$0 = /** @class */ (function () { + function AbstractMap$0$0(__parent, outerIter) { + this.outerIter = outerIter; + this.__parent = __parent; + } + /* Default method injected from java.util.Iterator */ + AbstractMap$0$0.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + AbstractMap$0$0.prototype.hasNext = function () { + return this.outerIter.hasNext(); + }; + /** + * + * @return {*} + */ + AbstractMap$0$0.prototype.next = function () { + var entry = this.outerIter.next(); + return entry.getKey(); + }; + /** + * + */ + AbstractMap$0$0.prototype.remove = function () { + this.outerIter.remove(); + }; + return AbstractMap$0$0; + }()); + AbstractMap$0.AbstractMap$0$0 = AbstractMap$0$0; + AbstractMap$0$0["__interfaces"] = ["java.util.Iterator"]; + })(AbstractMap$0 = AbstractMap.AbstractMap$0 || (AbstractMap.AbstractMap$0 = {})); + var AbstractMap$1 = /** @class */ (function (_super) { + __extends(AbstractMap$1, _super); + function AbstractMap$1(__parent) { + var _this = _super.call(this) || this; + _this.__parent = __parent; + return _this; + } + /** + * + */ + AbstractMap$1.prototype.clear = function () { + this.clear(); + }; + /** + * + * @param {*} value + * @return {boolean} + */ + AbstractMap$1.prototype.contains = function (value) { + return this.__parent.containsValue(value); + }; + /** + * + * @return {*} + */ + AbstractMap$1.prototype.iterator = function () { + var outerIter = this.__parent.entrySet().iterator(); + return new AbstractMap$1.AbstractMap$1$0(this, outerIter); + }; + /** + * + * @return {number} + */ + AbstractMap$1.prototype.size = function () { + return this.size(); + }; + return AbstractMap$1; + }(java.util.AbstractCollection)); + AbstractMap.AbstractMap$1 = AbstractMap$1; + AbstractMap$1["__interfaces"] = ["java.util.Collection", "java.lang.Iterable"]; + (function (AbstractMap$1) { + var AbstractMap$1$0 = /** @class */ (function () { + function AbstractMap$1$0(__parent, outerIter) { + this.outerIter = outerIter; + this.__parent = __parent; + } + /* Default method injected from java.util.Iterator */ + AbstractMap$1$0.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + AbstractMap$1$0.prototype.hasNext = function () { + return this.outerIter.hasNext(); + }; + /** + * + * @return {*} + */ + AbstractMap$1$0.prototype.next = function () { + var entry = this.outerIter.next(); + return entry.getValue(); + }; + /** + * + */ + AbstractMap$1$0.prototype.remove = function () { + this.outerIter.remove(); + }; + return AbstractMap$1$0; + }()); + AbstractMap$1.AbstractMap$1$0 = AbstractMap$1$0; + AbstractMap$1$0["__interfaces"] = ["java.util.Iterator"]; + })(AbstractMap$1 = AbstractMap.AbstractMap$1 || (AbstractMap.AbstractMap$1 = {})); + })(AbstractMap = util.AbstractMap || (util.AbstractMap = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Implements a set in terms of a hash table. [Sun + * docs] + * + * @param element type. + * @param {number} initialCapacity + * @param {number} loadFactor + * @class + * @extends java.util.AbstractSet + */ + var HashSet = /** @class */ (function (_super) { + __extends(HashSet, _super); + function HashSet(initialCapacity, loadFactor) { + var _this = this; + if (((typeof initialCapacity === 'number') || initialCapacity === null) && ((typeof loadFactor === 'number') || loadFactor === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.map = (new java.util.HashMap(initialCapacity, loadFactor)); + } + else if (((initialCapacity != null && (initialCapacity["__interfaces"] != null && initialCapacity["__interfaces"].indexOf("java.util.Collection") >= 0 || initialCapacity.constructor != null && initialCapacity.constructor["__interfaces"] != null && initialCapacity.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || initialCapacity === null) && loadFactor === undefined) { + var __args = arguments; + var c = __args[0]; + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.map = (new java.util.HashMap(c.size())); + _this.addAll(c); + } + else if (((initialCapacity != null && initialCapacity instanceof java.util.HashMap) || initialCapacity === null) && loadFactor === undefined) { + var __args = arguments; + var map = __args[0]; + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.map = map; + } + else if (((typeof initialCapacity === 'number') || initialCapacity === null) && loadFactor === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.map = (new java.util.HashMap(initialCapacity)); + } + else if (initialCapacity === undefined && loadFactor === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.map = (new java.util.HashMap()); + } + else + throw new Error('invalid overload'); + return _this; + } + /* Default method injected from java.util.Collection */ + HashSet.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_12 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_12(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + HashSet.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + HashSet.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + HashSet.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_13 = function (index147) { + var t = index147.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index147 = this.iterator(); index147.hasNext();) { + _loop_13(index147); + } + }; + /** + * + * @param {*} o + * @return {boolean} + */ + HashSet.prototype.add = function (o) { + var old = this.map.put(o, this); + return (old == null); + }; + /** + * + */ + HashSet.prototype.clear = function () { + this.map.clear(); + }; + HashSet.prototype.clone = function () { + return (new HashSet(this)); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + HashSet.prototype.contains = function (o) { + return this.map.containsKey(o); + }; + /** + * + * @return {boolean} + */ + HashSet.prototype.isEmpty = function () { + return this.map.isEmpty(); + }; + /** + * + * @return {*} + */ + HashSet.prototype.iterator = function () { + return this.map.keySet().iterator(); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + HashSet.prototype.remove = function (o) { + return (this.map.remove(o) != null); + }; + /** + * + * @return {number} + */ + HashSet.prototype.size = function () { + return this.map.size(); + }; + /** + * + * @return {string} + */ + HashSet.prototype.toString = function () { + return this.map.keySet().toString(); + }; + return HashSet; + }(java.util.AbstractSet)); + util.HashSet = HashSet; + HashSet["__class"] = "java.util.HashSet"; + HashSet["__interfaces"] = ["java.lang.Cloneable", "java.util.Collection", "java.util.Set", "java.lang.Iterable", "java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * A {@link java.util.Set} of {@link Enum}s. [Sun + * docs] + * + * @param enumeration type + * @extends java.util.AbstractSet + * @class + */ + var EnumSet = /** @class */ (function (_super) { + __extends(EnumSet, _super); + function EnumSet() { + return _super.call(this) || this; + } + EnumSet.allOf = function (elementType) { + var all = elementType.getEnumConstants(); + var set = javaemul.internal.ArrayHelper.clone(all, 0, all.length); + return (new EnumSet.EnumSetImpl(all, set, all.length)); + }; + EnumSet.complementOf = function (other) { + var s = other; + var all = s.all; + var oldSet = s.set; + var newSet = javaemul.internal.ArrayHelper.createFrom(oldSet, oldSet.length); + for (var i = 0, c = oldSet.length; i < c; ++i) { + { + if (oldSet[i] == null) { + newSet[i] = all[i]; + } + } + ; + } + return (new EnumSet.EnumSetImpl(all, newSet, all.length - s.__size)); + }; + EnumSet.copyOf$java_util_Collection = function (c) { + if (c != null && c instanceof java.util.EnumSet) { + return EnumSet.copyOf$java_util_Collection(c); + } + javaemul.internal.InternalPreconditions.checkArgument(!c.isEmpty(), "Collection is empty"); + var iterator = c.iterator(); + var first = iterator.next(); + var set = EnumSet.of(first); + while ((iterator.hasNext())) { + { + var e = iterator.next(); + set.add(e); + } + } + ; + return set; + }; + EnumSet.copyOf$java_util_EnumSet = function (s) { + return /* clone */ (function (o) { if (o.clone != undefined) { + return o.clone(); + } + else { + var clone = Object.create(o); + for (var p in o) { + if (o.hasOwnProperty(p)) + clone[p] = o[p]; + } + return clone; + } })(s); + }; + EnumSet.copyOf = function (s) { + if (((s != null && s instanceof java.util.EnumSet) || s === null)) { + return java.util.EnumSet.copyOf$java_util_EnumSet(s); + } + else if (((s != null && (s["__interfaces"] != null && s["__interfaces"].indexOf("java.util.Collection") >= 0 || s.constructor != null && s.constructor["__interfaces"] != null && s.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || s === null)) { + return java.util.EnumSet.copyOf$java_util_Collection(s); + } + else + throw new Error('invalid overload'); + }; + EnumSet.noneOf = function (elementType) { + var all = elementType.getEnumConstants(); + return (new EnumSet.EnumSetImpl(all, javaemul.internal.ArrayHelper.createFrom(all, all.length), 0)); + }; + EnumSet.ofOne = function (first) { + var set = EnumSet.noneOf(first.getDeclaringClass()); + set.add(first); + return set; + }; + EnumSet.of = function (first) { + var _a; + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } + var set = EnumSet.ofOne(first); + (_a = java.util.Collections).addAll.apply(_a, __spreadArrays([set], rest)); + return set; + }; + EnumSet.range = function (from, to) { + javaemul.internal.InternalPreconditions.checkArgument(from.compareTo(to) <= 0, "%s > %s", from, to); + var all = from.getDeclaringClass().getEnumConstants(); + var set = javaemul.internal.ArrayHelper.createFrom(all, all.length); + var start = from.ordinal(); + var end = to.ordinal() + 1; + for (var i = start; i < end; ++i) { + { + set[i] = all[i]; + } + ; + } + return (new EnumSet.EnumSetImpl(all, set, end - start)); + }; + return EnumSet; + }(java.util.AbstractSet)); + util.EnumSet = EnumSet; + EnumSet["__class"] = "java.util.EnumSet"; + EnumSet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + (function (EnumSet) { + /** + * Constructs a set taking ownership of the specified set. The size must + * accurately reflect the number of non-null items in set. + * @param {Array} all + * @param {Array} set + * @param {number} size + * @class + * @extends java.util.EnumSet + */ + var EnumSetImpl = /** @class */ (function (_super) { + __extends(EnumSetImpl, _super); + function EnumSetImpl(all, set, size) { + var _this = _super.call(this) || this; + if (_this.all === undefined) { + _this.all = null; + } + if (_this.set === undefined) { + _this.set = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + _this.all = all; + _this.set = set; + _this.__size = size; + return _this; + } + EnumSetImpl.prototype.add$java_lang_Enum = function (e) { + javaemul.internal.InternalPreconditions.checkNotNull(e); + var ordinal = e.ordinal(); + if (this.set[ordinal] == null) { + this.set[ordinal] = e; + ++this.__size; + return true; + } + return false; + }; + /** + * + * @param {java.lang.Enum} e + * @return {boolean} + */ + EnumSetImpl.prototype.add = function (e) { + if (((e != null) || e === null)) { + return this.add$java_lang_Enum(e); + } + else if (((e != null) || e === null)) { + return _super.prototype.add.call(this, e); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {java.util.EnumSet} + */ + EnumSetImpl.prototype.clone = function () { + var clonedSet = javaemul.internal.ArrayHelper.clone(this.set, 0, this.set.length); + return (new EnumSet.EnumSetImpl(this.all, clonedSet, this.__size)); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + EnumSetImpl.prototype.contains = function (o) { + return (o != null && o instanceof java.lang.Enum) && this.containsEnum(o); + }; + EnumSetImpl.prototype.containsEnum = function (e) { + return e != null && this.set[e.ordinal()] === e; + }; + /** + * + * @return {*} + */ + EnumSetImpl.prototype.iterator = function () { + return new EnumSetImpl.IteratorImpl(this); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + EnumSetImpl.prototype.remove = function (o) { + return (o != null && o instanceof java.lang.Enum) && this.removeEnum(o); + }; + EnumSetImpl.prototype.removeEnum = function (e) { + if (e != null && this.set[e.ordinal()] === e) { + this.set[e.ordinal()] = null; + --this.__size; + return true; + } + return false; + }; + /** + * + * @return {number} + */ + EnumSetImpl.prototype.size = function () { + return this.__size; + }; + /** + * + * @return {number} + */ + EnumSetImpl.prototype.capacity = function () { + return this.all.length; + }; + return EnumSetImpl; + }(java.util.EnumSet)); + EnumSet.EnumSetImpl = EnumSetImpl; + EnumSetImpl["__class"] = "java.util.EnumSet.EnumSetImpl"; + EnumSetImpl["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + (function (EnumSetImpl) { + var IteratorImpl = /** @class */ (function () { + function IteratorImpl(__parent) { + this.__parent = __parent; + this.i = -1; + this.last = -1; + this.findNext(); + } + /* Default method injected from java.util.Iterator */ + IteratorImpl.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + IteratorImpl.prototype.hasNext = function () { + return this.i < this.__parent.capacity(); + }; + /** + * + * @return {java.lang.Enum} + */ + IteratorImpl.prototype.next = function () { + javaemul.internal.InternalPreconditions.checkElement(this.hasNext()); + this.last = this.i; + this.findNext(); + return this.__parent.set[this.last]; + }; + /** + * + */ + IteratorImpl.prototype.remove = function () { + javaemul.internal.InternalPreconditions.checkState(this.last !== -1); + this.__parent.set[this.last] = null; + --this.__parent.__size; + this.last = -1; + }; + IteratorImpl.prototype.findNext = function () { + ++this.i; + for (var c = this.__parent.capacity(); this.i < c; ++this.i) { + { + if (this.__parent.set[this.i] != null) { + return; + } + } + ; + } + }; + return IteratorImpl; + }()); + EnumSetImpl.IteratorImpl = IteratorImpl; + IteratorImpl["__class"] = "java.util.EnumSet.EnumSetImpl.IteratorImpl"; + IteratorImpl["__interfaces"] = ["java.util.Iterator"]; + })(EnumSetImpl = EnumSet.EnumSetImpl || (EnumSet.EnumSetImpl = {})); + })(EnumSet = util.EnumSet || (util.EnumSet = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Implements a set using a TreeMap. [Sun + * docs] + * + * @param element type. + * @param {*} c + * @class + * @extends java.util.AbstractSet + */ + var TreeSet = /** @class */ (function (_super) { + __extends(TreeSet, _super); + function TreeSet(c) { + var _this = this; + if (((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.Collection") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || c === null)) { + var __args = arguments; + { + var __args_24 = arguments; + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + _this.map = (new java.util.TreeMap()); + } + if (_this.map === undefined) { + _this.map = null; + } + (function () { + _this.addAll(c); + })(); + } + else if (((typeof c === 'function' && c.length === 2) || c === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + _this.map = (new java.util.TreeMap((c))); + } + else if (((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.SortedSet") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.SortedSet") >= 0)) || c === null)) { + var __args = arguments; + var s_1 = __args[0]; + { + var __args_25 = arguments; + var c_1 = javaemul.internal.InternalPreconditions.checkNotNull(s_1).comparator(); + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + _this.map = (new java.util.TreeMap((c_1))); + } + if (_this.map === undefined) { + _this.map = null; + } + (function () { + _this.addAll(s_1); + })(); + } + else if (((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.NavigableMap") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.NavigableMap") >= 0)) || c === null)) { + var __args = arguments; + var map = __args[0]; + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + _this.map = map; + } + else if (c === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + _this.map = (new java.util.TreeMap()); + } + else + throw new Error('invalid overload'); + return _this; + } + /* Default method injected from java.util.Collection */ + TreeSet.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_14 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_14(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + TreeSet.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + TreeSet.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + TreeSet.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_15 = function (index148) { + var t = index148.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index148 = this.iterator(); index148.hasNext();) { + _loop_15(index148); + } + }; + /** + * + * @param {*} o + * @return {boolean} + */ + TreeSet.prototype.add = function (o) { + return this.map.put(o, javaemul.internal.BooleanHelper.FALSE) == null; + }; + /** + * + * @param {*} e + * @return {*} + */ + TreeSet.prototype.ceiling = function (e) { + return this.map.ceilingKey(e); + }; + /** + * + */ + TreeSet.prototype.clear = function () { + this.map.clear(); + }; + /** + * + * @return {*} + */ + TreeSet.prototype.comparator = function () { + return (this.map.comparator()); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + TreeSet.prototype.contains = function (o) { + return this.map.containsKey(o); + }; + /** + * + * @return {*} + */ + TreeSet.prototype.descendingIterator = function () { + return this.descendingSet().iterator(); + }; + /** + * + * @return {*} + */ + TreeSet.prototype.descendingSet = function () { + return (new TreeSet(this.map.descendingMap())); + }; + /** + * + * @return {*} + */ + TreeSet.prototype.first = function () { + return this.map.firstKey(); + }; + /** + * + * @param {*} e + * @return {*} + */ + TreeSet.prototype.floor = function (e) { + return this.map.floorKey(e); + }; + TreeSet.prototype.headSet$java_lang_Object = function (toElement) { + return this.headSet(toElement, false); + }; + TreeSet.prototype.headSet$java_lang_Object$boolean = function (toElement, inclusive) { + return (new TreeSet(this.map.headMap(toElement, inclusive))); + }; + /** + * + * @param {*} toElement + * @param {boolean} inclusive + * @return {*} + */ + TreeSet.prototype.headSet = function (toElement, inclusive) { + if (((toElement != null) || toElement === null) && ((typeof inclusive === 'boolean') || inclusive === null)) { + return this.headSet$java_lang_Object$boolean(toElement, inclusive); + } + else if (((toElement != null) || toElement === null) && inclusive === undefined) { + return this.headSet$java_lang_Object(toElement); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} e + * @return {*} + */ + TreeSet.prototype.higher = function (e) { + return this.map.higherKey(e); + }; + /** + * + * @return {*} + */ + TreeSet.prototype.iterator = function () { + return this.map.keySet().iterator(); + }; + /** + * + * @return {*} + */ + TreeSet.prototype.last = function () { + return this.map.lastKey(); + }; + /** + * + * @param {*} e + * @return {*} + */ + TreeSet.prototype.lower = function (e) { + return this.map.lowerKey(e); + }; + /** + * + * @return {*} + */ + TreeSet.prototype.pollFirst = function () { + return (java.util.AbstractMap.getEntryKeyOrNull(this.map.pollFirstEntry())); + }; + /** + * + * @return {*} + */ + TreeSet.prototype.pollLast = function () { + return (java.util.AbstractMap.getEntryKeyOrNull(this.map.pollLastEntry())); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + TreeSet.prototype.remove = function (o) { + return this.map.remove(o) != null; + }; + /** + * + * @return {number} + */ + TreeSet.prototype.size = function () { + return this.map.size(); + }; + TreeSet.prototype.subSet$java_lang_Object$boolean$java_lang_Object$boolean = function (fromElement, fromInclusive, toElement, toInclusive) { + return (new TreeSet(this.map.subMap(fromElement, fromInclusive, toElement, toInclusive))); + }; + /** + * + * @param {*} fromElement + * @param {boolean} fromInclusive + * @param {*} toElement + * @param {boolean} toInclusive + * @return {*} + */ + TreeSet.prototype.subSet = function (fromElement, fromInclusive, toElement, toInclusive) { + if (((fromElement != null) || fromElement === null) && ((typeof fromInclusive === 'boolean') || fromInclusive === null) && ((toElement != null) || toElement === null) && ((typeof toInclusive === 'boolean') || toInclusive === null)) { + return this.subSet$java_lang_Object$boolean$java_lang_Object$boolean(fromElement, fromInclusive, toElement, toInclusive); + } + else if (((fromElement != null) || fromElement === null) && ((fromInclusive != null) || fromInclusive === null) && toElement === undefined && toInclusive === undefined) { + return this.subSet$java_lang_Object$java_lang_Object(fromElement, fromInclusive); + } + else + throw new Error('invalid overload'); + }; + TreeSet.prototype.subSet$java_lang_Object$java_lang_Object = function (fromElement, toElement) { + return this.subSet(fromElement, true, toElement, false); + }; + TreeSet.prototype.tailSet$java_lang_Object = function (fromElement) { + return this.tailSet(fromElement, true); + }; + TreeSet.prototype.tailSet$java_lang_Object$boolean = function (fromElement, inclusive) { + return (new TreeSet(this.map.tailMap(fromElement, inclusive))); + }; + /** + * + * @param {*} fromElement + * @param {boolean} inclusive + * @return {*} + */ + TreeSet.prototype.tailSet = function (fromElement, inclusive) { + if (((fromElement != null) || fromElement === null) && ((typeof inclusive === 'boolean') || inclusive === null)) { + return this.tailSet$java_lang_Object$boolean(fromElement, inclusive); + } + else if (((fromElement != null) || fromElement === null) && inclusive === undefined) { + return this.tailSet$java_lang_Object(fromElement); + } + else + throw new Error('invalid overload'); + }; + return TreeSet; + }(java.util.AbstractSet)); + util.TreeSet = TreeSet; + TreeSet["__class"] = "java.util.TreeSet"; + TreeSet["__interfaces"] = ["java.util.SortedSet", "java.util.Collection", "java.util.Set", "java.util.NavigableSet", "java.lang.Iterable", "java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Capacity increment is ignored. + * @param {number} initialCapacity + * @param {number} ignoredCapacityIncrement + * @class + * @extends java.util.AbstractList + */ + var Vector = /** @class */ (function (_super) { + __extends(Vector, _super); + function Vector(initialCapacity, ignoredCapacityIncrement) { + var _this = this; + if (((typeof initialCapacity === 'number') || initialCapacity === null) && ((typeof ignoredCapacityIncrement === 'number') || ignoredCapacityIncrement === null)) { + var __args = arguments; + { + var __args_26 = arguments; + _this = _super.call(this) || this; + if (_this.arrayList === undefined) { + _this.arrayList = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.arrayList = (new java.util.ArrayList(initialCapacity)); + } + if (_this.arrayList === undefined) { + _this.arrayList = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + } + else if (((initialCapacity != null && (initialCapacity["__interfaces"] != null && initialCapacity["__interfaces"].indexOf("java.util.Collection") >= 0 || initialCapacity.constructor != null && initialCapacity.constructor["__interfaces"] != null && initialCapacity.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || initialCapacity === null) && ignoredCapacityIncrement === undefined) { + var __args = arguments; + var c = __args[0]; + _this = _super.call(this) || this; + if (_this.arrayList === undefined) { + _this.arrayList = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.arrayList = (new java.util.ArrayList()); + _this.addAll$java_util_Collection(c); + } + else if (((typeof initialCapacity === 'number') || initialCapacity === null) && ignoredCapacityIncrement === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.arrayList === undefined) { + _this.arrayList = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.arrayList = (new java.util.ArrayList(initialCapacity)); + } + else if (initialCapacity === undefined && ignoredCapacityIncrement === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.arrayList === undefined) { + _this.arrayList = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.arrayList = (new java.util.ArrayList()); + } + else + throw new Error('invalid overload'); + return _this; + } + /* Default method injected from java.util.Collection */ + Vector.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_16 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_16(it); + } + return removed; + }; + /* Default method injected from java.util.List */ + Vector.prototype.sort = function (c) { + var a = this.toArray(); + java.util.Arrays.sort(a, (c)); + var i = this.listIterator(); + for (var index149 = 0; index149 < a.length; index149++) { + var e = a[index149]; + { + i.next(); + i.set(e); + } + } + }; + /* Default method injected from java.util.Collection */ + Vector.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + Vector.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + Vector.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_17 = function (index150) { + var t = index150.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index150 = this.iterator(); index150.hasNext();) { + _loop_17(index150); + } + }; + Vector.prototype.add$java_lang_Object = function (o) { + return this.arrayList.add(o); + }; + Vector.prototype.add$int$java_lang_Object = function (index, o) { + Vector.checkArrayElementIndex(index, this.size() + 1); + this.arrayList.add(index, o); + }; + /** + * + * @param {number} index + * @param {*} o + */ + Vector.prototype.add = function (index, o) { + if (((typeof index === 'number') || index === null) && ((o != null) || o === null)) { + return this.add$int$java_lang_Object(index, o); + } + else if (((index != null) || index === null) && o === undefined) { + return this.add$java_lang_Object(index); + } + else + throw new Error('invalid overload'); + }; + Vector.prototype.addAll$java_util_Collection = function (c) { + return this.arrayList.addAll$java_util_Collection(c); + }; + Vector.prototype.addAll$int$java_util_Collection = function (index, c) { + return this.arrayList.addAll$int$java_util_Collection(index, c); + }; + /** + * + * @param {number} index + * @param {*} c + * @return {boolean} + */ + Vector.prototype.addAll = function (index, c) { + if (((typeof index === 'number') || index === null) && ((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.Collection") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || c === null)) { + return this.addAll$int$java_util_Collection(index, c); + } + else if (((index != null && (index["__interfaces"] != null && index["__interfaces"].indexOf("java.util.Collection") >= 0 || index.constructor != null && index.constructor["__interfaces"] != null && index.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || index === null) && c === undefined) { + return this.addAll$java_util_Collection(index); + } + else + throw new Error('invalid overload'); + }; + Vector.prototype.addElement = function (o) { + this.add(o); + }; + Vector.prototype.capacity = function () { + return this.arrayList.size(); + }; + /** + * + */ + Vector.prototype.clear = function () { + this.arrayList.clear(); + }; + Vector.prototype.clone = function () { + return (new Vector(this)); + }; + /** + * + * @param {*} elem + * @return {boolean} + */ + Vector.prototype.contains = function (elem) { + return this.arrayList.contains(elem); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + Vector.prototype.containsAll = function (c) { + return this.arrayList.containsAll(c); + }; + Vector.prototype.copyInto = function (objs) { + var i = -1; + var n = this.size(); + while ((++i < n)) { + { + objs[i] = this.get(i); + } + } + ; + }; + Vector.prototype.elementAt = function (index) { + return this.get(index); + }; + Vector.prototype.elements = function () { + return java.util.Collections.enumeration(this.arrayList); + }; + Vector.prototype.ensureCapacity = function (capacity) { + this.arrayList.ensureCapacity(capacity); + }; + Vector.prototype.firstElement = function () { + javaemul.internal.InternalPreconditions.checkElement(!this.isEmpty()); + return this.get(0); + }; + /** + * + * @param {number} index + * @return {*} + */ + Vector.prototype.get = function (index) { + Vector.checkArrayElementIndex(index, this.size()); + return this.arrayList.get(index); + }; + Vector.prototype.indexOf$java_lang_Object = function (elem) { + return this.arrayList.indexOf$java_lang_Object(elem); + }; + Vector.prototype.indexOf$java_lang_Object$int = function (elem, index) { + Vector.checkArrayIndexOutOfBounds(index >= 0, index); + return this.arrayList.indexOf$java_lang_Object$int(elem, index); + }; + Vector.prototype.indexOf = function (elem, index) { + if (((elem != null) || elem === null) && ((typeof index === 'number') || index === null)) { + return this.indexOf$java_lang_Object$int(elem, index); + } + else if (((elem != null) || elem === null) && index === undefined) { + return this.indexOf$java_lang_Object(elem); + } + else + throw new Error('invalid overload'); + }; + Vector.prototype.insertElementAt = function (o, index) { + this.add(index, o); + }; + /** + * + * @return {boolean} + */ + Vector.prototype.isEmpty = function () { + return (this.arrayList.size() === 0); + }; + /** + * + * @return {*} + */ + Vector.prototype.iterator = function () { + return this.arrayList.iterator(); + }; + Vector.prototype.lastElement = function () { + javaemul.internal.InternalPreconditions.checkElement(!this.isEmpty()); + return this.get(this.size() - 1); + }; + Vector.prototype.lastIndexOf$java_lang_Object = function (o) { + return this.arrayList.lastIndexOf$java_lang_Object(o); + }; + Vector.prototype.lastIndexOf$java_lang_Object$int = function (o, index) { + Vector.checkArrayIndexOutOfBounds(index < this.size(), index); + return this.arrayList.lastIndexOf$java_lang_Object$int(o, index); + }; + Vector.prototype.lastIndexOf = function (o, index) { + if (((o != null) || o === null) && ((typeof index === 'number') || index === null)) { + return this.lastIndexOf$java_lang_Object$int(o, index); + } + else if (((o != null) || o === null) && index === undefined) { + return this.lastIndexOf$java_lang_Object(o); + } + else + throw new Error('invalid overload'); + }; + Vector.prototype.remove$int = function (index) { + Vector.checkArrayElementIndex(index, this.size()); + return this.arrayList.remove$int(index); + }; + /** + * + * @param {number} index + * @return {*} + */ + Vector.prototype.remove = function (index) { + if (((typeof index === 'number') || index === null)) { + return this.remove$int(index); + } + else if (((index != null) || index === null)) { + return _super.prototype.remove.call(this, index); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + Vector.prototype.removeAll = function (c) { + return this.arrayList.removeAll(c); + }; + Vector.prototype.removeAllElements = function () { + this.clear(); + }; + Vector.prototype.removeElement = function (o) { + return this.remove(o); + }; + Vector.prototype.removeElementAt = function (index) { + this.remove$int(index); + }; + /** + * + * @param {number} index + * @param {*} elem + * @return {*} + */ + Vector.prototype.set = function (index, elem) { + Vector.checkArrayElementIndex(index, this.size()); + return this.arrayList.set(index, elem); + }; + Vector.prototype.setElementAt = function (o, index) { + this.set(index, o); + }; + Vector.prototype.setSize = function (size) { + Vector.checkArrayIndexOutOfBounds(size >= 0, size); + this.arrayList.setSize(size); + }; + /** + * + * @return {number} + */ + Vector.prototype.size = function () { + return this.arrayList.size(); + }; + /** + * + * @param {number} fromIndex + * @param {number} toIndex + * @return {*} + */ + Vector.prototype.subList = function (fromIndex, toIndex) { + return this.arrayList.subList(fromIndex, toIndex); + }; + Vector.prototype.toArray$ = function () { + return this.arrayList.toArray$(); + }; + Vector.prototype.toArray$java_lang_Object_A = function (a) { + return this.arrayList.toArray$java_lang_Object_A(a); + }; + /** + * + * @param {Array} a + * @return {Array} + */ + Vector.prototype.toArray = function (a) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null)) { + return this.toArray$java_lang_Object_A(a); + } + else if (a === undefined) { + return this.toArray$(); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {string} + */ + Vector.prototype.toString = function () { + return this.arrayList.toString(); + }; + Vector.prototype.trimToSize = function () { + this.arrayList.trimToSize(); + }; + /** + * + * @param {number} fromIndex + * @param {number} endIndex + */ + Vector.prototype.removeRange = function (fromIndex, endIndex) { + this.arrayList.removeRange(fromIndex, endIndex); + }; + /*private*/ Vector.checkArrayElementIndex = function (index, size) { + if (index < 0 || index >= size) { + throw new java.lang.ArrayIndexOutOfBoundsException(); + } + }; + /*private*/ Vector.checkArrayIndexOutOfBounds = function (expression, index) { + if (!expression) { + throw new java.lang.ArrayIndexOutOfBoundsException(/* valueOf */ new String(index).toString()); + } + }; + return Vector; + }(java.util.AbstractList)); + util.Vector = Vector; + Vector["__class"] = "java.util.Vector"; + Vector["__interfaces"] = ["java.util.RandomAccess", "java.util.List", "java.lang.Cloneable", "java.util.Collection", "java.lang.Iterable", "java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Skeletal implementation of the List interface. [Sun + * docs] + * + * @param element type. + * @extends java.util.AbstractList + * @class + */ + var AbstractSequentialList = /** @class */ (function (_super) { + __extends(AbstractSequentialList, _super); + function AbstractSequentialList() { + return _super.call(this) || this; + } + AbstractSequentialList.prototype.add$int$java_lang_Object = function (index, element) { + var iter = this.listIterator$int(index); + iter.add(element); + }; + /** + * + * @param {number} index + * @param {*} element + */ + AbstractSequentialList.prototype.add = function (index, element) { + if (((typeof index === 'number') || index === null) && ((element != null) || element === null)) { + return this.add$int$java_lang_Object(index, element); + } + else if (((index != null) || index === null) && element === undefined) { + return this.add$java_lang_Object(index); + } + else + throw new Error('invalid overload'); + }; + AbstractSequentialList.prototype.addAll$int$java_util_Collection = function (index, c) { + javaemul.internal.InternalPreconditions.checkNotNull(c); + var modified = false; + var iter = this.listIterator$int(index); + for (var index151 = c.iterator(); index151.hasNext();) { + var e = index151.next(); + { + iter.add(e); + modified = true; + } + } + return modified; + }; + /** + * + * @param {number} index + * @param {*} c + * @return {boolean} + */ + AbstractSequentialList.prototype.addAll = function (index, c) { + if (((typeof index === 'number') || index === null) && ((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.Collection") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || c === null)) { + return this.addAll$int$java_util_Collection(index, c); + } + else if (((index != null && (index["__interfaces"] != null && index["__interfaces"].indexOf("java.util.Collection") >= 0 || index.constructor != null && index.constructor["__interfaces"] != null && index.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || index === null) && c === undefined) { + return _super.prototype.addAll.call(this, index); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {number} index + * @return {*} + */ + AbstractSequentialList.prototype.get = function (index) { + var iter = this.listIterator$int(index); + try { + return iter.next(); + } + catch (e) { + throw new java.lang.IndexOutOfBoundsException("Can\'t get element " + index); + } + ; + }; + /** + * + * @return {*} + */ + AbstractSequentialList.prototype.iterator = function () { + return this.listIterator$(); + }; + AbstractSequentialList.prototype.listIterator$int = function (index) { throw new Error('cannot invoke abstract overloaded method... check your argument(s) type(s)'); }; + /** + * + * @param {number} index + * @return {*} + */ + AbstractSequentialList.prototype.listIterator = function (index) { + if (((typeof index === 'number') || index === null)) { + return this.listIterator$int(index); + } + else if (index === undefined) { + return this.listIterator$(); + } + else + throw new Error('invalid overload'); + }; + AbstractSequentialList.prototype.remove$int = function (index) { + var iter = this.listIterator$int(index); + try { + var old = iter.next(); + iter.remove(); + return old; + } + catch (e) { + throw new java.lang.IndexOutOfBoundsException("Can\'t remove element " + index); + } + ; + }; + /** + * + * @param {number} index + * @return {*} + */ + AbstractSequentialList.prototype.remove = function (index) { + if (((typeof index === 'number') || index === null)) { + return this.remove$int(index); + } + else if (((index != null) || index === null)) { + return _super.prototype.remove.call(this, index); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {number} index + * @param {*} element + * @return {*} + */ + AbstractSequentialList.prototype.set = function (index, element) { + var iter = this.listIterator$int(index); + try { + var old = iter.next(); + iter.set(element); + return old; + } + catch (e) { + throw new java.lang.IndexOutOfBoundsException("Can\'t set element " + index); + } + ; + }; + return AbstractSequentialList; + }(java.util.AbstractList)); + util.AbstractSequentialList = AbstractSequentialList; + AbstractSequentialList["__class"] = "java.util.AbstractSequentialList"; + AbstractSequentialList["__interfaces"] = ["java.util.List", "java.util.Collection", "java.lang.Iterable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Resizeable array implementation of the List interface. [Sun + * docs] + * + *

+ * This implementation differs from JDK 1.5 ArrayList in terms of + * capacity management. There is no speed advantage to pre-allocating array + * sizes in JavaScript, so this implementation does not include any of the + * capacity and "growth increment" concepts in the standard ArrayList class. + * Although ArrayList(int) accepts a value for the initial + * capacity of the array, this constructor simply delegates to + * ArrayList(). It is only present for compatibility with JDK + * 1.5's API. + *

+ * + * @param the element type. + * @param {*} c + * @class + * @extends java.util.AbstractList + */ + var ArrayList = /** @class */ (function (_super) { + __extends(ArrayList, _super); + function ArrayList(c) { + var _this = this; + if (((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.Collection") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || c === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.array === undefined) { + _this.array = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.array = []; + javaemul.internal.ArrayHelper.insertValuesToArray(_this.array, 0, c['toArray$']()); + } + else if (((typeof c === 'number') || c === null)) { + var __args = arguments; + var initialCapacity = __args[0]; + _this = _super.call(this) || this; + if (_this.array === undefined) { + _this.array = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + javaemul.internal.InternalPreconditions.checkArgument(initialCapacity >= 0, "Initial capacity must not be negative"); + _this.array = []; + } + else if (c === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.array === undefined) { + _this.array = null; + } + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + _this.array = []; + } + else + throw new Error('invalid overload'); + return _this; + } + /* Default method injected from java.util.Collection */ + ArrayList.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_18 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_18(it); + } + return removed; + }; + /* Default method injected from java.util.List */ + ArrayList.prototype.sort = function (c) { + var a = this.toArray(); + java.util.Arrays.sort(a, (c)); + var i = this.listIterator(); + for (var index152 = 0; index152 < a.length; index152++) { + var e = a[index152]; + { + i.next(); + i.set(e); + } + } + }; + /* Default method injected from java.util.Collection */ + ArrayList.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + ArrayList.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + ArrayList.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_19 = function (index153) { + var t = index153.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index153 = this.iterator(); index153.hasNext();) { + _loop_19(index153); + } + }; + ArrayList.prototype.add$java_lang_Object = function (o) { + this.array[this.array.length] = o; + return true; + }; + ArrayList.prototype.add$int$java_lang_Object = function (index, o) { + javaemul.internal.InternalPreconditions.checkPositionIndex(index, this.array.length); + javaemul.internal.ArrayHelper.insertTo$java_lang_Object$int$java_lang_Object(this.array, index, o); + }; + /** + * + * @param {number} index + * @param {*} o + */ + ArrayList.prototype.add = function (index, o) { + if (((typeof index === 'number') || index === null) && ((o != null) || o === null)) { + return this.add$int$java_lang_Object(index, o); + } + else if (((index != null) || index === null) && o === undefined) { + return this.add$java_lang_Object(index); + } + else + throw new Error('invalid overload'); + }; + ArrayList.prototype.addAll$java_util_Collection = function (c) { + var cArray = c['toArray$'](); + var len = cArray.length; + if (len === 0) { + return false; + } + javaemul.internal.ArrayHelper.insertValuesToArray(this.array, this.array.length, cArray); + return true; + }; + ArrayList.prototype.addAll$int$java_util_Collection = function (index, c) { + javaemul.internal.InternalPreconditions.checkPositionIndex(index, this.array.length); + var cArray = c['toArray$'](); + var len = cArray.length; + if (len === 0) { + return false; + } + javaemul.internal.ArrayHelper.insertValuesToArray(this.array, index, cArray); + return true; + }; + /** + * + * @param {number} index + * @param {*} c + * @return {boolean} + */ + ArrayList.prototype.addAll = function (index, c) { + if (((typeof index === 'number') || index === null) && ((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.Collection") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || c === null)) { + return this.addAll$int$java_util_Collection(index, c); + } + else if (((index != null && (index["__interfaces"] != null && index["__interfaces"].indexOf("java.util.Collection") >= 0 || index.constructor != null && index.constructor["__interfaces"] != null && index.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || index === null) && c === undefined) { + return this.addAll$java_util_Collection(index); + } + else + throw new Error('invalid overload'); + }; + /** + * + */ + ArrayList.prototype.clear = function () { + this.array = []; + }; + ArrayList.prototype.clone = function () { + return (new ArrayList(this)); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + ArrayList.prototype.contains = function (o) { + return (this.indexOf$java_lang_Object(o) !== -1); + }; + ArrayList.prototype.ensureCapacity = function (ignored) { + }; + /** + * + * @param {number} index + * @return {*} + */ + ArrayList.prototype.get = function (index) { + javaemul.internal.InternalPreconditions.checkElementIndex(index, this.array.length); + return this.array[index]; + }; + ArrayList.prototype.indexOf$java_lang_Object = function (o) { + return this.indexOf$java_lang_Object$int(o, 0); + }; + /** + * + * @return {*} + */ + ArrayList.prototype.iterator = function () { + return new ArrayList.ArrayList$0(this); + }; + /** + * + * @return {boolean} + */ + ArrayList.prototype.isEmpty = function () { + return this.array.length === 0; + }; + ArrayList.prototype.lastIndexOf$java_lang_Object = function (o) { + return this.lastIndexOf$java_lang_Object$int(o, this.size() - 1); + }; + ArrayList.prototype.remove$int = function (index) { + var previous = this.get(index); + javaemul.internal.ArrayHelper.removeFrom(this.array, index, 1); + return previous; + }; + /** + * + * @param {number} index + * @return {*} + */ + ArrayList.prototype.remove = function (index) { + if (((typeof index === 'number') || index === null)) { + return this.remove$int(index); + } + else if (((index != null) || index === null)) { + return this.remove$java_lang_Object(index); + } + else + throw new Error('invalid overload'); + }; + ArrayList.prototype.remove$java_lang_Object = function (o) { + var i = this.indexOf$java_lang_Object(o); + if (i === -1) { + return false; + } + this.remove$int(i); + return true; + }; + /** + * + * @param {number} index + * @param {*} o + * @return {*} + */ + ArrayList.prototype.set = function (index, o) { + var previous = this.get(index); + this.array[index] = o; + return previous; + }; + /** + * + * @return {number} + */ + ArrayList.prototype.size = function () { + return this.array.length; + }; + ArrayList.prototype.toArray$ = function () { + return javaemul.internal.ArrayHelper.clone(this.array, 0, this.array.length); + }; + ArrayList.prototype.toArray$java_lang_Object_A = function (out) { + var size = this.array.length; + if (out.length < size) { + out = javaemul.internal.ArrayHelper.createFrom(out, size); + } + for (var i = 0; i < size; ++i) { + { + out[i] = this.array[i]; + } + ; + } + if (out.length > size) { + out[size] = null; + } + return out; + }; + /** + * + * @param {Array} out + * @return {Array} + */ + ArrayList.prototype.toArray = function (out) { + if (((out != null && out instanceof Array && (out.length == 0 || out[0] == null || (out[0] != null))) || out === null)) { + return this.toArray$java_lang_Object_A(out); + } + else if (out === undefined) { + return this.toArray$(); + } + else + throw new Error('invalid overload'); + }; + ArrayList.prototype.trimToSize = function () { + }; + /** + * + * @param {number} fromIndex + * @param {number} endIndex + */ + ArrayList.prototype.removeRange = function (fromIndex, endIndex) { + javaemul.internal.InternalPreconditions.checkPositionIndexes(fromIndex, endIndex, this.array.length); + var count = endIndex - fromIndex; + javaemul.internal.ArrayHelper.removeFrom(this.array, fromIndex, count); + }; + ArrayList.prototype.indexOf$java_lang_Object$int = function (o, index) { + for (; index < this.array.length; ++index) { + { + if (java.util.Objects.equals(o, this.array[index])) { + return index; + } + } + ; + } + return -1; + }; + /** + * Used by Vector. + * @param {*} o + * @param {number} index + * @return {number} + */ + ArrayList.prototype.indexOf = function (o, index) { + if (((o != null) || o === null) && ((typeof index === 'number') || index === null)) { + return this.indexOf$java_lang_Object$int(o, index); + } + else if (((o != null) || o === null) && index === undefined) { + return this.indexOf$java_lang_Object(o); + } + else + throw new Error('invalid overload'); + }; + ArrayList.prototype.lastIndexOf$java_lang_Object$int = function (o, index) { + for (; index >= 0; --index) { + { + if (java.util.Objects.equals(o, this.array[index])) { + return index; + } + } + ; + } + return -1; + }; + /** + * Used by Vector. + * @param {*} o + * @param {number} index + * @return {number} + */ + ArrayList.prototype.lastIndexOf = function (o, index) { + if (((o != null) || o === null) && ((typeof index === 'number') || index === null)) { + return this.lastIndexOf$java_lang_Object$int(o, index); + } + else if (((o != null) || o === null) && index === undefined) { + return this.lastIndexOf$java_lang_Object(o); + } + else + throw new Error('invalid overload'); + }; + ArrayList.prototype.setSize = function (newSize) { + javaemul.internal.ArrayHelper.setLength(this.array, newSize); + }; + return ArrayList; + }(java.util.AbstractList)); + util.ArrayList = ArrayList; + ArrayList["__class"] = "java.util.ArrayList"; + ArrayList["__interfaces"] = ["java.util.RandomAccess", "java.util.List", "java.lang.Cloneable", "java.util.Collection", "java.lang.Iterable", "java.io.Serializable"]; + (function (ArrayList) { + var ArrayList$0 = /** @class */ (function () { + function ArrayList$0(__parent) { + this.__parent = __parent; + this.i = 0; + this.last = -1; + } + /* Default method injected from java.util.Iterator */ + ArrayList$0.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + ArrayList$0.prototype.hasNext = function () { + return this.i < this.__parent.array.length; + }; + /** + * + * @return {*} + */ + ArrayList$0.prototype.next = function () { + javaemul.internal.InternalPreconditions.checkElement(this.hasNext()); + this.last = this.i++; + return this.__parent.array[this.last]; + }; + /** + * + */ + ArrayList$0.prototype.remove = function () { + javaemul.internal.InternalPreconditions.checkState(this.last !== -1); + this.__parent.remove$int(this.i = this.last); + this.last = -1; + }; + return ArrayList$0; + }()); + ArrayList.ArrayList$0 = ArrayList$0; + ArrayList$0["__interfaces"] = ["java.util.Iterator"]; + })(ArrayList = util.ArrayList || (util.ArrayList = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Utility methods related to native arrays. [Sun + * docs] + * @class + */ + var Arrays = /** @class */ (function () { + function Arrays() { + } + Arrays.asList = function () { + var array = []; + for (var _i = 0; _i < arguments.length; _i++) { + array[_i] = arguments[_i]; + } + if (array.length === 1 && Array.isArray(array[0])) { + array = array[0]; + } + return (new Arrays.ArrayList(array)); + }; + Arrays.stream = function () { + var array = []; + for (var _i = 0; _i < arguments.length; _i++) { + array[_i] = arguments[_i]; + } + return Arrays.asList.apply(this, array).stream(); + }; + Arrays.binarySearch$byte_A$byte = function (sortedArray, key) { + var low = 0; + var high = sortedArray.length - 1; + while ((low <= high)) { + { + var mid = low + ((high - low) >> 1); + var midVal = sortedArray[mid]; + if (midVal < key) { + low = mid + 1; + } + else if (midVal > key) { + high = mid - 1; + } + else { + return mid; + } + } + } + ; + return -low - 1; + }; + Arrays.binarySearch$char_A$char = function (a, key) { + var low = 0; + var high = a.length - 1; + while ((low <= high)) { + { + var mid = low + ((high - low) >> 1); + var midVal = a[mid]; + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(midVal) < (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(key)) { + low = mid + 1; + } + else if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(midVal) > (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(key)) { + high = mid - 1; + } + else { + return mid; + } + } + } + ; + return -low - 1; + }; + Arrays.binarySearch$double_A$double = function (sortedArray, key) { + var low = 0; + var high = sortedArray.length - 1; + while ((low <= high)) { + { + var mid = low + ((high - low) >> 1); + var midVal = sortedArray[mid]; + if (midVal < key) { + low = mid + 1; + } + else if (midVal > key) { + high = mid - 1; + } + else { + return mid; + } + } + } + ; + return -low - 1; + }; + Arrays.binarySearch$float_A$float = function (sortedArray, key) { + var low = 0; + var high = sortedArray.length - 1; + while ((low <= high)) { + { + var mid = low + ((high - low) >> 1); + var midVal = sortedArray[mid]; + if (midVal < key) { + low = mid + 1; + } + else if (midVal > key) { + high = mid - 1; + } + else { + return mid; + } + } + } + ; + return -low - 1; + }; + Arrays.binarySearch$int_A$int = function (sortedArray, key) { + var low = 0; + var high = sortedArray.length - 1; + while ((low <= high)) { + { + var mid = low + ((high - low) >> 1); + var midVal = sortedArray[mid]; + if (midVal < key) { + low = mid + 1; + } + else if (midVal > key) { + high = mid - 1; + } + else { + return mid; + } + } + } + ; + return -low - 1; + }; + Arrays.binarySearch$long_A$long = function (sortedArray, key) { + var low = 0; + var high = sortedArray.length - 1; + while ((low <= high)) { + { + var mid = low + ((high - low) >> 1); + var midVal = sortedArray[mid]; + if (midVal < key) { + low = mid + 1; + } + else if (midVal > key) { + high = mid - 1; + } + else { + return mid; + } + } + } + ; + return -low - 1; + }; + Arrays.binarySearch$java_lang_Object_A$java_lang_Object = function (sortedArray, key) { + return Arrays.binarySearch(sortedArray, key, (java.util.Comparators.natural())); + }; + Arrays.binarySearch$short_A$short = function (sortedArray, key) { + var low = 0; + var high = sortedArray.length - 1; + while ((low <= high)) { + { + var mid = low + ((high - low) >> 1); + var midVal = sortedArray[mid]; + if (midVal < key) { + low = mid + 1; + } + else if (midVal > key) { + high = mid - 1; + } + else { + return mid; + } + } + } + ; + return -low - 1; + }; + Arrays.binarySearch$java_lang_Object_A$java_lang_Object$java_util_Comparator = function (sortedArray, key, comparator) { + if (comparator == null) { + comparator = (java.util.Comparators.natural()); + } + var low = 0; + var high = sortedArray.length - 1; + while ((low <= high)) { + { + var mid = low + ((high - low) >> 1); + var midVal = sortedArray[mid]; + var compareResult = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(comparator))(midVal, key); + if (compareResult < 0) { + low = mid + 1; + } + else if (compareResult > 0) { + high = mid - 1; + } + else { + return mid; + } + } + } + ; + return -low - 1; + }; + /** + * Perform a binary search on a sorted object array, using a user-specified + * comparison function. + * + * @param {Array} sortedArray object array to search + * @param {*} key value to search for + * @param {*} comparator comparision function, null indicates + * natural ordering should be used. + * @return {number} the index of an element with a matching value, or a negative number + * which is the index of the next larger value (or just past the end + * of the array if the searched value is larger than all elements in + * the array) minus 1 (to ensure error returns are negative) + * @throws ClassCastException if key and + * sortedArray's elements cannot be compared by + * comparator. + */ + Arrays.binarySearch = function (sortedArray, key, comparator) { + if (((sortedArray != null && sortedArray instanceof Array && (sortedArray.length == 0 || sortedArray[0] == null || (sortedArray[0] != null))) || sortedArray === null) && ((key != null) || key === null) && ((typeof comparator === 'function' && comparator.length === 2) || comparator === null)) { + return java.util.Arrays.binarySearch$java_lang_Object_A$java_lang_Object$java_util_Comparator(sortedArray, key, comparator); + } + else if (((sortedArray != null && sortedArray instanceof Array && (sortedArray.length == 0 || sortedArray[0] == null || (typeof sortedArray[0] === 'number'))) || sortedArray === null) && ((typeof key === 'number') || key === null) && comparator === undefined) { + return java.util.Arrays.binarySearch$byte_A$byte(sortedArray, key); + } + else if (((sortedArray != null && sortedArray instanceof Array && (sortedArray.length == 0 || sortedArray[0] == null || (typeof sortedArray[0] === 'string'))) || sortedArray === null) && ((typeof key === 'string') || key === null) && comparator === undefined) { + return java.util.Arrays.binarySearch$char_A$char(sortedArray, key); + } + else if (((sortedArray != null && sortedArray instanceof Array && (sortedArray.length == 0 || sortedArray[0] == null || (typeof sortedArray[0] === 'number'))) || sortedArray === null) && ((typeof key === 'number') || key === null) && comparator === undefined) { + return java.util.Arrays.binarySearch$short_A$short(sortedArray, key); + } + else if (((sortedArray != null && sortedArray instanceof Array && (sortedArray.length == 0 || sortedArray[0] == null || (typeof sortedArray[0] === 'number'))) || sortedArray === null) && ((typeof key === 'number') || key === null) && comparator === undefined) { + return java.util.Arrays.binarySearch$int_A$int(sortedArray, key); + } + else if (((sortedArray != null && sortedArray instanceof Array && (sortedArray.length == 0 || sortedArray[0] == null || (typeof sortedArray[0] === 'number'))) || sortedArray === null) && ((typeof key === 'number') || key === null) && comparator === undefined) { + return java.util.Arrays.binarySearch$long_A$long(sortedArray, key); + } + else if (((sortedArray != null && sortedArray instanceof Array && (sortedArray.length == 0 || sortedArray[0] == null || (typeof sortedArray[0] === 'number'))) || sortedArray === null) && ((typeof key === 'number') || key === null) && comparator === undefined) { + return java.util.Arrays.binarySearch$float_A$float(sortedArray, key); + } + else if (((sortedArray != null && sortedArray instanceof Array && (sortedArray.length == 0 || sortedArray[0] == null || (typeof sortedArray[0] === 'number'))) || sortedArray === null) && ((typeof key === 'number') || key === null) && comparator === undefined) { + return java.util.Arrays.binarySearch$double_A$double(sortedArray, key); + } + else if (((sortedArray != null && sortedArray instanceof Array && (sortedArray.length == 0 || sortedArray[0] == null || (sortedArray[0] != null))) || sortedArray === null) && ((key != null) || key === null) && comparator === undefined) { + return java.util.Arrays.binarySearch$java_lang_Object_A$java_lang_Object(sortedArray, key); + } + else + throw new Error('invalid overload'); + }; + Arrays.copyOf$boolean_A$int = function (original, newLength) { + javaemul.internal.InternalPreconditions.checkArraySize(newLength); + return Arrays.copyOfRange$boolean_A$int$int(original, 0, newLength); + }; + Arrays.copyOf = function (original, newLength) { + if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'boolean'))) || original === null) && ((typeof newLength === 'number') || newLength === null)) { + return java.util.Arrays.copyOf$boolean_A$int(original, newLength); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof newLength === 'number') || newLength === null)) { + return java.util.Arrays.copyOf$byte_A$int(original, newLength); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'string'))) || original === null) && ((typeof newLength === 'number') || newLength === null)) { + return java.util.Arrays.copyOf$char_A$int(original, newLength); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof newLength === 'number') || newLength === null)) { + return java.util.Arrays.copyOf$double_A$int(original, newLength); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof newLength === 'number') || newLength === null)) { + return java.util.Arrays.copyOf$float_A$int(original, newLength); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof newLength === 'number') || newLength === null)) { + return java.util.Arrays.copyOf$int_A$int(original, newLength); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof newLength === 'number') || newLength === null)) { + return java.util.Arrays.copyOf$long_A$int(original, newLength); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof newLength === 'number') || newLength === null)) { + return java.util.Arrays.copyOf$short_A$int(original, newLength); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (original[0] != null))) || original === null) && ((typeof newLength === 'number') || newLength === null)) { + return java.util.Arrays.copyOf$java_lang_Object_A$int(original, newLength); + } + else + throw new Error('invalid overload'); + }; + Arrays.copyOf$byte_A$int = function (original, newLength) { + javaemul.internal.InternalPreconditions.checkArraySize(newLength); + return Arrays.copyOfRange$byte_A$int$int(original, 0, newLength); + }; + Arrays.copyOf$char_A$int = function (original, newLength) { + javaemul.internal.InternalPreconditions.checkArraySize(newLength); + return Arrays.copyOfRange$char_A$int$int(original, 0, newLength); + }; + Arrays.copyOf$double_A$int = function (original, newLength) { + javaemul.internal.InternalPreconditions.checkArraySize(newLength); + return Arrays.copyOfRange$double_A$int$int(original, 0, newLength); + }; + Arrays.copyOf$float_A$int = function (original, newLength) { + javaemul.internal.InternalPreconditions.checkArraySize(newLength); + return Arrays.copyOfRange$float_A$int$int(original, 0, newLength); + }; + Arrays.copyOf$int_A$int = function (original, newLength) { + javaemul.internal.InternalPreconditions.checkArraySize(newLength); + return Arrays.copyOfRange$int_A$int$int(original, 0, newLength); + }; + Arrays.copyOf$long_A$int = function (original, newLength) { + javaemul.internal.InternalPreconditions.checkArraySize(newLength); + return Arrays.copyOfRange$long_A$int$int(original, 0, newLength); + }; + Arrays.copyOf$short_A$int = function (original, newLength) { + javaemul.internal.InternalPreconditions.checkArraySize(newLength); + return Arrays.copyOfRange$short_A$int$int(original, 0, newLength); + }; + Arrays.copyOf$java_lang_Object_A$int = function (original, newLength) { + javaemul.internal.InternalPreconditions.checkArraySize(newLength); + javaemul.internal.InternalPreconditions.checkNotNull(original, "original"); + var clone = javaemul.internal.ArrayHelper.clone(original, 0, newLength); + javaemul.internal.ArrayHelper.setLength(clone, newLength); + return clone; + }; + Arrays.copyOfRange$boolean_A$int$int = function (original, from, to) { + var len = Arrays.getCopyLength(original, from, to); + var copy = (function (s) { var a = []; while (s-- > 0) + a.push(false); return a; })(to - from); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(original, from, copy, 0, len); + return copy; + }; + Arrays.copyOfRange = function (original, from, to) { + if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'boolean'))) || original === null) && ((typeof from === 'number') || from === null) && ((typeof to === 'number') || to === null)) { + return java.util.Arrays.copyOfRange$boolean_A$int$int(original, from, to); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof from === 'number') || from === null) && ((typeof to === 'number') || to === null)) { + return java.util.Arrays.copyOfRange$byte_A$int$int(original, from, to); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'string'))) || original === null) && ((typeof from === 'number') || from === null) && ((typeof to === 'number') || to === null)) { + return java.util.Arrays.copyOfRange$char_A$int$int(original, from, to); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof from === 'number') || from === null) && ((typeof to === 'number') || to === null)) { + return java.util.Arrays.copyOfRange$double_A$int$int(original, from, to); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof from === 'number') || from === null) && ((typeof to === 'number') || to === null)) { + return java.util.Arrays.copyOfRange$float_A$int$int(original, from, to); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof from === 'number') || from === null) && ((typeof to === 'number') || to === null)) { + return java.util.Arrays.copyOfRange$int_A$int$int(original, from, to); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof from === 'number') || from === null) && ((typeof to === 'number') || to === null)) { + return java.util.Arrays.copyOfRange$long_A$int$int(original, from, to); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (typeof original[0] === 'number'))) || original === null) && ((typeof from === 'number') || from === null) && ((typeof to === 'number') || to === null)) { + return java.util.Arrays.copyOfRange$short_A$int$int(original, from, to); + } + else if (((original != null && original instanceof Array && (original.length == 0 || original[0] == null || (original[0] != null))) || original === null) && ((typeof from === 'number') || from === null) && ((typeof to === 'number') || to === null)) { + return java.util.Arrays.copyOfRange$java_lang_Object_A$int$int(original, from, to); + } + else + throw new Error('invalid overload'); + }; + Arrays.copyOfRange$byte_A$int$int = function (original, from, to) { + var len = Arrays.getCopyLength(original, from, to); + var copy = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(to - from); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(original, from, copy, 0, len); + return copy; + }; + Arrays.copyOfRange$char_A$int$int = function (original, from, to) { + var len = Arrays.getCopyLength(original, from, to); + var copy = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(to - from); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(original, from, copy, 0, len); + return copy; + }; + Arrays.copyOfRange$double_A$int$int = function (original, from, to) { + var len = Arrays.getCopyLength(original, from, to); + var copy = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(to - from); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(original, from, copy, 0, len); + return copy; + }; + Arrays.copyOfRange$float_A$int$int = function (original, from, to) { + var len = Arrays.getCopyLength(original, from, to); + var copy = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(to - from); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(original, from, copy, 0, len); + return copy; + }; + Arrays.copyOfRange$int_A$int$int = function (original, from, to) { + var len = Arrays.getCopyLength(original, from, to); + var copy = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(to - from); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(original, from, copy, 0, len); + return copy; + }; + Arrays.copyOfRange$long_A$int$int = function (original, from, to) { + var len = Arrays.getCopyLength(original, from, to); + var copy = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(to - from); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(original, from, copy, 0, len); + return copy; + }; + Arrays.copyOfRange$short_A$int$int = function (original, from, to) { + var len = Arrays.getCopyLength(original, from, to); + var copy = (function (s) { var a = []; while (s-- > 0) + a.push(0); return a; })(to - from); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(original, from, copy, 0, len); + return copy; + }; + Arrays.copyOfRange$java_lang_Object_A$int$int = function (original, from, to) { + var len = Arrays.getCopyLength(original, from, to); + var copy = javaemul.internal.ArrayHelper.createFrom(original, to - from); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(original, from, copy, 0, len); + return copy; + }; + Arrays.deepEquals = function (a1, a2) { + if (a1 === a2) { + return true; + } + if (a1 == null || a2 == null) { + return false; + } + if (a1.length !== a2.length) { + return false; + } + for (var i = 0, n = a1.length; i < n; ++i) { + { + if (!java.util.Objects.deepEquals(a1[i], a2[i])) { + return false; + } + } + ; + } + return true; + }; + Arrays.deepHashCode = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index154 = 0; index154 < a.length; index154++) { + var obj = a[index154]; + { + var hash = void 0; + if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || obj[0] != null)) { + hash = Arrays.deepHashCode(obj); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'boolean')) { + hash = Arrays.hashCode$boolean_A(obj); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + hash = Arrays.hashCode$byte_A(obj); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'string')) { + hash = Arrays.hashCode$char_A(obj); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + hash = Arrays.hashCode$short_A(obj); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + hash = Arrays.hashCode$int_A(obj); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + hash = Arrays.hashCode$long_A(obj); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + hash = Arrays.hashCode$float_A(obj); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + hash = Arrays.hashCode$double_A(obj); + } + else { + hash = java.util.Objects.hashCode(obj); + } + hashCode = 31 * hashCode + hash; + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.deepToString$java_lang_Object_A = function (a) { + return Arrays.deepToString$java_lang_Object_A$java_util_Set(a, (new java.util.HashSet())); + }; + Arrays.equals$boolean_A$boolean_A = function (array1, array2) { + if (array1 === array2) { + return true; + } + if (array1 == null || array2 == null) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + { + if (array1[i] !== array2[i]) { + return false; + } + } + ; + } + return true; + }; + Arrays.equals = function (array1, array2) { + if (((array1 != null && array1 instanceof Array && (array1.length == 0 || array1[0] == null || (typeof array1[0] === 'boolean'))) || array1 === null) && ((array2 != null && array2 instanceof Array && (array2.length == 0 || array2[0] == null || (typeof array2[0] === 'boolean'))) || array2 === null)) { + return java.util.Arrays.equals$boolean_A$boolean_A(array1, array2); + } + else if (((array1 != null && array1 instanceof Array && (array1.length == 0 || array1[0] == null || (typeof array1[0] === 'number'))) || array1 === null) && ((array2 != null && array2 instanceof Array && (array2.length == 0 || array2[0] == null || (typeof array2[0] === 'number'))) || array2 === null)) { + return java.util.Arrays.equals$byte_A$byte_A(array1, array2); + } + else if (((array1 != null && array1 instanceof Array && (array1.length == 0 || array1[0] == null || (typeof array1[0] === 'string'))) || array1 === null) && ((array2 != null && array2 instanceof Array && (array2.length == 0 || array2[0] == null || (typeof array2[0] === 'string'))) || array2 === null)) { + return java.util.Arrays.equals$char_A$char_A(array1, array2); + } + else if (((array1 != null && array1 instanceof Array && (array1.length == 0 || array1[0] == null || (typeof array1[0] === 'number'))) || array1 === null) && ((array2 != null && array2 instanceof Array && (array2.length == 0 || array2[0] == null || (typeof array2[0] === 'number'))) || array2 === null)) { + return java.util.Arrays.equals$double_A$double_A(array1, array2); + } + else if (((array1 != null && array1 instanceof Array && (array1.length == 0 || array1[0] == null || (typeof array1[0] === 'number'))) || array1 === null) && ((array2 != null && array2 instanceof Array && (array2.length == 0 || array2[0] == null || (typeof array2[0] === 'number'))) || array2 === null)) { + return java.util.Arrays.equals$float_A$float_A(array1, array2); + } + else if (((array1 != null && array1 instanceof Array && (array1.length == 0 || array1[0] == null || (typeof array1[0] === 'number'))) || array1 === null) && ((array2 != null && array2 instanceof Array && (array2.length == 0 || array2[0] == null || (typeof array2[0] === 'number'))) || array2 === null)) { + return java.util.Arrays.equals$int_A$int_A(array1, array2); + } + else if (((array1 != null && array1 instanceof Array && (array1.length == 0 || array1[0] == null || (typeof array1[0] === 'number'))) || array1 === null) && ((array2 != null && array2 instanceof Array && (array2.length == 0 || array2[0] == null || (typeof array2[0] === 'number'))) || array2 === null)) { + return java.util.Arrays.equals$long_A$long_A(array1, array2); + } + else if (((array1 != null && array1 instanceof Array && (array1.length == 0 || array1[0] == null || (array1[0] != null))) || array1 === null) && ((array2 != null && array2 instanceof Array && (array2.length == 0 || array2[0] == null || (array2[0] != null))) || array2 === null)) { + return java.util.Arrays.equals$java_lang_Object_A$java_lang_Object_A(array1, array2); + } + else if (((array1 != null && array1 instanceof Array && (array1.length == 0 || array1[0] == null || (typeof array1[0] === 'number'))) || array1 === null) && ((array2 != null && array2 instanceof Array && (array2.length == 0 || array2[0] == null || (typeof array2[0] === 'number'))) || array2 === null)) { + return java.util.Arrays.equals$short_A$short_A(array1, array2); + } + else + throw new Error('invalid overload'); + }; + Arrays.equals$byte_A$byte_A = function (array1, array2) { + if (array1 === array2) { + return true; + } + if (array1 == null || array2 == null) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + { + if (array1[i] !== array2[i]) { + return false; + } + } + ; + } + return true; + }; + Arrays.equals$char_A$char_A = function (array1, array2) { + if (array1 === array2) { + return true; + } + if (array1 == null || array2 == null) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + { + if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(array1[i]) != (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(array2[i])) { + return false; + } + } + ; + } + return true; + }; + Arrays.equals$double_A$double_A = function (array1, array2) { + if (array1 === array2) { + return true; + } + if (array1 == null || array2 == null) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + { + if (array1[i] !== array2[i]) { + return false; + } + } + ; + } + return true; + }; + Arrays.equals$float_A$float_A = function (array1, array2) { + if (array1 === array2) { + return true; + } + if (array1 == null || array2 == null) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + { + if (array1[i] !== array2[i]) { + return false; + } + } + ; + } + return true; + }; + Arrays.equals$int_A$int_A = function (array1, array2) { + if (array1 === array2) { + return true; + } + if (array1 == null || array2 == null) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + { + if (array1[i] !== array2[i]) { + return false; + } + } + ; + } + return true; + }; + Arrays.equals$long_A$long_A = function (array1, array2) { + if (array1 === array2) { + return true; + } + if (array1 == null || array2 == null) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + { + if (array1[i] !== array2[i]) { + return false; + } + } + ; + } + return true; + }; + Arrays.equals$java_lang_Object_A$java_lang_Object_A = function (array1, array2) { + if (array1 === array2) { + return true; + } + if (array1 == null || array2 == null) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + { + var val1 = array1[i]; + var val2 = array2[i]; + if (!java.util.Objects.equals(val1, val2)) { + return false; + } + } + ; + } + return true; + }; + Arrays.equals$short_A$short_A = function (array1, array2) { + if (array1 === array2) { + return true; + } + if (array1 == null || array2 == null) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + { + if (array1[i] !== array2[i]) { + return false; + } + } + ; + } + return true; + }; + Arrays.fill$boolean_A$boolean = function (a, val) { + Arrays.fill$boolean_A$int$int$boolean(a, 0, a.length, val); + }; + Arrays.fill$boolean_A$int$int$boolean = function (a, fromIndex, toIndex, val) { + for (var i = fromIndex; i < toIndex; ++i) { + { + a[i] = val; + } + ; + } + }; + Arrays.fill = function (a, fromIndex, toIndex, val) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'boolean'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof val === 'boolean') || val === null)) { + return java.util.Arrays.fill$boolean_A$int$int$boolean(a, fromIndex, toIndex, val); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof val === 'number') || val === null)) { + return java.util.Arrays.fill$byte_A$int$int$byte(a, fromIndex, toIndex, val); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof val === 'string') || val === null)) { + return java.util.Arrays.fill$char_A$int$int$char(a, fromIndex, toIndex, val); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof val === 'number') || val === null)) { + return java.util.Arrays.fill$short_A$int$int$short(a, fromIndex, toIndex, val); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof val === 'number') || val === null)) { + return java.util.Arrays.fill$int_A$int$int$int(a, fromIndex, toIndex, val); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof val === 'number') || val === null)) { + return java.util.Arrays.fill$long_A$int$int$long(a, fromIndex, toIndex, val); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof val === 'number') || val === null)) { + return java.util.Arrays.fill$float_A$int$int$float(a, fromIndex, toIndex, val); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof val === 'number') || val === null)) { + return java.util.Arrays.fill$double_A$int$int$double(a, fromIndex, toIndex, val); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((val != null) || val === null)) { + return java.util.Arrays.fill$java_lang_Object_A$int$int$java_lang_Object(a, fromIndex, toIndex, val); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'boolean'))) || a === null) && ((typeof fromIndex === 'boolean') || fromIndex === null) && toIndex === undefined && val === undefined) { + return java.util.Arrays.fill$boolean_A$boolean(a, fromIndex); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined && val === undefined) { + return java.util.Arrays.fill$byte_A$byte(a, fromIndex); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null) && ((typeof fromIndex === 'string') || fromIndex === null) && toIndex === undefined && val === undefined) { + return java.util.Arrays.fill$char_A$char(a, fromIndex); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined && val === undefined) { + return java.util.Arrays.fill$short_A$short(a, fromIndex); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined && val === undefined) { + return java.util.Arrays.fill$int_A$int(a, fromIndex); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined && val === undefined) { + return java.util.Arrays.fill$long_A$long(a, fromIndex); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined && val === undefined) { + return java.util.Arrays.fill$float_A$float(a, fromIndex); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null) && ((typeof fromIndex === 'number') || fromIndex === null) && toIndex === undefined && val === undefined) { + return java.util.Arrays.fill$double_A$double(a, fromIndex); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null) && ((fromIndex != null) || fromIndex === null) && toIndex === undefined && val === undefined) { + return java.util.Arrays.fill$java_lang_Object_A$java_lang_Object(a, fromIndex); + } + else + throw new Error('invalid overload'); + }; + Arrays.fill$byte_A$byte = function (a, val) { + Arrays.fill$byte_A$int$int$byte(a, 0, a.length, val); + }; + Arrays.fill$byte_A$int$int$byte = function (a, fromIndex, toIndex, val) { + for (var i = fromIndex; i < toIndex; ++i) { + { + a[i] = val; + } + ; + } + }; + Arrays.fill$char_A$char = function (a, val) { + Arrays.fill$char_A$int$int$char(a, 0, a.length, val); + }; + Arrays.fill$char_A$int$int$char = function (a, fromIndex, toIndex, val) { + for (var i = fromIndex; i < toIndex; ++i) { + { + a[i] = val; + } + ; + } + }; + Arrays.fill$double_A$double = function (a, val) { + Arrays.fill$double_A$int$int$double(a, 0, a.length, val); + }; + Arrays.fill$double_A$int$int$double = function (a, fromIndex, toIndex, val) { + for (var i = fromIndex; i < toIndex; ++i) { + { + a[i] = val; + } + ; + } + }; + Arrays.fill$float_A$float = function (a, val) { + Arrays.fill$float_A$int$int$float(a, 0, a.length, val); + }; + Arrays.fill$float_A$int$int$float = function (a, fromIndex, toIndex, val) { + for (var i = fromIndex; i < toIndex; ++i) { + { + a[i] = val; + } + ; + } + }; + Arrays.fill$int_A$int = function (a, val) { + Arrays.fill$int_A$int$int$int(a, 0, a.length, val); + }; + Arrays.fill$int_A$int$int$int = function (a, fromIndex, toIndex, val) { + for (var i = fromIndex; i < toIndex; ++i) { + { + a[i] = val; + } + ; + } + }; + Arrays.fill$long_A$int$int$long = function (a, fromIndex, toIndex, val) { + for (var i = fromIndex; i < toIndex; ++i) { + { + a[i] = val; + } + ; + } + }; + Arrays.fill$long_A$long = function (a, val) { + Arrays.fill$long_A$int$int$long(a, 0, a.length, val); + }; + Arrays.fill$java_lang_Object_A$int$int$java_lang_Object = function (a, fromIndex, toIndex, val) { + for (var i = fromIndex; i < toIndex; ++i) { + { + a[i] = val; + } + ; + } + }; + Arrays.fill$java_lang_Object_A$java_lang_Object = function (a, val) { + Arrays.fill$java_lang_Object_A$int$int$java_lang_Object(a, 0, a.length, val); + }; + Arrays.fill$short_A$int$int$short = function (a, fromIndex, toIndex, val) { + for (var i = fromIndex; i < toIndex; ++i) { + { + a[i] = val; + } + ; + } + }; + Arrays.fill$short_A$short = function (a, val) { + Arrays.fill$short_A$int$int$short(a, 0, a.length, val); + }; + Arrays.hashCode$boolean_A = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index155 = 0; index155 < a.length; index155++) { + var e = a[index155]; + { + hashCode = 31 * hashCode + javaemul.internal.BooleanHelper.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.hashCode = function (a) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'boolean'))) || a === null)) { + return java.util.Arrays.hashCode$boolean_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.hashCode$byte_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null)) { + return java.util.Arrays.hashCode$char_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.hashCode$double_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.hashCode$float_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.hashCode$int_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.hashCode$long_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null)) { + return java.util.Arrays.hashCode$java_lang_Object_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.hashCode$short_A(a); + } + else + throw new Error('invalid overload'); + }; + Arrays.hashCode$byte_A = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index156 = 0; index156 < a.length; index156++) { + var e = a[index156]; + { + hashCode = 31 * hashCode + javaemul.internal.ByteHelper.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.hashCode$char_A = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index157 = 0; index157 < a.length; index157++) { + var e = a[index157]; + { + hashCode = 31 * hashCode + javaemul.internal.CharacterHelper.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.hashCode$double_A = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index158 = 0; index158 < a.length; index158++) { + var e = a[index158]; + { + hashCode = 31 * hashCode + javaemul.internal.DoubleHelper.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.hashCode$float_A = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index159 = 0; index159 < a.length; index159++) { + var e = a[index159]; + { + hashCode = 31 * hashCode + javaemul.internal.FloatHelper.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.hashCode$int_A = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index160 = 0; index160 < a.length; index160++) { + var e = a[index160]; + { + hashCode = 31 * hashCode + javaemul.internal.IntegerHelper.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.hashCode$long_A = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index161 = 0; index161 < a.length; index161++) { + var e = a[index161]; + { + hashCode = 31 * hashCode + javaemul.internal.LongHelper.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.hashCode$java_lang_Object_A = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index162 = 0; index162 < a.length; index162++) { + var e = a[index162]; + { + hashCode = 31 * hashCode + java.util.Objects.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.hashCode$short_A = function (a) { + if (a == null) { + return 0; + } + var hashCode = 1; + for (var index163 = 0; index163 < a.length; index163++) { + var e = a[index163]; + { + hashCode = 31 * hashCode + javaemul.internal.ShortHelper.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Arrays.sort$byte_A = function (array) { + Arrays.nativeNumberSort$java_lang_Object(array); + }; + Arrays.sort$byte_A$int$int = function (array, fromIndex, toIndex) { + javaemul.internal.InternalPreconditions.checkPositionIndexes(fromIndex, toIndex, array.length); + Arrays.nativeNumberSort$java_lang_Object$int$int(array, fromIndex, toIndex); + }; + Arrays.sort$char_A = function (array) { + Arrays.nativeNumberSort$java_lang_Object(array); + }; + Arrays.sort$char_A$int$int = function (array, fromIndex, toIndex) { + javaemul.internal.InternalPreconditions.checkPositionIndexes(fromIndex, toIndex, array.length); + Arrays.nativeNumberSort$java_lang_Object$int$int(array, fromIndex, toIndex); + }; + Arrays.sort$double_A = function (array) { + Arrays.nativeNumberSort$java_lang_Object(array); + }; + Arrays.sort$double_A$int$int = function (array, fromIndex, toIndex) { + javaemul.internal.InternalPreconditions.checkPositionIndexes(fromIndex, toIndex, array.length); + Arrays.nativeNumberSort$java_lang_Object$int$int(array, fromIndex, toIndex); + }; + Arrays.sort$float_A = function (array) { + Arrays.nativeNumberSort$java_lang_Object(array); + }; + Arrays.sort$float_A$int$int = function (array, fromIndex, toIndex) { + javaemul.internal.InternalPreconditions.checkPositionIndexes(fromIndex, toIndex, array.length); + Arrays.nativeNumberSort$java_lang_Object$int$int(array, fromIndex, toIndex); + }; + Arrays.sort$int_A = function (array) { + Arrays.nativeNumberSort$java_lang_Object(array); + }; + Arrays.sort$int_A$int$int = function (array, fromIndex, toIndex) { + javaemul.internal.InternalPreconditions.checkPositionIndexes(fromIndex, toIndex, array.length); + Arrays.nativeNumberSort$java_lang_Object$int$int(array, fromIndex, toIndex); + }; + Arrays.sort$long_A = function (array) { + Arrays.nativeLongSort$java_lang_Object$java_lang_Object(array, javaemul.internal.LongCompareHolder.getLongComparator()); + }; + Arrays.sort$long_A$int$int = function (array, fromIndex, toIndex) { + javaemul.internal.InternalPreconditions.checkPositionIndexes(fromIndex, toIndex, array.length); + Arrays.nativeLongSort$java_lang_Object$int$int(array, fromIndex, toIndex); + }; + Arrays.sort$java_lang_Object_A = function (array) { + Arrays.mergeSort$java_lang_Object_A$int$int$java_util_Comparator(array, 0, array.length, (java.util.Comparators.natural())); + }; + Arrays.sort$java_lang_Object_A$int$int = function (x, fromIndex, toIndex) { + Arrays.mergeSort$java_lang_Object_A$int$int$java_util_Comparator(x, fromIndex, toIndex, (java.util.Comparators.natural())); + }; + Arrays.sort$short_A = function (array) { + Arrays.nativeNumberSort$java_lang_Object(array); + }; + Arrays.sort$short_A$int$int = function (array, fromIndex, toIndex) { + javaemul.internal.InternalPreconditions.checkPositionIndexes(fromIndex, toIndex, array.length); + Arrays.nativeNumberSort$java_lang_Object$int$int(array, fromIndex, toIndex); + }; + Arrays.sort$java_lang_Object_A$java_util_Comparator = function (x, c) { + Arrays.mergeSort$java_lang_Object_A$int$int$java_util_Comparator(x, 0, x.length, (c)); + }; + Arrays.sort$java_lang_Object_A$int$int$java_util_Comparator = function (x, fromIndex, toIndex, c) { + javaemul.internal.InternalPreconditions.checkPositionIndexes(fromIndex, toIndex, x.length); + Arrays.mergeSort$java_lang_Object_A$int$int$java_util_Comparator(x, fromIndex, toIndex, (c)); + }; + Arrays.sort = function (x, fromIndex, toIndex, c) { + if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (x[0] != null))) || x === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && ((typeof c === 'function' && c.length === 2) || c === null)) { + return java.util.Arrays.sort$java_lang_Object_A$int$int$java_util_Comparator(x, fromIndex, toIndex, c); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && c === undefined) { + return java.util.Arrays.sort$byte_A$int$int(x, fromIndex, toIndex); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && c === undefined) { + return java.util.Arrays.sort$char_A$int$int(x, fromIndex, toIndex); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && c === undefined) { + return java.util.Arrays.sort$double_A$int$int(x, fromIndex, toIndex); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && c === undefined) { + return java.util.Arrays.sort$float_A$int$int(x, fromIndex, toIndex); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && c === undefined) { + return java.util.Arrays.sort$int_A$int$int(x, fromIndex, toIndex); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && c === undefined) { + return java.util.Arrays.sort$long_A$int$int(x, fromIndex, toIndex); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (x[0] != null))) || x === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && c === undefined) { + return java.util.Arrays.sort$java_lang_Object_A$int$int(x, fromIndex, toIndex); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null) && c === undefined) { + return java.util.Arrays.sort$short_A$int$int(x, fromIndex, toIndex); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (x[0] != null))) || x === null) && ((typeof fromIndex === 'function' && fromIndex.length === 2) || fromIndex === null) && toIndex === undefined && c === undefined) { + return java.util.Arrays.sort$java_lang_Object_A$java_util_Comparator(x, fromIndex); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && fromIndex === undefined && toIndex === undefined && c === undefined) { + return java.util.Arrays.sort$byte_A(x); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'string'))) || x === null) && fromIndex === undefined && toIndex === undefined && c === undefined) { + return java.util.Arrays.sort$char_A(x); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && fromIndex === undefined && toIndex === undefined && c === undefined) { + return java.util.Arrays.sort$double_A(x); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && fromIndex === undefined && toIndex === undefined && c === undefined) { + return java.util.Arrays.sort$float_A(x); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && fromIndex === undefined && toIndex === undefined && c === undefined) { + return java.util.Arrays.sort$int_A(x); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && fromIndex === undefined && toIndex === undefined && c === undefined) { + return java.util.Arrays.sort$long_A(x); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (x[0] != null))) || x === null) && fromIndex === undefined && toIndex === undefined && c === undefined) { + return java.util.Arrays.sort$java_lang_Object_A(x); + } + else if (((x != null && x instanceof Array && (x.length == 0 || x[0] == null || (typeof x[0] === 'number'))) || x === null) && fromIndex === undefined && toIndex === undefined && c === undefined) { + return java.util.Arrays.sort$short_A(x); + } + else + throw new Error('invalid overload'); + }; + Arrays.toString$boolean_A = function (a) { + if (a == null) { + return "null"; + } + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index164 = 0; index164 < a.length; index164++) { + var element = a[index164]; + { + joiner.add(/* valueOf */ new String(element).toString()); + } + } + return joiner.toString(); + }; + Arrays.toString = function (a) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'boolean'))) || a === null)) { + return java.util.Arrays.toString$boolean_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.toString$byte_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'string'))) || a === null)) { + return java.util.Arrays.toString$char_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.toString$double_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.toString$float_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.toString$int_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.toString$long_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null)) { + return java.util.Arrays.toString$java_lang_Object_A(a); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (typeof a[0] === 'number'))) || a === null)) { + return java.util.Arrays.toString$short_A(a); + } + else + throw new Error('invalid overload'); + }; + Arrays.toString$byte_A = function (a) { + if (a == null) { + return "null"; + } + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index165 = 0; index165 < a.length; index165++) { + var element = a[index165]; + { + joiner.add(/* valueOf */ new String(element).toString()); + } + } + return joiner.toString(); + }; + Arrays.toString$char_A = function (a) { + if (a == null) { + return "null"; + } + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index166 = 0; index166 < a.length; index166++) { + var element = a[index166]; + { + joiner.add(/* valueOf */ new String(element).toString()); + } + } + return joiner.toString(); + }; + Arrays.toString$double_A = function (a) { + if (a == null) { + return "null"; + } + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index167 = 0; index167 < a.length; index167++) { + var element = a[index167]; + { + joiner.add(/* valueOf */ new String(element).toString()); + } + } + return joiner.toString(); + }; + Arrays.toString$float_A = function (a) { + if (a == null) { + return "null"; + } + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index168 = 0; index168 < a.length; index168++) { + var element = a[index168]; + { + joiner.add(/* valueOf */ new String(element).toString()); + } + } + return joiner.toString(); + }; + Arrays.toString$int_A = function (a) { + if (a == null) { + return "null"; + } + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index169 = 0; index169 < a.length; index169++) { + var element = a[index169]; + { + joiner.add(/* valueOf */ new String(element).toString()); + } + } + return joiner.toString(); + }; + Arrays.toString$long_A = function (a) { + if (a == null) { + return "null"; + } + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index170 = 0; index170 < a.length; index170++) { + var element = a[index170]; + { + joiner.add(/* valueOf */ new String(element).toString()); + } + } + return joiner.toString(); + }; + Arrays.toString$java_lang_Object_A = function (x) { + if (x == null) { + return "null"; + } + return Arrays.asList.apply(null, x).toString(); + }; + Arrays.toString$short_A = function (a) { + if (a == null) { + return "null"; + } + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index171 = 0; index171 < a.length; index171++) { + var element = a[index171]; + { + joiner.add(/* valueOf */ new String(element).toString()); + } + } + return joiner.toString(); + }; + Arrays.deepToString$java_lang_Object_A$java_util_Set = function (a, arraysIveSeen) { + if (a == null) { + return "null"; + } + if (!arraysIveSeen.add(a)) { + return "[...]"; + } + var joiner = new java.util.StringJoiner(", ", "[", "]"); + for (var index172 = 0; index172 < a.length; index172++) { + var obj = a[index172]; + { + if (obj != null && obj.constructor.isArray()) { + if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || obj[0] != null)) { + if (arraysIveSeen.contains(obj)) { + joiner.add("[...]"); + } + else { + var objArray = obj; + var tempSet = (new java.util.HashSet(arraysIveSeen)); + joiner.add(Arrays.deepToString$java_lang_Object_A$java_util_Set(objArray, tempSet)); + } + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'boolean')) { + joiner.add(Arrays.toString$boolean_A(obj)); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + joiner.add(Arrays.toString$byte_A(obj)); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'string')) { + joiner.add(Arrays.toString$char_A(obj)); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + joiner.add(Arrays.toString$short_A(obj)); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + joiner.add(Arrays.toString$int_A(obj)); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + joiner.add(Arrays.toString$long_A(obj)); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + joiner.add(Arrays.toString$float_A(obj)); + } + else if (obj != null && obj instanceof Array && (obj.length == 0 || obj[0] == null || typeof obj[0] === 'number')) { + joiner.add(Arrays.toString$double_A(obj)); + } + else { + } + } + else { + joiner.add(/* valueOf */ new String(obj).toString()); + } + } + } + return joiner.toString(); + }; + /** + * Recursive helper function for {@link Arrays#deepToString(Object[])}. + * @param {Array} a + * @param {*} arraysIveSeen + * @return {string} + * @private + */ + Arrays.deepToString = function (a, arraysIveSeen) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null) && ((arraysIveSeen != null && (arraysIveSeen["__interfaces"] != null && arraysIveSeen["__interfaces"].indexOf("java.util.Set") >= 0 || arraysIveSeen.constructor != null && arraysIveSeen.constructor["__interfaces"] != null && arraysIveSeen.constructor["__interfaces"].indexOf("java.util.Set") >= 0)) || arraysIveSeen === null)) { + return java.util.Arrays.deepToString$java_lang_Object_A$java_util_Set(a, arraysIveSeen); + } + else if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null) && arraysIveSeen === undefined) { + return java.util.Arrays.deepToString$java_lang_Object_A(a); + } + else + throw new Error('invalid overload'); + }; + Arrays.getCopyLength = function (array, from, to) { + javaemul.internal.InternalPreconditions.checkArgument(from <= to, "%s > %s", from, to); + var len = javaemul.internal.ArrayHelper.getLength(array); + to = Math.min(to, len); + javaemul.internal.InternalPreconditions.checkCriticalPositionIndexes(from, to, len); + return to - from; + }; + /** + * Sort a small subsection of an array by insertion sort. + * + * @param {Array} array array to sort + * @param {number} low lower bound of range to sort + * @param {number} high upper bound of range to sort + * @param {*} comp comparator to use + * @private + */ + Arrays.insertionSort = function (array, low, high, comp) { + for (var i = low + 1; i < high; ++i) { + { + for (var j = i; j > low && ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(comp))(array[j - 1], array[j]) > 0; --j) { + { + var t = array[j]; + array[j] = array[j - 1]; + array[j - 1] = t; + } + ; + } + } + ; + } + }; + /** + * Merge the two sorted subarrays (srcLow,srcMid] and (srcMid,srcHigh] into + * dest. + * + * @param {Array} src source array for merge + * @param {number} srcLow lower bound of bottom sorted half + * @param {number} srcMid upper bound of bottom sorted half & lower bound of top sorted + * half + * @param {number} srcHigh upper bound of top sorted half + * @param {Array} dest destination array for merge + * @param {number} destLow lower bound of destination + * @param {number} destHigh upper bound of destination + * @param {*} comp comparator to use + * @private + */ + Arrays.merge = function (src, srcLow, srcMid, srcHigh, dest, destLow, destHigh, comp) { + var topIdx = srcMid; + while ((destLow < destHigh)) { + { + if (topIdx >= srcHigh || (srcLow < srcMid && ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(comp))(src[srcLow], src[topIdx]) <= 0)) { + dest[destLow++] = src[srcLow++]; + } + else { + dest[destLow++] = src[topIdx++]; + } + } + } + ; + }; + Arrays.mergeSort$java_lang_Object_A$int$int$java_util_Comparator = function (x, fromIndex, toIndex, comp) { + if (comp == null) { + comp = (java.util.Comparators.natural()); + } + var temp = Arrays.copyOfRange$java_lang_Object_A$int$int(x, fromIndex, toIndex); + Arrays.mergeSort$java_lang_Object_A$java_lang_Object_A$int$int$int$java_util_Comparator(temp, x, fromIndex, toIndex, -fromIndex, (comp)); + }; + Arrays.mergeSort$java_lang_Object_A$java_lang_Object_A$int$int$int$java_util_Comparator = function (temp, array, low, high, ofs, comp) { + var length = high - low; + if (length < 7) { + Arrays.insertionSort(array, low, high, (comp)); + return; + } + var tempLow = low + ofs; + var tempHigh = high + ofs; + var tempMid = tempLow + ((tempHigh - tempLow) >> 1); + Arrays.mergeSort$java_lang_Object_A$java_lang_Object_A$int$int$int$java_util_Comparator(array, temp, tempLow, tempMid, -ofs, (comp)); + Arrays.mergeSort$java_lang_Object_A$java_lang_Object_A$int$int$int$java_util_Comparator(array, temp, tempMid, tempHigh, -ofs, (comp)); + if (((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(comp))(temp[tempMid - 1], temp[tempMid]) <= 0) { + while ((low < high)) { + { + array[low++] = temp[tempLow++]; + } + } + ; + return; + } + Arrays.merge(temp, tempLow, tempMid, tempHigh, array, low, high, (comp)); + }; + /** + * Recursive helper function for + * {@link Arrays#mergeSort(Object[], int, int, Comparator)}. + * + * @param {Array} temp temporary space, as large as the range of elements being + * sorted. On entry, temp should contain a copy of the sort range + * from array. + * @param {Array} array array to sort + * @param {number} low lower bound of range to sort + * @param {number} high upper bound of range to sort + * @param {number} ofs offset to convert an array index into a temp index + * @param {*} comp comparison function + * @private + */ + Arrays.mergeSort = function (temp, array, low, high, ofs, comp) { + if (((temp != null && temp instanceof Array && (temp.length == 0 || temp[0] == null || (temp[0] != null))) || temp === null) && ((array != null && array instanceof Array && (array.length == 0 || array[0] == null || (array[0] != null))) || array === null) && ((typeof low === 'number') || low === null) && ((typeof high === 'number') || high === null) && ((typeof ofs === 'number') || ofs === null) && ((typeof comp === 'function' && comp.length === 2) || comp === null)) { + return java.util.Arrays.mergeSort$java_lang_Object_A$java_lang_Object_A$int$int$int$java_util_Comparator(temp, array, low, high, ofs, comp); + } + else if (((temp != null && temp instanceof Array && (temp.length == 0 || temp[0] == null || (temp[0] != null))) || temp === null) && ((typeof array === 'number') || array === null) && ((typeof low === 'number') || low === null) && ((typeof high === 'function' && high.length === 2) || high === null) && ofs === undefined && comp === undefined) { + return java.util.Arrays.mergeSort$java_lang_Object_A$int$int$java_util_Comparator(temp, array, low, high); + } + else + throw new Error('invalid overload'); + }; + Arrays.nativeLongSort$java_lang_Object$java_lang_Object = function (array, compareFunction) { + array.sort(compareFunction); + }; + Arrays.nativeLongSort$java_lang_Object$int$int = function (array, fromIndex, toIndex) { + var temp = javaemul.internal.ArrayHelper.unsafeClone(array, fromIndex, toIndex); + Arrays.nativeLongSort$java_lang_Object$java_lang_Object(temp, javaemul.internal.LongCompareHolder.getLongComparator()); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(temp, 0, array, fromIndex, toIndex - fromIndex); + }; + /** + * Sort a subset of an array of number primitives. + * @param {*} array + * @param {number} fromIndex + * @param {number} toIndex + * @private + */ + Arrays.nativeLongSort = function (array, fromIndex, toIndex) { + if (((array != null) || array === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null)) { + return java.util.Arrays.nativeLongSort$java_lang_Object$int$int(array, fromIndex, toIndex); + } + else if (((array != null) || array === null) && ((fromIndex != null) || fromIndex === null) && toIndex === undefined) { + return java.util.Arrays.nativeLongSort$java_lang_Object$java_lang_Object(array, fromIndex); + } + else + throw new Error('invalid overload'); + }; + Arrays.nativeNumberSort$java_lang_Object = function (array) { + array.sort(function (a, b) { return a - b; }); + }; + Arrays.nativeNumberSort$java_lang_Object$int$int = function (array, fromIndex, toIndex) { + var temp = javaemul.internal.ArrayHelper.unsafeClone(array, fromIndex, toIndex); + Arrays.nativeNumberSort$java_lang_Object(temp); + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(temp, 0, array, fromIndex, toIndex - fromIndex); + }; + /** + * Sort a subset of an array of number primitives. + * @param {*} array + * @param {number} fromIndex + * @param {number} toIndex + * @private + */ + Arrays.nativeNumberSort = function (array, fromIndex, toIndex) { + if (((array != null) || array === null) && ((typeof fromIndex === 'number') || fromIndex === null) && ((typeof toIndex === 'number') || toIndex === null)) { + return java.util.Arrays.nativeNumberSort$java_lang_Object$int$int(array, fromIndex, toIndex); + } + else if (((array != null) || array === null) && fromIndex === undefined && toIndex === undefined) { + return java.util.Arrays.nativeNumberSort$java_lang_Object(array); + } + else + throw new Error('invalid overload'); + }; + return Arrays; + }()); + util.Arrays = Arrays; + Arrays["__class"] = "java.util.Arrays"; + (function (Arrays) { + var ArrayList = /** @class */ (function (_super) { + __extends(ArrayList, _super); + function ArrayList(array) { + var _this = _super.call(this) || this; + if (_this.array === undefined) { + _this.array = null; + } + _this.array = array; + return _this; + } + /** + * + * @param {*} o + * @return {boolean} + */ + ArrayList.prototype.contains = function (o) { + return (this.indexOf(o) !== -1); + }; + /** + * + * @param {number} index + * @return {*} + */ + ArrayList.prototype.get = function (index) { + javaemul.internal.InternalPreconditions.checkElementIndex(index, this.size()); + return this.array[index]; + }; + /** + * + * @param {number} index + * @param {*} value + * @return {*} + */ + ArrayList.prototype.set = function (index, value) { + var was = this.get(index); + this.array[index] = value; + return was; + }; + /** + * + * @return {number} + */ + ArrayList.prototype.size = function () { + return this.array.length; + }; + ArrayList.prototype.toArray$ = function () { + return this.toArray$java_lang_Object_A((function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(this.array.length)); + }; + ArrayList.prototype.toArray$java_lang_Object_A = function (out) { + var size = this.size(); + if (out.length < size) { + out = javaemul.internal.ArrayHelper.createFrom(out, size); + } + for (var i = 0; i < size; ++i) { + { + out[i] = this.array[i]; + } + ; + } + if (out.length > size) { + out[size] = null; + } + return out; + }; + /** + * + * @param {Array} out + * @return {Array} + */ + ArrayList.prototype.toArray = function (out) { + if (((out != null && out instanceof Array && (out.length == 0 || out[0] == null || (out[0] != null))) || out === null)) { + return this.toArray$java_lang_Object_A(out); + } + else if (out === undefined) { + return this.toArray$(); + } + else + throw new Error('invalid overload'); + }; + return ArrayList; + }(java.util.AbstractList)); + Arrays.ArrayList = ArrayList; + ArrayList["__class"] = "java.util.Arrays.ArrayList"; + ArrayList["__interfaces"] = ["java.util.RandomAccess", "java.util.List", "java.util.Collection", "java.lang.Iterable", "java.io.Serializable"]; + })(Arrays = util.Arrays || (util.Arrays = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * An unbounded priority queue based on a priority heap. [Sun + * docs] + * + * @param element type. + * @param {number} initialCapacity + * @param {*} cmp + * @class + * @extends java.util.AbstractQueue + */ + var PriorityQueue = /** @class */ (function (_super) { + __extends(PriorityQueue, _super); + function PriorityQueue(initialCapacity, cmp) { + var _this = this; + if (((typeof initialCapacity === 'number') || initialCapacity === null) && ((typeof cmp === 'function' && cmp.length === 2) || cmp === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + _this.heap = (new java.util.ArrayList(initialCapacity)); + if (cmp == null) { + cmp = (java.util.Comparators.natural()); + } + _this.cmp = (cmp); + } + else if (((typeof initialCapacity === 'function' && initialCapacity.length === 2) || initialCapacity === null) && cmp === undefined) { + var __args = arguments; + var cp = __args[0]; + { + var __args_27 = arguments; + var initialCapacity_1 = PriorityQueue.INITIAL_CAPACITY; + var cmp_1 = cp; + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + _this.heap = (new java.util.ArrayList(initialCapacity_1)); + if (cmp_1 == null) { + cmp_1 = (java.util.Comparators.natural()); + } + _this.cmp = (cmp_1); + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + } + else if (((initialCapacity != null && initialCapacity instanceof java.util.PriorityQueue) || initialCapacity === null) && cmp === undefined) { + var __args = arguments; + var c_2 = __args[0]; + { + var __args_28 = arguments; + var initialCapacity_2 = c_2.size(); + var cmp_2 = (c_2.comparator()); + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + _this.heap = (new java.util.ArrayList(initialCapacity_2)); + if (cmp_2 == null) { + cmp_2 = (java.util.Comparators.natural()); + } + _this.cmp = (cmp_2); + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + (function () { + _this.addAll(c_2); + })(); + } + else if (((initialCapacity != null && (initialCapacity["__interfaces"] != null && initialCapacity["__interfaces"].indexOf("java.util.SortedSet") >= 0 || initialCapacity.constructor != null && initialCapacity.constructor["__interfaces"] != null && initialCapacity.constructor["__interfaces"].indexOf("java.util.SortedSet") >= 0)) || initialCapacity === null) && cmp === undefined) { + var __args = arguments; + var c_3 = __args[0]; + { + var __args_29 = arguments; + var initialCapacity_3 = c_3.size(); + var cmp_3 = (c_3.comparator()); + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + _this.heap = (new java.util.ArrayList(initialCapacity_3)); + if (cmp_3 == null) { + cmp_3 = (java.util.Comparators.natural()); + } + _this.cmp = (cmp_3); + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + (function () { + _this.addAll(c_3); + })(); + } + else if (((initialCapacity != null && (initialCapacity["__interfaces"] != null && initialCapacity["__interfaces"].indexOf("java.util.Collection") >= 0 || initialCapacity.constructor != null && initialCapacity.constructor["__interfaces"] != null && initialCapacity.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || initialCapacity === null) && cmp === undefined) { + var __args = arguments; + var c_4 = __args[0]; + { + var __args_30 = arguments; + var initialCapacity_4 = c_4.size(); + { + var __args_31 = arguments; + var cmp_4 = null; + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + _this.heap = (new java.util.ArrayList(initialCapacity_4)); + if (cmp_4 == null) { + cmp_4 = (java.util.Comparators.natural()); + } + _this.cmp = (cmp_4); + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + (function () { + _this.addAll(c_4); + })(); + } + else if (((typeof initialCapacity === 'number') || initialCapacity === null) && cmp === undefined) { + var __args = arguments; + { + var __args_32 = arguments; + var cmp_5 = null; + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + _this.heap = (new java.util.ArrayList(initialCapacity)); + if (cmp_5 == null) { + cmp_5 = (java.util.Comparators.natural()); + } + _this.cmp = (cmp_5); + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + } + else if (initialCapacity === undefined && cmp === undefined) { + var __args = arguments; + { + var __args_33 = arguments; + var initialCapacity_5 = PriorityQueue.INITIAL_CAPACITY; + { + var __args_34 = arguments; + var cmp_6 = null; + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + _this.heap = (new java.util.ArrayList(initialCapacity_5)); + if (cmp_6 == null) { + cmp_6 = (java.util.Comparators.natural()); + } + _this.cmp = (cmp_6); + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.heap === undefined) { + _this.heap = null; + } + } + else + throw new Error('invalid overload'); + return _this; + } + /*private*/ PriorityQueue.getLeftChild = function (node) { + return 2 * node + 1; + }; + /*private*/ PriorityQueue.getParent = function (node) { + return ((node - 1) / 2 | 0); + }; + /*private*/ PriorityQueue.getRightChild = function (node) { + return 2 * node + 2; + }; + /*private*/ PriorityQueue.isLeaf = function (node, size) { + return node * 2 + 1 >= size; + }; + /** + * + * @param {*} c + * @return {boolean} + */ + PriorityQueue.prototype.addAll = function (c) { + if (this.heap.addAll$java_util_Collection(c)) { + this.makeHeap(0); + return true; + } + return false; + }; + /** + * + */ + PriorityQueue.prototype.clear = function () { + this.heap.clear(); + }; + PriorityQueue.prototype.comparator = function () { + return this.cmp === java.util.Comparators.natural() ? (null) : (this.cmp); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + PriorityQueue.prototype.contains = function (o) { + return this.heap.contains(o); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + PriorityQueue.prototype.containsAll = function (c) { + return this.heap.containsAll(c); + }; + /** + * + * @return {boolean} + */ + PriorityQueue.prototype.isEmpty = function () { + return this.heap.isEmpty(); + }; + /** + * + * @return {*} + */ + PriorityQueue.prototype.iterator = function () { + return java.util.Collections.unmodifiableList(this.heap).iterator(); + }; + /** + * + * @param {*} e + * @return {boolean} + */ + PriorityQueue.prototype.offer = function (e) { + var node = this.heap.size(); + this.heap.add(e); + while ((node > 0)) { + { + var childNode = node; + node = PriorityQueue.getParent(node); + if (((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(this.heap.get(node), e) <= 0) { + this.heap.set(childNode, e); + return true; + } + this.heap.set(childNode, this.heap.get(node)); + } + } + ; + this.heap.set(node, e); + return true; + }; + /** + * + * @return {*} + */ + PriorityQueue.prototype.peek = function () { + if (this.heap.size() === 0) { + return null; + } + return this.heap.get(0); + }; + /** + * + * @return {*} + */ + PriorityQueue.prototype.poll = function () { + if (this.heap.size() === 0) { + return null; + } + var value = this.heap.get(0); + this.removeAtIndex(0); + return value; + }; + PriorityQueue.prototype.remove$java_lang_Object = function (o) { + var index = this.heap.indexOf$java_lang_Object(o); + if (index < 0) { + return false; + } + this.removeAtIndex(index); + return true; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + PriorityQueue.prototype.remove = function (o) { + if (((o != null) || o === null)) { + return this.remove$java_lang_Object(o); + } + else if (o === undefined) { + return this.remove$(); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + PriorityQueue.prototype.removeAll = function (c) { + if (this.heap.removeAll(c)) { + this.makeHeap(0); + return true; + } + return false; + }; + /** + * + * @param {*} c + * @return {boolean} + */ + PriorityQueue.prototype.retainAll = function (c) { + if (this.heap.retainAll(c)) { + this.makeHeap(0); + return true; + } + return false; + }; + /** + * + * @return {number} + */ + PriorityQueue.prototype.size = function () { + return this.heap.size(); + }; + PriorityQueue.prototype.toArray$ = function () { + return this.heap.toArray$(); + }; + PriorityQueue.prototype.toArray$java_lang_Object_A = function (a) { + return this.heap.toArray$java_lang_Object_A(a); + }; + /** + * + * @param {Array} a + * @return {Array} + */ + PriorityQueue.prototype.toArray = function (a) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null)) { + return this.toArray$java_lang_Object_A(a); + } + else if (a === undefined) { + return this.toArray$(); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {string} + */ + PriorityQueue.prototype.toString = function () { + return this.heap.toString(); + }; + /** + * Make the subtree rooted at node a valid heap. O(n) time + * + * @param {number} node + */ + PriorityQueue.prototype.makeHeap = function (node) { + if (this.isLeaf(node)) { + return; + } + this.makeHeap(PriorityQueue.getLeftChild(node)); + var rightChild = PriorityQueue.getRightChild(node); + if (rightChild < this.heap.size()) { + this.makeHeap(rightChild); + } + this.mergeHeaps(node); + }; + /** + * Merge two subheaps into a single heap. O(log n) time + * + * PRECONDITION: both children of node are heaps + * + * @param {number} node the parent of the two subtrees to merge + */ + PriorityQueue.prototype.mergeHeaps = function (node) { + var heapSize = this.heap.size(); + var value = this.heap.get(node); + while ((!PriorityQueue.isLeaf(node, heapSize))) { + { + var smallestChild = this.getSmallestChild(node, heapSize); + if (((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(value, this.heap.get(smallestChild)) < 0) { + break; + } + this.heap.set(node, this.heap.get(smallestChild)); + node = smallestChild; + } + } + ; + this.heap.set(node, value); + }; + /*private*/ PriorityQueue.prototype.getSmallestChild = function (node, heapSize) { + var smallestChild; + var leftChild = PriorityQueue.getLeftChild(node); + var rightChild = leftChild + 1; + smallestChild = leftChild; + if ((rightChild < heapSize) && (((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(this.heap.get(rightChild), this.heap.get(leftChild)) < 0)) { + smallestChild = rightChild; + } + return smallestChild; + }; + /*private*/ PriorityQueue.prototype.isLeaf = function (node) { + return PriorityQueue.isLeaf(node, this.heap.size()); + }; + /*private*/ PriorityQueue.prototype.removeAtIndex = function (index) { + var lastValue = this.heap.remove$int(this.heap.size() - 1); + if (index < this.heap.size()) { + this.heap.set(index, lastValue); + this.mergeHeaps(index); + } + }; + PriorityQueue.INITIAL_CAPACITY = 11; + return PriorityQueue; + }(java.util.AbstractQueue)); + util.PriorityQueue = PriorityQueue; + PriorityQueue["__class"] = "java.util.PriorityQueue"; + PriorityQueue["__interfaces"] = ["java.util.Collection", "java.util.Queue", "java.lang.Iterable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * @skip + * @param {java.io.OutputStream} out + * @class + * @extends java.io.FilterOutputStream + */ + var PrintStream = /** @class */ (function (_super) { + __extends(PrintStream, _super); + function PrintStream(out) { + return _super.call(this, out) || this; + } + PrintStream.prototype.print$java_lang_String = function (s) { + try { + this.write$byte_A(/* getBytes */ (s).split('').map(function (s) { return s.charCodeAt(0); })); + } + catch (e) { + console.error(e.message, e); + } + ; + }; + PrintStream.prototype.print = function (s) { + if (((typeof s === 'string') || s === null)) { + return this.print$java_lang_String(s); + } + else if (((s != null && s instanceof Array && (s.length == 0 || s[0] == null || (typeof s[0] === 'string'))) || s === null)) { + return this.print$char_A(s); + } + else if (((typeof s === 'boolean') || s === null)) { + return this.print$boolean(s); + } + else if (((typeof s === 'string') || s === null)) { + return this.print$char(s); + } + else if (((typeof s === 'number') || s === null)) { + return this.print$int(s); + } + else if (((typeof s === 'number') || s === null)) { + return this.print$long(s); + } + else if (((typeof s === 'number') || s === null)) { + return this.print$float(s); + } + else if (((typeof s === 'number') || s === null)) { + return this.print$double(s); + } + else if (((s != null) || s === null)) { + return this.print$java_lang_Object(s); + } + else + throw new Error('invalid overload'); + }; + PrintStream.prototype.println$java_lang_String = function (s) { + this.print$java_lang_String(s + java.lang.System.lineSeparator()); + }; + PrintStream.prototype.println = function (s) { + if (((typeof s === 'string') || s === null)) { + return this.println$java_lang_String(s); + } + else if (((s != null && s instanceof Array && (s.length == 0 || s[0] == null || (typeof s[0] === 'string'))) || s === null)) { + return this.println$char_A(s); + } + else if (((typeof s === 'boolean') || s === null)) { + return this.println$boolean(s); + } + else if (((typeof s === 'string') || s === null)) { + return this.println$char(s); + } + else if (((typeof s === 'number') || s === null)) { + return this.println$int(s); + } + else if (((typeof s === 'number') || s === null)) { + return this.println$long(s); + } + else if (((typeof s === 'number') || s === null)) { + return this.println$float(s); + } + else if (((typeof s === 'number') || s === null)) { + return this.println$double(s); + } + else if (((s != null) || s === null)) { + return this.println$java_lang_Object(s); + } + else if (s === undefined) { + return this.println$(); + } + else + throw new Error('invalid overload'); + }; + PrintStream.prototype.print$boolean = function (x) { + this.print$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.print$char = function (x) { + this.print$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.print$char_A = function (x) { + this.println$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.print$double = function (x) { + this.print$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.print$float = function (x) { + this.print$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.print$int = function (x) { + this.print$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.print$long = function (x) { + this.print$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.print$java_lang_Object = function (x) { + this.print$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.println$ = function () { + this.println$java_lang_String(""); + }; + PrintStream.prototype.println$boolean = function (x) { + this.println$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.println$char = function (x) { + this.println$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.println$char_A = function (x) { + this.println$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.println$double = function (x) { + this.println$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.println$float = function (x) { + this.println$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.println$int = function (x) { + this.println$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.println$long = function (x) { + this.println$java_lang_String(/* valueOf */ new String(x).toString()); + }; + PrintStream.prototype.println$java_lang_Object = function (x) { + this.println$java_lang_String(/* valueOf */ new String(x).toString()); + }; + return PrintStream; + }(java.io.FilterOutputStream)); + io.PrintStream = PrintStream; + PrintStream["__class"] = "java.io.PrintStream"; + PrintStream["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable", "java.io.Flushable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var security; + (function (security) { + /** + * A generic security exception type - [Sun's + * docs]. + * @param {string} msg + * @class + * @extends java.security.GeneralSecurityException + */ + var DigestException = /** @class */ (function (_super) { + __extends(DigestException, _super); + function DigestException(msg) { + var _this = this; + if (((typeof msg === 'string') || msg === null)) { + var __args = arguments; + _this = _super.call(this, msg) || this; + } + else if (msg === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return DigestException; + }(java.security.GeneralSecurityException)); + security.DigestException = DigestException; + DigestException["__class"] = "java.security.DigestException"; + DigestException["__interfaces"] = ["java.io.Serializable"]; + })(security = java.security || (java.security = {})); +})(java || (java = {})); +(function (java) { + var security; + (function (security) { + /** + * A generic security exception type - [Sun's + * docs]. + * @param {string} msg + * @class + * @extends java.security.GeneralSecurityException + */ + var NoSuchAlgorithmException = /** @class */ (function (_super) { + __extends(NoSuchAlgorithmException, _super); + function NoSuchAlgorithmException(msg) { + var _this = this; + if (((typeof msg === 'string') || msg === null)) { + var __args = arguments; + _this = _super.call(this, msg) || this; + } + else if (msg === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return NoSuchAlgorithmException; + }(java.security.GeneralSecurityException)); + security.NoSuchAlgorithmException = NoSuchAlgorithmException; + NoSuchAlgorithmException["__class"] = "java.security.NoSuchAlgorithmException"; + NoSuchAlgorithmException["__interfaces"] = ["java.io.Serializable"]; + })(security = java.security || (java.security = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * A character encoding is not supported - [Sun's + * docs]. + * @param {string} msg + * @class + * @extends java.io.IOException + */ + var UnsupportedEncodingException = /** @class */ (function (_super) { + __extends(UnsupportedEncodingException, _super); + function UnsupportedEncodingException(msg) { + var _this = this; + if (((typeof msg === 'string') || msg === null)) { + var __args = arguments; + _this = _super.call(this, msg) || this; + } + else if (msg === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return UnsupportedEncodingException; + }(java.io.IOException)); + io.UnsupportedEncodingException = UnsupportedEncodingException; + UnsupportedEncodingException["__class"] = "java.io.UnsupportedEncodingException"; + UnsupportedEncodingException["__interfaces"] = ["java.io.Serializable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (javaemul) { + var internal; + (function (internal) { + var stream; + (function (stream) { + var StopException = /** @class */ (function (_super) { + __extends(StopException, _super); + function StopException() { + var _this = _super.call(this) || this; + Object.setPrototypeOf(_this, StopException.prototype); + return _this; + } + return StopException; + }(java.lang.RuntimeException)); + stream.StopException = StopException; + StopException["__class"] = "javaemul.internal.stream.StopException"; + StopException["__interfaces"] = ["java.io.Serializable"]; + })(stream = internal.stream || (internal.stream = {})); + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (java) { + var util; + (function (util) { + /** + * See the + * official Java API doc for details. + * @param {string} s + * @param {string} className + * @param {string} key + * @class + * @extends java.lang.RuntimeException + */ + var MissingResourceException = /** @class */ (function (_super) { + __extends(MissingResourceException, _super); + function MissingResourceException(s, className, key) { + var _this = _super.call(this, s) || this; + Object.setPrototypeOf(_this, MissingResourceException.prototype); + if (_this.className === undefined) { + _this.className = null; + } + if (_this.key === undefined) { + _this.key = null; + } + _this.key = key; + _this.className = className; + return _this; + } + MissingResourceException.prototype.getClassName = function () { + return this.className; + }; + MissingResourceException.prototype.getKey = function () { + return this.key; + }; + return MissingResourceException; + }(java.lang.RuntimeException)); + util.MissingResourceException = MissingResourceException; + MissingResourceException["__class"] = "java.util.MissingResourceException"; + MissingResourceException["__interfaces"] = ["java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @class + * @extends java.lang.RuntimeException + */ + var ConcurrentModificationException = /** @class */ (function (_super) { + __extends(ConcurrentModificationException, _super); + function ConcurrentModificationException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return ConcurrentModificationException; + }(java.lang.RuntimeException)); + util.ConcurrentModificationException = ConcurrentModificationException; + ConcurrentModificationException["__class"] = "java.util.ConcurrentModificationException"; + ConcurrentModificationException["__interfaces"] = ["java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * See the + * official Java API doc for details. + * @param {string} s + * @class + * @extends java.lang.RuntimeException + */ + var NoSuchElementException = /** @class */ (function (_super) { + __extends(NoSuchElementException, _super); + function NoSuchElementException(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this, s) || this; + } + else if (s === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return NoSuchElementException; + }(java.lang.RuntimeException)); + util.NoSuchElementException = NoSuchElementException; + NoSuchElementException["__class"] = "java.util.NoSuchElementException"; + NoSuchElementException["__interfaces"] = ["java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * See the + * official Java API doc for details. + * @class + * @extends java.lang.RuntimeException + */ + var EmptyStackException = /** @class */ (function (_super) { + __extends(EmptyStackException, _super); + function EmptyStackException() { + var _this = _super.call(this) || this; + Object.setPrototypeOf(_this, EmptyStackException.prototype); + return _this; + } + return EmptyStackException; + }(java.lang.RuntimeException)); + util.EmptyStackException = EmptyStackException; + EmptyStackException["__class"] = "java.util.EmptyStackException"; + EmptyStackException["__interfaces"] = ["java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var io; + (function (io) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @param {java.io.IOException} cause + * @class + * @extends java.lang.RuntimeException + */ + var UncheckedIOException = /** @class */ (function (_super) { + __extends(UncheckedIOException, _super); + function UncheckedIOException(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof java.io.IOException) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message, (javaemul.internal.InternalPreconditions.checkNotNull(cause))) || this; + } + else if (((message != null && message instanceof java.io.IOException) || message === null) && cause === undefined) { + var __args = arguments; + var cause_7 = __args[0]; + _this = _super.call(this, (javaemul.internal.InternalPreconditions.checkNotNull(cause_7))) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + /** + * + * @return {java.io.IOException} + */ + UncheckedIOException.prototype.getCause = function () { + return null; + }; + return UncheckedIOException; + }(java.lang.RuntimeException)); + io.UncheckedIOException = UncheckedIOException; + UncheckedIOException["__class"] = "java.io.UncheckedIOException"; + UncheckedIOException["__interfaces"] = ["java.io.Serializable"]; + })(io = java.io || (java.io = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * Indicates that an objet was in an invalid state during an attempted + * operation. + * @param {string} message + * @param {java.lang.Throwable} cause + * @class + * @extends java.lang.RuntimeException + */ + var IllegalStateException = /** @class */ (function (_super) { + __extends(IllegalStateException, _super); + function IllegalStateException(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message, cause) || this; + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + var s = __args[0]; + _this = _super.call(this, s) || this; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined) { + var __args = arguments; + var cause_8 = __args[0]; + _this = _super.call(this, cause_8) || this; + } + else if (message === undefined && cause === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return IllegalStateException; + }(java.lang.RuntimeException)); + lang.IllegalStateException = IllegalStateException; + IllegalStateException["__class"] = "java.lang.IllegalStateException"; + IllegalStateException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @class + * @extends java.lang.RuntimeException + */ + var NullPointerException = /** @class */ (function (_super) { + __extends(NullPointerException, _super); + function NullPointerException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + NullPointerException.prototype.createError = function (msg) { + return (new TypeError(msg)); + }; + return NullPointerException; + }(java.lang.RuntimeException)); + lang.NullPointerException = NullPointerException; + NullPointerException["__class"] = "java.lang.NullPointerException"; + NullPointerException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var IllegalAccessException = /** @class */ (function (_super) { + __extends(IllegalAccessException, _super); + function IllegalAccessException(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message, cause) || this; + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + var s = __args[0]; + _this = _super.call(this, s) || this; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined) { + var __args = arguments; + var cause_9 = __args[0]; + _this = _super.call(this, cause_9) || this; + } + else if (message === undefined && cause === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return IllegalAccessException; + }(java.lang.RuntimeException)); + lang.IllegalAccessException = IllegalAccessException; + IllegalAccessException["__class"] = "java.lang.IllegalAccessException"; + IllegalAccessException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @param {java.lang.Throwable} cause + * @class + * @extends java.lang.RuntimeException + */ + var IllegalArgumentException = /** @class */ (function (_super) { + __extends(IllegalArgumentException, _super); + function IllegalArgumentException(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message, cause) || this; + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined) { + var __args = arguments; + var cause_10 = __args[0]; + _this = _super.call(this, cause_10) || this; + } + else if (message === undefined && cause === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return IllegalArgumentException; + }(java.lang.RuntimeException)); + lang.IllegalArgumentException = IllegalArgumentException; + IllegalArgumentException["__class"] = "java.lang.IllegalArgumentException"; + IllegalArgumentException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var annotation; + (function (annotation) { + /** + * Indicates an attempt to access an element of an annotation that has changed + * since it was compiled or serialized [Sun + * docs]. + * @class + * @extends java.lang.RuntimeException + */ + var AnnotationTypeMismatchException = /** @class */ (function (_super) { + __extends(AnnotationTypeMismatchException, _super); + function AnnotationTypeMismatchException() { + var _this = _super.call(this) || this; + Object.setPrototypeOf(_this, AnnotationTypeMismatchException.prototype); + return _this; + } + return AnnotationTypeMismatchException; + }(java.lang.RuntimeException)); + annotation.AnnotationTypeMismatchException = AnnotationTypeMismatchException; + AnnotationTypeMismatchException["__class"] = "java.lang.annotation.AnnotationTypeMismatchException"; + AnnotationTypeMismatchException["__interfaces"] = ["java.io.Serializable"]; + })(annotation = lang.annotation || (lang.annotation = {})); + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var annotation; + (function (annotation) { + /** + * Indicates an attempt to access an element of an annotation that was added + * since it was compiled or serialized [Sun + * docs]. + * @param {java.lang.Class} annotationType + * @param {string} elementName + * @class + * @extends java.lang.RuntimeException + */ + var IncompleteAnnotationException = /** @class */ (function (_super) { + __extends(IncompleteAnnotationException, _super); + function IncompleteAnnotationException(annotationType, elementName) { + var _this = _super.call(this, "Incomplete annotation: trying to access " + elementName + " on " + annotationType) || this; + Object.setPrototypeOf(_this, IncompleteAnnotationException.prototype); + if (_this.__annotationType === undefined) { + _this.__annotationType = null; + } + if (_this.__elementName === undefined) { + _this.__elementName = null; + } + _this.__annotationType = annotationType; + _this.__elementName = elementName; + return _this; + } + IncompleteAnnotationException.prototype.annotationType = function () { + return this.__annotationType; + }; + IncompleteAnnotationException.prototype.elementName = function () { + return this.__elementName; + }; + return IncompleteAnnotationException; + }(java.lang.RuntimeException)); + annotation.IncompleteAnnotationException = IncompleteAnnotationException; + IncompleteAnnotationException["__class"] = "java.lang.annotation.IncompleteAnnotationException"; + IncompleteAnnotationException["__interfaces"] = ["java.io.Serializable"]; + })(annotation = lang.annotation || (lang.annotation = {})); + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * Indicates failure to cast one type into another. + * @param {string} message + * @class + * @extends java.lang.RuntimeException + */ + var ClassCastException = /** @class */ (function (_super) { + __extends(ClassCastException, _super); + function ClassCastException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return ClassCastException; + }(java.lang.RuntimeException)); + lang.ClassCastException = ClassCastException; + ClassCastException["__class"] = "java.lang.ClassCastException"; + ClassCastException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @class + * @extends java.lang.RuntimeException + */ + var NegativeArraySizeException = /** @class */ (function (_super) { + __extends(NegativeArraySizeException, _super); + function NegativeArraySizeException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return NegativeArraySizeException; + }(java.lang.RuntimeException)); + lang.NegativeArraySizeException = NegativeArraySizeException; + NegativeArraySizeException["__class"] = "java.lang.NegativeArraySizeException"; + NegativeArraySizeException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @class + * @extends java.lang.RuntimeException + */ + var ArrayStoreException = /** @class */ (function (_super) { + __extends(ArrayStoreException, _super); + function ArrayStoreException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return ArrayStoreException; + }(java.lang.RuntimeException)); + lang.ArrayStoreException = ArrayStoreException; + ArrayStoreException["__class"] = "java.lang.ArrayStoreException"; + ArrayStoreException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * NOTE: in GWT this is only thrown for division by zero on longs and + * BigInteger/BigDecimal. + *

+ * See the + * official Java API doc for details. + * @param {string} explanation + * @class + * @extends java.lang.RuntimeException + */ + var ArithmeticException = /** @class */ (function (_super) { + __extends(ArithmeticException, _super); + function ArithmeticException(explanation) { + var _this = this; + if (((typeof explanation === 'string') || explanation === null)) { + var __args = arguments; + _this = _super.call(this, explanation) || this; + } + else if (explanation === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return ArithmeticException; + }(java.lang.RuntimeException)); + lang.ArithmeticException = ArithmeticException; + ArithmeticException["__class"] = "java.lang.ArithmeticException"; + ArithmeticException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @param {java.lang.Throwable} cause + * @class + * @extends java.lang.RuntimeException + */ + var UnsupportedOperationException = /** @class */ (function (_super) { + __extends(UnsupportedOperationException, _super); + function UnsupportedOperationException(message, cause) { + var _this = this; + if (((typeof message === 'string') || message === null) && ((cause != null && cause instanceof Error) || cause === null)) { + var __args = arguments; + _this = _super.call(this, message, cause) || this; + } + else if (((typeof message === 'string') || message === null) && cause === undefined) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (((message != null && message instanceof Error) || message === null) && cause === undefined) { + var __args = arguments; + var cause_11 = __args[0]; + _this = _super.call(this, cause_11) || this; + } + else if (message === undefined && cause === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return UnsupportedOperationException; + }(java.lang.RuntimeException)); + lang.UnsupportedOperationException = UnsupportedOperationException; + UnsupportedOperationException["__class"] = "java.lang.UnsupportedOperationException"; + UnsupportedOperationException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @class + * @extends java.lang.RuntimeException + */ + var IndexOutOfBoundsException = /** @class */ (function (_super) { + __extends(IndexOutOfBoundsException, _super); + function IndexOutOfBoundsException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return IndexOutOfBoundsException; + }(java.lang.RuntimeException)); + lang.IndexOutOfBoundsException = IndexOutOfBoundsException; + IndexOutOfBoundsException["__class"] = "java.lang.IndexOutOfBoundsException"; + IndexOutOfBoundsException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var BufferUnderflowException = /** @class */ (function (_super) { + __extends(BufferUnderflowException, _super); + function BufferUnderflowException() { + var _this = _super.call(this) || this; + Object.setPrototypeOf(_this, BufferUnderflowException.prototype); + return _this; + } + return BufferUnderflowException; + }(java.lang.RuntimeException)); + nio.BufferUnderflowException = BufferUnderflowException; + BufferUnderflowException["__class"] = "java.nio.BufferUnderflowException"; + BufferUnderflowException["__interfaces"] = ["java.io.Serializable"]; + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var BufferOverflowException = /** @class */ (function (_super) { + __extends(BufferOverflowException, _super); + function BufferOverflowException() { + var _this = _super.call(this) || this; + Object.setPrototypeOf(_this, BufferOverflowException.prototype); + return _this; + } + return BufferOverflowException; + }(java.lang.RuntimeException)); + nio.BufferOverflowException = BufferOverflowException; + BufferOverflowException["__class"] = "java.nio.BufferOverflowException"; + BufferOverflowException["__interfaces"] = ["java.io.Serializable"]; + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var InstantiationException = /** @class */ (function (_super) { + __extends(InstantiationException, _super); + function InstantiationException(s) { + var _this = this; + if (((typeof s === 'string') || s === null)) { + var __args = arguments; + _this = _super.call(this, s) || this; + } + else if (s === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return InstantiationException; + }(java.lang.ReflectiveOperationException)); + lang.InstantiationException = InstantiationException; + InstantiationException["__class"] = "java.lang.InstantiationException"; + InstantiationException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var charset; + (function (charset) { + /** + * Constant definitions for the standard Charsets. + * @class + */ + var StandardCharsets = /** @class */ (function () { + function StandardCharsets() { + } + StandardCharsets.ISO_8859_1_$LI$ = function () { if (StandardCharsets.ISO_8859_1 == null) { + StandardCharsets.ISO_8859_1 = javaemul.internal.EmulatedCharset.ISO_8859_1_$LI$(); + } return StandardCharsets.ISO_8859_1; }; + ; + StandardCharsets.UTF_8_$LI$ = function () { if (StandardCharsets.UTF_8 == null) { + StandardCharsets.UTF_8 = javaemul.internal.EmulatedCharset.UTF_8_$LI$(); + } return StandardCharsets.UTF_8; }; + ; + return StandardCharsets; + }()); + charset.StandardCharsets = StandardCharsets; + StandardCharsets["__class"] = "java.nio.charset.StandardCharsets"; + })(charset = nio.charset || (nio.charset = {})); + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Implementation of Map interface based on a hash table. + * [Sun + * docs] + * + * @param + * key type + * @param + * value type + * @param {number} ignored + * @param {number} alsoIgnored + * @class + * @extends java.util.AbstractMap + */ + var AbstractHashMap = /** @class */ (function (_super) { + __extends(AbstractHashMap, _super); + function AbstractHashMap(ignored, alsoIgnored) { + var _this = this; + if (((typeof ignored === 'number') || ignored === null) && ((typeof alsoIgnored === 'number') || alsoIgnored === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.hashCodeMap === undefined) { + _this.hashCodeMap = null; + } + if (_this.stringMap === undefined) { + _this.stringMap = null; + } + javaemul.internal.InternalPreconditions.checkArgument(ignored >= 0, "Negative initial capacity"); + javaemul.internal.InternalPreconditions.checkArgument(alsoIgnored >= 0, "Non-positive load factor"); + _this.reset(); + } + else if (((ignored != null && (ignored["__interfaces"] != null && ignored["__interfaces"].indexOf("java.util.Map") >= 0 || ignored.constructor != null && ignored.constructor["__interfaces"] != null && ignored.constructor["__interfaces"].indexOf("java.util.Map") >= 0)) || ignored === null) && alsoIgnored === undefined) { + var __args = arguments; + var toBeCopied = __args[0]; + _this = _super.call(this) || this; + if (_this.hashCodeMap === undefined) { + _this.hashCodeMap = null; + } + if (_this.stringMap === undefined) { + _this.stringMap = null; + } + _this.reset(); + _this.putAll(toBeCopied); + } + else if (((typeof ignored === 'number') || ignored === null) && alsoIgnored === undefined) { + var __args = arguments; + { + var __args_35 = arguments; + var alsoIgnored_1 = 0; + _this = _super.call(this) || this; + if (_this.hashCodeMap === undefined) { + _this.hashCodeMap = null; + } + if (_this.stringMap === undefined) { + _this.stringMap = null; + } + javaemul.internal.InternalPreconditions.checkArgument(ignored >= 0, "Negative initial capacity"); + javaemul.internal.InternalPreconditions.checkArgument(alsoIgnored_1 >= 0, "Non-positive load factor"); + _this.reset(); + } + if (_this.hashCodeMap === undefined) { + _this.hashCodeMap = null; + } + if (_this.stringMap === undefined) { + _this.stringMap = null; + } + } + else if (ignored === undefined && alsoIgnored === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.hashCodeMap === undefined) { + _this.hashCodeMap = null; + } + if (_this.stringMap === undefined) { + _this.stringMap = null; + } + _this.reset(); + } + else + throw new Error('invalid overload'); + return _this; + } + /** + * + */ + AbstractHashMap.prototype.clear = function () { + this.reset(); + }; + AbstractHashMap.prototype.reset = function () { + this.hashCodeMap = (new java.util.InternalHashCodeMap(this)); + this.stringMap = (new java.util.InternalStringMap(this)); + java.util.ConcurrentModificationDetector.structureChanged(this); + }; + /** + * + * @param {*} key + * @return {boolean} + */ + AbstractHashMap.prototype.containsKey = function (key) { + return (typeof key === 'string') ? this.hasStringValue(javaemul.internal.JsUtils.unsafeCastToString(key)) : this.hasHashValue(key); + }; + /** + * + * @param {*} value + * @return {boolean} + */ + AbstractHashMap.prototype.containsValue = function (value) { + return this._containsValue(value, this.stringMap) || this._containsValue(value, this.hashCodeMap); + }; + AbstractHashMap.prototype._containsValue = function (value, entries) { + for (var index173 = entries.iterator(); index173.hasNext();) { + var entry = index173.next(); + { + if (this._equals(value, entry.getValue())) { + return true; + } + } + } + return false; + }; + /** + * + * @return {*} + */ + AbstractHashMap.prototype.entrySet = function () { + return new AbstractHashMap.EntrySet(this); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractHashMap.prototype.get = function (key) { + var v = (typeof key === 'string') ? this.getStringValue(javaemul.internal.JsUtils.unsafeCastToString(key)) : this.getHashValue(key); + return v === undefined ? null : v; + }; + /** + * + * @param {*} key + * @param {*} value + * @return {*} + */ + AbstractHashMap.prototype.put = function (key, value) { + return (typeof key === 'string') ? this.putStringValue(javaemul.internal.JsUtils.unsafeCastToString(key), value) : this.putHashValue(key, value); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractHashMap.prototype.remove = function (key) { + return (typeof key === 'string') ? this.removeStringValue(javaemul.internal.JsUtils.unsafeCastToString(key)) : this.removeHashValue(key); + }; + /** + * + * @return {number} + */ + AbstractHashMap.prototype.size = function () { + return this.hashCodeMap.size() + this.stringMap.getSize(); + }; + /** + * Returns the Map.Entry whose key is Object equal to key, + * provided that key's hash code is hashCode; or + * null if no such Map.Entry exists at the specified hashCode. + * @param {*} key + * @return {*} + * @private + */ + AbstractHashMap.prototype.getHashValue = function (key) { + return (util.AbstractMap.getEntryValueOrNull(this.hashCodeMap.getEntry(key))); + }; + /** + * Returns the value for the given key in the stringMap. Returns + * null if the specified key does not exist. + * @param {string} key + * @return {*} + * @private + */ + AbstractHashMap.prototype.getStringValue = function (key) { + return key == null ? this.getHashValue(null) : this.stringMap.get(key); + }; + /** + * Returns true if the a key exists in the hashCodeMap that is Object equal + * to key, provided that key's hash code is + * hashCode. + * @param {*} key + * @return {boolean} + * @private + */ + AbstractHashMap.prototype.hasHashValue = function (key) { + return this.hashCodeMap.getEntry(key) != null; + }; + /** + * Returns true if the given key exists in the stringMap. + * @param {string} key + * @return {boolean} + * @private + */ + AbstractHashMap.prototype.hasStringValue = function (key) { + return key == null ? this.hasHashValue(null) : this.stringMap.contains(key); + }; + /** + * Sets the specified key to the specified value in the hashCodeMap. Returns + * the value previously at that key. Returns null if the + * specified key did not exist. + * @param {*} key + * @param {*} value + * @return {*} + * @private + */ + AbstractHashMap.prototype.putHashValue = function (key, value) { + return this.hashCodeMap.put(key, value); + }; + /** + * Sets the specified key to the specified value in the stringMap. Returns + * the value previously at that key. Returns null if the + * specified key did not exist. + * @param {string} key + * @param {*} value + * @return {*} + * @private + */ + AbstractHashMap.prototype.putStringValue = function (key, value) { + return key == null ? this.putHashValue(null, value) : this.stringMap.put(key, value); + }; + /** + * Removes the pair whose key is Object equal to key from + * hashCodeMap, provided that key's hash code is + * hashCode. Returns the value that was associated with the + * removed key, or null if no such key existed. + * @param {*} key + * @return {*} + * @private + */ + AbstractHashMap.prototype.removeHashValue = function (key) { + return this.hashCodeMap.remove(key); + }; + /** + * Removes the specified key from the stringMap and returns the value that + * was previously there. Returns null if the specified key does + * not exist. + * @param {string} key + * @return {*} + * @private + */ + AbstractHashMap.prototype.removeStringValue = function (key) { + return key == null ? this.removeHashValue(null) : this.stringMap.remove(key); + }; + return AbstractHashMap; + }(java.util.AbstractMap)); + util.AbstractHashMap = AbstractHashMap; + AbstractHashMap["__class"] = "java.util.AbstractHashMap"; + AbstractHashMap["__interfaces"] = ["java.util.Map"]; + (function (AbstractHashMap) { + var EntrySet = /** @class */ (function (_super) { + __extends(EntrySet, _super); + function EntrySet(__parent) { + var _this = _super.call(this) || this; + _this.__parent = __parent; + return _this; + } + /** + * + */ + EntrySet.prototype.clear = function () { + this.clear(); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + EntrySet.prototype.contains = function (o) { + if (o != null && (o["__interfaces"] != null && o["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || o.constructor != null && o.constructor["__interfaces"] != null && o.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0)) { + return this.__parent.containsEntry(o); + } + return false; + }; + /** + * + * @return {*} + */ + EntrySet.prototype.iterator = function () { + return new AbstractHashMap.EntrySetIterator(this.__parent); + }; + /** + * + * @param {*} entry + * @return {boolean} + */ + EntrySet.prototype.remove = function (entry) { + if (this.contains(entry)) { + var key = entry.getKey(); + this.remove(key); + return true; + } + return false; + }; + /** + * + * @return {number} + */ + EntrySet.prototype.size = function () { + return this.size(); + }; + return EntrySet; + }(java.util.AbstractSet)); + AbstractHashMap.EntrySet = EntrySet; + EntrySet["__class"] = "java.util.AbstractHashMap.EntrySet"; + EntrySet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + /** + * Iterator for EntrySet. + * @class + */ + var EntrySetIterator = /** @class */ (function () { + function EntrySetIterator(__parent) { + this.__parent = __parent; + if (this.stringMapEntries === undefined) { + this.stringMapEntries = null; + } + if (this.current === undefined) { + this.current = null; + } + if (this.last === undefined) { + this.last = null; + } + if (this.__hasNext === undefined) { + this.__hasNext = false; + } + this.stringMapEntries = __parent.stringMap.iterator(); + this.current = this.stringMapEntries; + this.__hasNext = this.computeHasNext(); + java.util.ConcurrentModificationDetector.recordLastKnownStructure(__parent, this); + } + /* Default method injected from java.util.Iterator */ + EntrySetIterator.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + EntrySetIterator.prototype.hasNext = function () { + return this.__hasNext; + }; + EntrySetIterator.prototype.computeHasNext = function () { + if (this.current.hasNext()) { + return true; + } + if (this.current !== this.stringMapEntries) { + return false; + } + this.current = this.__parent.hashCodeMap.iterator(); + return this.current.hasNext(); + }; + /** + * + * @return {*} + */ + EntrySetIterator.prototype.next = function () { + java.util.ConcurrentModificationDetector.checkStructuralChange(this.__parent, this); + javaemul.internal.InternalPreconditions.checkElement(this.hasNext()); + this.last = this.current; + var rv = this.current.next(); + this.__hasNext = this.computeHasNext(); + return rv; + }; + /** + * + */ + EntrySetIterator.prototype.remove = function () { + javaemul.internal.InternalPreconditions.checkState(this.last != null); + java.util.ConcurrentModificationDetector.checkStructuralChange(this.__parent, this); + this.last.remove(); + this.last = null; + this.__hasNext = this.computeHasNext(); + java.util.ConcurrentModificationDetector.recordLastKnownStructure(this.__parent, this); + }; + return EntrySetIterator; + }()); + AbstractHashMap.EntrySetIterator = EntrySetIterator; + EntrySetIterator["__class"] = "java.util.AbstractHashMap.EntrySetIterator"; + EntrySetIterator["__interfaces"] = ["java.util.Iterator"]; + })(AbstractHashMap = util.AbstractHashMap || (util.AbstractHashMap = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * A {@link java.util.Map} of {@link Enum}s. [Sun + * docs] + * + * @param key type + * @param value type + * @param {java.lang.Class} type + * @class + * @extends java.util.AbstractMap + */ + var EnumMap = /** @class */ (function (_super) { + __extends(EnumMap, _super); + function EnumMap(type) { + var _this = this; + if (((type != null && type instanceof java.lang.Class) || type === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.__keySet === undefined) { + _this.__keySet = null; + } + if (_this.__values === undefined) { + _this.__values = null; + } + _this.init$java_lang_Class(type); + } + else if (((type != null && type instanceof java.util.EnumMap) || type === null)) { + var __args = arguments; + var m = __args[0]; + _this = _super.call(this) || this; + if (_this.__keySet === undefined) { + _this.__keySet = null; + } + if (_this.__values === undefined) { + _this.__values = null; + } + _this.init$java_util_EnumMap(m); + } + else if (((type != null && (type["__interfaces"] != null && type["__interfaces"].indexOf("java.util.Map") >= 0 || type.constructor != null && type.constructor["__interfaces"] != null && type.constructor["__interfaces"].indexOf("java.util.Map") >= 0)) || type === null)) { + var __args = arguments; + var m = __args[0]; + _this = _super.call(this) || this; + if (_this.__keySet === undefined) { + _this.__keySet = null; + } + if (_this.__values === undefined) { + _this.__values = null; + } + if (m != null && m instanceof java.util.EnumMap) { + _this.init$java_util_EnumMap(m); + } + else { + javaemul.internal.InternalPreconditions.checkArgument(!m.isEmpty(), "Specified map is empty"); + _this.init$java_lang_Class(m.keySet().iterator().next().getDeclaringClass()); + _this.putAll(m); + } + } + else + throw new Error('invalid overload'); + return _this; + } + /** + * + */ + EnumMap.prototype.clear = function () { + this.__keySet.clear(); + this.__values = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(this.__values.length); + }; + EnumMap.prototype.clone = function () { + return (new EnumMap(this)); + }; + /** + * + * @param {*} key + * @return {boolean} + */ + EnumMap.prototype.containsKey = function (key) { + return this.__keySet.contains(key); + }; + /** + * + * @param {*} value + * @return {boolean} + */ + EnumMap.prototype.containsValue = function (value) { + for (var index174 = this.__keySet.iterator(); index174.hasNext();) { + var key = index174.next(); + { + if (java.util.Objects.equals(value, this.__values[key.ordinal()])) { + return true; + } + } + } + return false; + }; + /** + * + * @return {*} + */ + EnumMap.prototype.entrySet = function () { + return new EnumMap.EntrySet(this); + }; + /** + * + * @param {*} k + * @return {*} + */ + EnumMap.prototype.get = function (k) { + return this.__keySet.contains(k) ? this.__values[this.asOrdinal(k)] : null; + }; + EnumMap.prototype.put$java_lang_Enum$java_lang_Object = function (key, value) { + this.__keySet.add(key); + return this.set(key.ordinal(), value); + }; + /** + * + * @param {java.lang.Enum} key + * @param {*} value + * @return {*} + */ + EnumMap.prototype.put = function (key, value) { + if (((key != null) || key === null) && ((value != null) || value === null)) { + return this.put$java_lang_Enum$java_lang_Object(key, value); + } + else if (((key != null) || key === null) && ((value != null) || value === null)) { + return _super.prototype.put.call(this, key, value); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} key + * @return {*} + */ + EnumMap.prototype.remove = function (key) { + return this.__keySet.remove(key) ? this.set(this.asOrdinal(key), null) : null; + }; + /** + * + * @return {number} + */ + EnumMap.prototype.size = function () { + return this.__keySet.size(); + }; + /** + * Returns key as K. Only runtime checks that + * key is an Enum, not that it's the particular Enum K. Should only be called + * when you are sure key is of type K. + * @param {*} key + * @return {java.lang.Enum} + * @private + */ + EnumMap.prototype.asKey = function (key) { + return key; + }; + EnumMap.prototype.asOrdinal = function (key) { + return this.asKey(key).ordinal(); + }; + EnumMap.prototype.init$java_lang_Class = function (type) { + this.__keySet = java.util.EnumSet.noneOf(type); + this.__values = (function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(this.__keySet.capacity()); + }; + EnumMap.prototype.init = function (type) { + if (((type != null && type instanceof java.lang.Class) || type === null)) { + return this.init$java_lang_Class(type); + } + else if (((type != null && type instanceof java.util.EnumMap) || type === null)) { + return this.init$java_util_EnumMap(type); + } + else + throw new Error('invalid overload'); + }; + EnumMap.prototype.init$java_util_EnumMap = function (m) { + this.__keySet = /* clone */ (function (o) { if (o.clone != undefined) { + return o.clone(); + } + else { + var clone = Object.create(o); + for (var p in o) { + if (o.hasOwnProperty(p)) + clone[p] = o[p]; + } + return clone; + } })(m.__keySet); + this.__values = javaemul.internal.ArrayHelper.clone(m.__values, 0, m.__values.length); + }; + EnumMap.prototype.set = function (ordinal, value) { + var was = this.__values[ordinal]; + this.__values[ordinal] = value; + return was; + }; + return EnumMap; + }(java.util.AbstractMap)); + util.EnumMap = EnumMap; + EnumMap["__class"] = "java.util.EnumMap"; + EnumMap["__interfaces"] = ["java.util.Map"]; + (function (EnumMap) { + var EntrySet = /** @class */ (function (_super) { + __extends(EntrySet, _super); + function EntrySet(__parent) { + var _this = _super.call(this) || this; + _this.__parent = __parent; + return _this; + } + /** + * + */ + EntrySet.prototype.clear = function () { + this.clear(); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + EntrySet.prototype.contains = function (o) { + if (o != null && (o["__interfaces"] != null && o["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || o.constructor != null && o.constructor["__interfaces"] != null && o.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0)) { + return this.__parent.containsEntry(o); + } + return false; + }; + /** + * + * @return {*} + */ + EntrySet.prototype.iterator = function () { + return new EnumMap.EntrySetIterator(this.__parent); + }; + /** + * + * @param {*} entry + * @return {boolean} + */ + EntrySet.prototype.remove = function (entry) { + if (this.contains(entry)) { + var key = entry.getKey(); + this.remove(key); + return true; + } + return false; + }; + /** + * + * @return {number} + */ + EntrySet.prototype.size = function () { + return this.size(); + }; + return EntrySet; + }(java.util.AbstractSet)); + EnumMap.EntrySet = EntrySet; + EntrySet["__class"] = "java.util.EnumMap.EntrySet"; + EntrySet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + var EntrySetIterator = /** @class */ (function () { + function EntrySetIterator(__parent) { + this.__parent = __parent; + this.it = this.__parent.__keySet.iterator(); + if (this.key === undefined) { + this.key = null; + } + } + /* Default method injected from java.util.Iterator */ + EntrySetIterator.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + EntrySetIterator.prototype.hasNext = function () { + return this.it.hasNext(); + }; + /** + * + * @return {*} + */ + EntrySetIterator.prototype.next = function () { + this.key = this.it.next(); + return new EnumMap.MapEntry(this.__parent, this.key); + }; + /** + * + */ + EntrySetIterator.prototype.remove = function () { + javaemul.internal.InternalPreconditions.checkState(this.key != null); + this.__parent.remove(this.key); + this.key = null; + }; + return EntrySetIterator; + }()); + EnumMap.EntrySetIterator = EntrySetIterator; + EntrySetIterator["__class"] = "java.util.EnumMap.EntrySetIterator"; + EntrySetIterator["__interfaces"] = ["java.util.Iterator"]; + var MapEntry = /** @class */ (function (_super) { + __extends(MapEntry, _super); + function MapEntry(__parent, key) { + var _this = _super.call(this) || this; + _this.__parent = __parent; + if (_this.key === undefined) { + _this.key = null; + } + _this.key = key; + return _this; + } + /** + * + * @return {java.lang.Enum} + */ + MapEntry.prototype.getKey = function () { + return this.key; + }; + /** + * + * @return {*} + */ + MapEntry.prototype.getValue = function () { + return this.__parent.__values[this.key.ordinal()]; + }; + /** + * + * @param {*} value + * @return {*} + */ + MapEntry.prototype.setValue = function (value) { + return this.__parent.set(this.key.ordinal(), value); + }; + return MapEntry; + }(java.util.AbstractMapEntry)); + EnumMap.MapEntry = MapEntry; + MapEntry["__class"] = "java.util.EnumMap.MapEntry"; + MapEntry["__interfaces"] = ["java.util.Map.Entry"]; + })(EnumMap = util.EnumMap || (util.EnumMap = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Skeletal implementation of a NavigableMap. + * @extends java.util.AbstractMap + * @class + */ + var AbstractNavigableMap = /** @class */ (function (_super) { + __extends(AbstractNavigableMap, _super); + function AbstractNavigableMap() { + return _super.call(this) || this; + } + /* Default method injected from java.util.Map */ + AbstractNavigableMap.prototype.getOrDefault = function (key, defaultValue) { + var v; + return (((v = this.get(key)) != null) || this.containsKey(key)) ? v : defaultValue; + }; + /* Default method injected from java.util.Map */ + AbstractNavigableMap.prototype.putIfAbsent = function (key, value) { + var v = this.get(key); + if (v == null) { + v = this.put(key, value); + } + return v; + }; + /* Default method injected from java.util.Map */ + AbstractNavigableMap.prototype.merge = function (key, value, map) { + var old = this.get(key); + var next = (old == null) ? value : (function (target) { return (typeof target === 'function') ? target(old, value) : target.apply(old, value); })(map); + if (next == null) { + this.remove(key); + } + else { + this.put(key, next); + } + return next; + }; + /* Default method injected from java.util.Map */ + AbstractNavigableMap.prototype.computeIfAbsent = function (key, mappingFunction) { + var result; + if ((result = this.get(key)) == null) { + result = (function (target) { return (typeof target === 'function') ? target(key) : target.apply(key); })(mappingFunction); + if (result != null) + this.put(key, result); + } + return result; + }; + /* Default method injected from java.util.Map */ + AbstractNavigableMap.prototype.replaceAll = function (__function) { + java.util.Objects.requireNonNull((__function)); + var _loop_20 = function (index175) { + var entry = index175.next(); + { + var k_2; + var v_2; + try { + k_2 = entry.getKey(); + v_2 = entry.getValue(); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + v_2 = (function (target) { return (typeof target === 'function') ? target(k_2, v_2) : target.apply(k_2, v_2); })(__function); + try { + entry.setValue(v_2); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + } + }; + for (var index175 = this.entrySet().iterator(); index175.hasNext();) { + _loop_20(index175); + } + }; + AbstractNavigableMap.copyOf = function (entry) { + return entry == null ? null : (new util.AbstractMap.SimpleImmutableEntry(entry)); + }; + AbstractNavigableMap.getKeyOrNSE = function (entry) { + if (entry == null) { + throw new java.util.NoSuchElementException(); + } + return entry.getKey(); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractNavigableMap.prototype.ceilingEntry = function (key) { + return AbstractNavigableMap.copyOf(this.getCeilingEntry(key)); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractNavigableMap.prototype.ceilingKey = function (key) { + return (util.AbstractMap.getEntryKeyOrNull(this.getCeilingEntry(key))); + }; + /** + * + * @param {*} k + * @return {boolean} + */ + AbstractNavigableMap.prototype.containsKey = function (k) { + var key = k; + return this.getEntry(key) != null; + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.descendingKeySet = function () { + return this.descendingMap().navigableKeySet(); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.descendingMap = function () { + return new AbstractNavigableMap.DescendingMap(this); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.entrySet = function () { + return new AbstractNavigableMap.EntrySet(this); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.firstEntry = function () { + return AbstractNavigableMap.copyOf(this.getFirstEntry()); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.firstKey = function () { + return (AbstractNavigableMap.getKeyOrNSE(this.getFirstEntry())); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractNavigableMap.prototype.floorEntry = function (key) { + return AbstractNavigableMap.copyOf(this.getFloorEntry(key)); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractNavigableMap.prototype.floorKey = function (key) { + return (util.AbstractMap.getEntryKeyOrNull(this.getFloorEntry(key))); + }; + /** + * + * @param {*} k + * @return {*} + */ + AbstractNavigableMap.prototype.get = function (k) { + var key = k; + return (util.AbstractMap.getEntryValueOrNull(this.getEntry(key))); + }; + AbstractNavigableMap.prototype.headMap = function (toKey, inclusive) { + if (((toKey != null) || toKey === null) && inclusive === undefined) { + return this.headMap$java_lang_Object(toKey); + } + else + throw new Error('invalid overload'); + }; + AbstractNavigableMap.prototype.headMap$java_lang_Object = function (toKey) { + return this.headMap(toKey, false); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractNavigableMap.prototype.higherEntry = function (key) { + return AbstractNavigableMap.copyOf(this.getHigherEntry(key)); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractNavigableMap.prototype.higherKey = function (key) { + return (util.AbstractMap.getEntryKeyOrNull(this.getHigherEntry(key))); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.keySet = function () { + return this.navigableKeySet(); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.lastEntry = function () { + return AbstractNavigableMap.copyOf(this.getLastEntry()); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.lastKey = function () { + return (AbstractNavigableMap.getKeyOrNSE(this.getLastEntry())); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractNavigableMap.prototype.lowerEntry = function (key) { + return AbstractNavigableMap.copyOf(this.getLowerEntry(key)); + }; + /** + * + * @param {*} key + * @return {*} + */ + AbstractNavigableMap.prototype.lowerKey = function (key) { + return (util.AbstractMap.getEntryKeyOrNull(this.getLowerEntry(key))); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.navigableKeySet = function () { + return (new AbstractNavigableMap.NavigableKeySet(this)); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.pollFirstEntry = function () { + return this.pollEntry(this.getFirstEntry()); + }; + /** + * + * @return {*} + */ + AbstractNavigableMap.prototype.pollLastEntry = function () { + return this.pollEntry(this.getLastEntry()); + }; + AbstractNavigableMap.prototype.subMap = function (fromKey, fromInclusive, toKey, toInclusive) { + if (((fromKey != null) || fromKey === null) && ((fromInclusive != null) || fromInclusive === null) && toKey === undefined && toInclusive === undefined) { + return this.subMap$java_lang_Object$java_lang_Object(fromKey, fromInclusive); + } + else + throw new Error('invalid overload'); + }; + AbstractNavigableMap.prototype.subMap$java_lang_Object$java_lang_Object = function (fromKey, toKey) { + return this.subMap(fromKey, true, toKey, false); + }; + AbstractNavigableMap.prototype.tailMap = function (fromKey, inclusive) { + if (((fromKey != null) || fromKey === null) && inclusive === undefined) { + return this.tailMap$java_lang_Object(fromKey); + } + else + throw new Error('invalid overload'); + }; + AbstractNavigableMap.prototype.tailMap$java_lang_Object = function (fromKey) { + return this.tailMap(fromKey, true); + }; + /** + * + * @param {*} entry + * @return {boolean} + */ + AbstractNavigableMap.prototype.containsEntry = function (entry) { + var key = entry.getKey(); + var lookupEntry = this.getEntry(key); + return lookupEntry != null && java.util.Objects.equals(lookupEntry.getValue(), entry.getValue()); + }; + AbstractNavigableMap.prototype.pollEntry = function (entry) { + if (entry != null) { + this.removeEntry(entry); + } + return AbstractNavigableMap.copyOf(entry); + }; + return AbstractNavigableMap; + }(java.util.AbstractMap)); + util.AbstractNavigableMap = AbstractNavigableMap; + AbstractNavigableMap["__class"] = "java.util.AbstractNavigableMap"; + AbstractNavigableMap["__interfaces"] = ["java.util.Map", "java.util.NavigableMap", "java.util.SortedMap"]; + (function (AbstractNavigableMap) { + var DescendingMap = /** @class */ (function (_super) { + __extends(DescendingMap, _super); + function DescendingMap(__parent) { + var _this = _super.call(this) || this; + _this.__parent = __parent; + return _this; + } + /** + * + */ + DescendingMap.prototype.clear = function () { + this.ascendingMap().clear(); + }; + /** + * + * @return {*} + */ + DescendingMap.prototype.comparator = function () { + return (java.util.Collections.reverseOrder$java_util_Comparator((this.ascendingMap().comparator()))); + }; + /** + * + * @return {*} + */ + DescendingMap.prototype.descendingMap = function () { + return this.ascendingMap(); + }; + DescendingMap.prototype.headMap$java_lang_Object$boolean = function (toKey, inclusive) { + return this.ascendingMap().tailMap(toKey, inclusive).descendingMap(); + }; + /** + * + * @param {*} toKey + * @param {boolean} inclusive + * @return {*} + */ + DescendingMap.prototype.headMap = function (toKey, inclusive) { + if (((toKey != null) || toKey === null) && ((typeof inclusive === 'boolean') || inclusive === null)) { + return this.headMap$java_lang_Object$boolean(toKey, inclusive); + } + else if (((toKey != null) || toKey === null) && inclusive === undefined) { + return this.headMap$java_lang_Object(toKey); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} key + * @param {*} value + * @return {*} + */ + DescendingMap.prototype.put = function (key, value) { + return this.ascendingMap().put(key, value); + }; + /** + * + * @param {*} key + * @return {*} + */ + DescendingMap.prototype.remove = function (key) { + return this.ascendingMap().remove(key); + }; + /** + * + * @return {number} + */ + DescendingMap.prototype.size = function () { + return this.ascendingMap().size(); + }; + DescendingMap.prototype.subMap$java_lang_Object$boolean$java_lang_Object$boolean = function (fromKey, fromInclusive, toKey, toInclusive) { + return this.ascendingMap().subMap(toKey, toInclusive, fromKey, fromInclusive).descendingMap(); + }; + /** + * + * @param {*} fromKey + * @param {boolean} fromInclusive + * @param {*} toKey + * @param {boolean} toInclusive + * @return {*} + */ + DescendingMap.prototype.subMap = function (fromKey, fromInclusive, toKey, toInclusive) { + if (((fromKey != null) || fromKey === null) && ((typeof fromInclusive === 'boolean') || fromInclusive === null) && ((toKey != null) || toKey === null) && ((typeof toInclusive === 'boolean') || toInclusive === null)) { + return this.subMap$java_lang_Object$boolean$java_lang_Object$boolean(fromKey, fromInclusive, toKey, toInclusive); + } + else if (((fromKey != null) || fromKey === null) && ((fromInclusive != null) || fromInclusive === null) && toKey === undefined && toInclusive === undefined) { + return this.subMap$java_lang_Object$java_lang_Object(fromKey, fromInclusive); + } + else + throw new Error('invalid overload'); + }; + DescendingMap.prototype.tailMap$java_lang_Object$boolean = function (fromKey, inclusive) { + return this.ascendingMap().headMap(fromKey, inclusive).descendingMap(); + }; + /** + * + * @param {*} fromKey + * @param {boolean} inclusive + * @return {*} + */ + DescendingMap.prototype.tailMap = function (fromKey, inclusive) { + if (((fromKey != null) || fromKey === null) && ((typeof inclusive === 'boolean') || inclusive === null)) { + return this.tailMap$java_lang_Object$boolean(fromKey, inclusive); + } + else if (((fromKey != null) || fromKey === null) && inclusive === undefined) { + return this.tailMap$java_lang_Object(fromKey); + } + else + throw new Error('invalid overload'); + }; + DescendingMap.prototype.ascendingMap = function () { + return this.__parent; + }; + /** + * + * @return {*} + */ + DescendingMap.prototype.descendingEntryIterator = function () { + return this.ascendingMap().entryIterator(); + }; + /** + * + * @return {*} + */ + DescendingMap.prototype.entryIterator = function () { + return this.ascendingMap().descendingEntryIterator(); + }; + /** + * + * @param {*} key + * @return {*} + */ + DescendingMap.prototype.getEntry = function (key) { + return this.ascendingMap().getEntry(key); + }; + /** + * + * @return {*} + */ + DescendingMap.prototype.getFirstEntry = function () { + return this.ascendingMap().getLastEntry(); + }; + /** + * + * @return {*} + */ + DescendingMap.prototype.getLastEntry = function () { + return this.ascendingMap().getFirstEntry(); + }; + /** + * + * @param {*} key + * @return {*} + */ + DescendingMap.prototype.getCeilingEntry = function (key) { + return this.ascendingMap().getFloorEntry(key); + }; + /** + * + * @param {*} key + * @return {*} + */ + DescendingMap.prototype.getFloorEntry = function (key) { + return this.ascendingMap().getCeilingEntry(key); + }; + /** + * + * @param {*} key + * @return {*} + */ + DescendingMap.prototype.getHigherEntry = function (key) { + return this.ascendingMap().getLowerEntry(key); + }; + /** + * + * @param {*} key + * @return {*} + */ + DescendingMap.prototype.getLowerEntry = function (key) { + return this.ascendingMap().getHigherEntry(key); + }; + /** + * + * @param {*} entry + * @return {boolean} + */ + DescendingMap.prototype.removeEntry = function (entry) { + return this.ascendingMap().removeEntry(entry); + }; + return DescendingMap; + }(java.util.AbstractNavigableMap)); + AbstractNavigableMap.DescendingMap = DescendingMap; + DescendingMap["__class"] = "java.util.AbstractNavigableMap.DescendingMap"; + DescendingMap["__interfaces"] = ["java.util.Map", "java.util.NavigableMap", "java.util.SortedMap"]; + var EntrySet = /** @class */ (function (_super) { + __extends(EntrySet, _super); + function EntrySet(__parent) { + var _this = _super.call(this) || this; + _this.__parent = __parent; + return _this; + } + /** + * + * @param {*} o + * @return {boolean} + */ + EntrySet.prototype.contains = function (o) { + return (o != null && (o["__interfaces"] != null && o["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || o.constructor != null && o.constructor["__interfaces"] != null && o.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0)) && this.__parent.containsEntry(o); + }; + /** + * + * @return {*} + */ + EntrySet.prototype.iterator = function () { + return this.__parent.entryIterator(); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + EntrySet.prototype.remove = function (o) { + if (o != null && (o["__interfaces"] != null && o["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || o.constructor != null && o.constructor["__interfaces"] != null && o.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0)) { + var entry = o; + return this.__parent.removeEntry(entry); + } + return false; + }; + /** + * + * @return {number} + */ + EntrySet.prototype.size = function () { + return this.size(); + }; + return EntrySet; + }(java.util.AbstractSet)); + AbstractNavigableMap.EntrySet = EntrySet; + EntrySet["__class"] = "java.util.AbstractNavigableMap.EntrySet"; + EntrySet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + var NavigableKeySet = /** @class */ (function (_super) { + __extends(NavigableKeySet, _super); + function NavigableKeySet(map) { + var _this = _super.call(this) || this; + if (_this.map === undefined) { + _this.map = null; + } + _this.map = map; + return _this; + } + /* Default method injected from java.util.Collection */ + NavigableKeySet.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_21 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_21(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + NavigableKeySet.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + NavigableKeySet.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + NavigableKeySet.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_22 = function (index176) { + var t = index176.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index176 = this.iterator(); index176.hasNext();) { + _loop_22(index176); + } + }; + /** + * + * @param {*} k + * @return {*} + */ + NavigableKeySet.prototype.ceiling = function (k) { + return this.map.ceilingKey(k); + }; + /** + * + */ + NavigableKeySet.prototype.clear = function () { + this.map.clear(); + }; + /** + * + * @return {*} + */ + NavigableKeySet.prototype.comparator = function () { + return (this.map.comparator()); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + NavigableKeySet.prototype.contains = function (o) { + return this.map.containsKey(o); + }; + /** + * + * @return {*} + */ + NavigableKeySet.prototype.descendingIterator = function () { + return this.descendingSet().iterator(); + }; + /** + * + * @return {*} + */ + NavigableKeySet.prototype.descendingSet = function () { + return this.map.descendingMap().navigableKeySet(); + }; + /** + * + * @return {*} + */ + NavigableKeySet.prototype.first = function () { + return this.map.firstKey(); + }; + /** + * + * @param {*} k + * @return {*} + */ + NavigableKeySet.prototype.floor = function (k) { + return this.map.floorKey(k); + }; + NavigableKeySet.prototype.headSet$java_lang_Object = function (toElement) { + return this.headSet(toElement, false); + }; + NavigableKeySet.prototype.headSet$java_lang_Object$boolean = function (toElement, inclusive) { + return this.map.headMap(toElement, inclusive).navigableKeySet(); + }; + /** + * + * @param {*} toElement + * @param {boolean} inclusive + * @return {*} + */ + NavigableKeySet.prototype.headSet = function (toElement, inclusive) { + if (((toElement != null) || toElement === null) && ((typeof inclusive === 'boolean') || inclusive === null)) { + return this.headSet$java_lang_Object$boolean(toElement, inclusive); + } + else if (((toElement != null) || toElement === null) && inclusive === undefined) { + return this.headSet$java_lang_Object(toElement); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} k + * @return {*} + */ + NavigableKeySet.prototype.higher = function (k) { + return this.map.higherKey(k); + }; + /** + * + * @return {*} + */ + NavigableKeySet.prototype.iterator = function () { + var entryIterator = this.map.entrySet().iterator(); + return new NavigableKeySet.NavigableKeySet$0(this, entryIterator); + }; + /** + * + * @return {*} + */ + NavigableKeySet.prototype.last = function () { + return this.map.lastKey(); + }; + /** + * + * @param {*} k + * @return {*} + */ + NavigableKeySet.prototype.lower = function (k) { + return this.map.lowerKey(k); + }; + /** + * + * @return {*} + */ + NavigableKeySet.prototype.pollFirst = function () { + return (util.AbstractMap.getEntryKeyOrNull(this.map.pollFirstEntry())); + }; + /** + * + * @return {*} + */ + NavigableKeySet.prototype.pollLast = function () { + return (util.AbstractMap.getEntryKeyOrNull(this.map.pollLastEntry())); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + NavigableKeySet.prototype.remove = function (o) { + if (this.map.containsKey(o)) { + this.map.remove(o); + return true; + } + return false; + }; + /** + * + * @return {number} + */ + NavigableKeySet.prototype.size = function () { + return this.map.size(); + }; + NavigableKeySet.prototype.subSet$java_lang_Object$boolean$java_lang_Object$boolean = function (fromElement, fromInclusive, toElement, toInclusive) { + return this.map.subMap(fromElement, fromInclusive, toElement, toInclusive).navigableKeySet(); + }; + /** + * + * @param {*} fromElement + * @param {boolean} fromInclusive + * @param {*} toElement + * @param {boolean} toInclusive + * @return {*} + */ + NavigableKeySet.prototype.subSet = function (fromElement, fromInclusive, toElement, toInclusive) { + if (((fromElement != null) || fromElement === null) && ((typeof fromInclusive === 'boolean') || fromInclusive === null) && ((toElement != null) || toElement === null) && ((typeof toInclusive === 'boolean') || toInclusive === null)) { + return this.subSet$java_lang_Object$boolean$java_lang_Object$boolean(fromElement, fromInclusive, toElement, toInclusive); + } + else if (((fromElement != null) || fromElement === null) && ((fromInclusive != null) || fromInclusive === null) && toElement === undefined && toInclusive === undefined) { + return this.subSet$java_lang_Object$java_lang_Object(fromElement, fromInclusive); + } + else + throw new Error('invalid overload'); + }; + NavigableKeySet.prototype.subSet$java_lang_Object$java_lang_Object = function (fromElement, toElement) { + return this.subSet(fromElement, true, toElement, false); + }; + NavigableKeySet.prototype.tailSet$java_lang_Object = function (fromElement) { + return this.tailSet(fromElement, true); + }; + NavigableKeySet.prototype.tailSet$java_lang_Object$boolean = function (fromElement, inclusive) { + return this.map.tailMap(fromElement, inclusive).navigableKeySet(); + }; + /** + * + * @param {*} fromElement + * @param {boolean} inclusive + * @return {*} + */ + NavigableKeySet.prototype.tailSet = function (fromElement, inclusive) { + if (((fromElement != null) || fromElement === null) && ((typeof inclusive === 'boolean') || inclusive === null)) { + return this.tailSet$java_lang_Object$boolean(fromElement, inclusive); + } + else if (((fromElement != null) || fromElement === null) && inclusive === undefined) { + return this.tailSet$java_lang_Object(fromElement); + } + else + throw new Error('invalid overload'); + }; + return NavigableKeySet; + }(java.util.AbstractSet)); + AbstractNavigableMap.NavigableKeySet = NavigableKeySet; + NavigableKeySet["__class"] = "java.util.AbstractNavigableMap.NavigableKeySet"; + NavigableKeySet["__interfaces"] = ["java.util.SortedSet", "java.util.Collection", "java.util.Set", "java.util.NavigableSet", "java.lang.Iterable"]; + (function (NavigableKeySet) { + var NavigableKeySet$0 = /** @class */ (function () { + function NavigableKeySet$0(__parent, entryIterator) { + this.entryIterator = entryIterator; + this.__parent = __parent; + } + /* Default method injected from java.util.Iterator */ + NavigableKeySet$0.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + NavigableKeySet$0.prototype.hasNext = function () { + return this.entryIterator.hasNext(); + }; + /** + * + * @return {*} + */ + NavigableKeySet$0.prototype.next = function () { + var entry = this.entryIterator.next(); + return entry.getKey(); + }; + /** + * + */ + NavigableKeySet$0.prototype.remove = function () { + this.entryIterator.remove(); + }; + return NavigableKeySet$0; + }()); + NavigableKeySet.NavigableKeySet$0 = NavigableKeySet$0; + NavigableKeySet$0["__interfaces"] = ["java.util.Iterator"]; + })(NavigableKeySet = AbstractNavigableMap.NavigableKeySet || (AbstractNavigableMap.NavigableKeySet = {})); + })(AbstractNavigableMap = util.AbstractNavigableMap || (util.AbstractNavigableMap = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Utility methods that operate on collections. [Sun + * docs] + * @class + */ + var Collections = /** @class */ (function () { + function Collections() { + } + Collections.EMPTY_LIST_$LI$ = function () { if (Collections.EMPTY_LIST == null) { + Collections.EMPTY_LIST = new Collections.EmptyList(); + } return Collections.EMPTY_LIST; }; + ; + Collections.EMPTY_MAP_$LI$ = function () { if (Collections.EMPTY_MAP == null) { + Collections.EMPTY_MAP = new Collections.EmptyMap(); + } return Collections.EMPTY_MAP; }; + ; + Collections.EMPTY_SET_$LI$ = function () { if (Collections.EMPTY_SET == null) { + Collections.EMPTY_SET = new Collections.EmptySet(); + } return Collections.EMPTY_SET; }; + ; + Collections.addAll = function (c) { + var a = []; + for (var _i = 1; _i < arguments.length; _i++) { + a[_i - 1] = arguments[_i]; + } + var result = false; + for (var index177 = 0; index177 < a.length; index177++) { + var e = a[index177]; + { + result = c.add(e) || result; + } + } + return result; + }; + Collections.asLifoQueue = function (deque) { + return (new Collections.LifoQueue(deque)); + }; + Collections.binarySearch$java_util_List$java_lang_Object = function (sortedList, key) { + return Collections.binarySearch(sortedList, key, (null)); + }; + Collections.binarySearch$java_util_List$java_lang_Object$java_util_Comparator = function (sortedList, key, comparator) { + if (comparator == null) { + comparator = (java.util.Comparators.natural()); + } + var low = 0; + var high = sortedList.size() - 1; + while ((low <= high)) { + { + var mid = low + ((high - low) >> 1); + var midVal = sortedList.get(mid); + var compareResult = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(comparator))(midVal, key); + if (compareResult < 0) { + low = mid + 1; + } + else if (compareResult > 0) { + high = mid - 1; + } + else { + return mid; + } + } + } + ; + return -low - 1; + }; + /** + * Perform a binary search on a sorted List, using a user-specified comparison + * function. + * + *

+ * Note: The GWT implementation differs from the JDK implementation in that it + * does not do an iterator-based binary search for Lists that do not implement + * RandomAccess. + *

+ * + * @param {*} sortedList + * List to search + * @param {*} key + * value to search for + * @param {*} comparator + * comparision function, null indicates natural + * ordering should be used. + * @return {number} the index of an element with a matching value, or a negative number + * which is the index of the next larger value (or just past the end of + * the array if the searched value is larger than all elements in the + * array) minus 1 (to ensure error returns are negative) + * @throws ClassCastException + * if key and sortedList's elements cannot + * be compared by comparator. + */ + Collections.binarySearch = function (sortedList, key, comparator) { + if (((sortedList != null && (sortedList["__interfaces"] != null && sortedList["__interfaces"].indexOf("java.util.List") >= 0 || sortedList.constructor != null && sortedList.constructor["__interfaces"] != null && sortedList.constructor["__interfaces"].indexOf("java.util.List") >= 0)) || sortedList === null) && ((key != null) || key === null) && ((typeof comparator === 'function' && comparator.length === 2) || comparator === null)) { + return java.util.Collections.binarySearch$java_util_List$java_lang_Object$java_util_Comparator(sortedList, key, comparator); + } + else if (((sortedList != null && (sortedList["__interfaces"] != null && sortedList["__interfaces"].indexOf("java.util.List") >= 0 || sortedList.constructor != null && sortedList.constructor["__interfaces"] != null && sortedList.constructor["__interfaces"].indexOf("java.util.List") >= 0)) || sortedList === null) && ((key != null) || key === null) && comparator === undefined) { + return java.util.Collections.binarySearch$java_util_List$java_lang_Object(sortedList, key); + } + else + throw new Error('invalid overload'); + }; + Collections.copy = function (dest, src) { + if (src.size() > dest.size()) { + throw new java.lang.IndexOutOfBoundsException("src does not fit in dest"); + } + var destIt = dest['listIterator$'](); + for (var index178 = src.iterator(); index178.hasNext();) { + var e = index178.next(); + { + destIt.next(); + destIt.set(e); + } + } + }; + Collections.disjoint = function (c1, c2) { + var iterating = c1; + var testing = c2; + if ((c1 != null && (c1["__interfaces"] != null && c1["__interfaces"].indexOf("java.util.Set") >= 0 || c1.constructor != null && c1.constructor["__interfaces"] != null && c1.constructor["__interfaces"].indexOf("java.util.Set") >= 0)) && !(c2 != null && (c2["__interfaces"] != null && c2["__interfaces"].indexOf("java.util.Set") >= 0 || c2.constructor != null && c2.constructor["__interfaces"] != null && c2.constructor["__interfaces"].indexOf("java.util.Set") >= 0))) { + iterating = c2; + testing = c1; + } + for (var index179 = iterating.iterator(); index179.hasNext();) { + var o = index179.next(); + { + if (testing.contains(o)) { + return false; + } + } + } + return true; + }; + Collections.emptyIterator = function () { + return Collections.EmptyListIterator.INSTANCE_$LI$(); + }; + Collections.emptyList = function () { + return Collections.EMPTY_LIST_$LI$(); + }; + Collections.emptyListIterator = function () { + return Collections.EmptyListIterator.INSTANCE_$LI$(); + }; + Collections.emptyMap = function () { + return Collections.EMPTY_MAP_$LI$(); + }; + Collections.emptySet = function () { + return Collections.EMPTY_SET_$LI$(); + }; + Collections.enumeration = function (c) { + var it = c.iterator(); + return new Collections.Collections$0(it); + }; + Collections.fill = function (list, obj) { + for (var it = list['listIterator$'](); it.hasNext();) { + { + it.next(); + it.set(obj); + } + ; + } + }; + Collections.frequency = function (c, o) { + var count = 0; + for (var index180 = c.iterator(); index180.hasNext();) { + var e = index180.next(); + { + if (java.util.Objects.equals(o, e)) { + ++count; + } + } + } + return count; + }; + Collections.list = function (e) { + var arrayList = (new java.util.ArrayList()); + while ((e.hasMoreElements())) { + { + arrayList.add(e.nextElement()); + } + } + ; + return arrayList; + }; + Collections.max$java_util_Collection = function (coll) { + return (Collections.max$java_util_Collection$java_util_Comparator(coll, (null))); + }; + Collections.max$java_util_Collection$java_util_Comparator = function (coll, comp) { + if (comp == null) { + comp = (java.util.Comparators.natural()); + } + var it = coll.iterator(); + var max = it.next(); + while ((it.hasNext())) { + { + var t = it.next(); + if (((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(comp))(t, max) > 0) { + max = t; + } + } + } + ; + return max; + }; + Collections.max = function (coll, comp) { + if (((coll != null && (coll["__interfaces"] != null && coll["__interfaces"].indexOf("java.util.Collection") >= 0 || coll.constructor != null && coll.constructor["__interfaces"] != null && coll.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || coll === null) && ((typeof comp === 'function' && comp.length === 2) || comp === null)) { + return java.util.Collections.max$java_util_Collection$java_util_Comparator(coll, comp); + } + else if (((coll != null && (coll["__interfaces"] != null && coll["__interfaces"].indexOf("java.util.Collection") >= 0 || coll.constructor != null && coll.constructor["__interfaces"] != null && coll.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || coll === null) && comp === undefined) { + return java.util.Collections.max$java_util_Collection(coll); + } + else + throw new Error('invalid overload'); + }; + Collections.min = function (coll, comp) { + if (comp === void 0) { comp = null; } + return (Collections.max$java_util_Collection$java_util_Comparator(coll, (Collections.reverseOrder$java_util_Comparator((comp))))); + }; + Collections.newSetFromMap = function (map) { + javaemul.internal.InternalPreconditions.checkArgument(map.isEmpty(), "map is not empty"); + return (new Collections.SetFromMap(map)); + }; + Collections.nCopies = function (n, o) { + var list = (new java.util.ArrayList()); + for (var i = 0; i < n; ++i) { + { + list.add(o); + } + ; + } + return Collections.unmodifiableList(list); + }; + Collections.replaceAll = function (list, oldVal, newVal) { + var modified = false; + for (var it = list['listIterator$'](); it.hasNext();) { + { + var t = it.next(); + if (java.util.Objects.equals(t, oldVal)) { + it.set(newVal); + modified = true; + } + } + ; + } + return modified; + }; + Collections.reverse = function (l) { + if (l != null && (l["__interfaces"] != null && l["__interfaces"].indexOf("java.util.RandomAccess") >= 0 || l.constructor != null && l.constructor["__interfaces"] != null && l.constructor["__interfaces"].indexOf("java.util.RandomAccess") >= 0)) { + for (var iFront = 0, iBack = l.size() - 1; iFront < iBack; ++iFront, --iBack) { + { + Collections.swap(l, iFront, iBack); + } + ; + } + } + else { + var head = l['listIterator$'](); + var tail = l['listIterator$int'](l.size()); + while ((head.nextIndex() < tail.previousIndex())) { + { + var headElem = head.next(); + var tailElem = tail.previous(); + head.set(tailElem); + tail.set(headElem); + } + } + ; + } + }; + Collections.reverseOrder$ = function () { + return Collections.ReverseComparator.INSTANCE_$LI$(); + }; + Collections.reverseOrder$java_util_Comparator = function (cmp) { + if (cmp == null) { + return (Collections.reverseOrder$()); + } + return function (t1, t2) { + return ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(cmp))(t2, t1); + }; + }; + Collections.reverseOrder = function (cmp) { + if (((typeof cmp === 'function' && cmp.length === 2) || cmp === null)) { + return java.util.Collections.reverseOrder$java_util_Comparator(cmp); + } + else if (cmp === undefined) { + return java.util.Collections.reverseOrder$(); + } + else + throw new Error('invalid overload'); + }; + /** + * Rotates the elements in {@code list} by the distance {@code dist} + *

+ * e.g. for a given list with elements [1, 2, 3, 4, 5, 6, 7, 8, 9, 0], calling + * rotate(list, 3) or rotate(list, -7) would modify the list to look like this: + * [8, 9, 0, 1, 2, 3, 4, 5, 6, 7] + * + * @param {*} lst + * the list whose elements are to be rotated. + * @param {number} dist + * is the distance the list is rotated. This can be any valid + * integer. Negative values rotate the list backwards. + */ + Collections.rotate = function (lst, dist) { + javaemul.internal.InternalPreconditions.checkNotNull(lst); + var size = lst.size(); + if (size === 0) { + return; + } + var normdist = dist % size; + if (normdist === 0) { + return; + } + if (normdist < 0) { + normdist += size; + } + if (lst != null && (lst["__interfaces"] != null && lst["__interfaces"].indexOf("java.util.RandomAccess") >= 0 || lst.constructor != null && lst.constructor["__interfaces"] != null && lst.constructor["__interfaces"].indexOf("java.util.RandomAccess") >= 0)) { + var list = lst; + var temp = list.get(0); + var index = 0; + var beginIndex = 0; + for (var i = 0; i < size; i++) { + { + index = (index + normdist) % size; + temp = list.set(index, temp); + if (index === beginIndex) { + index = ++beginIndex; + temp = list.get(beginIndex); + } + } + ; + } + } + else { + var divideIndex = size - normdist; + var sublist1 = lst.subList(0, divideIndex); + var sublist2 = lst.subList(divideIndex, size); + Collections.reverse(sublist1); + Collections.reverse(sublist2); + Collections.reverse(lst); + } + }; + Collections.shuffle = function (list, rnd) { + if (rnd === void 0) { rnd = Collections.RandomHolder.rnd_$LI$(); } + if (list != null && (list["__interfaces"] != null && list["__interfaces"].indexOf("java.util.RandomAccess") >= 0 || list.constructor != null && list.constructor["__interfaces"] != null && list.constructor["__interfaces"].indexOf("java.util.RandomAccess") >= 0)) { + for (var i = list.size() - 1; i >= 1; i--) { + { + Collections.swapImpl$java_util_List$int$int(list, i, rnd.nextInt$int(i + 1)); + } + ; + } + } + else { + var arr = list['toArray$'](); + for (var i = arr.length - 1; i >= 1; i--) { + { + Collections.swapImpl$java_lang_Object_A$int$int(arr, i, rnd.nextInt$int(i + 1)); + } + ; + } + var it = list['listIterator$'](); + for (var index181 = 0; index181 < arr.length; index181++) { + var e = arr[index181]; + { + it.next(); + it.set(e); + } + } + } + }; + Collections.singleton = function (o) { + var set = (new java.util.HashSet(1)); + set.add(o); + return Collections.unmodifiableSet(set); + }; + Collections.singletonList = function (o) { + return (new Collections.SingletonList(o)); + }; + Collections.singletonMap = function (key, value) { + var map = (new java.util.HashMap(1)); + map.put(key, value); + return Collections.unmodifiableMap(map); + }; + Collections.sort$java_util_List = function (target) { + Collections.sort$java_util_List$java_util_Comparator(target, (null)); + }; + Collections.sort$java_util_List$java_util_Comparator = function (target, c) { + var x = target['toArray$'](); + java.util.Arrays.sort$java_lang_Object_A$java_util_Comparator(x, (c)); + Collections.replaceContents(target, x); + }; + Collections.sort = function (target, c) { + if (((target != null && (target["__interfaces"] != null && target["__interfaces"].indexOf("java.util.List") >= 0 || target.constructor != null && target.constructor["__interfaces"] != null && target.constructor["__interfaces"].indexOf("java.util.List") >= 0)) || target === null) && ((typeof c === 'function' && c.length === 2) || c === null)) { + return java.util.Collections.sort$java_util_List$java_util_Comparator(target, c); + } + else if (((target != null && (target["__interfaces"] != null && target["__interfaces"].indexOf("java.util.List") >= 0 || target.constructor != null && target.constructor["__interfaces"] != null && target.constructor["__interfaces"].indexOf("java.util.List") >= 0)) || target === null) && c === undefined) { + return java.util.Collections.sort$java_util_List(target); + } + else + throw new Error('invalid overload'); + }; + Collections.swap = function (list, i, j) { + Collections.swapImpl$java_util_List$int$int(list, i, j); + }; + Collections.unmodifiableCollection = function (coll) { + return (new Collections.UnmodifiableCollection(coll)); + }; + Collections.unmodifiableList = function (list) { + return (list != null && (list["__interfaces"] != null && list["__interfaces"].indexOf("java.util.RandomAccess") >= 0 || list.constructor != null && list.constructor["__interfaces"] != null && list.constructor["__interfaces"].indexOf("java.util.RandomAccess") >= 0)) ? (new Collections.UnmodifiableRandomAccessList(list)) : (new Collections.UnmodifiableList(list)); + }; + Collections.unmodifiableMap = function (map) { + return (new Collections.UnmodifiableMap(map)); + }; + Collections.unmodifiableSet = function (set) { + return (new Collections.UnmodifiableSet(set)); + }; + Collections.unmodifiableSortedMap = function (map) { + return (new Collections.UnmodifiableSortedMap(map)); + }; + Collections.unmodifiableSortedSet = function (set) { + return (new Collections.UnmodifiableSortedSet(set)); + }; + Collections.hashCode$java_lang_Iterable = function (collection) { + var hashCode = 0; + for (var index182 = collection.iterator(); index182.hasNext();) { + var e = index182.next(); + { + hashCode = hashCode + java.util.Objects.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + Collections.hashCode$java_util_List = function (list) { + var hashCode = 1; + for (var index183 = list.iterator(); index183.hasNext();) { + var e = index183.next(); + { + hashCode = 31 * hashCode + java.util.Objects.hashCode(e); + hashCode = javaemul.internal.Coercions.ensureInt(hashCode); + } + } + return hashCode; + }; + /** + * Computes hash code preserving collection order (e.g. ArrayList). + * @param {*} list + * @return {number} + */ + Collections.hashCode = function (list) { + if (((list != null && (list["__interfaces"] != null && list["__interfaces"].indexOf("java.util.List") >= 0 || list.constructor != null && list.constructor["__interfaces"] != null && list.constructor["__interfaces"].indexOf("java.util.List") >= 0)) || list === null)) { + return java.util.Collections.hashCode$java_util_List(list); + } + else if (((list != null && (list["__interfaces"] != null && list["__interfaces"].indexOf("java.lang.Iterable") >= 0 || list.constructor != null && list.constructor["__interfaces"] != null && list.constructor["__interfaces"].indexOf("java.lang.Iterable") >= 0)) || list === null)) { + return java.util.Collections.hashCode$java_lang_Iterable(list); + } + else + throw new Error('invalid overload'); + }; + /** + * Replace contents of a list from an array. + * + * @param + * element type + * @param {*} target + * list to replace contents from an array + * @param {Array} x + * an Object array which can contain only T instances + * @private + */ + Collections.replaceContents = function (target, x) { + var size = target.size(); + for (var i = 0; i < size; i++) { + { + target.set(i, x[i]); + } + ; + } + }; + Collections.swapImpl$java_util_List$int$int = function (list, i, j) { + var t = list.get(i); + list.set(i, list.get(j)); + list.set(j, t); + }; + Collections.swapImpl = function (list, i, j) { + if (((list != null && (list["__interfaces"] != null && list["__interfaces"].indexOf("java.util.List") >= 0 || list.constructor != null && list.constructor["__interfaces"] != null && list.constructor["__interfaces"].indexOf("java.util.List") >= 0)) || list === null) && ((typeof i === 'number') || i === null) && ((typeof j === 'number') || j === null)) { + return java.util.Collections.swapImpl$java_util_List$int$int(list, i, j); + } + else if (((list != null && list instanceof Array && (list.length == 0 || list[0] == null || (list[0] != null))) || list === null) && ((typeof i === 'number') || i === null) && ((typeof j === 'number') || j === null)) { + return java.util.Collections.swapImpl$java_lang_Object_A$int$int(list, i, j); + } + else + throw new Error('invalid overload'); + }; + Collections.swapImpl$java_lang_Object_A$int$int = function (a, i, j) { + var obj = a[i]; + a[i] = a[j]; + a[j] = obj; + }; + Collections.synchronizedList = function (list) { + return (new java.util.ArrayList(list)); + }; + Collections.synchronizedSet = function (s) { + return (new java.util.HashSet(s)); + }; + return Collections; + }()); + util.Collections = Collections; + Collections["__class"] = "java.util.Collections"; + (function (Collections) { + var LifoQueue = /** @class */ (function (_super) { + __extends(LifoQueue, _super); + function LifoQueue(deque) { + var _this = _super.call(this) || this; + if (_this.deque === undefined) { + _this.deque = null; + } + _this.deque = deque; + return _this; + } + /** + * + * @return {*} + */ + LifoQueue.prototype.iterator = function () { + return this.deque.iterator(); + }; + /** + * + * @param {*} e + * @return {boolean} + */ + LifoQueue.prototype.offer = function (e) { + return this.deque.offerFirst(e); + }; + /** + * + * @return {*} + */ + LifoQueue.prototype.peek = function () { + return this.deque.peekFirst(); + }; + /** + * + * @return {*} + */ + LifoQueue.prototype.poll = function () { + return this.deque.pollFirst(); + }; + /** + * + * @return {number} + */ + LifoQueue.prototype.size = function () { + return this.deque.size(); + }; + return LifoQueue; + }(java.util.AbstractQueue)); + Collections.LifoQueue = LifoQueue; + LifoQueue["__class"] = "java.util.Collections.LifoQueue"; + LifoQueue["__interfaces"] = ["java.util.Collection", "java.util.Queue", "java.lang.Iterable", "java.io.Serializable"]; + var EmptyList = /** @class */ (function (_super) { + __extends(EmptyList, _super); + function EmptyList() { + return _super.call(this) || this; + } + /** + * + * @param {*} object + * @return {boolean} + */ + EmptyList.prototype.contains = function (object) { + return false; + }; + /** + * + * @param {number} location + * @return {*} + */ + EmptyList.prototype.get = function (location) { + javaemul.internal.InternalPreconditions.checkElementIndex(location, 0); + return null; + }; + /** + * + * @return {*} + */ + EmptyList.prototype.iterator = function () { + return Collections.emptyIterator(); + }; + /** + * + * @param {number} from + * @return {*} + */ + EmptyList.prototype.listIterator = function (from) { + if (((typeof from === 'number') || from === null)) { + return _super.prototype.listIterator.call(this, from); + } + else if (from === undefined) { + return this.listIterator$(); + } + else + throw new Error('invalid overload'); + }; + EmptyList.prototype.listIterator$ = function () { + return Collections.emptyListIterator(); + }; + /** + * + * @return {number} + */ + EmptyList.prototype.size = function () { + return 0; + }; + return EmptyList; + }(java.util.AbstractList)); + Collections.EmptyList = EmptyList; + EmptyList["__class"] = "java.util.Collections.EmptyList"; + EmptyList["__interfaces"] = ["java.util.RandomAccess", "java.util.List", "java.util.Collection", "java.lang.Iterable", "java.io.Serializable"]; + var EmptyListIterator = /** @class */ (function () { + function EmptyListIterator() { + } + /* Default method injected from java.util.Iterator */ + EmptyListIterator.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + EmptyListIterator.INSTANCE_$LI$ = function () { if (EmptyListIterator.INSTANCE == null) { + EmptyListIterator.INSTANCE = new Collections.EmptyListIterator(); + } return EmptyListIterator.INSTANCE; }; + ; + /** + * + * @param {*} o + */ + EmptyListIterator.prototype.add = function (o) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @return {boolean} + */ + EmptyListIterator.prototype.hasNext = function () { + return false; + }; + /** + * + * @return {boolean} + */ + EmptyListIterator.prototype.hasPrevious = function () { + return false; + }; + /** + * + * @return {*} + */ + EmptyListIterator.prototype.next = function () { + throw new java.util.NoSuchElementException(); + }; + /** + * + * @return {number} + */ + EmptyListIterator.prototype.nextIndex = function () { + return 0; + }; + /** + * + * @return {*} + */ + EmptyListIterator.prototype.previous = function () { + throw new java.util.NoSuchElementException(); + }; + /** + * + * @return {number} + */ + EmptyListIterator.prototype.previousIndex = function () { + return -1; + }; + /** + * + */ + EmptyListIterator.prototype.remove = function () { + throw new java.lang.IllegalStateException(); + }; + /** + * + * @param {*} o + */ + EmptyListIterator.prototype.set = function (o) { + throw new java.lang.IllegalStateException(); + }; + return EmptyListIterator; + }()); + Collections.EmptyListIterator = EmptyListIterator; + EmptyListIterator["__class"] = "java.util.Collections.EmptyListIterator"; + EmptyListIterator["__interfaces"] = ["java.util.Iterator", "java.util.ListIterator"]; + var EmptySet = /** @class */ (function (_super) { + __extends(EmptySet, _super); + function EmptySet() { + return _super.call(this) || this; + } + /** + * + * @param {*} object + * @return {boolean} + */ + EmptySet.prototype.contains = function (object) { + return false; + }; + /** + * + * @return {*} + */ + EmptySet.prototype.iterator = function () { + return Collections.emptyIterator(); + }; + /** + * + * @return {number} + */ + EmptySet.prototype.size = function () { + return 0; + }; + return EmptySet; + }(java.util.AbstractSet)); + Collections.EmptySet = EmptySet; + EmptySet["__class"] = "java.util.Collections.EmptySet"; + EmptySet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable", "java.io.Serializable"]; + var EmptyMap = /** @class */ (function (_super) { + __extends(EmptyMap, _super); + function EmptyMap() { + return _super.call(this) || this; + } + /** + * + * @param {*} key + * @return {boolean} + */ + EmptyMap.prototype.containsKey = function (key) { + return false; + }; + /** + * + * @param {*} value + * @return {boolean} + */ + EmptyMap.prototype.containsValue = function (value) { + return false; + }; + /** + * + * @return {*} + */ + EmptyMap.prototype.entrySet = function () { + return java.util.Collections.EMPTY_SET_$LI$(); + }; + /** + * + * @param {*} key + * @return {*} + */ + EmptyMap.prototype.get = function (key) { + return null; + }; + /** + * + * @return {*} + */ + EmptyMap.prototype.keySet = function () { + return java.util.Collections.EMPTY_SET_$LI$(); + }; + /** + * + * @return {number} + */ + EmptyMap.prototype.size = function () { + return 0; + }; + /** + * + * @return {*} + */ + EmptyMap.prototype.values = function () { + return java.util.Collections.EMPTY_LIST_$LI$(); + }; + return EmptyMap; + }(java.util.AbstractMap)); + Collections.EmptyMap = EmptyMap; + EmptyMap["__class"] = "java.util.Collections.EmptyMap"; + EmptyMap["__interfaces"] = ["java.util.Map", "java.io.Serializable"]; + var ReverseComparator = /** @class */ (function () { + function ReverseComparator() { + } + ReverseComparator.INSTANCE_$LI$ = function () { if (ReverseComparator.INSTANCE == null) { + ReverseComparator.INSTANCE = new Collections.ReverseComparator(); + } return ReverseComparator.INSTANCE; }; + ; + ReverseComparator.prototype.compare$java_lang_Comparable$java_lang_Comparable = function (o1, o2) { + return o2.compareTo(o1); + }; + /** + * + * @param {*} o1 + * @param {*} o2 + * @return {number} + */ + ReverseComparator.prototype.compare = function (o1, o2) { + if (((o1 != null && (o1["__interfaces"] != null && o1["__interfaces"].indexOf("java.lang.Comparable") >= 0 || o1.constructor != null && o1.constructor["__interfaces"] != null && o1.constructor["__interfaces"].indexOf("java.lang.Comparable") >= 0)) || o1 === null) && ((o2 != null && (o2["__interfaces"] != null && o2["__interfaces"].indexOf("java.lang.Comparable") >= 0 || o2.constructor != null && o2.constructor["__interfaces"] != null && o2.constructor["__interfaces"].indexOf("java.lang.Comparable") >= 0)) || o2 === null)) { + return this.compare$java_lang_Comparable$java_lang_Comparable(o1, o2); + } + else + throw new Error('invalid overload'); + }; + return ReverseComparator; + }()); + Collections.ReverseComparator = ReverseComparator; + ReverseComparator["__class"] = "java.util.Collections.ReverseComparator"; + ReverseComparator["__interfaces"] = ["java.util.Comparator"]; + var SetFromMap = /** @class */ (function (_super) { + __extends(SetFromMap, _super); + function SetFromMap(map) { + var _this = _super.call(this) || this; + if (_this.backingMap === undefined) { + _this.backingMap = null; + } + if (_this.__keySet === undefined) { + _this.__keySet = null; + } + _this.backingMap = map; + return _this; + } + /** + * + * @param {*} e + * @return {boolean} + */ + SetFromMap.prototype.add = function (e) { + return this.backingMap.put(e, javaemul.internal.BooleanHelper.TRUE) == null; + }; + /** + * + */ + SetFromMap.prototype.clear = function () { + this.backingMap.clear(); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + SetFromMap.prototype.contains = function (o) { + return this.backingMap.containsKey(o); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + SetFromMap.prototype.equals = function (o) { + return o === this || /* equals */ (function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(this.keySet(), o); + }; + /** + * + * @return {number} + */ + SetFromMap.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.keySet()); + }; + /** + * + * @return {*} + */ + SetFromMap.prototype.iterator = function () { + return this.keySet().iterator(); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + SetFromMap.prototype.remove = function (o) { + return this.backingMap.remove(o) != null; + }; + /** + * + * @return {number} + */ + SetFromMap.prototype.size = function () { + return this.keySet().size(); + }; + /** + * + * @return {string} + */ + SetFromMap.prototype.toString = function () { + return this.keySet().toString(); + }; + /** + * Lazy initialize keySet to avoid NPE after deserialization. + * @return {*} + * @private + */ + SetFromMap.prototype.keySet = function () { + if (this.__keySet == null) { + this.__keySet = this.backingMap.keySet(); + } + return this.__keySet; + }; + return SetFromMap; + }(java.util.AbstractSet)); + Collections.SetFromMap = SetFromMap; + SetFromMap["__class"] = "java.util.Collections.SetFromMap"; + SetFromMap["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable", "java.io.Serializable"]; + var SingletonList = /** @class */ (function (_super) { + __extends(SingletonList, _super); + function SingletonList(element) { + var _this = _super.call(this) || this; + if (_this.element === undefined) { + _this.element = null; + } + _this.element = element; + return _this; + } + /** + * + * @param {*} item + * @return {boolean} + */ + SingletonList.prototype.contains = function (item) { + return java.util.Objects.equals(this.element, item); + }; + /** + * + * @param {number} index + * @return {*} + */ + SingletonList.prototype.get = function (index) { + javaemul.internal.InternalPreconditions.checkElementIndex(index, 1); + return this.element; + }; + /** + * + * @return {number} + */ + SingletonList.prototype.size = function () { + return 1; + }; + return SingletonList; + }(java.util.AbstractList)); + Collections.SingletonList = SingletonList; + SingletonList["__class"] = "java.util.Collections.SingletonList"; + SingletonList["__interfaces"] = ["java.util.List", "java.util.Collection", "java.lang.Iterable", "java.io.Serializable"]; + var UnmodifiableCollection = /** @class */ (function () { + function UnmodifiableCollection(coll) { + if (this.coll === undefined) { + this.coll = null; + } + this.coll = coll; + } + /* Default method injected from java.util.Collection */ + UnmodifiableCollection.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_23 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_23(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + UnmodifiableCollection.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + UnmodifiableCollection.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + UnmodifiableCollection.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_24 = function (index184) { + var t = index184.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index184 = this.iterator(); index184.hasNext();) { + _loop_24(index184); + } + }; + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableCollection.prototype.add = function (o) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + UnmodifiableCollection.prototype.addAll = function (c) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + */ + UnmodifiableCollection.prototype.clear = function () { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableCollection.prototype.contains = function (o) { + return this.coll.contains(o); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + UnmodifiableCollection.prototype.containsAll = function (c) { + return this.coll.containsAll(c); + }; + /** + * + * @return {boolean} + */ + UnmodifiableCollection.prototype.isEmpty = function () { + return this.coll.isEmpty(); + }; + /** + * + * @return {*} + */ + UnmodifiableCollection.prototype.iterator = function () { + return (new Collections.UnmodifiableCollectionIterator(this.coll.iterator())); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableCollection.prototype.remove = function (o) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + UnmodifiableCollection.prototype.removeAll = function (c) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {*} c + * @return {boolean} + */ + UnmodifiableCollection.prototype.retainAll = function (c) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @return {number} + */ + UnmodifiableCollection.prototype.size = function () { + return this.coll.size(); + }; + UnmodifiableCollection.prototype.toArray$ = function () { + return this.coll['toArray$'](); + }; + UnmodifiableCollection.prototype.toArray$java_lang_Object_A = function (a) { + return this.coll['toArray$java_lang_Object_A'](a); + }; + /** + * + * @param {Array} a + * @return {Array} + */ + UnmodifiableCollection.prototype.toArray = function (a) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null)) { + return this.toArray$java_lang_Object_A(a); + } + else if (a === undefined) { + return this.toArray$(); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {string} + */ + UnmodifiableCollection.prototype.toString = function () { + return this.coll.toString(); + }; + return UnmodifiableCollection; + }()); + Collections.UnmodifiableCollection = UnmodifiableCollection; + UnmodifiableCollection["__class"] = "java.util.Collections.UnmodifiableCollection"; + UnmodifiableCollection["__interfaces"] = ["java.util.Collection", "java.lang.Iterable"]; + var UnmodifiableCollectionIterator = /** @class */ (function () { + function UnmodifiableCollectionIterator(it) { + if (this.it === undefined) { + this.it = null; + } + this.it = it; + } + /* Default method injected from java.util.Iterator */ + UnmodifiableCollectionIterator.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + UnmodifiableCollectionIterator.prototype.hasNext = function () { + return this.it.hasNext(); + }; + /** + * + * @return {*} + */ + UnmodifiableCollectionIterator.prototype.next = function () { + return this.it.next(); + }; + /** + * + */ + UnmodifiableCollectionIterator.prototype.remove = function () { + throw new java.lang.UnsupportedOperationException(); + }; + return UnmodifiableCollectionIterator; + }()); + Collections.UnmodifiableCollectionIterator = UnmodifiableCollectionIterator; + UnmodifiableCollectionIterator["__class"] = "java.util.Collections.UnmodifiableCollectionIterator"; + UnmodifiableCollectionIterator["__interfaces"] = ["java.util.Iterator"]; + var RandomHolder = /** @class */ (function () { + function RandomHolder() { + } + RandomHolder.rnd_$LI$ = function () { if (RandomHolder.rnd == null) { + RandomHolder.rnd = new java.util.Random(); + } return RandomHolder.rnd; }; + ; + return RandomHolder; + }()); + Collections.RandomHolder = RandomHolder; + RandomHolder["__class"] = "java.util.Collections.RandomHolder"; + var UnmodifiableList = /** @class */ (function (_super) { + __extends(UnmodifiableList, _super); + function UnmodifiableList(list) { + var _this = _super.call(this, list) || this; + if (_this.list === undefined) { + _this.list = null; + } + _this.list = list; + return _this; + } + /* Default method injected from java.util.Collection */ + UnmodifiableList.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_25 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_25(it); + } + return removed; + }; + /* Default method injected from java.util.List */ + UnmodifiableList.prototype.sort = function (c) { + var a = this.toArray(); + java.util.Arrays.sort(a, (c)); + var i = this.listIterator(); + for (var index185 = 0; index185 < a.length; index185++) { + var e = a[index185]; + { + i.next(); + i.set(e); + } + } + }; + /* Default method injected from java.util.Collection */ + UnmodifiableList.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + UnmodifiableList.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + UnmodifiableList.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_26 = function (index186) { + var t = index186.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index186 = this.iterator(); index186.hasNext();) { + _loop_26(index186); + } + }; + UnmodifiableList.prototype.add$int$java_lang_Object = function (index, element) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {number} index + * @param {*} element + */ + UnmodifiableList.prototype.add = function (index, element) { + if (((typeof index === 'number') || index === null) && ((element != null) || element === null)) { + return this.add$int$java_lang_Object(index, element); + } + else if (((index != null) || index === null) && element === undefined) { + _super.prototype.add.call(this, index); + } + else + throw new Error('invalid overload'); + }; + UnmodifiableList.prototype.addAll$int$java_util_Collection = function (index, c) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {number} index + * @param {*} c + * @return {boolean} + */ + UnmodifiableList.prototype.addAll = function (index, c) { + if (((typeof index === 'number') || index === null) && ((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.Collection") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || c === null)) { + return this.addAll$int$java_util_Collection(index, c); + } + else if (((index != null && (index["__interfaces"] != null && index["__interfaces"].indexOf("java.util.Collection") >= 0 || index.constructor != null && index.constructor["__interfaces"] != null && index.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || index === null) && c === undefined) { + return _super.prototype.addAll.call(this, index); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableList.prototype.equals = function (o) { + return /* equals */ (function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(this.list, o); + }; + /** + * + * @param {number} index + * @return {*} + */ + UnmodifiableList.prototype.get = function (index) { + return this.list.get(index); + }; + /** + * + * @return {number} + */ + UnmodifiableList.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.list); + }; + /** + * + * @param {*} o + * @return {number} + */ + UnmodifiableList.prototype.indexOf = function (o) { + return this.list.indexOf(o); + }; + /** + * + * @return {boolean} + */ + UnmodifiableList.prototype.isEmpty = function () { + return this.list.isEmpty(); + }; + /** + * + * @param {*} o + * @return {number} + */ + UnmodifiableList.prototype.lastIndexOf = function (o) { + return this.list.lastIndexOf(o); + }; + UnmodifiableList.prototype.listIterator$ = function () { + return this.listIterator$int(0); + }; + UnmodifiableList.prototype.listIterator$int = function (from) { + return (new Collections.UnmodifiableListIterator(this.list['listIterator$int'](from))); + }; + /** + * + * @param {number} from + * @return {*} + */ + UnmodifiableList.prototype.listIterator = function (from) { + if (((typeof from === 'number') || from === null)) { + return this.listIterator$int(from); + } + else if (from === undefined) { + return this.listIterator$(); + } + else + throw new Error('invalid overload'); + }; + UnmodifiableList.prototype.remove$int = function (index) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {number} index + * @return {*} + */ + UnmodifiableList.prototype.remove = function (index) { + if (((typeof index === 'number') || index === null)) { + return this.remove$int(index); + } + else if (((index != null) || index === null)) { + return _super.prototype.remove.call(this, index); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {number} index + * @param {*} element + * @return {*} + */ + UnmodifiableList.prototype.set = function (index, element) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {number} fromIndex + * @param {number} toIndex + * @return {*} + */ + UnmodifiableList.prototype.subList = function (fromIndex, toIndex) { + return (new Collections.UnmodifiableList(this.list.subList(fromIndex, toIndex))); + }; + return UnmodifiableList; + }(Collections.UnmodifiableCollection)); + Collections.UnmodifiableList = UnmodifiableList; + UnmodifiableList["__class"] = "java.util.Collections.UnmodifiableList"; + UnmodifiableList["__interfaces"] = ["java.util.List", "java.util.Collection", "java.lang.Iterable"]; + var UnmodifiableSet = /** @class */ (function (_super) { + __extends(UnmodifiableSet, _super); + function UnmodifiableSet(set) { + return _super.call(this, set) || this; + } + /* Default method injected from java.util.Collection */ + UnmodifiableSet.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_27 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_27(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + UnmodifiableSet.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + UnmodifiableSet.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + UnmodifiableSet.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_28 = function (index187) { + var t = index187.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index187 = this.iterator(); index187.hasNext();) { + _loop_28(index187); + } + }; + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableSet.prototype.equals = function (o) { + return /* equals */ (function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(this.coll, o); + }; + /** + * + * @return {number} + */ + UnmodifiableSet.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.coll); + }; + return UnmodifiableSet; + }(Collections.UnmodifiableCollection)); + Collections.UnmodifiableSet = UnmodifiableSet; + UnmodifiableSet["__class"] = "java.util.Collections.UnmodifiableSet"; + UnmodifiableSet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + var UnmodifiableListIterator = /** @class */ (function (_super) { + __extends(UnmodifiableListIterator, _super); + function UnmodifiableListIterator(lit) { + var _this = _super.call(this, lit) || this; + if (_this.lit === undefined) { + _this.lit = null; + } + _this.lit = lit; + return _this; + } + /* Default method injected from java.util.Iterator */ + UnmodifiableListIterator.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @param {*} o + */ + UnmodifiableListIterator.prototype.add = function (o) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @return {boolean} + */ + UnmodifiableListIterator.prototype.hasPrevious = function () { + return this.lit.hasPrevious(); + }; + /** + * + * @return {number} + */ + UnmodifiableListIterator.prototype.nextIndex = function () { + return this.lit.nextIndex(); + }; + /** + * + * @return {*} + */ + UnmodifiableListIterator.prototype.previous = function () { + return this.lit.previous(); + }; + /** + * + * @return {number} + */ + UnmodifiableListIterator.prototype.previousIndex = function () { + return this.lit.previousIndex(); + }; + /** + * + * @param {*} o + */ + UnmodifiableListIterator.prototype.set = function (o) { + throw new java.lang.UnsupportedOperationException(); + }; + return UnmodifiableListIterator; + }(Collections.UnmodifiableCollectionIterator)); + Collections.UnmodifiableListIterator = UnmodifiableListIterator; + UnmodifiableListIterator["__class"] = "java.util.Collections.UnmodifiableListIterator"; + UnmodifiableListIterator["__interfaces"] = ["java.util.Iterator", "java.util.ListIterator"]; + var UnmodifiableRandomAccessList = /** @class */ (function (_super) { + __extends(UnmodifiableRandomAccessList, _super); + function UnmodifiableRandomAccessList(list) { + return _super.call(this, list) || this; + } + return UnmodifiableRandomAccessList; + }(Collections.UnmodifiableList)); + Collections.UnmodifiableRandomAccessList = UnmodifiableRandomAccessList; + UnmodifiableRandomAccessList["__class"] = "java.util.Collections.UnmodifiableRandomAccessList"; + UnmodifiableRandomAccessList["__interfaces"] = ["java.util.RandomAccess", "java.util.List", "java.util.Collection", "java.lang.Iterable"]; + var UnmodifiableMap = /** @class */ (function () { + function UnmodifiableMap(map) { + if (this.__entrySet === undefined) { + this.__entrySet = null; + } + if (this.__keySet === undefined) { + this.__keySet = null; + } + if (this.map === undefined) { + this.map = null; + } + if (this.__values === undefined) { + this.__values = null; + } + this.map = map; + } + /* Default method injected from java.util.Map */ + UnmodifiableMap.prototype.getOrDefault = function (key, defaultValue) { + var v; + return (((v = this.get(key)) != null) || this.containsKey(key)) ? v : defaultValue; + }; + /* Default method injected from java.util.Map */ + UnmodifiableMap.prototype.putIfAbsent = function (key, value) { + var v = this.get(key); + if (v == null) { + v = this.put(key, value); + } + return v; + }; + /* Default method injected from java.util.Map */ + UnmodifiableMap.prototype.merge = function (key, value, map) { + var old = this.get(key); + var next = (old == null) ? value : (function (target) { return (typeof target === 'function') ? target(old, value) : target.apply(old, value); })(map); + if (next == null) { + this.remove(key); + } + else { + this.put(key, next); + } + return next; + }; + /* Default method injected from java.util.Map */ + UnmodifiableMap.prototype.computeIfAbsent = function (key, mappingFunction) { + var result; + if ((result = this.get(key)) == null) { + result = (function (target) { return (typeof target === 'function') ? target(key) : target.apply(key); })(mappingFunction); + if (result != null) + this.put(key, result); + } + return result; + }; + /* Default method injected from java.util.Map */ + UnmodifiableMap.prototype.replaceAll = function (__function) { + java.util.Objects.requireNonNull((__function)); + var _loop_29 = function (index188) { + var entry = index188.next(); + { + var k_3; + var v_3; + try { + k_3 = entry.getKey(); + v_3 = entry.getValue(); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + v_3 = (function (target) { return (typeof target === 'function') ? target(k_3, v_3) : target.apply(k_3, v_3); })(__function); + try { + entry.setValue(v_3); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + } + }; + for (var index188 = this.entrySet().iterator(); index188.hasNext();) { + _loop_29(index188); + } + }; + /** + * + */ + UnmodifiableMap.prototype.clear = function () { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {*} key + * @return {boolean} + */ + UnmodifiableMap.prototype.containsKey = function (key) { + return this.map.containsKey(key); + }; + /** + * + * @param {*} val + * @return {boolean} + */ + UnmodifiableMap.prototype.containsValue = function (val) { + return this.map.containsValue(val); + }; + /** + * + * @return {*} + */ + UnmodifiableMap.prototype.entrySet = function () { + if (this.__entrySet == null) { + this.__entrySet = (new UnmodifiableMap.UnmodifiableEntrySet(this.map.entrySet())); + } + return this.__entrySet; + }; + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableMap.prototype.equals = function (o) { + return /* equals */ (function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(this.map, o); + }; + /** + * + * @param {*} key + * @return {*} + */ + UnmodifiableMap.prototype.get = function (key) { + return this.map.get(key); + }; + /** + * + * @return {number} + */ + UnmodifiableMap.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.map); + }; + /** + * + * @return {boolean} + */ + UnmodifiableMap.prototype.isEmpty = function () { + return this.map.isEmpty(); + }; + /** + * + * @return {*} + */ + UnmodifiableMap.prototype.keySet = function () { + if (this.__keySet == null) { + this.__keySet = (new Collections.UnmodifiableSet(this.map.keySet())); + } + return this.__keySet; + }; + /** + * + * @param {*} key + * @param {*} value + * @return {*} + */ + UnmodifiableMap.prototype.put = function (key, value) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {*} t + */ + UnmodifiableMap.prototype.putAll = function (t) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @param {*} key + * @return {*} + */ + UnmodifiableMap.prototype.remove = function (key) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @return {number} + */ + UnmodifiableMap.prototype.size = function () { + return this.map.size(); + }; + /** + * + * @return {string} + */ + UnmodifiableMap.prototype.toString = function () { + return this.map.toString(); + }; + /** + * + * @return {*} + */ + UnmodifiableMap.prototype.values = function () { + if (this.__values == null) { + this.__values = (new Collections.UnmodifiableCollection(this.map.values())); + } + return this.__values; + }; + return UnmodifiableMap; + }()); + Collections.UnmodifiableMap = UnmodifiableMap; + UnmodifiableMap["__class"] = "java.util.Collections.UnmodifiableMap"; + UnmodifiableMap["__interfaces"] = ["java.util.Map"]; + (function (UnmodifiableMap) { + var UnmodifiableEntrySet = /** @class */ (function (_super) { + __extends(UnmodifiableEntrySet, _super); + function UnmodifiableEntrySet(s) { + return _super.call(this, s) || this; + } + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableEntrySet.prototype.contains = function (o) { + return this.coll.contains(o); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableEntrySet.prototype.containsAll = function (o) { + return this.coll.containsAll(o); + }; + /** + * + * @return {*} + */ + UnmodifiableEntrySet.prototype.iterator = function () { + var it = this.coll.iterator(); + return new UnmodifiableEntrySet.UnmodifiableEntrySet$0(this, it); + }; + UnmodifiableEntrySet.prototype.toArray$ = function () { + var array = _super.prototype.toArray$.call(this); + this.wrap(array, array.length); + return array; + }; + UnmodifiableEntrySet.prototype.toArray$java_lang_Object_A = function (a) { + var result = _super.prototype.toArray$java_lang_Object_A.call(this, a); + this.wrap(result, this.coll.size()); + return result; + }; + /** + * + * @param {Array} a + * @return {Array} + */ + UnmodifiableEntrySet.prototype.toArray = function (a) { + if (((a != null && a instanceof Array && (a.length == 0 || a[0] == null || (a[0] != null))) || a === null)) { + return this.toArray$java_lang_Object_A(a); + } + else if (a === undefined) { + return this.toArray$(); + } + else + throw new Error('invalid overload'); + }; + /** + * Wrap an array of Map.Entries as UnmodifiableEntries. + * + * @param {Array} array + * array to wrap + * @param {number} size + * number of entries to wrap + * @private + */ + UnmodifiableEntrySet.prototype.wrap = function (array, size) { + for (var i = 0; i < size; ++i) { + { + array[i] = (new UnmodifiableEntrySet.UnmodifiableEntry(array[i])); + } + ; + } + }; + return UnmodifiableEntrySet; + }(Collections.UnmodifiableSet)); + UnmodifiableMap.UnmodifiableEntrySet = UnmodifiableEntrySet; + UnmodifiableEntrySet["__class"] = "java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet"; + UnmodifiableEntrySet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + (function (UnmodifiableEntrySet) { + var UnmodifiableEntry = /** @class */ (function () { + function UnmodifiableEntry(entry) { + if (this.entry === undefined) { + this.entry = null; + } + this.entry = entry; + } + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableEntry.prototype.equals = function (o) { + return /* equals */ (function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(this.entry, o); + }; + /** + * + * @return {*} + */ + UnmodifiableEntry.prototype.getKey = function () { + return this.entry.getKey(); + }; + /** + * + * @return {*} + */ + UnmodifiableEntry.prototype.getValue = function () { + return this.entry.getValue(); + }; + /** + * + * @return {number} + */ + UnmodifiableEntry.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.entry); + }; + /** + * + * @param {*} value + * @return {*} + */ + UnmodifiableEntry.prototype.setValue = function (value) { + throw new java.lang.UnsupportedOperationException(); + }; + /** + * + * @return {string} + */ + UnmodifiableEntry.prototype.toString = function () { + return this.entry.toString(); + }; + return UnmodifiableEntry; + }()); + UnmodifiableEntrySet.UnmodifiableEntry = UnmodifiableEntry; + UnmodifiableEntry["__class"] = "java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableEntry"; + UnmodifiableEntry["__interfaces"] = ["java.util.Map.Entry"]; + var UnmodifiableEntrySet$0 = /** @class */ (function () { + function UnmodifiableEntrySet$0(__parent, it) { + this.it = it; + this.__parent = __parent; + } + /* Default method injected from java.util.Iterator */ + UnmodifiableEntrySet$0.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + UnmodifiableEntrySet$0.prototype.hasNext = function () { + return this.it.hasNext(); + }; + /** + * + * @return {*} + */ + UnmodifiableEntrySet$0.prototype.next = function () { + return (new UnmodifiableEntrySet.UnmodifiableEntry(this.it.next())); + }; + /** + * + */ + UnmodifiableEntrySet$0.prototype.remove = function () { + throw new java.lang.UnsupportedOperationException(); + }; + return UnmodifiableEntrySet$0; + }()); + UnmodifiableEntrySet.UnmodifiableEntrySet$0 = UnmodifiableEntrySet$0; + UnmodifiableEntrySet$0["__interfaces"] = ["java.util.Iterator"]; + })(UnmodifiableEntrySet = UnmodifiableMap.UnmodifiableEntrySet || (UnmodifiableMap.UnmodifiableEntrySet = {})); + })(UnmodifiableMap = Collections.UnmodifiableMap || (Collections.UnmodifiableMap = {})); + var UnmodifiableSortedSet = /** @class */ (function (_super) { + __extends(UnmodifiableSortedSet, _super); + function UnmodifiableSortedSet(sortedSet) { + var _this = _super.call(this, sortedSet) || this; + if (_this.sortedSet === undefined) { + _this.sortedSet = null; + } + _this.sortedSet = sortedSet; + return _this; + } + /* Default method injected from java.util.Collection */ + UnmodifiableSortedSet.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_30 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_30(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + UnmodifiableSortedSet.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + UnmodifiableSortedSet.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + UnmodifiableSortedSet.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_31 = function (index189) { + var t = index189.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index189 = this.iterator(); index189.hasNext();) { + _loop_31(index189); + } + }; + /** + * + * @return {*} + */ + UnmodifiableSortedSet.prototype.comparator = function () { + return (this.sortedSet.comparator()); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableSortedSet.prototype.equals = function (o) { + return /* equals */ (function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(this.sortedSet, o); + }; + /** + * + * @return {*} + */ + UnmodifiableSortedSet.prototype.first = function () { + return this.sortedSet.first(); + }; + /** + * + * @return {number} + */ + UnmodifiableSortedSet.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.sortedSet); + }; + /** + * + * @param {*} toElement + * @return {*} + */ + UnmodifiableSortedSet.prototype.headSet = function (toElement) { + return (new Collections.UnmodifiableSortedSet(this.sortedSet.headSet(toElement))); + }; + /** + * + * @return {*} + */ + UnmodifiableSortedSet.prototype.last = function () { + return this.sortedSet.last(); + }; + /** + * + * @param {*} fromElement + * @param {*} toElement + * @return {*} + */ + UnmodifiableSortedSet.prototype.subSet = function (fromElement, toElement) { + return (new Collections.UnmodifiableSortedSet(this.sortedSet.subSet(fromElement, toElement))); + }; + /** + * + * @param {*} fromElement + * @return {*} + */ + UnmodifiableSortedSet.prototype.tailSet = function (fromElement) { + return (new Collections.UnmodifiableSortedSet(this.sortedSet.tailSet(fromElement))); + }; + return UnmodifiableSortedSet; + }(Collections.UnmodifiableSet)); + Collections.UnmodifiableSortedSet = UnmodifiableSortedSet; + UnmodifiableSortedSet["__class"] = "java.util.Collections.UnmodifiableSortedSet"; + UnmodifiableSortedSet["__interfaces"] = ["java.util.SortedSet", "java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + var UnmodifiableSortedMap = /** @class */ (function (_super) { + __extends(UnmodifiableSortedMap, _super); + function UnmodifiableSortedMap(sortedMap) { + var _this = _super.call(this, sortedMap) || this; + if (_this.sortedMap === undefined) { + _this.sortedMap = null; + } + _this.sortedMap = sortedMap; + return _this; + } + /* Default method injected from java.util.Map */ + UnmodifiableSortedMap.prototype.getOrDefault = function (key, defaultValue) { + var v; + return (((v = this.get(key)) != null) || this.containsKey(key)) ? v : defaultValue; + }; + /* Default method injected from java.util.Map */ + UnmodifiableSortedMap.prototype.putIfAbsent = function (key, value) { + var v = this.get(key); + if (v == null) { + v = this.put(key, value); + } + return v; + }; + /* Default method injected from java.util.Map */ + UnmodifiableSortedMap.prototype.merge = function (key, value, map) { + var old = this.get(key); + var next = (old == null) ? value : (function (target) { return (typeof target === 'function') ? target(old, value) : target.apply(old, value); })(map); + if (next == null) { + this.remove(key); + } + else { + this.put(key, next); + } + return next; + }; + /* Default method injected from java.util.Map */ + UnmodifiableSortedMap.prototype.computeIfAbsent = function (key, mappingFunction) { + var result; + if ((result = this.get(key)) == null) { + result = (function (target) { return (typeof target === 'function') ? target(key) : target.apply(key); })(mappingFunction); + if (result != null) + this.put(key, result); + } + return result; + }; + /* Default method injected from java.util.Map */ + UnmodifiableSortedMap.prototype.replaceAll = function (__function) { + java.util.Objects.requireNonNull((__function)); + var _loop_32 = function (index190) { + var entry = index190.next(); + { + var k_4; + var v_4; + try { + k_4 = entry.getKey(); + v_4 = entry.getValue(); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + v_4 = (function (target) { return (typeof target === 'function') ? target(k_4, v_4) : target.apply(k_4, v_4); })(__function); + try { + entry.setValue(v_4); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + } + }; + for (var index190 = this.entrySet().iterator(); index190.hasNext();) { + _loop_32(index190); + } + }; + /** + * + * @return {*} + */ + UnmodifiableSortedMap.prototype.comparator = function () { + return (this.sortedMap.comparator()); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + UnmodifiableSortedMap.prototype.equals = function (o) { + return /* equals */ (function (o1, o2) { if (o1 && o1.equals) { + return o1.equals(o2); + } + else { + return o1 === o2; + } })(this.sortedMap, o); + }; + /** + * + * @return {*} + */ + UnmodifiableSortedMap.prototype.firstKey = function () { + return this.sortedMap.firstKey(); + }; + /** + * + * @return {number} + */ + UnmodifiableSortedMap.prototype.hashCode = function () { + return /* hashCode */ (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(this.sortedMap); + }; + /** + * + * @param {*} toKey + * @return {*} + */ + UnmodifiableSortedMap.prototype.headMap = function (toKey) { + return (new Collections.UnmodifiableSortedMap(this.sortedMap.headMap(toKey))); + }; + /** + * + * @return {*} + */ + UnmodifiableSortedMap.prototype.lastKey = function () { + return this.sortedMap.lastKey(); + }; + /** + * + * @param {*} fromKey + * @param {*} toKey + * @return {*} + */ + UnmodifiableSortedMap.prototype.subMap = function (fromKey, toKey) { + return (new Collections.UnmodifiableSortedMap(this.sortedMap.subMap(fromKey, toKey))); + }; + /** + * + * @param {*} fromKey + * @return {*} + */ + UnmodifiableSortedMap.prototype.tailMap = function (fromKey) { + return (new Collections.UnmodifiableSortedMap(this.sortedMap.tailMap(fromKey))); + }; + return UnmodifiableSortedMap; + }(Collections.UnmodifiableMap)); + Collections.UnmodifiableSortedMap = UnmodifiableSortedMap; + UnmodifiableSortedMap["__class"] = "java.util.Collections.UnmodifiableSortedMap"; + UnmodifiableSortedMap["__interfaces"] = ["java.util.Map", "java.util.SortedMap"]; + var Collections$0 = /** @class */ (function () { + function Collections$0(it) { + this.it = it; + } + /** + * + * @return {boolean} + */ + Collections$0.prototype.hasMoreElements = function () { + return this.it.hasNext(); + }; + /** + * + * @return {*} + */ + Collections$0.prototype.nextElement = function () { + return this.it.next(); + }; + return Collections$0; + }()); + Collections.Collections$0 = Collections$0; + Collections$0["__interfaces"] = ["java.util.Enumeration"]; + })(Collections = util.Collections || (util.Collections = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Hash table and linked-list implementation of the Set interface with + * predictable iteration order. [Sun + * docs] + * + * @param element type. + * @param {number} ignored + * @param {number} alsoIgnored + * @class + * @extends java.util.HashSet + */ + var LinkedHashSet = /** @class */ (function (_super) { + __extends(LinkedHashSet, _super); + function LinkedHashSet(ignored, alsoIgnored) { + var _this = this; + if (((typeof ignored === 'number') || ignored === null) && ((typeof alsoIgnored === 'number') || alsoIgnored === null)) { + var __args = arguments; + _this = _super.call(this, (new java.util.LinkedHashMap(ignored, alsoIgnored))) || this; + } + else if (((ignored != null && (ignored["__interfaces"] != null && ignored["__interfaces"].indexOf("java.util.Collection") >= 0 || ignored.constructor != null && ignored.constructor["__interfaces"] != null && ignored.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || ignored === null) && alsoIgnored === undefined) { + var __args = arguments; + var c = __args[0]; + _this = _super.call(this, (new java.util.LinkedHashMap())) || this; + _this.addAll(c); + } + else if (((typeof ignored === 'number') || ignored === null) && alsoIgnored === undefined) { + var __args = arguments; + _this = _super.call(this, (new java.util.LinkedHashMap(ignored))) || this; + } + else if (ignored === undefined && alsoIgnored === undefined) { + var __args = arguments; + _this = _super.call(this, (new java.util.LinkedHashMap())) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + /* Default method injected from java.util.Collection */ + LinkedHashSet.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_33 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_33(it); + } + return removed; + }; + /* Default method injected from java.util.Collection */ + LinkedHashSet.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + LinkedHashSet.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + LinkedHashSet.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_34 = function (index191) { + var t = index191.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index191 = this.iterator(); index191.hasNext();) { + _loop_34(index191); + } + }; + /** + * + * @return {*} + */ + LinkedHashSet.prototype.clone = function () { + return (new LinkedHashSet(this)); + }; + return LinkedHashSet; + }(java.util.HashSet)); + util.LinkedHashSet = LinkedHashSet; + LinkedHashSet["__class"] = "java.util.LinkedHashSet"; + LinkedHashSet["__interfaces"] = ["java.lang.Cloneable", "java.util.Collection", "java.util.Set", "java.lang.Iterable", "java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Maintains a last-in, first-out collection of objects. [Sun + * docs] + * + * @param element type. + * @class + * @extends java.util.Vector + */ + var Stack = /** @class */ (function (_super) { + __extends(Stack, _super); + function Stack() { + return _super.call(this) || this; + } + /** + * + * @return {*} + */ + Stack.prototype.clone = function () { + var s = (new Stack()); + s.addAll$java_util_Collection(this); + return s; + }; + Stack.prototype.empty = function () { + return this.isEmpty(); + }; + Stack.prototype.peek = function () { + var sz = this.size(); + if (sz > 0) { + return this.get(sz - 1); + } + else { + throw new java.util.EmptyStackException(); + } + }; + Stack.prototype.pop = function () { + var sz = this.size(); + if (sz > 0) { + return this.remove$int(sz - 1); + } + else { + throw new java.util.EmptyStackException(); + } + }; + Stack.prototype.push = function (o) { + this.add(o); + return o; + }; + Stack.prototype.search = function (o) { + var pos = this.lastIndexOf$java_lang_Object(o); + if (pos >= 0) { + return this.size() - pos; + } + return -1; + }; + return Stack; + }(java.util.Vector)); + util.Stack = Stack; + Stack["__class"] = "java.util.Stack"; + Stack["__interfaces"] = ["java.util.RandomAccess", "java.util.List", "java.lang.Cloneable", "java.util.Collection", "java.lang.Iterable", "java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Linked list implementation. + * + * [Sun docs] + * + * @param + * element type. + * @param {*} c + * @class + * @extends java.util.AbstractSequentialList + */ + var LinkedList = /** @class */ (function (_super) { + __extends(LinkedList, _super); + function LinkedList(c) { + var _this = this; + if (((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.Collection") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.Collection") >= 0)) || c === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + if (_this.header === undefined) { + _this.header = null; + } + if (_this.tail === undefined) { + _this.tail = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + _this.header = (new LinkedList.Node()); + _this.tail = (new LinkedList.Node()); + _this.reset(); + _this.addAll(c); + } + else if (c === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.exposeElement === undefined) { + _this.exposeElement = null; + } + if (_this.header === undefined) { + _this.header = null; + } + if (_this.tail === undefined) { + _this.tail = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + _this.header = (new LinkedList.Node()); + _this.tail = (new LinkedList.Node()); + _this.reset(); + } + else + throw new Error('invalid overload'); + return _this; + } + /* Default method injected from java.util.Collection */ + LinkedList.prototype.removeIf = function (filter) { + javaemul.internal.InternalPreconditions.checkNotNull((filter)); + var removed = false; + var _loop_35 = function (it) { + { + if ((function (target) { return (typeof target === 'function') ? target(it.next()) : target.test(it.next()); })(filter)) { + it.remove(); + removed = true; + } + } + ; + }; + for (var it = this.iterator(); it.hasNext();) { + _loop_35(it); + } + return removed; + }; + /* Default method injected from java.util.List */ + LinkedList.prototype.sort = function (c) { + var a = this.toArray(); + java.util.Arrays.sort(a, (c)); + var i = this.listIterator(); + for (var index192 = 0; index192 < a.length; index192++) { + var e = a[index192]; + { + i.next(); + i.set(e); + } + } + }; + /* Default method injected from java.util.Collection */ + LinkedList.prototype.stream = function () { + return (new javaemul.internal.stream.StreamHelper(this)); + }; + /* Default method injected from java.util.Collection */ + LinkedList.prototype.parallelStream = function () { + return this.stream(); + }; + /* Default method injected from java.lang.Iterable */ + LinkedList.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_36 = function (index193) { + var t = index193.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index193 = this.iterator(); index193.hasNext();) { + _loop_36(index193); + } + }; + /** + * + * @param {number} index + * @param {*} element + */ + LinkedList.prototype.add = function (index, element) { + if (((typeof index === 'number') || index === null) && ((element != null) || element === null)) { + _super.prototype.add.call(this, index, element); + } + else if (((index != null) || index === null) && element === undefined) { + return this.add$java_lang_Object(index); + } + else + throw new Error('invalid overload'); + }; + LinkedList.prototype.add$java_lang_Object = function (o) { + this.addLast(o); + return true; + }; + /** + * + * @param {*} o + */ + LinkedList.prototype.addFirst = function (o) { + this.addNode(o, this.header, this.header.next); + }; + /** + * + * @param {*} o + */ + LinkedList.prototype.addLast = function (o) { + this.addNode(o, this.tail.prev, this.tail); + }; + /** + * + */ + LinkedList.prototype.clear = function () { + this.reset(); + }; + LinkedList.prototype.reset = function () { + this.header.next = this.tail; + this.tail.prev = this.header; + this.header.prev = this.tail.next = null; + this.__size = 0; + }; + LinkedList.prototype.clone = function () { + return (new LinkedList(this)); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.descendingIterator = function () { + return new LinkedList.DescendingIteratorImpl(this); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.element = function () { + return this.getFirst(); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.getFirst = function () { + javaemul.internal.InternalPreconditions.checkElement(this.__size !== 0); + return this.header.next.value; + }; + /** + * + * @return {*} + */ + LinkedList.prototype.getLast = function () { + javaemul.internal.InternalPreconditions.checkElement(this.__size !== 0); + return this.tail.prev.value; + }; + LinkedList.prototype.listIterator$int = function (index) { + javaemul.internal.InternalPreconditions.checkPositionIndex(index, this.__size); + var node; + if (index >= this.__size >> 1) { + node = this.tail; + for (var i = this.__size; i > index; --i) { + { + node = node.prev; + } + ; + } + } + else { + node = this.header.next; + for (var i = 0; i < index; ++i) { + { + node = node.next; + } + ; + } + } + return new LinkedList.ListIteratorImpl2(this, index, node); + }; + /** + * + * @param {number} index + * @return {*} + */ + LinkedList.prototype.listIterator = function (index) { + if (((typeof index === 'number') || index === null)) { + return this.listIterator$int(index); + } + else if (index === undefined) { + return this.listIterator$(); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + LinkedList.prototype.offer = function (o) { + return this.offerLast(o); + }; + /** + * + * @param {*} e + * @return {boolean} + */ + LinkedList.prototype.offerFirst = function (e) { + this.addFirst(e); + return true; + }; + /** + * + * @param {*} e + * @return {boolean} + */ + LinkedList.prototype.offerLast = function (e) { + this.addLast(e); + return true; + }; + /** + * + * @return {*} + */ + LinkedList.prototype.peek = function () { + return this.peekFirst(); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.peekFirst = function () { + return this.__size === 0 ? null : this.getFirst(); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.peekLast = function () { + return this.__size === 0 ? null : this.getLast(); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.poll = function () { + return this.pollFirst(); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.pollFirst = function () { + return this.__size === 0 ? null : this.removeFirst(); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.pollLast = function () { + return this.__size === 0 ? null : this.removeLast(); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.pop = function () { + return this.removeFirst(); + }; + /** + * + * @param {*} e + */ + LinkedList.prototype.push = function (e) { + this.addFirst(e); + }; + /** + * + * @param {number} index + * @return {*} + */ + LinkedList.prototype.remove = function (index) { + if (((typeof index === 'number') || index === null)) { + return _super.prototype.remove.call(this, index); + } + else if (((index != null) || index === null)) { + return _super.prototype.remove.call(this, index); + } + else if (index === undefined) { + return this.remove$(); + } + else + throw new Error('invalid overload'); + }; + LinkedList.prototype.remove$ = function () { + return this.removeFirst(); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.removeFirst = function () { + javaemul.internal.InternalPreconditions.checkElement(this.__size !== 0); + return this.removeNode(this.header.next); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + LinkedList.prototype.removeFirstOccurrence = function (o) { + return this.remove(o); + }; + /** + * + * @return {*} + */ + LinkedList.prototype.removeLast = function () { + javaemul.internal.InternalPreconditions.checkElement(this.__size !== 0); + return this.removeNode(this.tail.prev); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + LinkedList.prototype.removeLastOccurrence = function (o) { + for (var e = this.tail.prev; e !== this.header; e = e.prev) { + { + if (java.util.Objects.equals(e.value, o)) { + this.removeNode(e); + return true; + } + } + ; + } + return false; + }; + /** + * + * @return {number} + */ + LinkedList.prototype.size = function () { + return this.__size; + }; + LinkedList.prototype.addNode = function (o, prev, next) { + var node = (new LinkedList.Node()); + node.value = o; + node.prev = prev; + node.next = next; + next.prev = prev.next = node; + ++this.__size; + }; + LinkedList.prototype.removeNode = function (node) { + var oldValue = node.value; + node.next.prev = node.prev; + node.prev.next = node.next; + node.next = node.prev = null; + node.value = null; + --this.__size; + return oldValue; + }; + return LinkedList; + }(java.util.AbstractSequentialList)); + util.LinkedList = LinkedList; + LinkedList["__class"] = "java.util.LinkedList"; + LinkedList["__interfaces"] = ["java.lang.Cloneable", "java.util.List", "java.util.Collection", "java.util.Queue", "java.util.Deque", "java.lang.Iterable", "java.io.Serializable"]; + (function (LinkedList) { + var DescendingIteratorImpl = /** @class */ (function () { + function DescendingIteratorImpl(__parent) { + this.__parent = __parent; + this.itr = new LinkedList.ListIteratorImpl2(this.__parent, this.__parent.__size, this.__parent.tail); + } + /* Default method injected from java.util.Iterator */ + DescendingIteratorImpl.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + DescendingIteratorImpl.prototype.hasNext = function () { + return this.itr.hasPrevious(); + }; + /** + * + * @return {*} + */ + DescendingIteratorImpl.prototype.next = function () { + return this.itr.previous(); + }; + /** + * + */ + DescendingIteratorImpl.prototype.remove = function () { + this.itr.remove(); + }; + return DescendingIteratorImpl; + }()); + LinkedList.DescendingIteratorImpl = DescendingIteratorImpl; + DescendingIteratorImpl["__class"] = "java.util.LinkedList.DescendingIteratorImpl"; + DescendingIteratorImpl["__interfaces"] = ["java.util.Iterator"]; + /** + * @param {number} index + * from the beginning of the list (0 = first node) + * @param {java.util.LinkedList.Node} startNode + * the initial current node + * @class + */ + var ListIteratorImpl2 = /** @class */ (function () { + function ListIteratorImpl2(__parent, index, startNode) { + this.__parent = __parent; + if (this.currentIndex === undefined) { + this.currentIndex = 0; + } + if (this.currentNode === undefined) { + this.currentNode = null; + } + this.lastNode = null; + this.currentNode = startNode; + this.currentIndex = index; + } + /* Default method injected from java.util.Iterator */ + ListIteratorImpl2.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @param {*} o + */ + ListIteratorImpl2.prototype.add = function (o) { + this.__parent.addNode(o, this.currentNode.prev, this.currentNode); + ++this.currentIndex; + this.lastNode = null; + }; + /** + * + * @return {boolean} + */ + ListIteratorImpl2.prototype.hasNext = function () { + return this.currentNode !== this.__parent.tail; + }; + /** + * + * @return {boolean} + */ + ListIteratorImpl2.prototype.hasPrevious = function () { + return this.currentNode.prev !== this.__parent.header; + }; + /** + * + * @return {*} + */ + ListIteratorImpl2.prototype.next = function () { + javaemul.internal.InternalPreconditions.checkElement(this.hasNext()); + this.lastNode = this.currentNode; + this.currentNode = this.currentNode.next; + ++this.currentIndex; + return this.lastNode.value; + }; + /** + * + * @return {number} + */ + ListIteratorImpl2.prototype.nextIndex = function () { + return this.currentIndex; + }; + /** + * + * @return {*} + */ + ListIteratorImpl2.prototype.previous = function () { + javaemul.internal.InternalPreconditions.checkElement(this.hasPrevious()); + this.lastNode = this.currentNode = this.currentNode.prev; + --this.currentIndex; + return this.lastNode.value; + }; + /** + * + * @return {number} + */ + ListIteratorImpl2.prototype.previousIndex = function () { + return this.currentIndex - 1; + }; + /** + * + */ + ListIteratorImpl2.prototype.remove = function () { + javaemul.internal.InternalPreconditions.checkState(this.lastNode != null); + var nextNode = this.lastNode.next; + this.__parent.removeNode(this.lastNode); + if (this.currentNode === this.lastNode) { + this.currentNode = nextNode; + } + else { + --this.currentIndex; + } + this.lastNode = null; + }; + /** + * + * @param {*} o + */ + ListIteratorImpl2.prototype.set = function (o) { + javaemul.internal.InternalPreconditions.checkState(this.lastNode != null); + this.lastNode.value = o; + }; + return ListIteratorImpl2; + }()); + LinkedList.ListIteratorImpl2 = ListIteratorImpl2; + ListIteratorImpl2["__class"] = "java.util.LinkedList.ListIteratorImpl2"; + ListIteratorImpl2["__interfaces"] = ["java.util.Iterator", "java.util.ListIterator"]; + /** + * Internal class representing a doubly-linked list node. + * + * @param + * element type + * @class + */ + var Node = /** @class */ (function () { + function Node() { + if (this.next === undefined) { + this.next = null; + } + if (this.prev === undefined) { + this.prev = null; + } + if (this.value === undefined) { + this.value = null; + } + } + return Node; + }()); + LinkedList.Node = Node; + Node["__class"] = "java.util.LinkedList.Node"; + })(LinkedList = util.LinkedList || (util.LinkedList = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var InputMismatchException = /** @class */ (function (_super) { + __extends(InputMismatchException, _super); + function InputMismatchException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return InputMismatchException; + }(java.util.NoSuchElementException)); + util.InputMismatchException = InputMismatchException; + InputMismatchException["__class"] = "java.util.InputMismatchException"; + InputMismatchException["__interfaces"] = ["java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var InvalidMarkException = /** @class */ (function (_super) { + __extends(InvalidMarkException, _super); + function InvalidMarkException() { + var _this = _super.call(this) || this; + Object.setPrototypeOf(_this, InvalidMarkException.prototype); + return _this; + } + return InvalidMarkException; + }(java.lang.IllegalStateException)); + nio.InvalidMarkException = InvalidMarkException; + InvalidMarkException["__class"] = "java.nio.InvalidMarkException"; + InvalidMarkException["__interfaces"] = ["java.io.Serializable"]; + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var regex; + (function (regex) { + var PatternSyntaxException = /** @class */ (function (_super) { + __extends(PatternSyntaxException, _super); + function PatternSyntaxException(desc, pattern, index) { + var _this = this; + if (((typeof desc === 'string') || desc === null) && ((typeof pattern === 'string') || pattern === null) && ((typeof index === 'number') || index === null)) { + var __args = arguments; + { + var __args_36 = arguments; + var throwable = PatternSyntaxException.createSyntaxError(desc, index); + _this = _super.call(this, throwable) || this; + if (_this.pattern === undefined) { + _this.pattern = null; + } + _this.pattern = pattern; + } + if (_this.pattern === undefined) { + _this.pattern = null; + } + } + else if (((desc != null && desc instanceof Error) || desc === null) && ((typeof pattern === 'string') || pattern === null) && index === undefined) { + var __args = arguments; + var throwable = __args[0]; + _this = _super.call(this, throwable) || this; + if (_this.pattern === undefined) { + _this.pattern = null; + } + _this.pattern = pattern; + } + else + throw new Error('invalid overload'); + return _this; + } + /*private*/ PatternSyntaxException.createSyntaxError = function (desc, index) { + var syntaxError = new SyntaxError(desc); + (syntaxError)["columnNumber"] = index; + return syntaxError; + }; + PatternSyntaxException.prototype.getIndex = function () { + return (null["columnNumber"]); + }; + PatternSyntaxException.prototype.getDescription = function () { + return this.message; + }; + PatternSyntaxException.prototype.getPattern = function () { + return this.pattern; + }; + /** + * + * @return {string} + */ + PatternSyntaxException.prototype.getMessage = function () { + return this.getDescription() + " Pattern: " + this.pattern; + }; + return PatternSyntaxException; + }(java.lang.IllegalArgumentException)); + regex.PatternSyntaxException = PatternSyntaxException; + PatternSyntaxException["__class"] = "java.util.regex.PatternSyntaxException"; + PatternSyntaxException["__interfaces"] = ["java.io.Serializable"]; + })(regex = util.regex || (util.regex = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @class + * @extends java.lang.IllegalArgumentException + */ + var NumberFormatException = /** @class */ (function (_super) { + __extends(NumberFormatException, _super); + function NumberFormatException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + NumberFormatException.forInputString = function (s) { + return new java.lang.NumberFormatException("For input string: \"" + s + "\""); + }; + NumberFormatException.forNullInputString = function () { + return new java.lang.NumberFormatException("null"); + }; + NumberFormatException.forRadix = function (radix) { + return new java.lang.NumberFormatException("radix " + radix + " out of range"); + }; + return NumberFormatException; + }(java.lang.IllegalArgumentException)); + lang.NumberFormatException = NumberFormatException; + NumberFormatException["__class"] = "java.lang.NumberFormatException"; + NumberFormatException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var charset; + (function (charset) { + /** + * GWT emulation of {@link IllegalCharsetNameException}. + * @param {string} charsetName + * @class + * @extends java.lang.IllegalArgumentException + */ + var IllegalCharsetNameException = /** @class */ (function (_super) { + __extends(IllegalCharsetNameException, _super); + function IllegalCharsetNameException(charsetName) { + var _this = _super.call(this, /* valueOf */ new String(charsetName).toString()) || this; + Object.setPrototypeOf(_this, IllegalCharsetNameException.prototype); + if (_this.charsetName === undefined) { + _this.charsetName = null; + } + _this.charsetName = charsetName; + return _this; + } + IllegalCharsetNameException.prototype.getCharsetName = function () { + return this.charsetName; + }; + return IllegalCharsetNameException; + }(java.lang.IllegalArgumentException)); + charset.IllegalCharsetNameException = IllegalCharsetNameException; + IllegalCharsetNameException["__class"] = "java.nio.charset.IllegalCharsetNameException"; + IllegalCharsetNameException["__interfaces"] = ["java.io.Serializable"]; + })(charset = nio.charset || (nio.charset = {})); + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var charset; + (function (charset) { + /** + * GWT emulation of {@link UnsupportedCharsetException}. + * @param {string} charsetName + * @class + * @extends java.lang.IllegalArgumentException + */ + var UnsupportedCharsetException = /** @class */ (function (_super) { + __extends(UnsupportedCharsetException, _super); + function UnsupportedCharsetException(charsetName) { + var _this = _super.call(this, /* valueOf */ new String(charsetName).toString()) || this; + Object.setPrototypeOf(_this, UnsupportedCharsetException.prototype); + if (_this.charsetName === undefined) { + _this.charsetName = null; + } + _this.charsetName = charsetName; + return _this; + } + UnsupportedCharsetException.prototype.getCharsetName = function () { + return this.charsetName; + }; + return UnsupportedCharsetException; + }(java.lang.IllegalArgumentException)); + charset.UnsupportedCharsetException = UnsupportedCharsetException; + UnsupportedCharsetException["__class"] = "java.nio.charset.UnsupportedCharsetException"; + UnsupportedCharsetException["__interfaces"] = ["java.io.Serializable"]; + })(charset = nio.charset || (nio.charset = {})); + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var ReadOnlyBufferException = /** @class */ (function (_super) { + __extends(ReadOnlyBufferException, _super); + function ReadOnlyBufferException() { + var _this = _super.call(this) || this; + Object.setPrototypeOf(_this, ReadOnlyBufferException.prototype); + return _this; + } + return ReadOnlyBufferException; + }(java.lang.UnsupportedOperationException)); + nio.ReadOnlyBufferException = ReadOnlyBufferException; + ReadOnlyBufferException["__class"] = "java.nio.ReadOnlyBufferException"; + ReadOnlyBufferException["__interfaces"] = ["java.io.Serializable"]; + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * See the + * official Java API doc for details. + * @param {string} message + * @class + * @extends java.lang.IndexOutOfBoundsException + */ + var StringIndexOutOfBoundsException = /** @class */ (function (_super) { + __extends(StringIndexOutOfBoundsException, _super); + function StringIndexOutOfBoundsException(message) { + var _this = this; + if (((typeof message === 'string') || message === null)) { + var __args = arguments; + _this = _super.call(this, message) || this; + } + else if (((typeof message === 'number') || message === null)) { + var __args = arguments; + var index = __args[0]; + _this = _super.call(this, "String index out of range: " + index) || this; + } + else if (message === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return StringIndexOutOfBoundsException; + }(java.lang.IndexOutOfBoundsException)); + lang.StringIndexOutOfBoundsException = StringIndexOutOfBoundsException; + StringIndexOutOfBoundsException["__class"] = "java.lang.StringIndexOutOfBoundsException"; + StringIndexOutOfBoundsException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + /** + * NOTE: in GWT this will never be thrown for normal array accesses, only for + * explicit throws. + * + * See the + * official Java API doc for details. + * @param {number} index + * @class + * @extends java.lang.IndexOutOfBoundsException + */ + var ArrayIndexOutOfBoundsException = /** @class */ (function (_super) { + __extends(ArrayIndexOutOfBoundsException, _super); + function ArrayIndexOutOfBoundsException(msg) { + var _this = this; + if (((typeof msg === 'string') || msg === null)) { + var __args = arguments; + _this = _super.call(this, msg) || this; + } + else if (((typeof msg === 'number') || msg === null)) { + var __args = arguments; + var index = __args[0]; + _this = _super.call(this, "Array index " + index + " out of range") || this; + } + else if (msg === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + return ArrayIndexOutOfBoundsException; + }(java.lang.IndexOutOfBoundsException)); + lang.ArrayIndexOutOfBoundsException = ArrayIndexOutOfBoundsException; + ArrayIndexOutOfBoundsException["__class"] = "java.lang.ArrayIndexOutOfBoundsException"; + ArrayIndexOutOfBoundsException["__interfaces"] = ["java.io.Serializable"]; + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Map using reference equality on keys. [Sun + * docs] + * + * @param key type + * @param value type + * @param {number} ignored + * @class + * @extends java.util.AbstractHashMap + */ + var IdentityHashMap = /** @class */ (function (_super) { + __extends(IdentityHashMap, _super); + function IdentityHashMap(toBeCopied) { + var _this = this; + if (((toBeCopied != null && (toBeCopied["__interfaces"] != null && toBeCopied["__interfaces"].indexOf("java.util.Map") >= 0 || toBeCopied.constructor != null && toBeCopied.constructor["__interfaces"] != null && toBeCopied.constructor["__interfaces"].indexOf("java.util.Map") >= 0)) || toBeCopied === null)) { + var __args = arguments; + _this = _super.call(this, toBeCopied) || this; + if (_this.exposeKey === undefined) { + _this.exposeKey = null; + } + if (_this.exposeValue === undefined) { + _this.exposeValue = null; + } + } + else if (((typeof toBeCopied === 'number') || toBeCopied === null)) { + var __args = arguments; + var ignored = __args[0]; + _this = _super.call(this, ignored) || this; + if (_this.exposeKey === undefined) { + _this.exposeKey = null; + } + if (_this.exposeValue === undefined) { + _this.exposeValue = null; + } + } + else if (toBeCopied === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.exposeKey === undefined) { + _this.exposeKey = null; + } + if (_this.exposeValue === undefined) { + _this.exposeValue = null; + } + } + else + throw new Error('invalid overload'); + return _this; + } + /* Default method injected from java.util.Map */ + IdentityHashMap.prototype.getOrDefault = function (key, defaultValue) { + var v; + return (((v = this.get(key)) != null) || this.containsKey(key)) ? v : defaultValue; + }; + /* Default method injected from java.util.Map */ + IdentityHashMap.prototype.putIfAbsent = function (key, value) { + var v = this.get(key); + if (v == null) { + v = this.put(key, value); + } + return v; + }; + /* Default method injected from java.util.Map */ + IdentityHashMap.prototype.merge = function (key, value, map) { + var old = this.get(key); + var next = (old == null) ? value : (function (target) { return (typeof target === 'function') ? target(old, value) : target.apply(old, value); })(map); + if (next == null) { + this.remove(key); + } + else { + this.put(key, next); + } + return next; + }; + /* Default method injected from java.util.Map */ + IdentityHashMap.prototype.computeIfAbsent = function (key, mappingFunction) { + var result; + if ((result = this.get(key)) == null) { + result = (function (target) { return (typeof target === 'function') ? target(key) : target.apply(key); })(mappingFunction); + if (result != null) + this.put(key, result); + } + return result; + }; + /* Default method injected from java.util.Map */ + IdentityHashMap.prototype.replaceAll = function (__function) { + java.util.Objects.requireNonNull((__function)); + var _loop_37 = function (index194) { + var entry = index194.next(); + { + var k_5; + var v_5; + try { + k_5 = entry.getKey(); + v_5 = entry.getValue(); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + v_5 = (function (target) { return (typeof target === 'function') ? target(k_5, v_5) : target.apply(k_5, v_5); })(__function); + try { + entry.setValue(v_5); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + } + }; + for (var index194 = this.entrySet().iterator(); index194.hasNext();) { + _loop_37(index194); + } + }; + IdentityHashMap.prototype.clone = function () { + return (new IdentityHashMap(this)); + }; + /** + * + * @param {*} obj + * @return {boolean} + */ + IdentityHashMap.prototype.equals = function (obj) { + if (obj === this) { + return true; + } + if (!(obj != null && (obj["__interfaces"] != null && obj["__interfaces"].indexOf("java.util.Map") >= 0 || obj.constructor != null && obj.constructor["__interfaces"] != null && obj.constructor["__interfaces"].indexOf("java.util.Map") >= 0))) { + return false; + } + var otherMap = obj; + if (this.size() !== otherMap.size()) { + return false; + } + for (var index195 = otherMap.entrySet().iterator(); index195.hasNext();) { + var entry = index195.next(); + { + var otherKey = entry.getKey(); + var otherValue = entry.getValue(); + if (!this.containsKey(otherKey)) { + return false; + } + if (otherValue !== this.get(otherKey)) { + return false; + } + } + } + return true; + }; + /** + * + * @return {number} + */ + IdentityHashMap.prototype.hashCode = function () { + var hashCode = 0; + for (var index196 = this.entrySet().iterator(); index196.hasNext();) { + var entry = index196.next(); + { + hashCode += java.lang.System.identityHashCode(entry.getKey()); + hashCode += java.lang.System.identityHashCode(entry.getValue()); + } + } + return hashCode; + }; + /** + * + * @param {*} value1 + * @param {*} value2 + * @return {boolean} + */ + IdentityHashMap.prototype._equals = function (value1, value2) { + return value1 === value2; + }; + /** + * + * @param {*} key + * @return {number} + */ + IdentityHashMap.prototype.getHashCode = function (key) { + return javaemul.internal.HashCodes.getObjectIdentityHashCode(key); + }; + return IdentityHashMap; + }(java.util.AbstractHashMap)); + util.IdentityHashMap = IdentityHashMap; + IdentityHashMap["__class"] = "java.util.IdentityHashMap"; + IdentityHashMap["__interfaces"] = ["java.lang.Cloneable", "java.util.Map", "java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Implementation of Map interface based on a hash table. [Sun + * docs] + * + * @param key type + * @param value type + * @param {number} ignored + * @param {number} alsoIgnored + * @class + * @extends java.util.AbstractHashMap + */ + var HashMap = /** @class */ (function (_super) { + __extends(HashMap, _super); + function HashMap(ignored, alsoIgnored) { + var _this = this; + if (((typeof ignored === 'number') || ignored === null) && ((typeof alsoIgnored === 'number') || alsoIgnored === null)) { + var __args = arguments; + _this = _super.call(this, ignored, alsoIgnored) || this; + if (_this.exposeKey === undefined) { + _this.exposeKey = null; + } + if (_this.exposeValue === undefined) { + _this.exposeValue = null; + } + } + else if (((ignored != null && (ignored["__interfaces"] != null && ignored["__interfaces"].indexOf("java.util.Map") >= 0 || ignored.constructor != null && ignored.constructor["__interfaces"] != null && ignored.constructor["__interfaces"].indexOf("java.util.Map") >= 0)) || ignored === null) && alsoIgnored === undefined) { + var __args = arguments; + var toBeCopied = __args[0]; + _this = _super.call(this, toBeCopied) || this; + if (_this.exposeKey === undefined) { + _this.exposeKey = null; + } + if (_this.exposeValue === undefined) { + _this.exposeValue = null; + } + } + else if (((typeof ignored === 'number') || ignored === null) && alsoIgnored === undefined) { + var __args = arguments; + _this = _super.call(this, ignored) || this; + if (_this.exposeKey === undefined) { + _this.exposeKey = null; + } + if (_this.exposeValue === undefined) { + _this.exposeValue = null; + } + } + else if (ignored === undefined && alsoIgnored === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.exposeKey === undefined) { + _this.exposeKey = null; + } + if (_this.exposeValue === undefined) { + _this.exposeValue = null; + } + } + else + throw new Error('invalid overload'); + return _this; + } + HashMap.prototype.clone = function () { + return (new HashMap(this)); + }; + /** + * + * @param {*} value1 + * @param {*} value2 + * @return {boolean} + */ + HashMap.prototype._equals = function (value1, value2) { + return java.util.Objects.equals(value1, value2); + }; + /** + * + * @param {*} key + * @return {number} + */ + HashMap.prototype.getHashCode = function (key) { + var hashCode = (function (o) { if (o.hashCode) { + return o.hashCode(); + } + else { + return o.toString().split('').reduce(function (prevHash, currVal) { return (((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0; }, 0); + } })(key); + return javaemul.internal.Coercions.ensureInt(hashCode); + }; + return HashMap; + }(java.util.AbstractHashMap)); + util.HashMap = HashMap; + HashMap["__class"] = "java.util.HashMap"; + HashMap["__interfaces"] = ["java.lang.Cloneable", "java.util.Map", "java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Implements a TreeMap using a red-black tree. This guarantees O(log n) + * performance on lookups, inserts, and deletes while maintaining linear + * in-order traversal time. Null keys and values are fully supported if the + * comparator supports them (the default comparator does not). + * + * @param key type + * @param value type + * @param {*} c + * @class + * @extends java.util.AbstractNavigableMap + */ + var TreeMap = /** @class */ (function (_super) { + __extends(TreeMap, _super); + function TreeMap(c) { + var _this = this; + if (((typeof c === 'function' && c.length === 2) || c === null)) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.exposeKeyType === undefined) { + _this.exposeKeyType = null; + } + if (_this.exposeValueType === undefined) { + _this.exposeValueType = null; + } + if (_this.root === undefined) { + _this.root = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + _this.root = null; + if (c == null) { + c = (java.util.Comparators.natural()); + } + _this.cmp = (c); + } + else if (((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.SortedMap") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.SortedMap") >= 0)) || c === null)) { + var __args = arguments; + var map_1 = __args[0]; + { + var __args_37 = arguments; + var c_5 = javaemul.internal.InternalPreconditions.checkNotNull(map_1).comparator(); + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.exposeKeyType === undefined) { + _this.exposeKeyType = null; + } + if (_this.exposeValueType === undefined) { + _this.exposeValueType = null; + } + if (_this.root === undefined) { + _this.root = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + _this.root = null; + if (c_5 == null) { + c_5 = (java.util.Comparators.natural()); + } + _this.cmp = (c_5); + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.exposeKeyType === undefined) { + _this.exposeKeyType = null; + } + if (_this.exposeValueType === undefined) { + _this.exposeValueType = null; + } + if (_this.root === undefined) { + _this.root = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + (function () { + _this.putAll(map_1); + })(); + } + else if (((c != null && (c["__interfaces"] != null && c["__interfaces"].indexOf("java.util.Map") >= 0 || c.constructor != null && c.constructor["__interfaces"] != null && c.constructor["__interfaces"].indexOf("java.util.Map") >= 0)) || c === null)) { + var __args = arguments; + var map_2 = __args[0]; + { + var __args_38 = arguments; + { + var __args_39 = arguments; + var c_6 = (null); + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.exposeKeyType === undefined) { + _this.exposeKeyType = null; + } + if (_this.exposeValueType === undefined) { + _this.exposeValueType = null; + } + if (_this.root === undefined) { + _this.root = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + _this.root = null; + if (c_6 == null) { + c_6 = (java.util.Comparators.natural()); + } + _this.cmp = (c_6); + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.exposeKeyType === undefined) { + _this.exposeKeyType = null; + } + if (_this.exposeValueType === undefined) { + _this.exposeValueType = null; + } + if (_this.root === undefined) { + _this.root = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.exposeKeyType === undefined) { + _this.exposeKeyType = null; + } + if (_this.exposeValueType === undefined) { + _this.exposeValueType = null; + } + if (_this.root === undefined) { + _this.root = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + (function () { + _this.putAll(map_2); + })(); + } + else if (c === undefined) { + var __args = arguments; + { + var __args_40 = arguments; + var c_7 = (null); + _this = _super.call(this) || this; + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.exposeKeyType === undefined) { + _this.exposeKeyType = null; + } + if (_this.exposeValueType === undefined) { + _this.exposeValueType = null; + } + if (_this.root === undefined) { + _this.root = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + _this.root = null; + if (c_7 == null) { + c_7 = (java.util.Comparators.natural()); + } + _this.cmp = (c_7); + } + if (_this.cmp === undefined) { + _this.cmp = null; + } + if (_this.exposeKeyType === undefined) { + _this.exposeKeyType = null; + } + if (_this.exposeValueType === undefined) { + _this.exposeValueType = null; + } + if (_this.root === undefined) { + _this.root = null; + } + if (_this.__size === undefined) { + _this.__size = 0; + } + } + else + throw new Error('invalid overload'); + return _this; + } + TreeMap.SubMapType_All_$LI$ = function () { if (TreeMap.SubMapType_All == null) { + TreeMap.SubMapType_All = new TreeMap.SubMapType(); + } return TreeMap.SubMapType_All; }; + ; + TreeMap.SubMapType_Head_$LI$ = function () { if (TreeMap.SubMapType_Head == null) { + TreeMap.SubMapType_Head = new TreeMap.SubMapTypeHead(); + } return TreeMap.SubMapType_Head; }; + ; + TreeMap.SubMapType_Range_$LI$ = function () { if (TreeMap.SubMapType_Range == null) { + TreeMap.SubMapType_Range = new TreeMap.SubMapTypeRange(); + } return TreeMap.SubMapType_Range; }; + ; + TreeMap.SubMapType_Tail_$LI$ = function () { if (TreeMap.SubMapType_Tail == null) { + TreeMap.SubMapType_Tail = new TreeMap.SubMapTypeTail(); + } return TreeMap.SubMapType_Tail; }; + ; + TreeMap.otherChild = function (child) { + return 1 - child; + }; + /** + * + */ + TreeMap.prototype.clear = function () { + this.root = null; + this.__size = 0; + }; + /** + * + * @return {*} + */ + TreeMap.prototype.comparator = function () { + if (this.cmp === java.util.Comparators.natural()) { + return (null); + } + return (this.cmp); + }; + /** + * + * @return {*} + */ + TreeMap.prototype.entrySet = function () { + return new TreeMap.__java_util_TreeMap_EntrySet(this); + }; + TreeMap.prototype.headMap$java_lang_Object$boolean = function (toKey, inclusive) { + return new TreeMap.SubMap(this, TreeMap.SubMapType_Head_$LI$(), null, false, toKey, inclusive); + }; + /** + * + * @param {*} toKey + * @param {boolean} inclusive + * @return {*} + */ + TreeMap.prototype.headMap = function (toKey, inclusive) { + if (((toKey != null) || toKey === null) && ((typeof inclusive === 'boolean') || inclusive === null)) { + return this.headMap$java_lang_Object$boolean(toKey, inclusive); + } + else if (((toKey != null) || toKey === null) && inclusive === undefined) { + return this.headMap$java_lang_Object(toKey); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @param {*} key + * @param {*} value + * @return {*} + */ + TreeMap.prototype.put = function (key, value) { + var node = (new TreeMap.Node(key, value)); + var state = (new TreeMap.State()); + this.root = this.insert(this.root, node, state); + if (!state.found) { + ++this.__size; + } + this.root.isRed = false; + return state.value; + }; + /** + * + * @param {*} k + * @return {*} + */ + TreeMap.prototype.remove = function (k) { + var key = k; + var state = (new TreeMap.State()); + this.removeWithState(key, state); + return state.value; + }; + /** + * + * @return {number} + */ + TreeMap.prototype.size = function () { + return this.__size; + }; + TreeMap.prototype.subMap$java_lang_Object$boolean$java_lang_Object$boolean = function (fromKey, fromInclusive, toKey, toInclusive) { + return new TreeMap.SubMap(this, TreeMap.SubMapType_Range_$LI$(), fromKey, fromInclusive, toKey, toInclusive); + }; + /** + * + * @param {*} fromKey + * @param {boolean} fromInclusive + * @param {*} toKey + * @param {boolean} toInclusive + * @return {*} + */ + TreeMap.prototype.subMap = function (fromKey, fromInclusive, toKey, toInclusive) { + if (((fromKey != null) || fromKey === null) && ((typeof fromInclusive === 'boolean') || fromInclusive === null) && ((toKey != null) || toKey === null) && ((typeof toInclusive === 'boolean') || toInclusive === null)) { + return this.subMap$java_lang_Object$boolean$java_lang_Object$boolean(fromKey, fromInclusive, toKey, toInclusive); + } + else if (((fromKey != null) || fromKey === null) && ((fromInclusive != null) || fromInclusive === null) && toKey === undefined && toInclusive === undefined) { + return this.subMap$java_lang_Object$java_lang_Object(fromKey, fromInclusive); + } + else + throw new Error('invalid overload'); + }; + TreeMap.prototype.tailMap$java_lang_Object$boolean = function (fromKey, inclusive) { + return new TreeMap.SubMap(this, TreeMap.SubMapType_Tail_$LI$(), fromKey, inclusive, null, false); + }; + /** + * + * @param {*} fromKey + * @param {boolean} inclusive + * @return {*} + */ + TreeMap.prototype.tailMap = function (fromKey, inclusive) { + if (((fromKey != null) || fromKey === null) && ((typeof inclusive === 'boolean') || inclusive === null)) { + return this.tailMap$java_lang_Object$boolean(fromKey, inclusive); + } + else if (((fromKey != null) || fromKey === null) && inclusive === undefined) { + return this.tailMap$java_lang_Object(fromKey); + } + else + throw new Error('invalid overload'); + }; + /** + * Returns the first node which compares greater than the given key. + * + * @param {*} key the key to search for + * @return {java.util.TreeMap.Node} the next node, or null if there is none + * @param {boolean} inclusive + * @private + */ + TreeMap.prototype.getNodeAfter = function (key, inclusive) { + var foundNode = null; + var node = this.root; + while ((node != null)) { + { + var c = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(key, node.getKey()); + if (inclusive && c === 0) { + return node; + } + if (c >= 0) { + node = node.child[TreeMap.RIGHT]; + } + else { + foundNode = node; + node = node.child[TreeMap.LEFT]; + } + } + } + ; + return foundNode; + }; + /** + * Returns the last node which is strictly less than the given key. + * + * @param {*} key the key to search for + * @return {java.util.TreeMap.Node} the previous node, or null if there is none + * @param {boolean} inclusive + * @private + */ + TreeMap.prototype.getNodeBefore = function (key, inclusive) { + var foundNode = null; + var node = this.root; + while ((node != null)) { + { + var c = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(key, node.getKey()); + if (inclusive && c === 0) { + return node; + } + if (c <= 0) { + node = node.child[TreeMap.LEFT]; + } + else { + foundNode = node; + node = node.child[TreeMap.RIGHT]; + } + } + } + ; + return foundNode; + }; + TreeMap.prototype.assertCorrectness$ = function () { + this.assertCorrectness$java_util_TreeMap_Node$boolean(this.root, true); + }; + /** + * + * @return {*} + */ + TreeMap.prototype.descendingEntryIterator = function () { + return new TreeMap.DescendingEntryIterator(this); + }; + /** + * + * @return {*} + */ + TreeMap.prototype.entryIterator = function () { + return new TreeMap.EntryIterator(this); + }; + TreeMap.prototype.assertCorrectness$java_util_TreeMap_Node$boolean = function (tree, isRed) { + if (tree == null) { + return 0; + } + if (isRed && tree.isRed) { + throw new java.lang.RuntimeException("Two red nodes adjacent"); + } + var leftNode = tree.child[TreeMap.LEFT]; + if (leftNode != null && ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(leftNode.getKey(), tree.getKey()) > 0) { + throw new java.lang.RuntimeException("Left child " + leftNode + " larger than " + tree); + } + var rightNode = tree.child[TreeMap.RIGHT]; + if (rightNode != null && ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(rightNode.getKey(), tree.getKey()) < 0) { + throw new java.lang.RuntimeException("Right child " + rightNode + " smaller than " + tree); + } + var leftHeight = this.assertCorrectness$java_util_TreeMap_Node$boolean(leftNode, tree.isRed); + var rightHeight = this.assertCorrectness$java_util_TreeMap_Node$boolean(rightNode, tree.isRed); + if (leftHeight !== 0 && rightHeight !== 0 && leftHeight !== rightHeight) { + throw new java.lang.RuntimeException("Black heights don\'t match"); + } + return tree.isRed ? leftHeight : leftHeight + 1; + }; + /** + * Internal helper function for public {@link #assertCorrectness()}. + * + * @param {java.util.TreeMap.Node} tree the subtree to validate. + * @param {boolean} isRed true if the parent of this node is red. + * @return {number} the black height of this subtree. + * @throws RuntimeException if this RB-tree is not valid. + * @private + */ + TreeMap.prototype.assertCorrectness = function (tree, isRed) { + if (((tree != null && tree instanceof java.util.TreeMap.Node) || tree === null) && ((typeof isRed === 'boolean') || isRed === null)) { + return this.assertCorrectness$java_util_TreeMap_Node$boolean(tree, isRed); + } + else if (tree === undefined && isRed === undefined) { + return this.assertCorrectness$(); + } + else + throw new Error('invalid overload'); + }; + /** + * Finds an entry given a key and returns the node. + * + * @param {*} key the search key + * @return {*} the node matching the key or null + */ + TreeMap.prototype.getEntry = function (key) { + var tree = this.root; + while ((tree != null)) { + { + var c = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(key, tree.getKey()); + if (c === 0) { + return tree; + } + var childNum = c < 0 ? TreeMap.LEFT : TreeMap.RIGHT; + tree = tree.child[childNum]; + } + } + ; + return null; + }; + /** + * Returns the left-most node of the tree, or null if empty. + * @return {*} + */ + TreeMap.prototype.getFirstEntry = function () { + if (this.root == null) { + return null; + } + var node = this.root; + var nextNode; + while (((nextNode = node.child[TreeMap.LEFT]) != null)) { + { + node = nextNode; + } + } + ; + return node; + }; + /** + * Returns the right-most node of the tree, or null if empty. + * @return {*} + */ + TreeMap.prototype.getLastEntry = function () { + if (this.root == null) { + return null; + } + var node = this.root; + var nextNode; + while (((nextNode = node.child[TreeMap.RIGHT]) != null)) { + { + node = nextNode; + } + } + ; + return node; + }; + /** + * + * @param {*} key + * @return {*} + */ + TreeMap.prototype.getCeilingEntry = function (key) { + return this.getNodeAfter(key, true); + }; + /** + * + * @param {*} key + * @return {*} + */ + TreeMap.prototype.getFloorEntry = function (key) { + return this.getNodeBefore(key, true); + }; + /** + * + * @param {*} key + * @return {*} + */ + TreeMap.prototype.getHigherEntry = function (key) { + return this.getNodeAfter(key, false); + }; + /** + * + * @param {*} key + * @return {*} + */ + TreeMap.prototype.getLowerEntry = function (key) { + return this.getNodeBefore(key, false); + }; + /** + * + * @param {*} entry + * @return {boolean} + */ + TreeMap.prototype.removeEntry = function (entry) { + var state = (new TreeMap.State()); + state.matchValue = true; + state.value = entry.getValue(); + return this.removeWithState(entry.getKey(), state); + }; + TreeMap.prototype.inOrderAdd = function (list, type, current, fromKey, fromInclusive, toKey, toInclusive) { + if (current == null) { + return; + } + var leftNode = current.child[TreeMap.LEFT]; + if (leftNode != null) { + this.inOrderAdd(list, type, leftNode, fromKey, fromInclusive, toKey, toInclusive); + } + if (this.inRange(type, current.getKey(), fromKey, fromInclusive, toKey, toInclusive)) { + list.add(current); + } + var rightNode = current.child[TreeMap.RIGHT]; + if (rightNode != null) { + this.inOrderAdd(list, type, rightNode, fromKey, fromInclusive, toKey, toInclusive); + } + }; + TreeMap.prototype.inRange = function (type, key, fromKey, fromInclusive, toKey, toInclusive) { + if (type.fromKeyValid() && this.smaller(key, fromKey, !fromInclusive)) { + return false; + } + if (type.toKeyValid() && this.larger(key, toKey, !toInclusive)) { + return false; + } + return true; + }; + /** + * Insert a node into a subtree, collecting state about the insertion. + * + * If the same key already exists, the value of the node is overwritten with + * the value from the new node instead. + * + * @param {java.util.TreeMap.Node} tree subtree to insert into + * @param {java.util.TreeMap.Node} newNode new node to insert + * @param {java.util.TreeMap.State} state result of the insertion: state.found true if the key already + * existed in the tree state.value the old value if the key existed + * @return {java.util.TreeMap.Node} the new subtree root + * @private + */ + TreeMap.prototype.insert = function (tree, newNode, state) { + if (tree == null) { + return newNode; + } + else { + var c = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(newNode.getKey(), tree.getKey()); + if (c === 0) { + state.value = tree.setValue(newNode.getValue()); + state.found = true; + return tree; + } + var childNum = c < 0 ? TreeMap.LEFT : TreeMap.RIGHT; + tree.child[childNum] = this.insert(tree.child[childNum], newNode, state); + if (this.isRed(tree.child[childNum])) { + if (this.isRed(tree.child[TreeMap.otherChild(childNum)])) { + tree.isRed = true; + tree.child[TreeMap.LEFT].isRed = false; + tree.child[TreeMap.RIGHT].isRed = false; + } + else { + if (this.isRed(tree.child[childNum].child[childNum])) { + tree = this.rotateSingle(tree, TreeMap.otherChild(childNum)); + } + else if (this.isRed(tree.child[childNum].child[TreeMap.otherChild(childNum)])) { + tree = this.rotateDouble(tree, TreeMap.otherChild(childNum)); + } + } + } + } + return tree; + }; + /** + * Returns true if node is red. Note that null pointers are + * considered black. + * @param {java.util.TreeMap.Node} node + * @return {boolean} + * @private + */ + TreeMap.prototype.isRed = function (node) { + return node != null && node.isRed; + }; + /** + * Returns true if a is greater than or equal to b. + * @param {*} a + * @param {*} b + * @param {boolean} orEqual + * @return {boolean} + * @private + */ + TreeMap.prototype.larger = function (a, b, orEqual) { + var compare = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(a, b); + return compare > 0 || (orEqual && compare === 0); + }; + /** + * Returns true if a is less than or equal to b. + * @param {*} a + * @param {*} b + * @param {boolean} orEqual + * @return {boolean} + * @private + */ + TreeMap.prototype.smaller = function (a, b, orEqual) { + var compare = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(a, b); + return compare < 0 || (orEqual && compare === 0); + }; + /** + * Remove a key from the tree, returning whether it was found and its value. + * + * @param {*} key key to remove + * @param {java.util.TreeMap.State} state return state, not null + * @return {boolean} true if the value was found + * @private + */ + TreeMap.prototype.removeWithState = function (key, state) { + if (this.root == null) { + return false; + } + var found = null; + var parent = null; + var head = (new TreeMap.Node(null, null)); + var dir = TreeMap.RIGHT; + head.child[TreeMap.RIGHT] = this.root; + var node = head; + while ((node.child[dir] != null)) { + { + var last = dir; + var grandparent = parent; + parent = node; + node = node.child[dir]; + var c = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(key, node.getKey()); + dir = c < 0 ? TreeMap.LEFT : TreeMap.RIGHT; + if (c === 0 && (!state.matchValue || java.util.Objects.equals(node.getValue(), state.value))) { + found = node; + } + if (!this.isRed(node) && !this.isRed(node.child[dir])) { + if (this.isRed(node.child[TreeMap.otherChild(dir)])) { + parent = parent.child[last] = this.rotateSingle(node, dir); + } + else if (!this.isRed(node.child[TreeMap.otherChild(dir)])) { + var sibling = parent.child[TreeMap.otherChild(last)]; + if (sibling != null) { + if (!this.isRed(sibling.child[TreeMap.otherChild(last)]) && !this.isRed(sibling.child[last])) { + parent.isRed = false; + sibling.isRed = true; + node.isRed = true; + } + else { + var dir2 = grandparent.child[TreeMap.RIGHT] === parent ? TreeMap.RIGHT : TreeMap.LEFT; + if (this.isRed(sibling.child[last])) { + grandparent.child[dir2] = this.rotateDouble(parent, last); + } + else if (this.isRed(sibling.child[TreeMap.otherChild(last)])) { + grandparent.child[dir2] = this.rotateSingle(parent, last); + } + node.isRed = grandparent.child[dir2].isRed = true; + grandparent.child[dir2].child[TreeMap.LEFT].isRed = false; + grandparent.child[dir2].child[TreeMap.RIGHT].isRed = false; + } + } + } + } + } + } + ; + if (found != null) { + state.found = true; + state.value = found.getValue(); + if (node !== found) { + var newNode = (new TreeMap.Node(node.getKey(), node.getValue())); + this.replaceNode(head, found, newNode); + if (parent === found) { + parent = newNode; + } + } + parent.child[parent.child[TreeMap.RIGHT] === node ? TreeMap.RIGHT : TreeMap.LEFT] = node.child[node.child[TreeMap.LEFT] == null ? TreeMap.RIGHT : TreeMap.LEFT]; + this.__size--; + } + this.root = head.child[TreeMap.RIGHT]; + if (this.root != null) { + this.root.isRed = false; + } + return state.found; + }; + /** + * replace 'node' with 'newNode' in the tree rooted at 'head'. Could have + * avoided this traversal if each node maintained a parent pointer. + * @param {java.util.TreeMap.Node} head + * @param {java.util.TreeMap.Node} node + * @param {java.util.TreeMap.Node} newNode + * @private + */ + TreeMap.prototype.replaceNode = function (head, node, newNode) { + var parent = head; + var direction = (parent.getKey() == null || ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(node.getKey(), parent.getKey()) > 0) ? TreeMap.RIGHT : TreeMap.LEFT; + while ((parent.child[direction] !== node)) { + { + parent = parent.child[direction]; + direction = ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.cmp))(node.getKey(), parent.getKey()) > 0 ? TreeMap.RIGHT : TreeMap.LEFT; + } + } + ; + parent.child[direction] = newNode; + newNode.isRed = node.isRed; + newNode.child[TreeMap.LEFT] = node.child[TreeMap.LEFT]; + newNode.child[TreeMap.RIGHT] = node.child[TreeMap.RIGHT]; + node.child[TreeMap.LEFT] = null; + node.child[TreeMap.RIGHT] = null; + }; + /** + * Perform a double rotation, first rotating the child which will become the + * root in the opposite direction, then rotating the root in the specified + * direction. + * + *

+             * A                                               F
+             * B   C    becomes (with rotateDirection=0)       A   C
+             * D E F G                                         B E   G
+             * D
+             * 
+ * + * @param {java.util.TreeMap.Node} tree root of the subtree to rotate + * @param {number} rotateDirection the direction to rotate: 0=left, 1=right + * @return {java.util.TreeMap.Node} the new root of the rotated subtree + * @private + */ + TreeMap.prototype.rotateDouble = function (tree, rotateDirection) { + var otherChildDir = TreeMap.otherChild(rotateDirection); + tree.child[otherChildDir] = this.rotateSingle(tree.child[otherChildDir], otherChildDir); + return this.rotateSingle(tree, rotateDirection); + }; + /** + * Perform a single rotation, pushing the root of the subtree to the specified + * direction. + * + *
+             * A                                              B
+             * B   C     becomes (with rotateDirection=1)     D   A
+             * D E                                              E   C
+             * 
+ * + * @param {java.util.TreeMap.Node} tree the root of the subtree to rotate + * @param {number} rotateDirection the direction to rotate: 0=left rotation, 1=right + * @return {java.util.TreeMap.Node} the new root of the rotated subtree + * @private + */ + TreeMap.prototype.rotateSingle = function (tree, rotateDirection) { + var otherChildDir = TreeMap.otherChild(rotateDirection); + var save = tree.child[otherChildDir]; + tree.child[otherChildDir] = save.child[rotateDirection]; + save.child[rotateDirection] = tree; + tree.isRed = true; + save.isRed = false; + return save; + }; + TreeMap.LEFT = 0; + TreeMap.RIGHT = 1; + return TreeMap; + }(java.util.AbstractNavigableMap)); + util.TreeMap = TreeMap; + TreeMap["__class"] = "java.util.TreeMap"; + TreeMap["__interfaces"] = ["java.util.Map", "java.util.NavigableMap", "java.util.SortedMap", "java.io.Serializable"]; + (function (TreeMap) { + /** + * Create an iterator which may return only a restricted range. + * + * @param {*} fromKey the first key to return in the iterator. + * @param {*} toKey the upper bound of keys to return. + * @param {java.util.TreeMap.SubMapType} type + * @param {boolean} fromInclusive + * @param {boolean} toInclusive + * @class + */ + var DescendingEntryIterator = /** @class */ (function () { + function DescendingEntryIterator(__parent, type, fromKey, fromInclusive, toKey, toInclusive) { + if (((type != null && type instanceof java.util.TreeMap.SubMapType) || type === null) && ((fromKey != null) || fromKey === null) && ((typeof fromInclusive === 'boolean') || fromInclusive === null) && ((toKey != null) || toKey === null) && ((typeof toInclusive === 'boolean') || toInclusive === null)) { + var __args = Array.prototype.slice.call(arguments, [1]); + if (this.iter === undefined) { + this.iter = null; + } + if (this.last === undefined) { + this.last = null; + } + var list = (new java.util.ArrayList()); + __parent.inOrderAdd(list, type, __parent.root, fromKey, fromInclusive, toKey, toInclusive); + this.iter = list['listIterator$int'](list.size()); + } + else if (type === undefined && fromKey === undefined && fromInclusive === undefined && toKey === undefined && toInclusive === undefined) { + var __args = Array.prototype.slice.call(arguments, [1]); + { + var __args_41 = Array.prototype.slice.call(arguments, [1]); + var type_1 = java.util.TreeMap.SubMapType_All_$LI$(); + var fromKey_1 = null; + var fromInclusive_1 = false; + var toKey_1 = null; + var toInclusive_1 = false; + if (this.iter === undefined) { + this.iter = null; + } + if (this.last === undefined) { + this.last = null; + } + var list = (new java.util.ArrayList()); + __parent.inOrderAdd(list, type_1, __parent.root, fromKey_1, fromInclusive_1, toKey_1, toInclusive_1); + this.iter = list['listIterator$int'](list.size()); + } + if (this.iter === undefined) { + this.iter = null; + } + if (this.last === undefined) { + this.last = null; + } + } + else + throw new Error('invalid overload'); + } + /* Default method injected from java.util.Iterator */ + DescendingEntryIterator.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + DescendingEntryIterator.prototype.hasNext = function () { + return this.iter.hasPrevious(); + }; + /** + * + * @return {*} + */ + DescendingEntryIterator.prototype.next = function () { + return this.last = this.iter.previous(); + }; + /** + * + */ + DescendingEntryIterator.prototype.remove = function () { + this.iter.remove(); + this.__parent.removeEntry(this.last); + this.last = null; + }; + return DescendingEntryIterator; + }()); + TreeMap.DescendingEntryIterator = DescendingEntryIterator; + DescendingEntryIterator["__class"] = "java.util.TreeMap.DescendingEntryIterator"; + DescendingEntryIterator["__interfaces"] = ["java.util.Iterator"]; + /** + * Create an iterator which may return only a restricted range. + * + * @param {*} fromKey the first key to return in the iterator. + * @param {*} toKey the upper bound of keys to return. + * @param {java.util.TreeMap.SubMapType} type + * @param {boolean} fromInclusive + * @param {boolean} toInclusive + * @class + */ + var EntryIterator = /** @class */ (function () { + function EntryIterator(__parent, type, fromKey, fromInclusive, toKey, toInclusive) { + if (((type != null && type instanceof java.util.TreeMap.SubMapType) || type === null) && ((fromKey != null) || fromKey === null) && ((typeof fromInclusive === 'boolean') || fromInclusive === null) && ((toKey != null) || toKey === null) && ((typeof toInclusive === 'boolean') || toInclusive === null)) { + var __args = Array.prototype.slice.call(arguments, [1]); + if (this.iter === undefined) { + this.iter = null; + } + if (this.last === undefined) { + this.last = null; + } + var list = (new java.util.ArrayList()); + __parent.inOrderAdd(list, type, __parent.root, fromKey, fromInclusive, toKey, toInclusive); + this.iter = list['listIterator$'](); + } + else if (type === undefined && fromKey === undefined && fromInclusive === undefined && toKey === undefined && toInclusive === undefined) { + var __args = Array.prototype.slice.call(arguments, [1]); + { + var __args_42 = Array.prototype.slice.call(arguments, [1]); + var type_2 = java.util.TreeMap.SubMapType_All_$LI$(); + var fromKey_2 = null; + var fromInclusive_2 = false; + var toKey_2 = null; + var toInclusive_2 = false; + if (this.iter === undefined) { + this.iter = null; + } + if (this.last === undefined) { + this.last = null; + } + var list = (new java.util.ArrayList()); + __parent.inOrderAdd(list, type_2, __parent.root, fromKey_2, fromInclusive_2, toKey_2, toInclusive_2); + this.iter = list['listIterator$'](); + } + if (this.iter === undefined) { + this.iter = null; + } + if (this.last === undefined) { + this.last = null; + } + } + else + throw new Error('invalid overload'); + } + /* Default method injected from java.util.Iterator */ + EntryIterator.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + EntryIterator.prototype.hasNext = function () { + return this.iter.hasNext(); + }; + /** + * + * @return {*} + */ + EntryIterator.prototype.next = function () { + return this.last = this.iter.next(); + }; + /** + * + */ + EntryIterator.prototype.remove = function () { + this.iter.remove(); + this.__parent.removeEntry(this.last); + this.last = null; + }; + return EntryIterator; + }()); + TreeMap.EntryIterator = EntryIterator; + EntryIterator["__class"] = "java.util.TreeMap.EntryIterator"; + EntryIterator["__interfaces"] = ["java.util.Iterator"]; + var __java_util_TreeMap_EntrySet = /** @class */ (function (_super) { + __extends(__java_util_TreeMap_EntrySet, _super); + function __java_util_TreeMap_EntrySet(__parent) { + var _this = _super.call(this, __parent) || this; + _this.__parent = __parent; + return _this; + } + /** + * + */ + __java_util_TreeMap_EntrySet.prototype.clear = function () { + this.clear(); + }; + return __java_util_TreeMap_EntrySet; + }(java.util.AbstractNavigableMap.EntrySet)); + TreeMap.__java_util_TreeMap_EntrySet = __java_util_TreeMap_EntrySet; + __java_util_TreeMap_EntrySet["__class"] = "java.util.TreeMap.EntrySet"; + __java_util_TreeMap_EntrySet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + /** + * Create a node of the specified color. + * + * @param {*} key + * @param {*} value + * @param {boolean} isRed true if this should be a red node, false for black + * @class + * @extends java.util.AbstractMap.SimpleEntry + */ + var Node = /** @class */ (function (_super) { + __extends(Node, _super); + function Node(key, value, isRed) { + var _this = this; + if (((key != null) || key === null) && ((value != null) || value === null) && ((typeof isRed === 'boolean') || isRed === null)) { + var __args = arguments; + _this = _super.call(this, key, value) || this; + if (_this.isRed === undefined) { + _this.isRed = false; + } + _this.child = [null, null]; + _this.isRed = isRed; + } + else if (((key != null) || key === null) && ((value != null) || value === null) && isRed === undefined) { + var __args = arguments; + { + var __args_43 = arguments; + var isRed_1 = true; + _this = _super.call(this, key, value) || this; + if (_this.isRed === undefined) { + _this.isRed = false; + } + _this.child = [null, null]; + _this.isRed = isRed_1; + } + if (_this.isRed === undefined) { + _this.isRed = false; + } + _this.child = [null, null]; + } + else + throw new Error('invalid overload'); + return _this; + } + return Node; + }(util.AbstractMap.SimpleEntry)); + TreeMap.Node = Node; + Node["__class"] = "java.util.TreeMap.Node"; + Node["__interfaces"] = ["java.util.Map.Entry"]; + /** + * A state object which is passed down the tree for both insert and remove. + * All uses make use of the done flag to indicate when no further rebalancing + * of the tree is required. Remove methods use the found flag to indicate when + * the desired key has been found. value is used both to return the value of a + * removed node as well as to pass in a value which must match (used for + * entrySet().remove(entry)), and the matchValue flag is used to request this + * behavior. + * + * @param value type + * @class + */ + var State = /** @class */ (function () { + function State() { + if (this.done === undefined) { + this.done = false; + } + if (this.found === undefined) { + this.found = false; + } + if (this.matchValue === undefined) { + this.matchValue = false; + } + if (this.value === undefined) { + this.value = null; + } + } + /** + * + * @return {string} + */ + State.prototype.toString = function () { + return "State: mv=" + this.matchValue + " value=" + this.value + " done=" + this.done + " found=" + this.found; + }; + return State; + }()); + TreeMap.State = State; + State["__class"] = "java.util.TreeMap.State"; + var SubMap = /** @class */ (function (_super) { + __extends(SubMap, _super); + function SubMap(__parent, type, fromKey, fromInclusive, toKey, toInclusive) { + var _this = _super.call(this) || this; + _this.__parent = __parent; + if (_this.fromInclusive === undefined) { + _this.fromInclusive = false; + } + if (_this.fromKey === undefined) { + _this.fromKey = null; + } + if (_this.toInclusive === undefined) { + _this.toInclusive = false; + } + if (_this.toKey === undefined) { + _this.toKey = null; + } + if (_this.type === undefined) { + _this.type = null; + } + if (type === java.util.TreeMap.SubMapType_Range_$LI$()) { + if (((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(__parent.cmp))(toKey, fromKey) < 0) { + throw new java.lang.IllegalArgumentException("subMap: " + toKey + " less than " + fromKey); + } + } + if (type === java.util.TreeMap.SubMapType_Head_$LI$()) { + ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(__parent.cmp))(toKey, toKey); + } + if (type === java.util.TreeMap.SubMapType_Tail_$LI$()) { + ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(__parent.cmp))(fromKey, fromKey); + } + if (type === java.util.TreeMap.SubMapType_All_$LI$()) { + } + _this.type = type; + _this.fromKey = fromKey; + _this.fromInclusive = fromInclusive; + _this.toKey = toKey; + _this.toInclusive = toInclusive; + return _this; + } + /** + * + * @return {*} + */ + SubMap.prototype.comparator = function () { + return (this.comparator()); + }; + /** + * + * @return {*} + */ + SubMap.prototype.entrySet = function () { + return new SubMap.SubMap$0(this); + }; + SubMap.prototype.headMap$java_lang_Object$boolean = function (toKey, toInclusive) { + if (this.type.toKeyValid() && ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.__parent.cmp))(toKey, this.toKey) > 0) { + throw new java.lang.IllegalArgumentException("subMap: " + toKey + " greater than " + this.toKey); + } + if (this.type.fromKeyValid()) { + return this.subMap(this.fromKey, this.fromInclusive, toKey, toInclusive); + } + else { + return this.headMap(toKey, toInclusive); + } + }; + /** + * + * @param {*} toKey + * @param {boolean} toInclusive + * @return {*} + */ + SubMap.prototype.headMap = function (toKey, toInclusive) { + if (((toKey != null) || toKey === null) && ((typeof toInclusive === 'boolean') || toInclusive === null)) { + return this.headMap$java_lang_Object$boolean(toKey, toInclusive); + } + else if (((toKey != null) || toKey === null) && toInclusive === undefined) { + return this.headMap$java_lang_Object(toKey); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {boolean} + */ + SubMap.prototype.isEmpty = function () { + return this.getFirstEntry() == null; + }; + /** + * + * @param {*} key + * @param {*} value + * @return {*} + */ + SubMap.prototype.put = function (key, value) { + if (!this.inRange(key)) { + throw new java.lang.IllegalArgumentException(key + " outside the range " + this.fromKey + " to " + this.toKey); + } + return this.put(key, value); + }; + /** + * + * @param {*} k + * @return {*} + */ + SubMap.prototype.remove = function (k) { + var key = k; + if (!this.inRange(key)) { + return null; + } + return this.remove(key); + }; + /** + * + * @return {number} + */ + SubMap.prototype.size = function () { + var count = 0; + for (var it = this.entryIterator(); it.hasNext(); it.next()) { + { + count++; + } + ; + } + return count; + }; + SubMap.prototype.subMap$java_lang_Object$boolean$java_lang_Object$boolean = function (newFromKey, newFromInclusive, newToKey, newToInclusive) { + if (this.type.fromKeyValid() && ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.__parent.cmp))(newFromKey, this.fromKey) < 0) { + throw new java.lang.IllegalArgumentException("subMap: " + newFromKey + " less than " + this.fromKey); + } + if (this.type.toKeyValid() && ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.__parent.cmp))(newToKey, this.toKey) > 0) { + throw new java.lang.IllegalArgumentException("subMap: " + newToKey + " greater than " + this.toKey); + } + return this.subMap(newFromKey, newFromInclusive, newToKey, newToInclusive); + }; + /** + * + * @param {*} newFromKey + * @param {boolean} newFromInclusive + * @param {*} newToKey + * @param {boolean} newToInclusive + * @return {*} + */ + SubMap.prototype.subMap = function (newFromKey, newFromInclusive, newToKey, newToInclusive) { + if (((newFromKey != null) || newFromKey === null) && ((typeof newFromInclusive === 'boolean') || newFromInclusive === null) && ((newToKey != null) || newToKey === null) && ((typeof newToInclusive === 'boolean') || newToInclusive === null)) { + return this.subMap$java_lang_Object$boolean$java_lang_Object$boolean(newFromKey, newFromInclusive, newToKey, newToInclusive); + } + else if (((newFromKey != null) || newFromKey === null) && ((newFromInclusive != null) || newFromInclusive === null) && newToKey === undefined && newToInclusive === undefined) { + return this.subMap$java_lang_Object$java_lang_Object(newFromKey, newFromInclusive); + } + else + throw new Error('invalid overload'); + }; + SubMap.prototype.tailMap$java_lang_Object$boolean = function (fromKey, fromInclusive) { + if (this.type.fromKeyValid() && ((function (target) { return (target['compare'] === undefined) ? target : target['compare']; })(this.__parent.cmp))(fromKey, this.fromKey) < 0) { + throw new java.lang.IllegalArgumentException("subMap: " + fromKey + " less than " + this.fromKey); + } + if (this.type.toKeyValid()) { + return this.subMap(fromKey, fromInclusive, this.toKey, this.toInclusive); + } + else { + return this.tailMap(fromKey, fromInclusive); + } + }; + /** + * + * @param {*} fromKey + * @param {boolean} fromInclusive + * @return {*} + */ + SubMap.prototype.tailMap = function (fromKey, fromInclusive) { + if (((fromKey != null) || fromKey === null) && ((typeof fromInclusive === 'boolean') || fromInclusive === null)) { + return this.tailMap$java_lang_Object$boolean(fromKey, fromInclusive); + } + else if (((fromKey != null) || fromKey === null) && fromInclusive === undefined) { + return this.tailMap$java_lang_Object(fromKey); + } + else + throw new Error('invalid overload'); + }; + /** + * + * @return {*} + */ + SubMap.prototype.descendingEntryIterator = function () { + return new TreeMap.DescendingEntryIterator(this.__parent, this.type, this.fromKey, this.fromInclusive, this.toKey, this.toInclusive); + }; + /** + * + * @return {*} + */ + SubMap.prototype.entryIterator = function () { + return new TreeMap.EntryIterator(this.__parent, this.type, this.fromKey, this.fromInclusive, this.toKey, this.toInclusive); + }; + /** + * + * @param {*} key + * @return {*} + */ + SubMap.prototype.getEntry = function (key) { + return this.guardInRange(this.getEntry(key)); + }; + /** + * + * @return {*} + */ + SubMap.prototype.getFirstEntry = function () { + var entry; + if (this.type.fromKeyValid()) { + if (this.fromInclusive) { + entry = this.getCeilingEntry(this.fromKey); + } + else { + entry = this.getHigherEntry(this.fromKey); + } + } + else { + entry = this.getFirstEntry(); + } + return this.guardInRange(entry); + }; + /** + * + * @return {*} + */ + SubMap.prototype.getLastEntry = function () { + var entry; + if (this.type.toKeyValid()) { + if (this.toInclusive) { + entry = this.getFloorEntry(this.toKey); + } + else { + entry = this.getLowerEntry(this.toKey); + } + } + else { + entry = this.getLastEntry(); + } + return this.guardInRange(entry); + }; + /** + * + * @param {*} key + * @return {*} + */ + SubMap.prototype.getCeilingEntry = function (key) { + return this.guardInRange(this.getCeilingEntry(key)); + }; + /** + * + * @param {*} key + * @return {*} + */ + SubMap.prototype.getFloorEntry = function (key) { + return this.guardInRange(this.getFloorEntry(key)); + }; + /** + * + * @param {*} key + * @return {*} + */ + SubMap.prototype.getHigherEntry = function (key) { + return this.guardInRange(this.getHigherEntry(key)); + }; + /** + * + * @param {*} key + * @return {*} + */ + SubMap.prototype.getLowerEntry = function (key) { + return this.guardInRange(this.getLowerEntry(key)); + }; + /** + * + * @param {*} entry + * @return {boolean} + */ + SubMap.prototype.removeEntry = function (entry) { + return this.inRange(entry.getKey()) && this.removeEntry(entry); + }; + SubMap.prototype.guardInRange = function (entry) { + return entry != null && this.inRange(entry.getKey()) ? entry : null; + }; + SubMap.prototype.inRange = function (key) { + return this.__parent.inRange(this.type, key, this.fromKey, this.fromInclusive, this.toKey, this.toInclusive); + }; + return SubMap; + }(java.util.AbstractNavigableMap)); + TreeMap.SubMap = SubMap; + SubMap["__class"] = "java.util.TreeMap.SubMap"; + SubMap["__interfaces"] = ["java.util.Map", "java.util.NavigableMap", "java.util.SortedMap"]; + (function (SubMap) { + var SubMap$0 = /** @class */ (function (_super) { + __extends(SubMap$0, _super); + function SubMap$0(__parent) { + var _this = _super.call(this, __parent) || this; + _this.__parent = __parent; + return _this; + } + /** + * + * @return {boolean} + */ + SubMap$0.prototype.isEmpty = function () { + return this.isEmpty(); + }; + return SubMap$0; + }(TreeMap.SubMap.EntrySet)); + SubMap.SubMap$0 = SubMap$0; + SubMap$0["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + })(SubMap = TreeMap.SubMap || (TreeMap.SubMap = {})); + var SubMapType = /** @class */ (function () { + function SubMapType() { + } + /** + * Returns true if this submap type uses a from-key. + * @return {boolean} + */ + SubMapType.prototype.fromKeyValid = function () { + return false; + }; + /** + * Returns true if this submap type uses a to-key. + * @return {boolean} + */ + SubMapType.prototype.toKeyValid = function () { + return false; + }; + return SubMapType; + }()); + TreeMap.SubMapType = SubMapType; + SubMapType["__class"] = "java.util.TreeMap.SubMapType"; + var SubMapTypeHead = /** @class */ (function (_super) { + __extends(SubMapTypeHead, _super); + function SubMapTypeHead() { + return _super.call(this) || this; + } + /** + * + * @return {boolean} + */ + SubMapTypeHead.prototype.toKeyValid = function () { + return true; + }; + return SubMapTypeHead; + }(TreeMap.SubMapType)); + TreeMap.SubMapTypeHead = SubMapTypeHead; + SubMapTypeHead["__class"] = "java.util.TreeMap.SubMapTypeHead"; + var SubMapTypeRange = /** @class */ (function (_super) { + __extends(SubMapTypeRange, _super); + function SubMapTypeRange() { + return _super.call(this) || this; + } + /** + * + * @return {boolean} + */ + SubMapTypeRange.prototype.fromKeyValid = function () { + return true; + }; + /** + * + * @return {boolean} + */ + SubMapTypeRange.prototype.toKeyValid = function () { + return true; + }; + return SubMapTypeRange; + }(TreeMap.SubMapType)); + TreeMap.SubMapTypeRange = SubMapTypeRange; + SubMapTypeRange["__class"] = "java.util.TreeMap.SubMapTypeRange"; + var SubMapTypeTail = /** @class */ (function (_super) { + __extends(SubMapTypeTail, _super); + function SubMapTypeTail() { + return _super.call(this) || this; + } + /** + * + * @return {boolean} + */ + SubMapTypeTail.prototype.fromKeyValid = function () { + return true; + }; + return SubMapTypeTail; + }(TreeMap.SubMapType)); + TreeMap.SubMapTypeTail = SubMapTypeTail; + SubMapTypeTail["__class"] = "java.util.TreeMap.SubMapTypeTail"; + })(TreeMap = util.TreeMap || (util.TreeMap = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var stream; + (function (stream) { + var Collectors = /** @class */ (function () { + function Collectors() { + } + Collectors.throwingMerger = function () { + return function (u, v) { + throw new java.lang.IllegalStateException(javaemul.internal.StringHelper.format("Duplicate key %s", u)); + }; + }; + Collectors.CH_ID_$LI$ = function () { if (Collectors.CH_ID == null) { + Collectors.CH_ID = java.util.Collections.unmodifiableSet(java.util.Collections.singleton(java.util.stream.Collector.Characteristics.IDENTITY_FINISH)); + } return Collectors.CH_ID; }; + ; + Collectors.CH_NOID_$LI$ = function () { if (Collectors.CH_NOID == null) { + Collectors.CH_NOID = java.util.Collections.emptySet(); + } return Collectors.CH_NOID; }; + ; + Collectors.toList = function () { + return (new Collectors.CollectorImpl(function () { return new java.util.ArrayList(); }, function (l, i) { return l.add(i); }, function (left, right) { + left.addAll$java_util_Collection(right); + return left; + })); + }; + Collectors.toSet = function () { + return (new Collectors.CollectorImpl(function () { return new java.util.HashSet(); }, function (s, i) { return s.add(i); }, function (left, right) { + left.addAll(right); + return left; + })); + }; + Collectors.toMap$java_util_function_Function$java_util_function_Function = function (keyMapper, valueMapper) { + return Collectors.toMap$java_util_function_Function$java_util_function_Function$java_util_function_BinaryOperator$java_util_function_Supplier((keyMapper), (valueMapper), (Collectors.throwingMerger()), function () { return new java.util.HashMap(); }); + }; + Collectors.toMap$java_util_function_Function$java_util_function_Function$java_util_function_BinaryOperator = function (keyMapper, valueMapper, mergeFunction) { + return Collectors.toMap$java_util_function_Function$java_util_function_Function$java_util_function_BinaryOperator$java_util_function_Supplier((keyMapper), (valueMapper), (mergeFunction), function () { return new java.util.HashMap(); }); + }; + Collectors.toMap$java_util_function_Function$java_util_function_Function$java_util_function_BinaryOperator$java_util_function_Supplier = function (keyMapper, valueMapper, mergeFunction, mapSupplier) { + var accumulator = function (map, element) { return map.merge((function (target) { return (typeof target === 'function') ? target(element) : target.apply(element); })(keyMapper), (function (target) { return (typeof target === 'function') ? target(element) : target.apply(element); })(valueMapper), (mergeFunction)); }; + return (new Collectors.CollectorImpl((mapSupplier), (accumulator), (Collectors.mapMerger((mergeFunction))))); + }; + Collectors.toMap = function (keyMapper, valueMapper, mergeFunction, mapSupplier) { + if (((typeof keyMapper === 'function' && keyMapper.length === 1) || keyMapper === null) && ((typeof valueMapper === 'function' && valueMapper.length === 1) || valueMapper === null) && ((typeof mergeFunction === 'function' && mergeFunction.length === 2) || mergeFunction === null) && ((typeof mapSupplier === 'function' && mapSupplier.length === 0) || mapSupplier === null)) { + return java.util.stream.Collectors.toMap$java_util_function_Function$java_util_function_Function$java_util_function_BinaryOperator$java_util_function_Supplier(keyMapper, valueMapper, mergeFunction, mapSupplier); + } + else if (((typeof keyMapper === 'function' && keyMapper.length === 1) || keyMapper === null) && ((typeof valueMapper === 'function' && valueMapper.length === 1) || valueMapper === null) && ((typeof mergeFunction === 'function' && mergeFunction.length === 2) || mergeFunction === null) && mapSupplier === undefined) { + return java.util.stream.Collectors.toMap$java_util_function_Function$java_util_function_Function$java_util_function_BinaryOperator(keyMapper, valueMapper, mergeFunction); + } + else if (((typeof keyMapper === 'function' && keyMapper.length === 1) || keyMapper === null) && ((typeof valueMapper === 'function' && valueMapper.length === 1) || valueMapper === null) && mergeFunction === undefined && mapSupplier === undefined) { + return java.util.stream.Collectors.toMap$java_util_function_Function$java_util_function_Function(keyMapper, valueMapper); + } + else + throw new Error('invalid overload'); + }; + Collectors.mapMerger = function (mergeFunction) { + return function (m1, m2) { + for (var index197 = m2.entrySet().iterator(); index197.hasNext();) { + var e = index197.next(); + m1.merge(e.getKey(), e.getValue(), (mergeFunction)); + } + return m1; + }; + }; + Collectors.joining$ = function () { + return (new Collectors.CollectorImpl(function () { return new java.lang.StringBuilder(); }, function (instance$StringBuilder, x) { return instance$StringBuilder.append(x); }, function (r1, r2) { + r1.append$java_lang_CharSequence(r2); + return r1; + })); + }; + Collectors.joining$java_lang_CharSequence = function (delimiter) { + return Collectors.joining$java_lang_CharSequence$java_lang_CharSequence$java_lang_CharSequence(delimiter, "", ""); + }; + Collectors.joining$java_lang_CharSequence$java_lang_CharSequence$java_lang_CharSequence = function (delimiter, prefix, suffix) { + return (new Collectors.CollectorImpl(function () { return new java.util.StringJoiner(delimiter, prefix, suffix); }, function (instance$StringJoiner, newElement) { return instance$StringJoiner.add(newElement); }, function (instance$StringJoiner, other) { return instance$StringJoiner.merge(other); })); + }; + /** + * Returns a {@code Collector} that concatenates the input elements, separated + * by the specified delimiter, with the specified prefix and suffix, in + * encounter order. + * + * @param {*} delimiter + * the delimiter to be used between each element + * @param {*} prefix + * the sequence of characters to be used at the beginning of the + * joined result + * @param {*} suffix + * the sequence of characters to be used at the end of the joined + * result + * @return {*} A {@code Collector} which concatenates CharSequence elements, + * separated by the specified delimiter, in encounter order + */ + Collectors.joining = function (delimiter, prefix, suffix) { + if (((delimiter != null && (delimiter["__interfaces"] != null && delimiter["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || delimiter.constructor != null && delimiter.constructor["__interfaces"] != null && delimiter.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof delimiter === "string")) || delimiter === null) && ((prefix != null && (prefix["__interfaces"] != null && prefix["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || prefix.constructor != null && prefix.constructor["__interfaces"] != null && prefix.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof prefix === "string")) || prefix === null) && ((suffix != null && (suffix["__interfaces"] != null && suffix["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || suffix.constructor != null && suffix.constructor["__interfaces"] != null && suffix.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof suffix === "string")) || suffix === null)) { + return java.util.stream.Collectors.joining$java_lang_CharSequence$java_lang_CharSequence$java_lang_CharSequence(delimiter, prefix, suffix); + } + else if (((delimiter != null && (delimiter["__interfaces"] != null && delimiter["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || delimiter.constructor != null && delimiter.constructor["__interfaces"] != null && delimiter.constructor["__interfaces"].indexOf("java.lang.CharSequence") >= 0 || typeof delimiter === "string")) || delimiter === null) && prefix === undefined && suffix === undefined) { + return java.util.stream.Collectors.joining$java_lang_CharSequence(delimiter); + } + else if (delimiter === undefined && prefix === undefined && suffix === undefined) { + return java.util.stream.Collectors.joining$(); + } + else + throw new Error('invalid overload'); + }; + Collectors.groupingBy$java_util_function_Function$java_util_stream_Collector = function (classifier, downstream) { + return Collectors.groupingBy$java_util_function_Function$java_util_function_Supplier$java_util_stream_Collector((classifier), function () { return new java.util.HashMap(); }, downstream); + }; + Collectors.groupingBy$java_util_function_Function$java_util_function_Supplier$java_util_stream_Collector = function (classifier, mapFactory, downstream) { + var downstreamSupplier = (downstream.supplier()); + var downstreamAccumulator = (downstream.accumulator()); + var accumulator = (function (downstreamAccumulator) { + return function (m, t) { + var key = (java.util.Objects.requireNonNull((function (target) { return (typeof target === 'function') ? target(t) : target.apply(t); })(classifier), "element cannot be mapped to a null key")); + var container = m.computeIfAbsent(key, function (k) { return (function (target) { return (typeof target === 'function') ? target() : target.get(); })(downstreamSupplier); }); + (function (target) { return (typeof target === 'function') ? target(container, t) : target.accept(container, t); })(downstreamAccumulator); + }; + })(downstreamAccumulator); + var merger = (Collectors.mapMerger((downstream.combiner()))); + var mangledFactory = (mapFactory); + if (downstream.characteristics().contains(java.util.stream.Collector.Characteristics.IDENTITY_FINISH)) { + return (new Collectors.CollectorImpl((mangledFactory), (accumulator), (merger), Collectors.CH_ID_$LI$())); + } + else { + var downstreamFinisher_1 = (downstream.finisher()); + var finisher = function (intermediate) { + intermediate.replaceAll(function (k, v) { return (function (target) { return (typeof target === 'function') ? target(v) : target.apply(v); })(downstreamFinisher_1); }); + var castResult = intermediate; + return castResult; + }; + return (new Collectors.CollectorImpl((mangledFactory), (accumulator), (merger), (finisher), Collectors.CH_NOID_$LI$())); + } + }; + Collectors.groupingBy = function (classifier, mapFactory, downstream) { + if (((typeof classifier === 'function' && classifier.length === 1) || classifier === null) && ((typeof mapFactory === 'function' && mapFactory.length === 0) || mapFactory === null) && ((downstream != null && (downstream["__interfaces"] != null && downstream["__interfaces"].indexOf("java.util.stream.Collector") >= 0 || downstream.constructor != null && downstream.constructor["__interfaces"] != null && downstream.constructor["__interfaces"].indexOf("java.util.stream.Collector") >= 0)) || downstream === null)) { + return java.util.stream.Collectors.groupingBy$java_util_function_Function$java_util_function_Supplier$java_util_stream_Collector(classifier, mapFactory, downstream); + } + else if (((typeof classifier === 'function' && classifier.length === 1) || classifier === null) && ((mapFactory != null && (mapFactory["__interfaces"] != null && mapFactory["__interfaces"].indexOf("java.util.stream.Collector") >= 0 || mapFactory.constructor != null && mapFactory.constructor["__interfaces"] != null && mapFactory.constructor["__interfaces"].indexOf("java.util.stream.Collector") >= 0)) || mapFactory === null) && downstream === undefined) { + return java.util.stream.Collectors.groupingBy$java_util_function_Function$java_util_stream_Collector(classifier, mapFactory); + } + else + throw new Error('invalid overload'); + }; + Collectors.mapping = function (mapper, downstream) { + var downstreamAccumulator = (downstream.accumulator()); + return (new Collectors.CollectorImpl((downstream.supplier()), (function (downstreamAccumulator) { + return function (r, t) { return (function (target) { return (typeof target === 'function') ? target(r, (function (target) { return (typeof target === 'function') ? target(t) : target.apply(t); })(mapper)) : target.accept(r, (function (target) { return (typeof target === 'function') ? target(t) : target.apply(t); })(mapper)); })(downstreamAccumulator); }; + })(downstreamAccumulator), (downstream.combiner()), (downstream.finisher()), downstream.characteristics())); + }; + Collectors.reducing$java_lang_Object$java_util_function_BinaryOperator = function (identity, op) { + return (new Collectors.CollectorImpl((Collectors.boxSupplier(identity)), function (a, t) { + a[0] = (function (target) { return (typeof target === 'function') ? target(a[0], t) : target.apply(a[0], t); })(op); + }, function (a, b) { + a[0] = (function (target) { return (typeof target === 'function') ? target(a[0], b[0]) : target.apply(a[0], b[0]); })(op); + return a; + }, function (a) { return a[0]; }, Collectors.CH_NOID_$LI$())); + }; + Collectors.reducing$java_lang_Object$java_util_function_Function$java_util_function_BinaryOperator = function (identity, mapper, op) { + return (new Collectors.CollectorImpl((Collectors.boxSupplier(identity)), function (a, t) { + a[0] = (function (target) { return (typeof target === 'function') ? target(a[0], (function (target) { return (typeof target === 'function') ? target(t) : target.apply(t); })(mapper)) : target.apply(a[0], (function (target) { return (typeof target === 'function') ? target(t) : target.apply(t); })(mapper)); })(op); + }, function (a, b) { + a[0] = (function (target) { return (typeof target === 'function') ? target(a[0], b[0]) : target.apply(a[0], b[0]); })(op); + return a; + }, function (a) { return a[0]; }, Collectors.CH_NOID_$LI$())); + }; + Collectors.reducing = function (identity, mapper, op) { + if (((identity != null) || identity === null) && ((typeof mapper === 'function' && mapper.length === 1) || mapper === null) && ((typeof op === 'function' && op.length === 2) || op === null)) { + return java.util.stream.Collectors.reducing$java_lang_Object$java_util_function_Function$java_util_function_BinaryOperator(identity, mapper, op); + } + else if (((identity != null) || identity === null) && ((typeof mapper === 'function' && mapper.length === 2) || mapper === null) && op === undefined) { + return java.util.stream.Collectors.reducing$java_lang_Object$java_util_function_BinaryOperator(identity, mapper); + } + else + throw new Error('invalid overload'); + }; + Collectors.boxSupplier = function (identity) { + return function () { return [identity]; }; + }; + return Collectors; + }()); + stream.Collectors = Collectors; + Collectors["__class"] = "java.util.stream.Collectors"; + (function (Collectors) { + var CollectorImpl = /** @class */ (function () { + function CollectorImpl(supplier, accumulator, combiner, finisher, characteristics) { + if (((typeof supplier === 'function' && supplier.length === 0) || supplier === null) && ((typeof accumulator === 'function' && accumulator.length === 2) || accumulator === null) && ((typeof combiner === 'function' && combiner.length === 2) || combiner === null) && ((typeof finisher === 'function' && finisher.length === 1) || finisher === null) && ((characteristics != null && (characteristics["__interfaces"] != null && characteristics["__interfaces"].indexOf("java.util.Set") >= 0 || characteristics.constructor != null && characteristics.constructor["__interfaces"] != null && characteristics.constructor["__interfaces"].indexOf("java.util.Set") >= 0)) || characteristics === null)) { + var __args = arguments; + if (this.__supplier === undefined) { + this.__supplier = null; + } + if (this.__accumulator === undefined) { + this.__accumulator = null; + } + if (this.__combiner === undefined) { + this.__combiner = null; + } + if (this.__characteristics === undefined) { + this.__characteristics = null; + } + if (this.__finisher === undefined) { + this.__finisher = null; + } + this.__supplier = (supplier); + this.__accumulator = (accumulator); + this.__combiner = (combiner); + this.__finisher = (finisher); + this.__characteristics = characteristics; + } + else if (((typeof supplier === 'function' && supplier.length === 0) || supplier === null) && ((typeof accumulator === 'function' && accumulator.length === 2) || accumulator === null) && ((typeof combiner === 'function' && combiner.length === 2) || combiner === null) && ((finisher != null && (finisher["__interfaces"] != null && finisher["__interfaces"].indexOf("java.util.Set") >= 0 || finisher.constructor != null && finisher.constructor["__interfaces"] != null && finisher.constructor["__interfaces"].indexOf("java.util.Set") >= 0)) || finisher === null) && characteristics === undefined) { + var __args = arguments; + var characteristics_1 = __args[3]; + { + var __args_44 = arguments; + var finisher_1 = CollectorImpl.castingIdentity(); + if (this.__supplier === undefined) { + this.__supplier = null; + } + if (this.__accumulator === undefined) { + this.__accumulator = null; + } + if (this.__combiner === undefined) { + this.__combiner = null; + } + if (this.__characteristics === undefined) { + this.__characteristics = null; + } + if (this.__finisher === undefined) { + this.__finisher = null; + } + this.__supplier = (supplier); + this.__accumulator = (accumulator); + this.__combiner = (combiner); + this.__finisher = (finisher_1); + this.__characteristics = characteristics_1; + } + if (this.__supplier === undefined) { + this.__supplier = null; + } + if (this.__accumulator === undefined) { + this.__accumulator = null; + } + if (this.__combiner === undefined) { + this.__combiner = null; + } + if (this.__characteristics === undefined) { + this.__characteristics = null; + } + if (this.__finisher === undefined) { + this.__finisher = null; + } + } + else if (((typeof supplier === 'function' && supplier.length === 0) || supplier === null) && ((typeof accumulator === 'function' && accumulator.length === 2) || accumulator === null) && ((typeof combiner === 'function' && combiner.length === 2) || combiner === null) && finisher === undefined && characteristics === undefined) { + var __args = arguments; + { + var __args_45 = arguments; + var finisher_2 = CollectorImpl.castingIdentity(); + var characteristics_2 = null; + if (this.__supplier === undefined) { + this.__supplier = null; + } + if (this.__accumulator === undefined) { + this.__accumulator = null; + } + if (this.__combiner === undefined) { + this.__combiner = null; + } + if (this.__characteristics === undefined) { + this.__characteristics = null; + } + if (this.__finisher === undefined) { + this.__finisher = null; + } + this.__supplier = (supplier); + this.__accumulator = (accumulator); + this.__combiner = (combiner); + this.__finisher = (finisher_2); + this.__characteristics = characteristics_2; + } + if (this.__supplier === undefined) { + this.__supplier = null; + } + if (this.__accumulator === undefined) { + this.__accumulator = null; + } + if (this.__combiner === undefined) { + this.__combiner = null; + } + if (this.__characteristics === undefined) { + this.__characteristics = null; + } + if (this.__finisher === undefined) { + this.__finisher = null; + } + } + else + throw new Error('invalid overload'); + } + CollectorImpl.castingIdentity = function () { + return function (i) { return i; }; + }; + /** + * + * @return {*} + */ + CollectorImpl.prototype.accumulator = function () { + return (this.__accumulator); + }; + /** + * + * @return {*} + */ + CollectorImpl.prototype.supplier = function () { + return (this.__supplier); + }; + /** + * + * @return {*} + */ + CollectorImpl.prototype.combiner = function () { + return (this.__combiner); + }; + /** + * + * @return {*} + */ + CollectorImpl.prototype.finisher = function () { + return (this.__finisher); + }; + /** + * + * @return {*} + */ + CollectorImpl.prototype.characteristics = function () { + return this.__characteristics; + }; + return CollectorImpl; + }()); + Collectors.CollectorImpl = CollectorImpl; + CollectorImpl["__class"] = "java.util.stream.Collectors.CollectorImpl"; + CollectorImpl["__interfaces"] = ["java.util.stream.Collector"]; + })(Collectors = stream.Collectors || (stream.Collectors = {})); + })(stream = util.stream || (util.stream = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + /** + * Hash table implementation of the Map interface with predictable iteration + * order. [Sun + * docs] + * + * @param + * key type. + * @param + * value type. + * @param {number} ignored + * @param {number} alsoIgnored + * @param {boolean} accessOrder + * @class + * @extends java.util.HashMap + */ + var LinkedHashMap = /** @class */ (function (_super) { + __extends(LinkedHashMap, _super); + function LinkedHashMap(ignored, alsoIgnored, accessOrder) { + var _this = this; + if (((typeof ignored === 'number') || ignored === null) && ((typeof alsoIgnored === 'number') || alsoIgnored === null) && ((typeof accessOrder === 'boolean') || accessOrder === null)) { + var __args = arguments; + _this = _super.call(this, ignored, alsoIgnored) || this; + if (_this.accessOrder === undefined) { + _this.accessOrder = false; + } + if (_this.head === undefined) { + _this.head = null; + } + if (_this.map === undefined) { + _this.map = null; + } + _this.head = new LinkedHashMap.ChainEntry(_this); + _this.map = (new java.util.HashMap()); + _this.accessOrder = accessOrder; + _this.resetChainEntries(); + } + else if (((typeof ignored === 'number') || ignored === null) && ((typeof alsoIgnored === 'number') || alsoIgnored === null) && accessOrder === undefined) { + var __args = arguments; + _this = _super.call(this, ignored, alsoIgnored) || this; + if (_this.accessOrder === undefined) { + _this.accessOrder = false; + } + if (_this.head === undefined) { + _this.head = null; + } + if (_this.map === undefined) { + _this.map = null; + } + _this.head = new LinkedHashMap.ChainEntry(_this); + _this.map = (new java.util.HashMap()); + _this.resetChainEntries(); + } + else if (((ignored != null && (ignored["__interfaces"] != null && ignored["__interfaces"].indexOf("java.util.Map") >= 0 || ignored.constructor != null && ignored.constructor["__interfaces"] != null && ignored.constructor["__interfaces"].indexOf("java.util.Map") >= 0)) || ignored === null) && alsoIgnored === undefined && accessOrder === undefined) { + var __args = arguments; + var toBeCopied = __args[0]; + _this = _super.call(this) || this; + if (_this.accessOrder === undefined) { + _this.accessOrder = false; + } + if (_this.head === undefined) { + _this.head = null; + } + if (_this.map === undefined) { + _this.map = null; + } + _this.head = new LinkedHashMap.ChainEntry(_this); + _this.map = (new java.util.HashMap()); + _this.resetChainEntries(); + _this.putAll(toBeCopied); + } + else if (((typeof ignored === 'number') || ignored === null) && alsoIgnored === undefined && accessOrder === undefined) { + var __args = arguments; + { + var __args_46 = arguments; + var alsoIgnored_2 = 0; + _this = _super.call(this, ignored, alsoIgnored_2) || this; + if (_this.accessOrder === undefined) { + _this.accessOrder = false; + } + if (_this.head === undefined) { + _this.head = null; + } + if (_this.map === undefined) { + _this.map = null; + } + _this.head = new LinkedHashMap.ChainEntry(_this); + _this.map = (new java.util.HashMap()); + _this.resetChainEntries(); + } + if (_this.accessOrder === undefined) { + _this.accessOrder = false; + } + if (_this.head === undefined) { + _this.head = null; + } + if (_this.map === undefined) { + _this.map = null; + } + } + else if (ignored === undefined && alsoIgnored === undefined && accessOrder === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + if (_this.accessOrder === undefined) { + _this.accessOrder = false; + } + if (_this.head === undefined) { + _this.head = null; + } + if (_this.map === undefined) { + _this.map = null; + } + _this.head = new LinkedHashMap.ChainEntry(_this); + _this.map = (new java.util.HashMap()); + _this.resetChainEntries(); + } + else + throw new Error('invalid overload'); + return _this; + } + /* Default method injected from java.util.Map */ + LinkedHashMap.prototype.getOrDefault = function (key, defaultValue) { + var v; + return (((v = this.get(key)) != null) || this.containsKey(key)) ? v : defaultValue; + }; + /* Default method injected from java.util.Map */ + LinkedHashMap.prototype.putIfAbsent = function (key, value) { + var v = this.get(key); + if (v == null) { + v = this.put(key, value); + } + return v; + }; + /* Default method injected from java.util.Map */ + LinkedHashMap.prototype.merge = function (key, value, map) { + var old = this.get(key); + var next = (old == null) ? value : (function (target) { return (typeof target === 'function') ? target(old, value) : target.apply(old, value); })(map); + if (next == null) { + this.remove(key); + } + else { + this.put(key, next); + } + return next; + }; + /* Default method injected from java.util.Map */ + LinkedHashMap.prototype.computeIfAbsent = function (key, mappingFunction) { + var result; + if ((result = this.get(key)) == null) { + result = (function (target) { return (typeof target === 'function') ? target(key) : target.apply(key); })(mappingFunction); + if (result != null) + this.put(key, result); + } + return result; + }; + /* Default method injected from java.util.Map */ + LinkedHashMap.prototype.replaceAll = function (__function) { + java.util.Objects.requireNonNull((__function)); + var _loop_38 = function (index198) { + var entry = index198.next(); + { + var k_6; + var v_6; + try { + k_6 = entry.getKey(); + v_6 = entry.getValue(); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + v_6 = (function (target) { return (typeof target === 'function') ? target(k_6, v_6) : target.apply(k_6, v_6); })(__function); + try { + entry.setValue(v_6); + } + catch (ise) { + throw new java.lang.RuntimeException(ise); + } + ; + } + }; + for (var index198 = this.entrySet().iterator(); index198.hasNext();) { + _loop_38(index198); + } + }; + /** + * + */ + LinkedHashMap.prototype.clear = function () { + this.map.clear(); + this.resetChainEntries(); + }; + LinkedHashMap.prototype.resetChainEntries = function () { + this.head.prev = this.head; + this.head.next = this.head; + }; + /** + * + * @return {*} + */ + LinkedHashMap.prototype.clone = function () { + return (new LinkedHashMap(this)); + }; + /** + * + * @param {*} key + * @return {boolean} + */ + LinkedHashMap.prototype.containsKey = function (key) { + return this.map.containsKey(key); + }; + /** + * + * @param {*} value + * @return {boolean} + */ + LinkedHashMap.prototype.containsValue = function (value) { + var node = this.head.next; + while ((node !== this.head)) { + { + if (java.util.Objects.equals(node.getValue(), value)) { + return true; + } + node = node.next; + } + } + ; + return false; + }; + /** + * + * @return {*} + */ + LinkedHashMap.prototype.entrySet = function () { + return new LinkedHashMap.__java_util_LinkedHashMap_EntrySet(this); + }; + /** + * + * @param {*} key + * @return {*} + */ + LinkedHashMap.prototype.get = function (key) { + var entry = this.map.get(key); + if (entry != null) { + this.recordAccess(entry); + return entry.getValue(); + } + return null; + }; + /** + * + * @param {*} key + * @param {*} value + * @return {*} + */ + LinkedHashMap.prototype.put = function (key, value) { + var old = this.map.get(key); + if (old == null) { + var newEntry = new LinkedHashMap.ChainEntry(this, key, value); + this.map.put(key, newEntry); + newEntry.addToEnd(); + var eldest = this.head.next; + if (this.removeEldestEntry(eldest)) { + eldest.remove(); + this.map.remove(eldest.getKey()); + } + return null; + } + else { + var oldValue = old.setValue(value); + this.recordAccess(old); + return oldValue; + } + }; + /** + * + * @param {*} key + * @return {*} + */ + LinkedHashMap.prototype.remove = function (key) { + var entry = this.map.remove(key); + if (entry != null) { + entry.remove(); + return entry.getValue(); + } + return null; + }; + /** + * + * @return {number} + */ + LinkedHashMap.prototype.size = function () { + return this.map.size(); + }; + LinkedHashMap.prototype.removeEldestEntry = function (eldest) { + return false; + }; + LinkedHashMap.prototype.recordAccess = function (entry) { + if (this.accessOrder) { + entry.remove(); + entry.addToEnd(); + } + }; + return LinkedHashMap; + }(java.util.HashMap)); + util.LinkedHashMap = LinkedHashMap; + LinkedHashMap["__class"] = "java.util.LinkedHashMap"; + LinkedHashMap["__interfaces"] = ["java.lang.Cloneable", "java.util.Map", "java.io.Serializable"]; + (function (LinkedHashMap) { + /** + * The entry we use includes next/prev pointers for a doubly-linked circular + * list with a head node. This reduces the special cases we have to deal + * with in the list operations. + * + * Note that we duplicate the key from the underlying hash map so we can + * find the eldest entry. The alternative would have been to modify HashMap + * so more of the code was directly usable here, but this would have added + * some overhead to HashMap, or to reimplement most of the HashMap code here + * with small modifications. Paying a small storage cost only if you use + * LinkedHashMap and minimizing code size seemed like a better tradeoff + * @param {*} key + * @param {*} value + * @class + * @extends java.util.AbstractMap.SimpleEntry + */ + var ChainEntry = /** @class */ (function (_super) { + __extends(ChainEntry, _super); + function ChainEntry(__parent, key, value) { + if (key === void 0) { key = null; } + if (value === void 0) { value = null; } + var _this = _super.call(this, key, value) || this; + _this.__parent = __parent; + if (_this.next === undefined) { + _this.next = null; + } + if (_this.prev === undefined) { + _this.prev = null; + } + return _this; + } + /** + * Add this node to the end of the chain. + */ + ChainEntry.prototype.addToEnd = function () { + var tail = this.__parent.head.prev; + this.prev = tail; + this.next = this.__parent.head; + tail.next = this.__parent.head.prev = this; + }; + /** + * Remove this node from any list it may be a part of. + */ + ChainEntry.prototype.remove = function () { + this.next.prev = this.prev; + this.prev.next = this.next; + this.next = this.prev = null; + }; + return ChainEntry; + }(util.AbstractMap.SimpleEntry)); + LinkedHashMap.ChainEntry = ChainEntry; + ChainEntry["__class"] = "java.util.LinkedHashMap.ChainEntry"; + ChainEntry["__interfaces"] = ["java.util.Map.Entry"]; + var __java_util_LinkedHashMap_EntrySet = /** @class */ (function (_super) { + __extends(__java_util_LinkedHashMap_EntrySet, _super); + function __java_util_LinkedHashMap_EntrySet(__parent) { + var _this = _super.call(this) || this; + _this.__parent = __parent; + return _this; + } + /** + * + */ + __java_util_LinkedHashMap_EntrySet.prototype.clear = function () { + this.clear(); + }; + /** + * + * @param {*} o + * @return {boolean} + */ + __java_util_LinkedHashMap_EntrySet.prototype.contains = function (o) { + if (o != null && (o["__interfaces"] != null && o["__interfaces"].indexOf("java.util.Map.Entry") >= 0 || o.constructor != null && o.constructor["__interfaces"] != null && o.constructor["__interfaces"].indexOf("java.util.Map.Entry") >= 0)) { + return this.__parent.containsEntry(o); + } + return false; + }; + /** + * + * @return {*} + */ + __java_util_LinkedHashMap_EntrySet.prototype.iterator = function () { + return new __java_util_LinkedHashMap_EntrySet.EntryIterator(this); + }; + /** + * + * @param {*} entry + * @return {boolean} + */ + __java_util_LinkedHashMap_EntrySet.prototype.remove = function (entry) { + if (this.contains(entry)) { + var key = entry.getKey(); + this.remove(key); + return true; + } + return false; + }; + /** + * + * @return {number} + */ + __java_util_LinkedHashMap_EntrySet.prototype.size = function () { + return this.size(); + }; + return __java_util_LinkedHashMap_EntrySet; + }(java.util.AbstractSet)); + LinkedHashMap.__java_util_LinkedHashMap_EntrySet = __java_util_LinkedHashMap_EntrySet; + __java_util_LinkedHashMap_EntrySet["__class"] = "java.util.LinkedHashMap.EntrySet"; + __java_util_LinkedHashMap_EntrySet["__interfaces"] = ["java.util.Collection", "java.util.Set", "java.lang.Iterable"]; + (function (__java_util_LinkedHashMap_EntrySet) { + var EntryIterator = /** @class */ (function () { + function EntryIterator(__parent) { + this.__parent = __parent; + if (this.last === undefined) { + this.last = null; + } + if (this.__next === undefined) { + this.__next = null; + } + this.__next = __parent.__parent.head.next; + java.util.ConcurrentModificationDetector.recordLastKnownStructure(__parent.__parent.map, this); + } + /* Default method injected from java.util.Iterator */ + EntryIterator.prototype.forEachRemaining = function (consumer) { + var _this = this; + javaemul.internal.InternalPreconditions.checkNotNull((consumer)); + while ((this.hasNext())) { + { + (function (target) { return (typeof target === 'function') ? target(_this.next()) : target.accept(_this.next()); })(consumer); + } + } + ; + }; + /** + * + * @return {boolean} + */ + EntryIterator.prototype.hasNext = function () { + return this.__next !== this.__parent.__parent.head; + }; + /** + * + * @return {*} + */ + EntryIterator.prototype.next = function () { + java.util.ConcurrentModificationDetector.checkStructuralChange(this.__parent.__parent.map, this); + javaemul.internal.InternalPreconditions.checkCriticalElement(this.hasNext()); + this.last = this.__next; + this.__next = this.__next.next; + return this.last; + }; + /** + * + */ + EntryIterator.prototype.remove = function () { + javaemul.internal.InternalPreconditions.checkState(this.last != null); + java.util.ConcurrentModificationDetector.checkStructuralChange(this.__parent.__parent.map, this); + this.last.remove(); + this.__parent.__parent.map.remove(this.last.getKey()); + java.util.ConcurrentModificationDetector.recordLastKnownStructure(this.__parent.__parent.map, this); + this.last = null; + }; + return EntryIterator; + }()); + __java_util_LinkedHashMap_EntrySet.EntryIterator = EntryIterator; + EntryIterator["__class"] = "java.util.LinkedHashMap.EntrySet.EntryIterator"; + EntryIterator["__interfaces"] = ["java.util.Iterator"]; + })(__java_util_LinkedHashMap_EntrySet = LinkedHashMap.__java_util_LinkedHashMap_EntrySet || (LinkedHashMap.__java_util_LinkedHashMap_EntrySet = {})); + })(LinkedHashMap = util.LinkedHashMap || (util.LinkedHashMap = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var ConcurrentHashMap = /** @class */ (function (_super) { + __extends(ConcurrentHashMap, _super); + function ConcurrentHashMap() { + return _super.call(this) || this; + } + return ConcurrentHashMap; + }(java.util.HashMap)); + util.ConcurrentHashMap = ConcurrentHashMap; + ConcurrentHashMap["__class"] = "java.util.ConcurrentHashMap"; + ConcurrentHashMap["__interfaces"] = ["java.lang.Cloneable", "java.util.Map", "java.io.Serializable"]; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var Hashtable = /** @class */ (function (_super) { + __extends(Hashtable, _super); + function Hashtable(ignored, alsoIgnored) { + var _this = this; + if (((typeof ignored === 'number') || ignored === null) && ((typeof alsoIgnored === 'number') || alsoIgnored === null)) { + var __args = arguments; + _this = _super.call(this, ignored, alsoIgnored) || this; + } + else if (((ignored != null && (ignored["__interfaces"] != null && ignored["__interfaces"].indexOf("java.util.Map") >= 0 || ignored.constructor != null && ignored.constructor["__interfaces"] != null && ignored.constructor["__interfaces"].indexOf("java.util.Map") >= 0)) || ignored === null) && alsoIgnored === undefined) { + var __args = arguments; + var toBeCopied = __args[0]; + _this = _super.call(this, toBeCopied) || this; + } + else if (((typeof ignored === 'number') || ignored === null) && alsoIgnored === undefined) { + var __args = arguments; + _this = _super.call(this, ignored) || this; + } + else if (ignored === undefined && alsoIgnored === undefined) { + var __args = arguments; + _this = _super.call(this) || this; + } + else + throw new Error('invalid overload'); + return _this; + } + Hashtable.prototype.keys = function () { + var it = this.keySet().iterator(); + return new Hashtable.Hashtable$0(this, it); + }; + Hashtable.prototype.elements = function () { + var it = this.values().iterator(); + return new Hashtable.Hashtable$1(this, it); + }; + Hashtable.serialVersionUID = 1; + return Hashtable; + }(java.util.HashMap)); + util.Hashtable = Hashtable; + Hashtable["__class"] = "java.util.Hashtable"; + Hashtable["__interfaces"] = ["java.lang.Cloneable", "java.util.Map", "java.util.Dictionary", "java.io.Serializable"]; + (function (Hashtable) { + var Hashtable$0 = /** @class */ (function () { + function Hashtable$0(__parent, it) { + this.it = it; + this.__parent = __parent; + } + /** + * + * @return {boolean} + */ + Hashtable$0.prototype.hasMoreElements = function () { + return this.it.hasNext(); + }; + /** + * + * @return {*} + */ + Hashtable$0.prototype.nextElement = function () { + return this.it.next(); + }; + return Hashtable$0; + }()); + Hashtable.Hashtable$0 = Hashtable$0; + Hashtable$0["__interfaces"] = ["java.util.Enumeration"]; + var Hashtable$1 = /** @class */ (function () { + function Hashtable$1(__parent, it) { + this.it = it; + this.__parent = __parent; + } + /** + * + * @return {boolean} + */ + Hashtable$1.prototype.hasMoreElements = function () { + return this.it.hasNext(); + }; + /** + * + * @return {*} + */ + Hashtable$1.prototype.nextElement = function () { + return this.it.next(); + }; + return Hashtable$1; + }()); + Hashtable.Hashtable$1 = Hashtable$1; + Hashtable$1["__interfaces"] = ["java.util.Enumeration"]; + })(Hashtable = util.Hashtable || (util.Hashtable = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var lang; + (function (lang) { + var System = /** @class */ (function () { + function System() { + } + System.__static_initialize = function () { if (!System.__static_initialized) { + System.__static_initialized = true; + System.__static_initializer_0(); + } }; + System.ENVIRONMENT_IS_WEB_$LI$ = function () { System.__static_initialize(); if (System.ENVIRONMENT_IS_WEB == null) { + System.ENVIRONMENT_IS_WEB = java.util.Objects.equals(typeof window, "object"); + } return System.ENVIRONMENT_IS_WEB; }; + ; + System.ENVIRONMENT_IS_WORKER_$LI$ = function () { System.__static_initialize(); if (System.ENVIRONMENT_IS_WORKER == null) { + System.ENVIRONMENT_IS_WORKER = java.util.Objects.equals(typeof importScripts, "function"); + } return System.ENVIRONMENT_IS_WORKER; }; + ; + System.ENVIRONMENT_IS_NODE_$LI$ = function () { System.__static_initialize(); if (System.ENVIRONMENT_IS_NODE == null) { + System.ENVIRONMENT_IS_NODE = !System.ENVIRONMENT_IS_WEB_$LI$() && !System.ENVIRONMENT_IS_WORKER_$LI$() && java.util.Objects.equals((eval("typeof process")), "object") && java.util.Objects.equals((eval("typeof require")), "function"); + } return System.ENVIRONMENT_IS_NODE; }; + ; + System.ENVIRONMENT_IS_SHELL_$LI$ = function () { System.__static_initialize(); if (System.ENVIRONMENT_IS_SHELL == null) { + System.ENVIRONMENT_IS_SHELL = !System.ENVIRONMENT_IS_WEB_$LI$() && !System.ENVIRONMENT_IS_WORKER_$LI$() && !System.ENVIRONMENT_IS_NODE_$LI$(); + } return System.ENVIRONMENT_IS_SHELL; }; + ; + System.propertyMap_$LI$ = function () { System.__static_initialize(); return System.propertyMap; }; + ; + System.err_$LI$ = function () { System.__static_initialize(); return System.err; }; + ; + System.out_$LI$ = function () { System.__static_initialize(); return System.out; }; + ; + System.in_$LI$ = function () { System.__static_initialize(); return System["in"]; }; + ; + System.__static_initializer_0 = function () { + System.propertyMap = (new java.util.HashMap()); + System.propertyMap_$LI$().put("java.vendor", "JSweet"); + System.propertyMap_$LI$().put("java.vendor.url", "http://www.jsweet.org"); + System.propertyMap_$LI$().put("java.version", "jsweet"); + var tmpDir = ""; + var lineSeparator = "\n"; + var fileSeparator = "/"; + var userHome = ""; + var userName = ""; + var osArch = ""; + if (System.ENVIRONMENT_IS_WEB_$LI$() || System.ENVIRONMENT_IS_WORKER_$LI$()) { + System.propertyMap_$LI$().put("os.name", System.ENVIRONMENT_IS_WEB_$LI$() ? "WEB" : "WEB-WORKER"); + System.propertyMap_$LI$().put("os.version", navigator.userAgent); + var pathname = document.location.pathname; + System.propertyMap_$LI$().put("user.dir", pathname.substring(0, pathname.lastIndexOf("/"))); + } + else if (System.ENVIRONMENT_IS_NODE_$LI$()) { + var os = (eval("global.os || (global.os = require(\"os\"))")); + var path = (eval("global.path || (global.path = require(\"path\"))")); + System.propertyMap_$LI$().put("os.name", "NODE"); + System.propertyMap_$LI$().put("os.version", (eval("process.version"))); + System.propertyMap_$LI$().put("user.dir", (eval("process.cwd()"))); + tmpDir = ((os["tmpdir"])()); + lineSeparator = (os["EOL"]); + fileSeparator = (path["sep"]); + userHome = ((os["homedir"])()); + userName = (((os["userInfo"])())["username"]); + osArch = ((os["arch"])()); + } + else { + console = new Object(); + console["info"] = print; + console["error"] = java.util.Objects.equals((eval("typeof printErr")), "undefined") ? print : eval("printErr"); + System.propertyMap_$LI$().put("os.name", "SHELL"); + var runnerName = "UNKNOWN"; + var userDir = "."; + if (java.util.Objects.equals((eval("typeof environment")), "object")) { + runnerName = "RHINO"; + userDir = (eval("environment[\"user.dir\"]")); + lineSeparator = (eval("environment[\"line.separator\"]")); + fileSeparator = (eval("environment[\"file.separator\"]")); + userHome = (eval("environment[\"user.name\"]")); + userName = (eval("environment[\"user.home\"]")); + osArch = (eval("environment[\"os.arch\"]")); + } + else if (java.util.Objects.equals((eval("typeof jscOptions")), "function")) { + runnerName = "JSC"; + } + System.propertyMap_$LI$().put("os.version", runnerName); + System.propertyMap_$LI$().put("user.dir", userDir); + } + System.propertyMap_$LI$().put("java.io.tmpdir", tmpDir); + System.propertyMap_$LI$().put("line.separator", lineSeparator); + System.propertyMap_$LI$().put("file.separator", fileSeparator); + System.propertyMap_$LI$().put("user.home", userHome); + System.propertyMap_$LI$().put("user.name", userName); + System.propertyMap_$LI$().put("os.arch", osArch); + System.out = new java.io.PrintStream(new System.System$0()); + System.err = new java.io.PrintStream(new System.System$1()); + System["in"] = new System.System$2(); + }; + System.arraycopy = function (src, srcOfs, dest, destOfs, len) { + javaemul.internal.InternalPreconditions.checkNotNull(src, "src"); + javaemul.internal.InternalPreconditions.checkNotNull(dest, "dest"); + var srclen = javaemul.internal.ArrayHelper.getLength(src); + var destlen = javaemul.internal.ArrayHelper.getLength(dest); + if (srcOfs < 0 || destOfs < 0 || len < 0 || srcOfs + len > srclen || destOfs + len > destlen) { + throw new java.lang.IndexOutOfBoundsException(); + } + if (len > 0) { + javaemul.internal.ArrayHelper.copy$java_lang_Object$int$java_lang_Object$int$int(src, srcOfs, dest, destOfs, len); + } + }; + System.currentTimeMillis = function () { + return (function (n) { return n < 0 ? Math.ceil(n) : Math.floor(n); })(javaemul.internal.DateUtil.now()); + }; + System.gc = function () { + (function () { + var gcFun = (eval("this.gc")); + if (java.util.Objects.equals(typeof gcFun, "function")) { + gcFun(); + } + }).apply(null); + }; + System.getProperty$java_lang_String = function (key) { + return System.propertyMap_$LI$() == null ? null : System.propertyMap_$LI$().get(key); + }; + System.getProperty$java_lang_String$java_lang_String = function (key, def) { + var prop = System.getProperty$java_lang_String(key); + return prop == null ? def : prop; + }; + System.getProperty = function (key, def) { + if (((typeof key === 'string') || key === null) && ((typeof def === 'string') || def === null)) { + return java.lang.System.getProperty$java_lang_String$java_lang_String(key, def); + } + else if (((typeof key === 'string') || key === null) && def === undefined) { + return java.lang.System.getProperty$java_lang_String(key); + } + else + throw new Error('invalid overload'); + }; + System.identityHashCode = function (o) { + return javaemul.internal.HashCodes.getIdentityHashCode(o); + }; + System.setErr = function (err) { + java.lang.System.err = err; + }; + System.setOut = function (out) { + java.lang.System.out = out; + }; + System.lineSeparator = function () { + return System.getProperty$java_lang_String("line.separator"); + }; + System.exit = function (status) { + if (System.ENVIRONMENT_IS_NODE_$LI$()) { + eval("process.exit(" + status + ")"); + } + else if (System.ENVIRONMENT_IS_WEB_$LI$()) { + window.close(); + } + else if (System.ENVIRONMENT_IS_WORKER_$LI$()) { + self.close(); + } + else { + if (java.util.Objects.equals(typeof eval("quit"), "function")) { + eval("quit(" + status + ")"); + } + if (java.util.Objects.equals(typeof eval("exit"), "function")) { + eval("exit(" + status + ")"); + } + } + }; + System.__static_initialized = false; + return System; + }()); + lang.System = System; + System["__class"] = "java.lang.System"; + (function (System) { + var System$0 = /** @class */ (function (_super) { + __extends(System$0, _super); + function System$0() { + var _this = _super.call(this) || this; + _this.sep = java.lang.System.propertyMap_$LI$().get("line.separator"); + _this.toOut = ""; + return _this; + } + System$0.prototype.write = function (buffer, offset, count) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof offset === 'number') || offset === null) && ((typeof count === 'number') || count === null)) { + _super.prototype.write.call(this, buffer, offset, count); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && offset === undefined && count === undefined) { + return this.write$byte_A(buffer); + } + else if (((typeof buffer === 'number') || buffer === null) && offset === undefined && count === undefined) { + return this.write$int(buffer); + } + else + throw new Error('invalid overload'); + }; + System$0.prototype.write$int = function (i) { + this.toOut += String.fromCharCode(i); + if ( /* endsWith */(function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(this.toOut, this.sep)) { + this.flush(); + } + }; + /** + * + */ + System$0.prototype.flush = function () { + _super.prototype.flush.call(this); + if (!(this.toOut.length === 0)) { + if ( /* endsWith */(function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(this.toOut, this.sep)) { + this.toOut = this.toOut.substring(0, this.toOut.length - this.sep.length); + } + console.info(this.toOut); + this.toOut = ""; + } + }; + return System$0; + }(java.io.OutputStream)); + System.System$0 = System$0; + System$0["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable", "java.io.Flushable"]; + var System$1 = /** @class */ (function (_super) { + __extends(System$1, _super); + function System$1() { + var _this = _super.call(this) || this; + _this.sep = java.lang.System.propertyMap_$LI$().get("line.separator"); + _this.toOut = ""; + return _this; + } + System$1.prototype.write = function (buffer, offset, count) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof offset === 'number') || offset === null) && ((typeof count === 'number') || count === null)) { + _super.prototype.write.call(this, buffer, offset, count); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && offset === undefined && count === undefined) { + return this.write$byte_A(buffer); + } + else if (((typeof buffer === 'number') || buffer === null) && offset === undefined && count === undefined) { + return this.write$int(buffer); + } + else + throw new Error('invalid overload'); + }; + System$1.prototype.write$int = function (i) { + this.toOut += String.fromCharCode(i); + if ( /* endsWith */(function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(this.toOut, this.sep)) { + this.flush(); + } + }; + /** + * + */ + System$1.prototype.flush = function () { + _super.prototype.flush.call(this); + if (!(this.toOut.length === 0)) { + if ( /* endsWith */(function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(this.toOut, this.sep)) { + this.toOut = this.toOut.substring(0, this.toOut.length - this.sep.length); + } + console.error(this.toOut); + this.toOut = ""; + } + }; + return System$1; + }(java.io.OutputStream)); + System.System$1 = System$1; + System$1["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable", "java.io.Flushable"]; + var System$2 = /** @class */ (function (_super) { + __extends(System$2, _super); + function System$2() { + var _this = _super.call(this) || this; + if (_this.readData === undefined) { + _this.readData = null; + } + _this.where = 0; + _this.sep = java.lang.System.propertyMap_$LI$().get("line.separator"); + _this.readerFunction = function () { + var result = null; + if (java.lang.System.ENVIRONMENT_IS_NODE_$LI$()) { + var fs = (eval("global.fs || (global.fs = require(\"fs\"))")); + var BUFSIZE = 256; + var buf = (new (eval("Buffer"))(BUFSIZE)); + var fd = (eval("process.stdin.fd")); + var usingDevice = false; + try { + fd = ((fs["openSync"])(("/dev/stdin"), ("r"))); + usingDevice = true; + } + catch (ignored) { + } + ; + var bytesRead = 0; + try { + bytesRead = ((fs["readSync"])((fd), buf, (0), (BUFSIZE), null)); + } + catch (e) { + if (e.toString().indexOf("EOF") === -1) + throw e; + } + ; + if (usingDevice) + (fs["closeSync"])((fd)); + if (bytesRead > 0) + result = buf.slice(0, bytesRead).toString(); + } + else if (java.lang.System.ENVIRONMENT_IS_WEB_$LI$() || java.lang.System.ENVIRONMENT_IS_WORKER_$LI$()) { + if (java.util.Objects.equals(typeof window["prompt"], "function")) { + result = window.prompt("Input: "); + if (result != null) { + result += _this.sep; + } + } + } + else if (java.util.Objects.equals(typeof eval("readline"), "function")) { + result = (eval("readline()")); + if (result != null) { + result += _this.sep; + } + } + return result; + }; + return _this; + } + System$2.prototype.read = function (buffer, byteOffset, byteCount) { + if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && ((typeof byteOffset === 'number') || byteOffset === null) && ((typeof byteCount === 'number') || byteCount === null)) { + return _super.prototype.read.call(this, buffer, byteOffset, byteCount); + } + else if (((buffer != null && buffer instanceof Array && (buffer.length == 0 || buffer[0] == null || (typeof buffer[0] === 'number'))) || buffer === null) && byteOffset === undefined && byteCount === undefined) { + return this.read$byte_A(buffer); + } + else if (buffer === undefined && byteOffset === undefined && byteCount === undefined) { + return this.read$(); + } + else + throw new Error('invalid overload'); + }; + System$2.prototype.read$ = function () { + if (this.readData == null) { + this.readData = /* toCharArray */ ((function (target) { return (typeof target === 'function') ? target() : target.get(); })(this.readerFunction)).split(''); + this.where = 0; + } + else { + ++this.where; + } + if (this.where === this.readData.length) { + this.readData = null; + this.where = 0; + return -1; + } + return (this.readData[this.where]).charCodeAt(0); + }; + return System$2; + }(java.io.InputStream)); + System.System$2 = System$2; + System$2["__interfaces"] = ["java.io.Closeable", "java.lang.AutoCloseable"]; + })(System = lang.System || (lang.System = {})); + })(lang = java.lang || (java.lang = {})); +})(java || (java = {})); +(function (javaemul) { + var internal; + (function (internal) { + /** + * A utility class that provides utility functions to do precondition checks inside GWT-SDK. + * @class + */ + var InternalPreconditions = /** @class */ (function () { + function InternalPreconditions() { + } + InternalPreconditions.CHECKED_MODE_$LI$ = function () { if (InternalPreconditions.CHECKED_MODE == null) { + InternalPreconditions.CHECKED_MODE = java.lang.System.getProperty("jre.checkedMode", "ENABLED") === ("ENABLED"); + } return InternalPreconditions.CHECKED_MODE; }; + ; + InternalPreconditions.TYPE_CHECK_$LI$ = function () { if (InternalPreconditions.TYPE_CHECK == null) { + InternalPreconditions.TYPE_CHECK = java.lang.System.getProperty("jre.checks.type", "ENABLED") === ("ENABLED"); + } return InternalPreconditions.TYPE_CHECK; }; + ; + InternalPreconditions.API_CHECK_$LI$ = function () { if (InternalPreconditions.API_CHECK == null) { + InternalPreconditions.API_CHECK = java.lang.System.getProperty("jre.checks.api", "ENABLED") === ("ENABLED"); + } return InternalPreconditions.API_CHECK; }; + ; + InternalPreconditions.BOUND_CHECK_$LI$ = function () { if (InternalPreconditions.BOUND_CHECK == null) { + InternalPreconditions.BOUND_CHECK = java.lang.System.getProperty("jre.checks.bounds", "ENABLED") === ("ENABLED"); + } return InternalPreconditions.BOUND_CHECK; }; + ; + InternalPreconditions.checkType = function (expression) { + if (InternalPreconditions.TYPE_CHECK_$LI$()) { + InternalPreconditions.checkCriticalType(expression); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalType(expression); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + InternalPreconditions.checkCriticalType = function (expression) { + if (!expression) { + throw new java.lang.ClassCastException(); + } + }; + InternalPreconditions.checkArrayType$boolean = function (expression) { + if (InternalPreconditions.TYPE_CHECK_$LI$()) { + InternalPreconditions.checkCriticalArrayType$boolean(expression); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalArrayType$boolean(expression); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + InternalPreconditions.checkCriticalArrayType$boolean = function (expression) { + if (!expression) { + throw new java.lang.ArrayStoreException(); + } + }; + InternalPreconditions.checkArrayType$boolean$java_lang_Object = function (expression, errorMessage) { + if (InternalPreconditions.TYPE_CHECK_$LI$()) { + InternalPreconditions.checkCriticalArrayType$boolean$java_lang_Object(expression, errorMessage); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalArrayType$boolean$java_lang_Object(expression, errorMessage); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + /** + * Ensures the truth of an expression that verifies array type. + * @param {boolean} expression + * @param {*} errorMessage + */ + InternalPreconditions.checkArrayType = function (expression, errorMessage) { + if (((typeof expression === 'boolean') || expression === null) && ((errorMessage != null) || errorMessage === null)) { + return javaemul.internal.InternalPreconditions.checkArrayType$boolean$java_lang_Object(expression, errorMessage); + } + else if (((typeof expression === 'boolean') || expression === null) && errorMessage === undefined) { + return javaemul.internal.InternalPreconditions.checkArrayType$boolean(expression); + } + else + throw new Error('invalid overload'); + }; + InternalPreconditions.checkCriticalArrayType$boolean$java_lang_Object = function (expression, errorMessage) { + if (!expression) { + throw new java.lang.ArrayStoreException(/* valueOf */ new String(errorMessage).toString()); + } + }; + InternalPreconditions.checkCriticalArrayType = function (expression, errorMessage) { + if (((typeof expression === 'boolean') || expression === null) && ((errorMessage != null) || errorMessage === null)) { + return javaemul.internal.InternalPreconditions.checkCriticalArrayType$boolean$java_lang_Object(expression, errorMessage); + } + else if (((typeof expression === 'boolean') || expression === null) && errorMessage === undefined) { + return javaemul.internal.InternalPreconditions.checkCriticalArrayType$boolean(expression); + } + else + throw new Error('invalid overload'); + }; + InternalPreconditions.checkElement$boolean = function (expression) { + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCriticalElement$boolean(expression); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalElement$boolean(expression); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + InternalPreconditions.checkCriticalElement$boolean = function (expression) { + if (!expression) { + throw new java.util.NoSuchElementException(); + } + }; + InternalPreconditions.checkElement$boolean$java_lang_Object = function (expression, errorMessage) { + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCriticalElement$boolean$java_lang_Object(expression, errorMessage); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalElement$boolean$java_lang_Object(expression, errorMessage); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + /** + * Ensures the truth of an expression involving existence of an element. + * @param {boolean} expression + * @param {*} errorMessage + */ + InternalPreconditions.checkElement = function (expression, errorMessage) { + if (((typeof expression === 'boolean') || expression === null) && ((errorMessage != null) || errorMessage === null)) { + return javaemul.internal.InternalPreconditions.checkElement$boolean$java_lang_Object(expression, errorMessage); + } + else if (((typeof expression === 'boolean') || expression === null) && errorMessage === undefined) { + return javaemul.internal.InternalPreconditions.checkElement$boolean(expression); + } + else + throw new Error('invalid overload'); + }; + InternalPreconditions.checkCriticalElement$boolean$java_lang_Object = function (expression, errorMessage) { + if (!expression) { + throw new java.util.NoSuchElementException(/* valueOf */ new String(errorMessage).toString()); + } + }; + /** + * Ensures the truth of an expression involving existence of an element. + *

+ * For cases where failing fast is pretty important and not failing early could cause bugs that + * are much harder to debug. + * @param {boolean} expression + * @param {*} errorMessage + */ + InternalPreconditions.checkCriticalElement = function (expression, errorMessage) { + if (((typeof expression === 'boolean') || expression === null) && ((errorMessage != null) || errorMessage === null)) { + return javaemul.internal.InternalPreconditions.checkCriticalElement$boolean$java_lang_Object(expression, errorMessage); + } + else if (((typeof expression === 'boolean') || expression === null) && errorMessage === undefined) { + return javaemul.internal.InternalPreconditions.checkCriticalElement$boolean(expression); + } + else + throw new Error('invalid overload'); + }; + InternalPreconditions.checkArgument$boolean = function (expression) { + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCriticalArgument$boolean(expression); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalArgument$boolean(expression); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + InternalPreconditions.checkCriticalArgument$boolean = function (expression) { + if (!expression) { + throw new java.lang.IllegalArgumentException(); + } + }; + InternalPreconditions.checkArgument$boolean$java_lang_Object = function (expression, errorMessage) { + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCriticalArgument$boolean$java_lang_Object(expression, errorMessage); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalArgument$boolean$java_lang_Object(expression, errorMessage); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + InternalPreconditions.checkCriticalArgument$boolean$java_lang_Object = function (expression, errorMessage) { + if (!expression) { + throw new java.lang.IllegalArgumentException(/* valueOf */ new String(errorMessage).toString()); + } + }; + InternalPreconditions.checkArgument$boolean$java_lang_String$java_lang_Object_A = function (expression, errorMessageTemplate) { + var errorMessageArgs = []; + for (var _i = 2; _i < arguments.length; _i++) { + errorMessageArgs[_i - 2] = arguments[_i]; + } + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCriticalArgument$boolean$java_lang_String$java_lang_Object_A.apply(this, [expression, errorMessageTemplate].concat(errorMessageArgs)); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalArgument$boolean$java_lang_String$java_lang_Object_A.apply(this, [expression, errorMessageTemplate].concat(errorMessageArgs)); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + /** + * Ensures the truth of an expression involving one or more parameters to the calling method. + * @param {boolean} expression + * @param {string} errorMessageTemplate + * @param {Array} errorMessageArgs + */ + InternalPreconditions.checkArgument = function (expression, errorMessageTemplate) { + var errorMessageArgs = []; + for (var _i = 2; _i < arguments.length; _i++) { + errorMessageArgs[_i - 2] = arguments[_i]; + } + if (((typeof expression === 'boolean') || expression === null) && ((typeof errorMessageTemplate === 'string') || errorMessageTemplate === null) && ((errorMessageArgs != null && errorMessageArgs instanceof Array && (errorMessageArgs.length == 0 || errorMessageArgs[0] == null || (errorMessageArgs[0] != null))) || errorMessageArgs === null)) { + return javaemul.internal.InternalPreconditions.checkArgument$boolean$java_lang_String$java_lang_Object_A(expression, errorMessageTemplate, errorMessageArgs); + } + else if (((typeof expression === 'boolean') || expression === null) && ((errorMessageTemplate != null) || errorMessageTemplate === null) && errorMessageArgs === undefined) { + return javaemul.internal.InternalPreconditions.checkArgument$boolean$java_lang_Object(expression, errorMessageTemplate); + } + else if (((typeof expression === 'boolean') || expression === null) && errorMessageTemplate === undefined && errorMessageArgs === undefined) { + return javaemul.internal.InternalPreconditions.checkArgument$boolean(expression); + } + else + throw new Error('invalid overload'); + }; + InternalPreconditions.checkCriticalArgument$boolean$java_lang_String$java_lang_Object_A = function (expression, errorMessageTemplate) { + var errorMessageArgs = []; + for (var _i = 2; _i < arguments.length; _i++) { + errorMessageArgs[_i - 2] = arguments[_i]; + } + if (!expression) { + throw new java.lang.IllegalArgumentException(InternalPreconditions.format.apply(this, [errorMessageTemplate].concat(errorMessageArgs))); + } + }; + /** + * Ensures the truth of an expression involving one or more parameters to the calling method. + *

+ * For cases where failing fast is pretty important and not failing early could cause bugs that + * are much harder to debug. + * @param {boolean} expression + * @param {string} errorMessageTemplate + * @param {Array} errorMessageArgs + */ + InternalPreconditions.checkCriticalArgument = function (expression, errorMessageTemplate) { + var errorMessageArgs = []; + for (var _i = 2; _i < arguments.length; _i++) { + errorMessageArgs[_i - 2] = arguments[_i]; + } + if (((typeof expression === 'boolean') || expression === null) && ((typeof errorMessageTemplate === 'string') || errorMessageTemplate === null) && ((errorMessageArgs != null && errorMessageArgs instanceof Array && (errorMessageArgs.length == 0 || errorMessageArgs[0] == null || (errorMessageArgs[0] != null))) || errorMessageArgs === null)) { + return javaemul.internal.InternalPreconditions.checkCriticalArgument$boolean$java_lang_String$java_lang_Object_A(expression, errorMessageTemplate, errorMessageArgs); + } + else if (((typeof expression === 'boolean') || expression === null) && ((errorMessageTemplate != null) || errorMessageTemplate === null) && errorMessageArgs === undefined) { + return javaemul.internal.InternalPreconditions.checkCriticalArgument$boolean$java_lang_Object(expression, errorMessageTemplate); + } + else if (((typeof expression === 'boolean') || expression === null) && errorMessageTemplate === undefined && errorMessageArgs === undefined) { + return javaemul.internal.InternalPreconditions.checkCriticalArgument$boolean(expression); + } + else + throw new Error('invalid overload'); + }; + InternalPreconditions.checkState$boolean = function (expression) { + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCritcalState(expression); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCritcalState(expression); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + /** + * Ensures the truth of an expression involving the state of the calling instance, but not + * involving any parameters to the calling method. + *

+ * For cases where failing fast is pretty important and not failing early could cause bugs that + * are much harder to debug. + * @param {boolean} expression + */ + InternalPreconditions.checkCritcalState = function (expression) { + if (!expression) { + throw new java.lang.IllegalStateException(); + } + }; + InternalPreconditions.checkState$boolean$java_lang_Object = function (expression, errorMessage) { + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCriticalState(expression, errorMessage); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalState(expression, errorMessage); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + /** + * Ensures the truth of an expression involving the state of the calling instance, but not + * involving any parameters to the calling method. + * @param {boolean} expression + * @param {*} errorMessage + */ + InternalPreconditions.checkState = function (expression, errorMessage) { + if (((typeof expression === 'boolean') || expression === null) && ((errorMessage != null) || errorMessage === null)) { + return javaemul.internal.InternalPreconditions.checkState$boolean$java_lang_Object(expression, errorMessage); + } + else if (((typeof expression === 'boolean') || expression === null) && errorMessage === undefined) { + return javaemul.internal.InternalPreconditions.checkState$boolean(expression); + } + else + throw new Error('invalid overload'); + }; + /** + * Ensures the truth of an expression involving the state of the calling instance, but not + * involving any parameters to the calling method. + * @param {boolean} expression + * @param {*} errorMessage + */ + InternalPreconditions.checkCriticalState = function (expression, errorMessage) { + if (!expression) { + throw new java.lang.IllegalStateException(/* valueOf */ new String(errorMessage).toString()); + } + }; + InternalPreconditions.checkNotNull$java_lang_Object = function (reference) { + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCriticalNotNull(reference); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalNotNull(reference); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + return reference; + }; + InternalPreconditions.checkCriticalNotNull$java_lang_Object = function (reference) { + if (reference == null) { + throw new java.lang.NullPointerException(); + } + return reference; + }; + InternalPreconditions.checkNotNull$java_lang_Object$java_lang_Object = function (reference, errorMessage) { + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCriticalNotNull$java_lang_Object$java_lang_Object(reference, errorMessage); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalNotNull$java_lang_Object$java_lang_Object(reference, errorMessage); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + /** + * Ensures that an object reference passed as a parameter to the calling method is not null. + * @param {*} reference + * @param {*} errorMessage + */ + InternalPreconditions.checkNotNull = function (reference, errorMessage) { + if (((reference != null) || reference === null) && ((errorMessage != null) || errorMessage === null)) { + return javaemul.internal.InternalPreconditions.checkNotNull$java_lang_Object$java_lang_Object(reference, errorMessage); + } + else if (((reference != null) || reference === null) && errorMessage === undefined) { + return javaemul.internal.InternalPreconditions.checkNotNull$java_lang_Object(reference); + } + else + throw new Error('invalid overload'); + }; + InternalPreconditions.checkCriticalNotNull$java_lang_Object$java_lang_Object = function (reference, errorMessage) { + if (reference == null) { + throw new java.lang.NullPointerException(/* valueOf */ new String(errorMessage).toString()); + } + }; + InternalPreconditions.checkCriticalNotNull = function (reference, errorMessage) { + if (((reference != null) || reference === null) && ((errorMessage != null) || errorMessage === null)) { + return javaemul.internal.InternalPreconditions.checkCriticalNotNull$java_lang_Object$java_lang_Object(reference, errorMessage); + } + else if (((reference != null) || reference === null) && errorMessage === undefined) { + return javaemul.internal.InternalPreconditions.checkCriticalNotNull$java_lang_Object(reference); + } + else + throw new Error('invalid overload'); + }; + /** + * Ensures that {@code size} specifies a valid array size (i.e. non-negative). + * @param {number} size + */ + InternalPreconditions.checkArraySize = function (size) { + if (InternalPreconditions.API_CHECK_$LI$()) { + InternalPreconditions.checkCriticalArraySize(size); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalArraySize(size); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + InternalPreconditions.checkCriticalArraySize = function (size) { + if (size < 0) { + throw new java.lang.NegativeArraySizeException("Negative array size: " + size); + } + }; + /** + * Ensures that {@code index} specifies a valid element in an array, list or string of size + * {@code size}. An element index may range from zero, inclusive, to {@code size}, exclusive. + * @param {number} index + * @param {number} size + */ + InternalPreconditions.checkElementIndex = function (index, size) { + if (InternalPreconditions.BOUND_CHECK_$LI$()) { + InternalPreconditions.checkCriticalElementIndex(index, size); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalElementIndex(index, size); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + InternalPreconditions.checkCriticalElementIndex = function (index, size) { + if (index < 0 || index >= size) { + throw new java.lang.IndexOutOfBoundsException("Index: " + index + ", Size: " + size); + } + }; + /** + * Ensures that {@code index} specifies a valid position in an array, list or string of + * size {@code size}. A position index may range from zero to {@code size}, inclusive. + * @param {number} index + * @param {number} size + */ + InternalPreconditions.checkPositionIndex = function (index, size) { + if (InternalPreconditions.BOUND_CHECK_$LI$()) { + InternalPreconditions.checkCriticalPositionIndex(index, size); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalPositionIndex(index, size); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + InternalPreconditions.checkCriticalPositionIndex = function (index, size) { + if (index < 0 || index > size) { + throw new java.lang.IndexOutOfBoundsException("Index: " + index + ", Size: " + size); + } + }; + /** + * Ensures that {@code start} and {@code end} specify a valid positions in an array, list + * or string of size {@code size}, and are in order. A position index may range from zero to + * {@code size}, inclusive. + * @param {number} start + * @param {number} end + * @param {number} size + */ + InternalPreconditions.checkPositionIndexes = function (start, end, size) { + if (InternalPreconditions.BOUND_CHECK_$LI$()) { + InternalPreconditions.checkCriticalPositionIndexes(start, end, size); + } + else if (InternalPreconditions.CHECKED_MODE_$LI$()) { + try { + InternalPreconditions.checkCriticalPositionIndexes(start, end, size); + } + catch (e) { + throw new java.lang.AssertionError(e); + } + ; + } + }; + /** + * Ensures that {@code start} and {@code end} specify a valid positions in an array, list + * or string of size {@code size}, and are in order. A position index may range from zero to + * {@code size}, inclusive. + * @param {number} start + * @param {number} end + * @param {number} size + */ + InternalPreconditions.checkCriticalPositionIndexes = function (start, end, size) { + if (start < 0) { + throw new java.lang.IndexOutOfBoundsException("fromIndex: " + start + " < 0"); + } + if (end > size) { + throw new java.lang.IndexOutOfBoundsException("toIndex: " + end + " > size " + size); + } + if (start > end) { + throw new java.lang.IllegalArgumentException("fromIndex: " + start + " > toIndex: " + end); + } + }; + /** + * Checks that bounds are correct. + * + * @throw StringIndexOutOfBoundsException if the range is not legal + * @param {number} start + * @param {number} end + * @param {number} size + */ + InternalPreconditions.checkStringBounds = function (start, end, size) { + if (start < 0) { + throw new java.lang.StringIndexOutOfBoundsException("fromIndex: " + start + " < 0"); + } + if (end > size) { + throw new java.lang.StringIndexOutOfBoundsException("toIndex: " + end + " > size " + size); + } + if (end < start) { + throw new java.lang.StringIndexOutOfBoundsException("fromIndex: " + start + " > toIndex: " + end); + } + }; + /** + * Substitutes each {@code %s} in {@code template} with an argument. These are matched by + * position: the first {@code %s} gets {@code args[0]}, etc. If there are more arguments than + * placeholders, the unmatched arguments will be appended to the end of the formatted message in + * square braces. + * @param {string} template + * @param {Array} args + * @return {string} + * @private + */ + /*private*/ InternalPreconditions.format = function (template) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + template = /* valueOf */ new String(template).toString(); + var builder = new java.lang.StringBuilder(template.length + 16 * args.length); + var templateStart = 0; + var i = 0; + while ((i < args.length)) { + { + var placeholderStart = template.indexOf("%s", templateStart); + if (placeholderStart === -1) { + break; + } + builder.append$java_lang_String(template.substring(templateStart, placeholderStart)); + builder.append$java_lang_Object(args[i++]); + templateStart = placeholderStart + 2; + } + } + ; + builder.append$java_lang_String(template.substring(templateStart)); + if (i < args.length) { + builder.append$java_lang_String(" ["); + builder.append$java_lang_Object(args[i++]); + while ((i < args.length)) { + { + builder.append$java_lang_String(", "); + builder.append$java_lang_Object(args[i++]); + } + } + ; + builder.append$char(']'); + } + return builder.toString(); + }; + return InternalPreconditions; + }()); + internal.InternalPreconditions = InternalPreconditions; + InternalPreconditions["__class"] = "javaemul.internal.InternalPreconditions"; + })(internal = javaemul.internal || (javaemul.internal = {})); +})(javaemul || (javaemul = {})); +(function (java) { + var util; + (function (util) { + /** + * A helper to detect concurrent modifications to collections. This is implemented as a helper + * utility so that we could remove the checks easily by a flag. + * @class + */ + var ConcurrentModificationDetector = /** @class */ (function () { + function ConcurrentModificationDetector() { + } + ConcurrentModificationDetector.API_CHECK_$LI$ = function () { if (ConcurrentModificationDetector.API_CHECK == null) { + ConcurrentModificationDetector.API_CHECK = java.lang.System.getProperty("jre.checks.api", "ENABLED") === ("ENABLED"); + } return ConcurrentModificationDetector.API_CHECK; }; + ; + ConcurrentModificationDetector.structureChanged = function (map) { + if (!ConcurrentModificationDetector.API_CHECK_$LI$()) { + return; + } + var modCount = javaemul.internal.JsUtils.getIntProperty(map, ConcurrentModificationDetector.MOD_COUNT_PROPERTY) | 0; + javaemul.internal.JsUtils.setIntProperty(map, ConcurrentModificationDetector.MOD_COUNT_PROPERTY, modCount + 1); + }; + ConcurrentModificationDetector.recordLastKnownStructure = function (host, iterator) { + if (!ConcurrentModificationDetector.API_CHECK_$LI$()) { + return; + } + var modCount = javaemul.internal.JsUtils.getIntProperty(host, ConcurrentModificationDetector.MOD_COUNT_PROPERTY); + javaemul.internal.JsUtils.setIntProperty(iterator, ConcurrentModificationDetector.MOD_COUNT_PROPERTY, modCount); + }; + ConcurrentModificationDetector.checkStructuralChange = function (host, iterator) { + if (!ConcurrentModificationDetector.API_CHECK_$LI$()) { + return; + } + if (javaemul.internal.JsUtils.getIntProperty(iterator, ConcurrentModificationDetector.MOD_COUNT_PROPERTY) !== javaemul.internal.JsUtils.getIntProperty(host, ConcurrentModificationDetector.MOD_COUNT_PROPERTY)) { + throw new java.util.ConcurrentModificationException(); + } + }; + ConcurrentModificationDetector.MOD_COUNT_PROPERTY = "_gwt_modCount"; + return ConcurrentModificationDetector; + }()); + util.ConcurrentModificationDetector = ConcurrentModificationDetector; + ConcurrentModificationDetector["__class"] = "java.util.ConcurrentModificationDetector"; + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var util; + (function (util) { + var logging; + (function (logging) { + /** + * An emulation of the java.util.logging.Logger class. See + * + * The Java API doc for details + * @class + */ + var Logger = /** @class */ (function () { + function Logger(name, resourceName) { + if (this.handlers === undefined) { + this.handlers = null; + } + this.level = null; + if (this.name === undefined) { + this.name = null; + } + if (this.parent === undefined) { + this.parent = null; + } + if (this.useParentHandlers === undefined) { + this.useParentHandlers = false; + } + if (Logger.LOGGING_FALSE_$LI$()) { + return; + } + this.name = name; + this.useParentHandlers = true; + this.handlers = (new java.util.ArrayList()); + } + Logger.__static_initialize = function () { if (!Logger.__static_initialized) { + Logger.__static_initialized = true; + Logger.__static_initializer_0(); + } }; + Logger.LOGGING_ENABLED_$LI$ = function () { Logger.__static_initialize(); if (Logger.LOGGING_ENABLED == null) { + Logger.LOGGING_ENABLED = java.lang.System.getProperty("gwt.logging.enabled", "TRUE"); + } return Logger.LOGGING_ENABLED; }; + ; + Logger.LOGGING_WARNING_$LI$ = function () { Logger.__static_initialize(); if (Logger.LOGGING_WARNING == null) { + Logger.LOGGING_WARNING = Logger.LOGGING_ENABLED_$LI$() === ("WARNING"); + } return Logger.LOGGING_WARNING; }; + ; + Logger.LOGGING_SEVERE_$LI$ = function () { Logger.__static_initialize(); if (Logger.LOGGING_SEVERE == null) { + Logger.LOGGING_SEVERE = Logger.LOGGING_ENABLED_$LI$() === ("SEVERE"); + } return Logger.LOGGING_SEVERE; }; + ; + Logger.LOGGING_FALSE_$LI$ = function () { Logger.__static_initialize(); if (Logger.LOGGING_FALSE == null) { + Logger.LOGGING_FALSE = Logger.LOGGING_ENABLED_$LI$() === ("FALSE"); + } return Logger.LOGGING_FALSE; }; + ; + Logger.__static_initializer_0 = function () { + Logger.assertLoggingValues(); + }; + Logger.getGlobal = function () { + return Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); + }; + Logger.getLogger = function (name) { + if (Logger.LOGGING_FALSE_$LI$()) { + return new Logger(name, null); + } + return java.util.logging.LogManager.getLogManager().ensureLogger(name); + }; + Logger.assertLoggingValues = function () { + if ((Logger.LOGGING_ENABLED_$LI$() === ("FALSE")) || (Logger.LOGGING_ENABLED_$LI$() === ("TRUE")) || (Logger.LOGGING_ENABLED_$LI$() === ("SEVERE")) || (Logger.LOGGING_ENABLED_$LI$() === ("WARNING"))) { + return; + } + throw new java.lang.RuntimeException("Undefined value for gwt.logging.enabled: \'" + Logger.LOGGING_ENABLED_$LI$() + "\'. Allowed values are TRUE, FALSE, SEVERE, WARNING"); + }; + Logger.prototype.addHandler = function (handler) { + if (Logger.LOGGING_FALSE_$LI$()) { + return; + } + this.handlers.add(handler); + }; + Logger.prototype.config = function (msg) { + if (Logger.LOGGING_FALSE_$LI$() || Logger.LOGGING_SEVERE_$LI$() || Logger.LOGGING_WARNING_$LI$()) { + return; + } + this.log$java_util_logging_Level$java_lang_String(java.util.logging.Level.CONFIG_$LI$(), msg); + }; + Logger.prototype.fine = function (msg) { + if (Logger.LOGGING_FALSE_$LI$() || Logger.LOGGING_SEVERE_$LI$() || Logger.LOGGING_WARNING_$LI$()) { + return; + } + this.log$java_util_logging_Level$java_lang_String(java.util.logging.Level.FINE_$LI$(), msg); + }; + Logger.prototype.finer = function (msg) { + if (Logger.LOGGING_FALSE_$LI$() || Logger.LOGGING_SEVERE_$LI$() || Logger.LOGGING_WARNING_$LI$()) { + return; + } + this.log$java_util_logging_Level$java_lang_String(java.util.logging.Level.FINER_$LI$(), msg); + }; + Logger.prototype.finest = function (msg) { + if (Logger.LOGGING_FALSE_$LI$() || Logger.LOGGING_SEVERE_$LI$() || Logger.LOGGING_WARNING_$LI$()) { + return; + } + this.log$java_util_logging_Level$java_lang_String(java.util.logging.Level.FINEST_$LI$(), msg); + }; + Logger.prototype.info = function (msg) { + if (Logger.LOGGING_FALSE_$LI$() || Logger.LOGGING_SEVERE_$LI$() || Logger.LOGGING_WARNING_$LI$()) { + return; + } + this.log$java_util_logging_Level$java_lang_String(java.util.logging.Level.INFO_$LI$(), msg); + }; + Logger.prototype.warning = function (msg) { + if (Logger.LOGGING_FALSE_$LI$() || Logger.LOGGING_SEVERE_$LI$()) { + return; + } + this.log$java_util_logging_Level$java_lang_String(java.util.logging.Level.WARNING_$LI$(), msg); + }; + Logger.prototype.severe = function (msg) { + if (Logger.LOGGING_FALSE_$LI$()) { + return; + } + this.log$java_util_logging_Level$java_lang_String(java.util.logging.Level.SEVERE_$LI$(), msg); + }; + Logger.prototype.getHandlers = function () { + if (Logger.LOGGING_FALSE_$LI$()) { + return []; + } + return this.handlers['toArray$java_lang_Object_A']((function (s) { var a = []; while (s-- > 0) + a.push(null); return a; })(this.handlers.size())); + }; + Logger.prototype.getLevel = function () { + return Logger.LOGGING_FALSE_$LI$() ? null : this.level; + }; + Logger.prototype.getName = function () { + return Logger.LOGGING_FALSE_$LI$() ? null : this.name; + }; + Logger.prototype.getParent = function () { + return Logger.LOGGING_FALSE_$LI$() ? null : this.parent; + }; + Logger.prototype.getUseParentHandlers = function () { + return Logger.LOGGING_FALSE_$LI$() ? false : this.useParentHandlers; + }; + Logger.prototype.isLoggable = function (messageLevel) { + return Logger.LOGGING_FALSE_$LI$() ? false : this.getEffectiveLevel().intValue() <= messageLevel.intValue(); + }; + Logger.prototype.log$java_util_logging_Level$java_lang_String = function (level, msg) { + this.log$java_util_logging_Level$java_lang_String$java_lang_Throwable(level, msg, null); + }; + Logger.prototype.log$java_util_logging_Level$java_lang_String$java_lang_Throwable = function (level, msg, thrown) { + if (Logger.LOGGING_FALSE_$LI$()) { + return; + } + if (Logger.LOGGING_SEVERE_$LI$()) { + if (level.intValue() >= 1000) { + this.actuallyLog$java_util_logging_Level$java_lang_String$java_lang_Throwable(level, msg, thrown); + } + } + else if (Logger.LOGGING_WARNING_$LI$()) { + if (level.intValue() >= java.util.logging.Level.WARNING_$LI$().intValue()) { + this.actuallyLog$java_util_logging_Level$java_lang_String$java_lang_Throwable(level, msg, thrown); + } + } + else { + this.actuallyLog$java_util_logging_Level$java_lang_String$java_lang_Throwable(level, msg, thrown); + } + }; + Logger.prototype.log = function (level, msg, thrown) { + if (((level != null && level instanceof java.util.logging.Level) || level === null) && ((typeof msg === 'string') || msg === null) && ((thrown != null && thrown instanceof Error) || thrown === null)) { + return this.log$java_util_logging_Level$java_lang_String$java_lang_Throwable(level, msg, thrown); + } + else if (((level != null && level instanceof java.util.logging.Level) || level === null) && ((typeof msg === 'string') || msg === null) && thrown === undefined) { + return this.log$java_util_logging_Level$java_lang_String(level, msg); + } + else if (((level != null && level instanceof java.util.logging.LogRecord) || level === null) && msg === undefined && thrown === undefined) { + return this.log$java_util_logging_LogRecord(level); + } + else + throw new Error('invalid overload'); + }; + Logger.prototype.log$java_util_logging_LogRecord = function (record) { + if (Logger.LOGGING_FALSE_$LI$()) { + return; + } + if (Logger.LOGGING_SEVERE_$LI$()) { + if (record.getLevel().intValue() >= 1000) { + this.actuallyLog$java_util_logging_LogRecord(record); + } + } + else if (Logger.LOGGING_WARNING_$LI$()) { + if (record.getLevel().intValue() >= java.util.logging.Level.WARNING_$LI$().intValue()) { + this.actuallyLog$java_util_logging_LogRecord(record); + } + } + else { + this.actuallyLog$java_util_logging_LogRecord(record); + } + }; + Logger.prototype.removeHandler = function (handler) { + if (Logger.LOGGING_FALSE_$LI$()) { + return; + } + this.handlers['remove$java_lang_Object'](handler); + }; + Logger.prototype.setLevel = function (newLevel) { + if (Logger.LOGGING_FALSE_$LI$()) { + return; + } + this.level = newLevel; + }; + Logger.prototype.setParent = function (newParent) { + if (Logger.LOGGING_FALSE_$LI$()) { + return; + } + if (newParent != null) { + this.parent = newParent; + } + }; + Logger.prototype.setUseParentHandlers = function (newUseParentHandlers) { + if (Logger.LOGGING_FALSE_$LI$()) { + return; + } + this.useParentHandlers = newUseParentHandlers; + }; + /*private*/ Logger.prototype.getEffectiveLevel = function () { + if (this.level != null) { + return this.level; + } + var logger = this.getParent(); + while ((logger != null)) { + { + var effectiveLevel = logger.getLevel(); + if (effectiveLevel != null) { + return effectiveLevel; + } + logger = logger.getParent(); + } + } + ; + return java.util.logging.Level.INFO_$LI$(); + }; + Logger.prototype.actuallyLog$java_util_logging_Level$java_lang_String$java_lang_Throwable = function (level, msg, thrown) { + if (this.isLoggable(level)) { + var record = new java.util.logging.LogRecord(level, msg); + record.setThrown(thrown); + record.setLoggerName(this.getName()); + this.actuallyLog$java_util_logging_LogRecord(record); + } + }; + Logger.prototype.actuallyLog = function (level, msg, thrown) { + if (((level != null && level instanceof java.util.logging.Level) || level === null) && ((typeof msg === 'string') || msg === null) && ((thrown != null && thrown instanceof Error) || thrown === null)) { + return this.actuallyLog$java_util_logging_Level$java_lang_String$java_lang_Throwable(level, msg, thrown); + } + else if (((level != null && level instanceof java.util.logging.LogRecord) || level === null) && msg === undefined && thrown === undefined) { + return this.actuallyLog$java_util_logging_LogRecord(level); + } + else + throw new Error('invalid overload'); + }; + /*private*/ Logger.prototype.actuallyLog$java_util_logging_LogRecord = function (record) { + if (this.isLoggable(record.getLevel())) { + { + var array200 = this.getHandlers(); + for (var index199 = 0; index199 < array200.length; index199++) { + var handler = array200[index199]; + { + handler.publish(record); + } + } + } + var logger = this.getUseParentHandlers() ? this.getParent() : null; + while ((logger != null)) { + { + { + var array202 = logger.getHandlers(); + for (var index201 = 0; index201 < array202.length; index201++) { + var handler = array202[index201]; + { + handler.publish(record); + } + } + } + logger = logger.getUseParentHandlers() ? logger.getParent() : null; + } + } + ; + } + }; + Logger.__static_initialized = false; + Logger.GLOBAL_LOGGER_NAME = "global"; + return Logger; + }()); + logging.Logger = Logger; + Logger["__class"] = "java.util.logging.Logger"; + })(logging = util.logging || (util.logging = {})); + })(util = java.util || (java.util = {})); +})(java || (java = {})); +(function (java) { + var nio; + (function (nio) { + var file; + (function (file) { + var Path = /** @class */ (function () { + function Path(fullPath) { + if (this.fullPath === undefined) { + this.fullPath = null; + } + this.fullPath = fullPath; + } + /* Default method injected from java.lang.Iterable */ + Path.prototype.forEach = function (action) { + javaemul.internal.InternalPreconditions.checkNotNull((action)); + var _loop_39 = function (index203) { + var t = index203.next(); + { + (function (target) { return (typeof target === 'function') ? target(t) : target.accept(t); })(action); + } + }; + for (var index203 = this.iterator(); index203.hasNext();) { + _loop_39(index203); + } + }; + Path.PATH_SEPARATOR_$LI$ = function () { if (Path.PATH_SEPARATOR == null) { + Path.PATH_SEPARATOR = java.lang.System.getProperty("file.separator"); + } return Path.PATH_SEPARATOR; }; + ; + Path.prototype.compareTo$java_nio_file_Path = function (path) { + return /* compareTo */ this.toString().localeCompare(path.toString()); + }; + /** + * + * @param {java.nio.file.Path} path + * @return {number} + */ + Path.prototype.compareTo = function (path) { + if (((path != null && path instanceof java.nio.file.Path) || path === null)) { + return this.compareTo$java_nio_file_Path(path); + } + else + throw new Error('invalid overload'); + }; + Path.prototype.isAbsolute = function () { + return java.util.Objects.equals(Path.PATH_SEPARATOR_$LI$(), "/") ? this.fullPath.length > 0 && java.util.Objects.equals(this.fullPath.substring(0, 1), Path.PATH_SEPARATOR_$LI$()) : this.fullPath.length >= 3 && java.util.Objects.equals(this.fullPath.substring(1, 3), ":\\"); + }; + Path.prototype.getFileName = function () { + return new Path(this.fullPath.substring(this.fullPath.lastIndexOf(Path.PATH_SEPARATOR_$LI$()) + Path.PATH_SEPARATOR_$LI$().length)); + }; + Path.prototype.getParent = function () { + return new Path(this.fullPath.substring(0, this.fullPath.lastIndexOf(Path.PATH_SEPARATOR_$LI$()))); + }; + Path.prototype.resolve$java_nio_file_Path = function (other) { + if (other.isAbsolute()) + return other; + return new Path(this.fullPath + "/" + other.fullPath); + }; + Path.prototype.resolve = function (other) { + if (((other != null && other instanceof java.nio.file.Path) || other === null)) { + return this.resolve$java_nio_file_Path(other); + } + else if (((typeof other === 'string') || other === null)) { + return this.resolve$java_lang_String(other); + } + else + throw new Error('invalid overload'); + }; + Path.prototype.resolve$java_lang_String = function (other) { + return this.resolve$java_nio_file_Path(java.nio.file.Paths.get(other)); + }; + Path.prototype.toAbsolutePath = function () { + return java.nio.file.Paths.get(java.lang.System.getProperty$java_lang_String("user.dir")).resolve$java_nio_file_Path(this); + }; + /** + * + * @return {*} + */ + Path.prototype.iterator = function () { + var _this = this; + return java.util.Arrays.asList(((this.fullPath).split(Path.PATH_SEPARATOR_$LI$()).map(function (str, i, arr) { return _this.isAbsolute() && i === 0 ? new Path(str + Path.PATH_SEPARATOR_$LI$()) : new Path(str); }))).iterator(); + }; + /** + * + * @return {string} + */ + Path.prototype.toString = function () { + return this.fullPath; + }; + return Path; + }()); + file.Path = Path; + Path["__class"] = "java.nio.file.Path"; + Path["__interfaces"] = ["java.lang.Comparable", "java.lang.Iterable"]; + })(file = nio.file || (nio.file = {})); + })(nio = java.nio || (java.nio = {})); +})(java || (java = {})); +java.nio.file.Path.PATH_SEPARATOR_$LI$(); +java.util.logging.Logger.LOGGING_FALSE_$LI$(); +java.util.logging.Logger.LOGGING_SEVERE_$LI$(); +java.util.logging.Logger.LOGGING_WARNING_$LI$(); +java.util.logging.Logger.LOGGING_ENABLED_$LI$(); +java.util.logging.Logger.__static_initialize(); +java.util.ConcurrentModificationDetector.API_CHECK_$LI$(); +javaemul.internal.InternalPreconditions.BOUND_CHECK_$LI$(); +javaemul.internal.InternalPreconditions.API_CHECK_$LI$(); +javaemul.internal.InternalPreconditions.TYPE_CHECK_$LI$(); +javaemul.internal.InternalPreconditions.CHECKED_MODE_$LI$(); +java.lang.System.in_$LI$(); +java.lang.System.out_$LI$(); +java.lang.System.err_$LI$(); +java.lang.System.propertyMap_$LI$(); +java.lang.System.ENVIRONMENT_IS_SHELL_$LI$(); +java.lang.System.ENVIRONMENT_IS_NODE_$LI$(); +java.lang.System.ENVIRONMENT_IS_WORKER_$LI$(); +java.lang.System.ENVIRONMENT_IS_WEB_$LI$(); +java.lang.System.__static_initialize(); +java.util.stream.Collectors.CH_NOID_$LI$(); +java.util.stream.Collectors.CH_ID_$LI$(); +java.util.TreeMap.SubMapType_Tail_$LI$(); +java.util.TreeMap.SubMapType_Range_$LI$(); +java.util.TreeMap.SubMapType_Head_$LI$(); +java.util.TreeMap.SubMapType_All_$LI$(); +java.util.Collections.RandomHolder.rnd_$LI$(); +java.util.Collections.ReverseComparator.INSTANCE_$LI$(); +java.util.Collections.EmptyListIterator.INSTANCE_$LI$(); +java.util.Collections.EMPTY_SET_$LI$(); +java.util.Collections.EMPTY_MAP_$LI$(); +java.util.Collections.EMPTY_LIST_$LI$(); +java.nio.charset.StandardCharsets.UTF_8_$LI$(); +java.nio.charset.StandardCharsets.ISO_8859_1_$LI$(); +javaemul.internal.EmulatedCharset.ISO_8859_1_$LI$(); +javaemul.internal.EmulatedCharset.ISO_LATIN_1_$LI$(); +javaemul.internal.EmulatedCharset.UTF_8_$LI$(); +java.security.MessageDigest.Md5Digest.padding_$LI$(); +javaemul.internal.StringHelper.CASE_INSENSITIVE_ORDER_$LI$(); +java.util.Scanner.whiteSpacePattern_$LI$(); +java.util.Scanner.endLinePattern_$LI$(); +java.util.Scanner.floatPattern_$LI$(); +java.util.Scanner.integerPattern_$LI$(); +java.util.Scanner.booleanPattern_$LI$(); +java.util.Scanner.signedNonNumber_$LI$(); +java.util.Scanner.decimal_$LI$(); +java.util.Scanner.exponent_$LI$(); +java.util.Scanner.decimalNumeral_$LI$(); +java.util.Scanner.numeral_$LI$(); +javaemul.internal.LongHelper.BoxedValues.boxedValues_$LI$(); +javaemul.internal.IntegerHelper.ReverseNibbles.reverseNibbles_$LI$(); +javaemul.internal.IntegerHelper.BoxedValues.boxedValues_$LI$(); +javaemul.internal.ByteHelper.BoxedValues.boxedValues_$LI$(); +javaemul.internal.ByteHelper.TYPE_$LI$(); +javaemul.internal.ByteHelper.MAX_VALUE_$LI$(); +javaemul.internal.ByteHelper.MIN_VALUE_$LI$(); +javaemul.internal.ShortHelper.BoxedValues.boxedValues_$LI$(); +javaemul.internal.ShortHelper.TYPE_$LI$(); +javaemul.internal.ShortHelper.MAX_VALUE_$LI$(); +javaemul.internal.ShortHelper.MIN_VALUE_$LI$(); +javaemul.internal.DoubleHelper.PowersTable.invPowers_$LI$(); +javaemul.internal.DoubleHelper.PowersTable.powers_$LI$(); +java.nio.ByteOrder.LITTLE_ENDIAN_$LI$(); +java.nio.ByteOrder.BIG_ENDIAN_$LI$(); +java.lang.Class.classes_$LI$(); +java.lang.Class.constructors_$LI$(); +java.util.logging.Level.WARNING_$LI$(); +java.util.logging.Level.SEVERE_$LI$(); +java.util.logging.Level.OFF_$LI$(); +java.util.logging.Level.INFO_$LI$(); +java.util.logging.Level.FINEST_$LI$(); +java.util.logging.Level.FINER_$LI$(); +java.util.logging.Level.FINE_$LI$(); +java.util.logging.Level.CONFIG_$LI$(); +java.util.logging.Level.ALL_$LI$(); +java.util.Date.StringData.MONTHS_$LI$(); +java.util.Date.StringData.DAYS_$LI$(); +java.util.Comparators.NATURAL_$LI$(); +java.util.Locale.defaultLocale_$LI$(); +java.util.Locale.UK_$LI$(); +java.util.Locale.FRANCE_$LI$(); +java.util.Locale.US_$LI$(); +java.util.Locale.ENGLISH_$LI$(); +java.util.Locale.ROOT_$LI$(); +java.util.Random.twoToTheXMinus48_$LI$(); +java.util.Random.twoToTheXMinus24_$LI$(); +java.util.Random.__static_initialize(); +java.util.OptionalLong.EMPTY_$LI$(); +java.util.OptionalInt.EMPTY_$LI$(); +java.util.OptionalDouble.EMPTY_$LI$(); +java.util.Optional.EMPTY_$LI$(); +java.util.InternalJsMapFactory.jsMapCtor_$LI$(); +java.net.InternalJsURLFactory.jsURLCtor_$LI$(); +javaemul.internal.NumberHelper.__ParseLong.maxValueForRadix_$LI$(); +javaemul.internal.NumberHelper.__ParseLong.maxLengthForRadix_$LI$(); +javaemul.internal.NumberHelper.__ParseLong.maxDigitsRadixPower_$LI$(); +javaemul.internal.NumberHelper.__ParseLong.maxDigitsForRadix_$LI$(); +javaemul.internal.NumberHelper.__ParseLong.__static_initialize(); +javaemul.internal.MathHelper.PI_UNDER_180_$LI$(); +javaemul.internal.MathHelper.PI_OVER_180_$LI$(); +javaemul.internal.MathHelper.MIN_VALUE_$LI$(); +javaemul.internal.MathHelper.MAX_VALUE_$LI$(); +javaemul.internal.MathHelper.EPSILON_$LI$(); +javaemul.internal.CharacterHelper.BoxedValues.boxedValues_$LI$(); +javaemul.internal.CharacterHelper.TYPE_$LI$(); +javaemul.internal.stream.VoidRunnable.dryRun_$LI$(); +javaemul.internal.StringHashCache.front_$LI$(); +javaemul.internal.StringHashCache.back_$LI$(); +javaemul.internal.BooleanHelper.TYPE_$LI$(); +javaemul.internal.JreHelper.LOG10E_$LI$(); +test.Test.main(null);