Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / jalview / util / GroupUrlLink.js
index b5b24a6..732a41b 100644 (file)
-Clazz.declarePackage ("jalview.util");\r
-Clazz.load (["java.lang.Exception"], "jalview.util.GroupUrlLink", ["jalview.jsdev.RegExp", "jalview.util.MessageManager", "$.Platform", "$.QuickSort", "java.lang.Error", "$.StringBuffer", "java.util.Hashtable"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-if (!Clazz.isClassDefined ("jalview.util.GroupUrlLink.UrlStringTooLongException")) {\r
-jalview.util.GroupUrlLink.$GroupUrlLink$UrlStringTooLongException$ ();\r
-}\r
-this.url_prefix = null;\r
-this.target = null;\r
-this.label = null;\r
-this.url_suffix = null;\r
-this.separators = null;\r
-this.regexReplace = null;\r
-this.invalidMessage = null;\r
-this.segs = null;\r
-this.mtch = null;\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.util, "GroupUrlLink");\r
-Clazz.makeConstructor (c$, \r
-function (link) {\r
-var sep = link.indexOf ("|");\r
-this.segs =  Clazz.newIntArray (jalview.util.GroupUrlLink.tokens.length, 0);\r
-var ntoks = 0;\r
-for (var i = 0; i < this.segs.length; i++) {\r
-if ((this.segs[i] = link.indexOf ("$" + jalview.util.GroupUrlLink.tokens[i])) > -1) {\r
-ntoks++;\r
-}}\r
-if (ntoks == 0) {\r
-this.invalidMessage = "Group URL string must contain at least one of ";\r
-for (var i = 0; i < this.segs.length; i++) {\r
-this.invalidMessage += " '$" + jalview.util.GroupUrlLink.tokens[i] + "[=/regex=/]$'";\r
-}\r
-return;\r
-}var ptok =  Clazz.newIntArray (ntoks + 1, 0);\r
-var tmtch =  new Array (ntoks + 1);\r
-this.mtch =  new Array (ntoks);\r
-for (var i = 0, t = 0; i < this.segs.length; i++) {\r
-if (this.segs[i] > -1) {\r
-ptok[t] = this.segs[i];\r
-tmtch[t++] = jalview.util.GroupUrlLink.tokens[i];\r
-}}\r
-ptok[ntoks] = link.length;\r
-tmtch[ntoks] = "$$$$$$$$$";\r
-jalview.util.QuickSort.sortInt (ptok, tmtch);\r
-for (var i = 0; i < ntoks; i++) {\r
-this.mtch[i] = tmtch[i];\r
-}\r
-var p = sep;\r
-do {\r
-sep = p;\r
-p = link.indexOf ("|", sep + 1);\r
-} while (p > sep && p < ptok[0]);\r
-this.label = link.substring (0, sep);\r
-if (this.label.indexOf ("|") > -1) {\r
-this.target = this.label.substring (0, this.label.indexOf ("|"));\r
-} else if (this.label.indexOf (" ") > 2) {\r
-this.target = this.label.substring (0, this.label.indexOf (" "));\r
-} else {\r
-this.target = this.label;\r
-}this.url_prefix = link.substring (sep + 1, ptok[0]);\r
-this.url_suffix =  new Array (this.mtch.length);\r
-this.regexReplace =  new Array (this.mtch.length);\r
-for (var pass = 0; pass < this.mtch.length; pass++) {\r
-var mlength = 3 + this.mtch[pass].length;\r
-if (link.indexOf ("$" + this.mtch[pass] + "=/") == ptok[pass] && (p = link.indexOf ("/=$", ptok[pass] + mlength)) > ptok[pass] + mlength) {\r
-if (ptok[pass + 1] < p + 3) {\r
-this.invalidMessage = "Token regexes cannot contain other regexes (did you terminate the $" + this.mtch[pass] + " regex with a '/=$' ?";\r
-return;\r
-}this.url_suffix[pass] = link.substring (p + 3, ptok[pass + 1]);\r
-this.regexReplace[pass] = link.substring (ptok[pass] + mlength, p);\r
-try {\r
-var rg = jalview.jsdev.RegExp.perlCode ("/" + this.regexReplace[pass] + "/");\r
-if (rg == null) {\r
-this.invalidMessage = "Invalid Regular Expression : '" + this.regexReplace[pass] + "'\n";\r
-}} catch (e) {\r
-if (Clazz.exceptionOf (e, Exception)) {\r
-this.invalidMessage = "Invalid Regular Expression : '" + this.regexReplace[pass] + "'\n";\r
-} else {\r
-throw e;\r
-}\r
-}\r
-} else {\r
-this.regexReplace[pass] = null;\r
-if ((p = link.indexOf ("$" + this.mtch[pass] + "$")) == ptok[pass]) {\r
-this.url_suffix[pass] = link.substring (p + this.mtch[pass].length + 2, ptok[pass + 1]);\r
-} else {\r
-this.invalidMessage = "Warning: invalid regex structure (after '" + this.mtch[0] + "') for URL link : " + link;\r
-}}}\r
-var pass = 0;\r
-this.separators =  new Array (this.url_suffix.length);\r
-var suffices = this.url_suffix[this.url_suffix.length - 1];\r
-var lastsep = ",";\r
-while ((p = suffices.indexOf ('|')) > -1) {\r
-this.separators[pass] = suffices.substring (p + 1);\r
-if (pass == 0) {\r
-this.url_suffix[this.url_suffix.length - 1] = suffices.substring (0, p);\r
-} else {\r
-lastsep = (this.separators[pass - 1] = this.separators[pass - 1].substring (0, p));\r
-}suffices = this.separators[pass];\r
-pass++;\r
-}\r
-if (pass > 0) {\r
-lastsep = this.separators[pass - 1];\r
-}while (pass < this.separators.length) {\r
-this.separators[pass++] = lastsep;\r
-}\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getUrl_suffix", \r
-function () {\r
-return this.url_suffix[this.url_suffix.length - 1];\r
-});\r
-Clazz.defineMethod (c$, "getUrl_prefix", \r
-function () {\r
-return this.url_prefix;\r
-});\r
-Clazz.defineMethod (c$, "getTarget", \r
-function () {\r
-return this.target;\r
-});\r
-Clazz.defineMethod (c$, "getLabel", \r
-function () {\r
-return this.label;\r
-});\r
-Clazz.defineMethod (c$, "getIDRegexReplace", \r
-function () {\r
-return this._replaceFor (jalview.util.GroupUrlLink.tokens[0]);\r
-});\r
-Clazz.defineMethod (c$, "_replaceFor", \r
- function (token) {\r
-for (var i = 0; i < this.mtch.length; i++) {\r
-if (this.segs[i] > -1 && this.mtch[i].equals (token)) {\r
-return this.regexReplace[i];\r
-}}\r
-return null;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getSeqRegexReplace", \r
-function () {\r
-return this._replaceFor (jalview.util.GroupUrlLink.tokens[1]);\r
-});\r
-Clazz.defineMethod (c$, "getInvalidMessage", \r
-function () {\r
-return this.invalidMessage;\r
-});\r
-Clazz.defineMethod (c$, "isValid", \r
-function () {\r
-return this.invalidMessage == null;\r
-});\r
-Clazz.defineMethod (c$, "makeUrls", \r
-function (idstrings, seqstrings, dsstring, onlyIfMatches) {\r
-var rstrings = this.replacementArgs (idstrings, seqstrings, dsstring);\r
-return this.makeUrls (rstrings, onlyIfMatches);\r
-}, "~A,~A,~S,~B");\r
-Clazz.defineMethod (c$, "replacementArgs", \r
- function (idstrings, seqstrings, dsstring) {\r
-var rstrings =  new java.util.Hashtable ();\r
-rstrings.put (jalview.util.GroupUrlLink.tokens[0], idstrings);\r
-rstrings.put (jalview.util.GroupUrlLink.tokens[1], seqstrings);\r
-rstrings.put (jalview.util.GroupUrlLink.tokens[2],  Clazz.newArray (-1, [dsstring]));\r
-if (idstrings.length != seqstrings.length) {\r
-throw  new Error (jalview.util.MessageManager.getString ("error.idstring_seqstrings_only_one_per_sequence"));\r
-}return rstrings;\r
-}, "~A,~A,~S");\r
-Clazz.defineMethod (c$, "makeUrls", \r
-function (repstrings, onlyIfMatches) {\r
-return this.makeUrlsIf (true, repstrings, onlyIfMatches);\r
-}, "java.util.Hashtable,~B");\r
-Clazz.defineMethod (c$, "makeUrlStubs", \r
-function (ids, seqstr, string, b) {\r
-var rstrings = this.replacementArgs (ids, seqstr, string);\r
-var stubs = this.makeUrlsIf (false, rstrings, b);\r
-if (stubs != null) {\r
-return  Clazz.newArray (-1, [stubs[0], stubs[1], rstrings,  Clazz.newBooleanArray (-1, [b])]);\r
-}return null;\r
-}, "~A,~A,~S,~B");\r
-Clazz.defineMethod (c$, "constructFrom", \r
-function (stubs) {\r
-var results = this.makeUrlsIf (true, stubs[2], (stubs[3])[0]);\r
-return (results[3])[0];\r
-}, "~A");\r
-Clazz.defineMethod (c$, "makeUrlsIf", \r
-function (createFullUrl, repstrings, onlyIfMatches) {\r
-var pass = 0;\r
-var idseq =  new Array (this.mtch.length);\r
-var mins = 0;\r
-var maxs = 0;\r
-for (var i = 0; i < this.mtch.length; i++) {\r
-idseq[i] = repstrings.get (this.mtch[i]);\r
-if (idseq[i].length >= 1) {\r
-if (mins == 0 && idseq[i].length == 1) {\r
-mins = 1;\r
-}if (maxs < 2) {\r
-maxs = idseq[i].length;\r
-} else {\r
-if (maxs != idseq[i].length) {\r
-throw  new Error (jalview.util.MessageManager.formatMessage ("error.cannot_have_mixed_length_replacement_vectors",  Clazz.newArray (-1, [(this.mtch[i]), Integer.$valueOf (idseq[i].length).toString (), Integer.$valueOf (maxs).toString ()])));\r
-}}} else {\r
-throw  new Error (jalview.util.MessageManager.getString ("error.cannot_have_zero_length_vector_replacement_strings"));\r
-}}\r
-var matched =  new Array (idseq.length);\r
-var rgxs =  new Array (matched.length);\r
-for (pass = 0; pass < matched.length; pass++) {\r
-matched[pass] =  new StringBuffer ();\r
-if (this.regexReplace[pass] != null) {\r
-rgxs[pass] = jalview.jsdev.RegExp.perlCode ("/" + this.regexReplace[pass] + "/");\r
-} else {\r
-rgxs[pass] = null;\r
-}}\r
-var urllength = this.url_prefix.length;\r
-for (pass = 0; pass < matched.length; pass++) {\r
-urllength += this.url_suffix[pass].length;\r
-}\r
-var thismatched =  Clazz.newBooleanArray (maxs, false);\r
-var seqsmatched = 0;\r
-for (var sq = 0; sq < maxs; sq++) {\r
-thismatched[sq] = false;\r
-var thematches =  new Array (rgxs.length);\r
-for (pass = 0; pass < rgxs.length; pass++) {\r
-thematches[pass] =  new StringBuffer ();\r
-if (idseq[pass].length <= sq) {\r
-continue;\r
-}if (rgxs[pass] != null) {\r
-var rg = rgxs[pass];\r
-var rematchat = 0;\r
-while (rg.searchFrom (idseq[pass][sq], rematchat)) {\r
-rematchat = rg.matchedTo ();\r
-thismatched[sq] = new Boolean (thismatched[sq] | true).valueOf ();\r
-urllength += rg.charsMatched ();\r
-if ((urllength + 32) > jalview.util.Platform.getMaxCommandLineLength ()) {\r
-throw Clazz.innerTypeInstance (jalview.util.GroupUrlLink.UrlStringTooLongException, this, null, urllength);\r
-}if (!createFullUrl) {\r
-continue;\r
-}var ns = rg.numSubs ();\r
-if (ns == 0) {\r
-thematches[pass].append (rg.stringMatched ());\r
-} else {\r
-var subs =  new StringBuffer ();\r
-var s = 0;\r
-while (s <= ns) {\r
-if (s + 1 <= ns && rg.matchedToI (s) > -1 && rg.matchedToI (s + 1) > -1 && rg.matchedToI (s + 1) < rg.matchedToI (s)) {\r
-var r = s + 1;\r
-var rmtch =  new StringBuffer ();\r
-while (r <= ns && rg.matchedToI (r) <= rg.matchedToI (s)) {\r
-if (rg.matchedFromI (r) > -1) {\r
-rmtch.append (rg.stringMatchedI (r));\r
-}r++;\r
-}\r
-if (rmtch.length () > 0) {\r
-subs.append (rmtch);\r
-}s = r;\r
-} else {\r
-if (rg.matchedFromI (s) > -1) {\r
-subs.append (rg.stringMatchedI (s));\r
-}s++;\r
-}}\r
-thematches[pass].append (subs);\r
-}}\r
-} else {\r
-if (!onlyIfMatches) {\r
-thismatched[sq] = new Boolean (thismatched[sq] | true).valueOf ();\r
-urllength += idseq[pass][sq].length;\r
-if (createFullUrl) {\r
-thematches[pass] =  new StringBuffer (idseq[pass][sq]);\r
-}}}}\r
-if (thismatched[sq]) {\r
-if (createFullUrl) {\r
-for (pass = 0; pass < matched.length; pass++) {\r
-if (idseq[pass].length > 1 && matched[pass].length () > 0) {\r
-matched[pass].append (this.separators[pass]);\r
-}matched[pass].append (thematches[pass]);\r
-}\r
-}seqsmatched++;\r
-}}\r
-if (seqsmatched == 0 || (createFullUrl && matched[0].length () == 0)) {\r
-return null;\r
-}if ((urllength + 32) > jalview.util.Platform.getMaxCommandLineLength ()) {\r
-throw Clazz.innerTypeInstance (jalview.util.GroupUrlLink.UrlStringTooLongException, this, null, urllength);\r
-}if (!createFullUrl) {\r
-return  Clazz.newArray (-1, [ Clazz.newIntArray (-1, [seqsmatched]), thismatched]);\r
-}var submiturl =  new StringBuffer ();\r
-submiturl.append (this.url_prefix);\r
-for (pass = 0; pass < matched.length; pass++) {\r
-submiturl.append (matched[pass]);\r
-if (this.url_suffix[pass] != null) {\r
-submiturl.append (this.url_suffix[pass]);\r
-}}\r
-return  Clazz.newArray (-1, [ Clazz.newIntArray (-1, [seqsmatched]), thismatched, matched,  Clazz.newArray (-1, [submiturl.toString ()])]);\r
-}, "~B,java.util.Hashtable,~B");\r
-Clazz.defineMethod (c$, "getNumberInvolved", \r
-function (urlstub) {\r
-return (urlstub[0])[0];\r
-}, "~A");\r
-Clazz.defineMethod (c$, "getGroupURLType", \r
-function () {\r
-var r = 0;\r
-for (var pass = 0; pass < jalview.util.GroupUrlLink.tokens.length; pass++) {\r
-for (var i = 0; i < this.mtch.length; i++) {\r
-if (this.mtch[i].equals (jalview.util.GroupUrlLink.tokens[pass])) {\r
-r += 1 << pass;\r
-}}\r
-}\r
-return r;\r
-});\r
-Clazz.overrideMethod (c$, "toString", \r
-function () {\r
-var result =  new StringBuffer ();\r
-result.append (this.label + "|" + this.url_prefix);\r
-var r;\r
-for (r = 0; r < this.url_suffix.length; r++) {\r
-result.append ("$");\r
-result.append (this.mtch[r]);\r
-if (this.regexReplace[r] != null) {\r
-result.append ("=/");\r
-result.append (this.regexReplace[r]);\r
-result.append ("/=");\r
-}result.append ("$");\r
-result.append (this.url_suffix[r]);\r
-}\r
-for (r = 0; r < this.separators.length; r++) {\r
-result.append ("|");\r
-result.append (this.separators[r]);\r
-}\r
-return result.toString ();\r
-});\r
-c$.formStrings = Clazz.defineMethod (c$, "formStrings", \r
-function (seqs) {\r
-var idset =  Clazz.newArray (2, seqs.length, null);\r
-for (var i = 0; i < seqs.length; i++) {\r
-idset[0][i] = seqs[i].getName ();\r
-idset[1][i] = seqs[i].getSequenceAsString ();\r
-}\r
-return idset;\r
-}, "~A");\r
-Clazz.defineMethod (c$, "setLabel", \r
-function (newlabel) {\r
-this.label = newlabel;\r
-}, "~S");\r
-c$.$GroupUrlLink$UrlStringTooLongException$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.decorateAsClass (function () {\r
-Clazz.prepareCallback (this, arguments);\r
-this.urlLength = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.util.GroupUrlLink, "UrlStringTooLongException", Exception);\r
-Clazz.makeConstructor (c$, \r
-function (a) {\r
-Clazz.superConstructor (this, jalview.util.GroupUrlLink.UrlStringTooLongException, []);\r
-this.urlLength = a;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "toString", \r
-function () {\r
-return "Generated url is estimated to be too long (" + this.urlLength + ")";\r
-});\r
-c$ = Clazz.p0p ();\r
-};\r
-Clazz.defineStatics (c$,\r
-"tokens", null);\r
-{\r
-if (jalview.util.GroupUrlLink.tokens == null) {\r
-jalview.util.GroupUrlLink.tokens =  Clazz.newArray (-1, ["SEQUENCEIDS", "SEQUENCES", "DATASETID"]);\r
-}}Clazz.defineStatics (c$,\r
-"SEQUENCEIDS", 1,\r
-"SEQUENCES", 2,\r
-"DATASETID", 4);\r
-});\r
+Clazz.declarePackage ("jalview.util");
+Clazz.load (["java.lang.Exception"], "jalview.util.GroupUrlLink", ["jalview.jsdev.RegExp", "jalview.util.MessageManager", "$.Platform", "$.QuickSort", "java.lang.Error", "$.StringBuffer", "java.util.Hashtable"], function () {
+c$ = Clazz.decorateAsClass (function () {
+if (!Clazz.isClassDefined ("jalview.util.GroupUrlLink.UrlStringTooLongException")) {
+jalview.util.GroupUrlLink.$GroupUrlLink$UrlStringTooLongException$ ();
+}
+this.url_prefix = null;
+this.target = null;
+this.label = null;
+this.url_suffix = null;
+this.separators = null;
+this.regexReplace = null;
+this.invalidMessage = null;
+this.segs = null;
+this.mtch = null;
+Clazz.instantialize (this, arguments);
+}, jalview.util, "GroupUrlLink");
+Clazz.makeConstructor (c$, 
+function (link) {
+var sep = link.indexOf ("|");
+this.segs =  Clazz.newIntArray (jalview.util.GroupUrlLink.tokens.length, 0);
+var ntoks = 0;
+for (var i = 0; i < this.segs.length; i++) {
+if ((this.segs[i] = link.indexOf ("$" + jalview.util.GroupUrlLink.tokens[i])) > -1) {
+ntoks++;
+}}
+if (ntoks == 0) {
+this.invalidMessage = "Group URL string must contain at least one of ";
+for (var i = 0; i < this.segs.length; i++) {
+this.invalidMessage += " '$" + jalview.util.GroupUrlLink.tokens[i] + "[=/regex=/]$'";
+}
+return;
+}var ptok =  Clazz.newIntArray (ntoks + 1, 0);
+var tmtch =  new Array (ntoks + 1);
+this.mtch =  new Array (ntoks);
+for (var i = 0, t = 0; i < this.segs.length; i++) {
+if (this.segs[i] > -1) {
+ptok[t] = this.segs[i];
+tmtch[t++] = jalview.util.GroupUrlLink.tokens[i];
+}}
+ptok[ntoks] = link.length;
+tmtch[ntoks] = "$$$$$$$$$";
+jalview.util.QuickSort.sortInt (ptok, tmtch);
+for (var i = 0; i < ntoks; i++) {
+this.mtch[i] = tmtch[i];
+}
+var p = sep;
+do {
+sep = p;
+p = link.indexOf ("|", sep + 1);
+} while (p > sep && p < ptok[0]);
+this.label = link.substring (0, sep);
+if (this.label.indexOf ("|") > -1) {
+this.target = this.label.substring (0, this.label.indexOf ("|"));
+} else if (this.label.indexOf (" ") > 2) {
+this.target = this.label.substring (0, this.label.indexOf (" "));
+} else {
+this.target = this.label;
+}this.url_prefix = link.substring (sep + 1, ptok[0]);
+this.url_suffix =  new Array (this.mtch.length);
+this.regexReplace =  new Array (this.mtch.length);
+for (var pass = 0; pass < this.mtch.length; pass++) {
+var mlength = 3 + this.mtch[pass].length;
+if (link.indexOf ("$" + this.mtch[pass] + "=/") == ptok[pass] && (p = link.indexOf ("/=$", ptok[pass] + mlength)) > ptok[pass] + mlength) {
+if (ptok[pass + 1] < p + 3) {
+this.invalidMessage = "Token regexes cannot contain other regexes (did you terminate the $" + this.mtch[pass] + " regex with a '/=$' ?";
+return;
+}this.url_suffix[pass] = link.substring (p + 3, ptok[pass + 1]);
+this.regexReplace[pass] = link.substring (ptok[pass] + mlength, p);
+try {
+var rg = jalview.jsdev.RegExp.perlCode ("/" + this.regexReplace[pass] + "/");
+if (rg == null) {
+this.invalidMessage = "Invalid Regular Expression : '" + this.regexReplace[pass] + "'\n";
+}} catch (e) {
+if (Clazz.exceptionOf (e, Exception)) {
+this.invalidMessage = "Invalid Regular Expression : '" + this.regexReplace[pass] + "'\n";
+} else {
+throw e;
+}
+}
+} else {
+this.regexReplace[pass] = null;
+if ((p = link.indexOf ("$" + this.mtch[pass] + "$")) == ptok[pass]) {
+this.url_suffix[pass] = link.substring (p + this.mtch[pass].length + 2, ptok[pass + 1]);
+} else {
+this.invalidMessage = "Warning: invalid regex structure (after '" + this.mtch[0] + "') for URL link : " + link;
+}}}
+var pass = 0;
+this.separators =  new Array (this.url_suffix.length);
+var suffices = this.url_suffix[this.url_suffix.length - 1];
+var lastsep = ",";
+while ((p = suffices.indexOf ('|')) > -1) {
+this.separators[pass] = suffices.substring (p + 1);
+if (pass == 0) {
+this.url_suffix[this.url_suffix.length - 1] = suffices.substring (0, p);
+} else {
+lastsep = (this.separators[pass - 1] = this.separators[pass - 1].substring (0, p));
+}suffices = this.separators[pass];
+pass++;
+}
+if (pass > 0) {
+lastsep = this.separators[pass - 1];
+}while (pass < this.separators.length) {
+this.separators[pass++] = lastsep;
+}
+}, "~S");
+Clazz.defineMethod (c$, "getUrl_suffix", 
+function () {
+return this.url_suffix[this.url_suffix.length - 1];
+});
+Clazz.defineMethod (c$, "getUrl_prefix", 
+function () {
+return this.url_prefix;
+});
+Clazz.defineMethod (c$, "getTarget", 
+function () {
+return this.target;
+});
+Clazz.defineMethod (c$, "getLabel", 
+function () {
+return this.label;
+});
+Clazz.defineMethod (c$, "getIDRegexReplace", 
+function () {
+return this._replaceFor (jalview.util.GroupUrlLink.tokens[0]);
+});
+Clazz.defineMethod (c$, "_replaceFor", 
+ function (token) {
+for (var i = 0; i < this.mtch.length; i++) {
+if (this.segs[i] > -1 && this.mtch[i].equals (token)) {
+return this.regexReplace[i];
+}}
+return null;
+}, "~S");
+Clazz.defineMethod (c$, "getSeqRegexReplace", 
+function () {
+return this._replaceFor (jalview.util.GroupUrlLink.tokens[1]);
+});
+Clazz.defineMethod (c$, "getInvalidMessage", 
+function () {
+return this.invalidMessage;
+});
+Clazz.defineMethod (c$, "isValid", 
+function () {
+return this.invalidMessage == null;
+});
+Clazz.defineMethod (c$, "makeUrls", 
+function (idstrings, seqstrings, dsstring, onlyIfMatches) {
+var rstrings = this.replacementArgs (idstrings, seqstrings, dsstring);
+return this.makeUrls (rstrings, onlyIfMatches);
+}, "~A,~A,~S,~B");
+Clazz.defineMethod (c$, "replacementArgs", 
+ function (idstrings, seqstrings, dsstring) {
+var rstrings =  new java.util.Hashtable ();
+rstrings.put (jalview.util.GroupUrlLink.tokens[0], idstrings);
+rstrings.put (jalview.util.GroupUrlLink.tokens[1], seqstrings);
+rstrings.put (jalview.util.GroupUrlLink.tokens[2],  Clazz.newArray (-1, [dsstring]));
+if (idstrings.length != seqstrings.length) {
+throw  new Error (jalview.util.MessageManager.getString ("error.idstring_seqstrings_only_one_per_sequence"));
+}return rstrings;
+}, "~A,~A,~S");
+Clazz.defineMethod (c$, "makeUrls", 
+function (repstrings, onlyIfMatches) {
+return this.makeUrlsIf (true, repstrings, onlyIfMatches);
+}, "java.util.Hashtable,~B");
+Clazz.defineMethod (c$, "makeUrlStubs", 
+function (ids, seqstr, string, b) {
+var rstrings = this.replacementArgs (ids, seqstr, string);
+var stubs = this.makeUrlsIf (false, rstrings, b);
+if (stubs != null) {
+return  Clazz.newArray (-1, [stubs[0], stubs[1], rstrings,  Clazz.newBooleanArray (-1, [b])]);
+}return null;
+}, "~A,~A,~S,~B");
+Clazz.defineMethod (c$, "constructFrom", 
+function (stubs) {
+var results = this.makeUrlsIf (true, stubs[2], (stubs[3])[0]);
+return (results[3])[0];
+}, "~A");
+Clazz.defineMethod (c$, "makeUrlsIf", 
+function (createFullUrl, repstrings, onlyIfMatches) {
+var pass = 0;
+var idseq =  new Array (this.mtch.length);
+var mins = 0;
+var maxs = 0;
+for (var i = 0; i < this.mtch.length; i++) {
+idseq[i] = repstrings.get (this.mtch[i]);
+if (idseq[i].length >= 1) {
+if (mins == 0 && idseq[i].length == 1) {
+mins = 1;
+}if (maxs < 2) {
+maxs = idseq[i].length;
+} else {
+if (maxs != idseq[i].length) {
+throw  new Error (jalview.util.MessageManager.formatMessage ("error.cannot_have_mixed_length_replacement_vectors",  Clazz.newArray (-1, [(this.mtch[i]), Integer.$valueOf (idseq[i].length).toString (), Integer.$valueOf (maxs).toString ()])));
+}}} else {
+throw  new Error (jalview.util.MessageManager.getString ("error.cannot_have_zero_length_vector_replacement_strings"));
+}}
+var matched =  new Array (idseq.length);
+var rgxs =  new Array (matched.length);
+for (pass = 0; pass < matched.length; pass++) {
+matched[pass] =  new StringBuffer ();
+if (this.regexReplace[pass] != null) {
+rgxs[pass] = jalview.jsdev.RegExp.perlCode ("/" + this.regexReplace[pass] + "/");
+} else {
+rgxs[pass] = null;
+}}
+var urllength = this.url_prefix.length;
+for (pass = 0; pass < matched.length; pass++) {
+urllength += this.url_suffix[pass].length;
+}
+var thismatched =  Clazz.newBooleanArray (maxs, false);
+var seqsmatched = 0;
+for (var sq = 0; sq < maxs; sq++) {
+thismatched[sq] = false;
+var thematches =  new Array (rgxs.length);
+for (pass = 0; pass < rgxs.length; pass++) {
+thematches[pass] =  new StringBuffer ();
+if (idseq[pass].length <= sq) {
+continue;
+}if (rgxs[pass] != null) {
+var rg = rgxs[pass];
+var rematchat = 0;
+while (rg.searchFrom (idseq[pass][sq], rematchat)) {
+rematchat = rg.matchedTo ();
+thismatched[sq] = new Boolean (thismatched[sq] | true).valueOf ();
+urllength += rg.charsMatched ();
+if ((urllength + 32) > jalview.util.Platform.getMaxCommandLineLength ()) {
+throw Clazz.innerTypeInstance (jalview.util.GroupUrlLink.UrlStringTooLongException, this, null, urllength);
+}if (!createFullUrl) {
+continue;
+}var ns = rg.numSubs ();
+if (ns == 0) {
+thematches[pass].append (rg.stringMatched ());
+} else {
+var subs =  new StringBuffer ();
+var s = 0;
+while (s <= ns) {
+if (s + 1 <= ns && rg.matchedToI (s) > -1 && rg.matchedToI (s + 1) > -1 && rg.matchedToI (s + 1) < rg.matchedToI (s)) {
+var r = s + 1;
+var rmtch =  new StringBuffer ();
+while (r <= ns && rg.matchedToI (r) <= rg.matchedToI (s)) {
+if (rg.matchedFromI (r) > -1) {
+rmtch.append (rg.stringMatchedI (r));
+}r++;
+}
+if (rmtch.length () > 0) {
+subs.append (rmtch);
+}s = r;
+} else {
+if (rg.matchedFromI (s) > -1) {
+subs.append (rg.stringMatchedI (s));
+}s++;
+}}
+thematches[pass].append (subs);
+}}
+} else {
+if (!onlyIfMatches) {
+thismatched[sq] = new Boolean (thismatched[sq] | true).valueOf ();
+urllength += idseq[pass][sq].length;
+if (createFullUrl) {
+thematches[pass] =  new StringBuffer (idseq[pass][sq]);
+}}}}
+if (thismatched[sq]) {
+if (createFullUrl) {
+for (pass = 0; pass < matched.length; pass++) {
+if (idseq[pass].length > 1 && matched[pass].length () > 0) {
+matched[pass].append (this.separators[pass]);
+}matched[pass].append (thematches[pass]);
+}
+}seqsmatched++;
+}}
+if (seqsmatched == 0 || (createFullUrl && matched[0].length () == 0)) {
+return null;
+}if ((urllength + 32) > jalview.util.Platform.getMaxCommandLineLength ()) {
+throw Clazz.innerTypeInstance (jalview.util.GroupUrlLink.UrlStringTooLongException, this, null, urllength);
+}if (!createFullUrl) {
+return  Clazz.newArray (-1, [ Clazz.newIntArray (-1, [seqsmatched]), thismatched]);
+}var submiturl =  new StringBuffer ();
+submiturl.append (this.url_prefix);
+for (pass = 0; pass < matched.length; pass++) {
+submiturl.append (matched[pass]);
+if (this.url_suffix[pass] != null) {
+submiturl.append (this.url_suffix[pass]);
+}}
+return  Clazz.newArray (-1, [ Clazz.newIntArray (-1, [seqsmatched]), thismatched, matched,  Clazz.newArray (-1, [submiturl.toString ()])]);
+}, "~B,java.util.Hashtable,~B");
+Clazz.defineMethod (c$, "getNumberInvolved", 
+function (urlstub) {
+return (urlstub[0])[0];
+}, "~A");
+Clazz.defineMethod (c$, "getGroupURLType", 
+function () {
+var r = 0;
+for (var pass = 0; pass < jalview.util.GroupUrlLink.tokens.length; pass++) {
+for (var i = 0; i < this.mtch.length; i++) {
+if (this.mtch[i].equals (jalview.util.GroupUrlLink.tokens[pass])) {
+r += 1 << pass;
+}}
+}
+return r;
+});
+Clazz.overrideMethod (c$, "toString", 
+function () {
+var result =  new StringBuffer ();
+result.append (this.label + "|" + this.url_prefix);
+var r;
+for (r = 0; r < this.url_suffix.length; r++) {
+result.append ("$");
+result.append (this.mtch[r]);
+if (this.regexReplace[r] != null) {
+result.append ("=/");
+result.append (this.regexReplace[r]);
+result.append ("/=");
+}result.append ("$");
+result.append (this.url_suffix[r]);
+}
+for (r = 0; r < this.separators.length; r++) {
+result.append ("|");
+result.append (this.separators[r]);
+}
+return result.toString ();
+});
+c$.formStrings = Clazz.defineMethod (c$, "formStrings", 
+function (seqs) {
+var idset =  Clazz.newArray (2, seqs.length, null);
+for (var i = 0; i < seqs.length; i++) {
+idset[0][i] = seqs[i].getName ();
+idset[1][i] = seqs[i].getSequenceAsString ();
+}
+return idset;
+}, "~A");
+Clazz.defineMethod (c$, "setLabel", 
+function (newlabel) {
+this.label = newlabel;
+}, "~S");
+c$.$GroupUrlLink$UrlStringTooLongException$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.decorateAsClass (function () {
+Clazz.prepareCallback (this, arguments);
+this.urlLength = 0;
+Clazz.instantialize (this, arguments);
+}, jalview.util.GroupUrlLink, "UrlStringTooLongException", Exception);
+Clazz.makeConstructor (c$, 
+function (a) {
+Clazz.superConstructor (this, jalview.util.GroupUrlLink.UrlStringTooLongException, []);
+this.urlLength = a;
+}, "~N");
+Clazz.overrideMethod (c$, "toString", 
+function () {
+return "Generated url is estimated to be too long (" + this.urlLength + ")";
+});
+c$ = Clazz.p0p ();
+};
+Clazz.defineStatics (c$,
+"tokens", null);
+{
+if (jalview.util.GroupUrlLink.tokens == null) {
+jalview.util.GroupUrlLink.tokens =  Clazz.newArray (-1, ["SEQUENCEIDS", "SEQUENCES", "DATASETID"]);
+}}Clazz.defineStatics (c$,
+"SEQUENCEIDS", 1,
+"SEQUENCES", 2,
+"DATASETID", 4);
+});