Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / com / stevesoft / pat / Transformer.js
index 3d169f9..25ef39f 100644 (file)
-Clazz.declarePackage ("com.stevesoft.pat");\r
-Clazz.load (["com.stevesoft.pat.ReplaceRule", "$.Replacer"], ["com.stevesoft.pat.Transformer", "$.TransRepRule"], ["com.stevesoft.pat.MessageManager", "$.Regex", "$.TransPat", "com.stevesoft.pat.wrap.StringWrap", "java.lang.ArrayIndexOutOfBoundsException", "$.NullPointerException"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.t = null;\r
-Clazz.instantialize (this, arguments);\r
-}, com.stevesoft.pat, "TransRepRule", com.stevesoft.pat.ReplaceRule);\r
-Clazz.makeConstructor (c$, \r
-function (t) {\r
-Clazz.superConstructor (this, com.stevesoft.pat.TransRepRule, []);\r
-this.t = t;\r
-}, "com.stevesoft.pat.Transformer");\r
-Clazz.overrideMethod (c$, "toString1", \r
-function () {\r
-return "";\r
-});\r
-Clazz.overrideMethod (c$, "clone1", \r
-function () {\r
-return  new com.stevesoft.pat.TransRepRule (this.t);\r
-});\r
-Clazz.overrideMethod (c$, "apply", \r
-function (sb, rr) {\r
-this.next = this.t.tp.ra[this.t.tp.pn].getReplaceRule ();\r
-}, "com.stevesoft.pat.StringBufferLike,com.stevesoft.pat.RegRes");\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.tp = null;\r
-this.rp = null;\r
-this.auto_optimize = false;\r
-this.repr = null;\r
-Clazz.instantialize (this, arguments);\r
-}, com.stevesoft.pat, "Transformer");\r
-Clazz.prepareFields (c$, function () {\r
-this.repr =  new com.stevesoft.pat.Replacer ();\r
-});\r
-Clazz.defineMethod (c$, "getReplacer", \r
-function () {\r
-return this.rp.getReplacer ();\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (auto) {\r
-this.rp =  new com.stevesoft.pat.Regex (null, "");\r
-this.auto_optimize = auto;\r
-this.tp =  new com.stevesoft.pat.TransPat ();\r
-this.rp.setReplaceRule ( new com.stevesoft.pat.TransRepRule (this));\r
-this.rp.thePattern = this.tp;\r
-}, "~B");\r
-Clazz.defineMethod (c$, "add", \r
-function (r) {\r
-if (this.auto_optimize) {\r
-r.optimize ();\r
-}this.tp.ra[this.tp.ra_len++] = r;\r
-if (this.tp.ra.length == this.tp.ra_len) {\r
-var ra2 =  new Array (this.tp.ra_len + 10);\r
-for (var i = 0; i < this.tp.ra_len; i++) {\r
-ra2[i] = this.tp.ra[i];\r
-}\r
-this.tp.ra = ra2;\r
-}this.rp.numSubs_ = r.numSubs_ > this.rp.numSubs_ ? r.numSubs_ : this.rp.numSubs_;\r
-}, "com.stevesoft.pat.Regex");\r
-Clazz.defineMethod (c$, "patterns", \r
-function () {\r
-return this.tp.ra_len;\r
-});\r
-Clazz.defineMethod (c$, "getRegexAt", \r
-function (i) {\r
-if (i >= this.tp.ra_len) {\r
-throw  new ArrayIndexOutOfBoundsException ("i=" + i + ">=" + this.patterns ());\r
-}if (i < 0) {\r
-throw  new ArrayIndexOutOfBoundsException ("i=" + i + "< 0");\r
-}return this.tp.ra[i];\r
-}, "~N");\r
-Clazz.defineMethod (c$, "setRegexAt", \r
-function (rx, i) {\r
-if (i >= this.tp.ra_len) {\r
-throw  new ArrayIndexOutOfBoundsException ("i=" + i + ">=" + this.patterns ());\r
-}if (i < 0) {\r
-throw  new ArrayIndexOutOfBoundsException ("i=" + i + "< 0");\r
-}this.tp.ra[i] = rx;\r
-}, "com.stevesoft.pat.Regex,~N");\r
-Clazz.defineMethod (c$, "add", \r
-function (rs) {\r
-var r = com.stevesoft.pat.Regex.perlCode (rs);\r
-if (r == null) {\r
-throw  new NullPointerException (com.stevesoft.pat.MessageManager.formatMessage ("exception.bad_pattern_to_regex_perl_code",  Clazz.newArray (-1, [rs])));\r
-}this.add (r);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "add", \r
-function (array) {\r
-for (var i = 0; i < array.length; i++) {\r
-this.add (array[i]);\r
-}\r
-}, "~A");\r
-Clazz.defineMethod (c$, "replaceAll", \r
-function (s) {\r
-return this.dorep (s, 0, s.length);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "replaceAll", \r
-function (s) {\r
-return this.dorep (s, 0, s.length ());\r
-}, "com.stevesoft.pat.StringLike");\r
-Clazz.defineMethod (c$, "replaceAllFrom", \r
-function (s, start) {\r
-return this.dorep (s, start, s.length);\r
-}, "~S,~N");\r
-Clazz.defineMethod (c$, "replaceAllRegion", \r
-function (s, start, end) {\r
-return this.dorep (s, start, end);\r
-}, "~S,~N,~N");\r
-Clazz.defineMethod (c$, "dorep", \r
-function (s, start, end) {\r
-var tfmd = this.repr.replaceAllRegion (s, this.rp, start, end);\r
-this.tp.lastMatchedTo = this.repr.$lastMatchedTo;\r
-return tfmd;\r
-}, "com.stevesoft.pat.StringLike,~N,~N");\r
-Clazz.defineMethod (c$, "dorep", \r
-function (s, start, end) {\r
-return this.dorep ( new com.stevesoft.pat.wrap.StringWrap (s), start, end).toString ();\r
-}, "~S,~N,~N");\r
-Clazz.defineMethod (c$, "replaceFirst", \r
-function (s) {\r
-return this.dorep (s, 0, s.length);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "replaceFirstFrom", \r
-function (s, start) {\r
-return this.dorep (s, start, s.length);\r
-}, "~S,~N");\r
-Clazz.defineMethod (c$, "replaceFirstRegion", \r
-function (s, start, end) {\r
-return this.dorep (s, start, end);\r
-}, "~S,~N,~N");\r
-});\r
+Clazz.declarePackage ("com.stevesoft.pat");
+Clazz.load (["com.stevesoft.pat.ReplaceRule", "$.Replacer"], ["com.stevesoft.pat.Transformer", "$.TransRepRule"], ["com.stevesoft.pat.MessageManager", "$.Regex", "$.TransPat", "com.stevesoft.pat.wrap.StringWrap", "java.lang.ArrayIndexOutOfBoundsException", "$.NullPointerException"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.t = null;
+Clazz.instantialize (this, arguments);
+}, com.stevesoft.pat, "TransRepRule", com.stevesoft.pat.ReplaceRule);
+Clazz.makeConstructor (c$, 
+function (t) {
+Clazz.superConstructor (this, com.stevesoft.pat.TransRepRule, []);
+this.t = t;
+}, "com.stevesoft.pat.Transformer");
+Clazz.overrideMethod (c$, "toString1", 
+function () {
+return "";
+});
+Clazz.overrideMethod (c$, "clone1", 
+function () {
+return  new com.stevesoft.pat.TransRepRule (this.t);
+});
+Clazz.overrideMethod (c$, "apply", 
+function (sb, rr) {
+this.next = this.t.tp.ra[this.t.tp.pn].getReplaceRule ();
+}, "com.stevesoft.pat.StringBufferLike,com.stevesoft.pat.RegRes");
+c$ = Clazz.decorateAsClass (function () {
+this.tp = null;
+this.rp = null;
+this.auto_optimize = false;
+this.repr = null;
+Clazz.instantialize (this, arguments);
+}, com.stevesoft.pat, "Transformer");
+Clazz.prepareFields (c$, function () {
+this.repr =  new com.stevesoft.pat.Replacer ();
+});
+Clazz.defineMethod (c$, "getReplacer", 
+function () {
+return this.rp.getReplacer ();
+});
+Clazz.makeConstructor (c$, 
+function (auto) {
+this.rp =  new com.stevesoft.pat.Regex (null, "");
+this.auto_optimize = auto;
+this.tp =  new com.stevesoft.pat.TransPat ();
+this.rp.setReplaceRule ( new com.stevesoft.pat.TransRepRule (this));
+this.rp.thePattern = this.tp;
+}, "~B");
+Clazz.defineMethod (c$, "add", 
+function (r) {
+if (this.auto_optimize) {
+r.optimize ();
+}this.tp.ra[this.tp.ra_len++] = r;
+if (this.tp.ra.length == this.tp.ra_len) {
+var ra2 =  new Array (this.tp.ra_len + 10);
+for (var i = 0; i < this.tp.ra_len; i++) {
+ra2[i] = this.tp.ra[i];
+}
+this.tp.ra = ra2;
+}this.rp.numSubs_ = r.numSubs_ > this.rp.numSubs_ ? r.numSubs_ : this.rp.numSubs_;
+}, "com.stevesoft.pat.Regex");
+Clazz.defineMethod (c$, "patterns", 
+function () {
+return this.tp.ra_len;
+});
+Clazz.defineMethod (c$, "getRegexAt", 
+function (i) {
+if (i >= this.tp.ra_len) {
+throw  new ArrayIndexOutOfBoundsException ("i=" + i + ">=" + this.patterns ());
+}if (i < 0) {
+throw  new ArrayIndexOutOfBoundsException ("i=" + i + "< 0");
+}return this.tp.ra[i];
+}, "~N");
+Clazz.defineMethod (c$, "setRegexAt", 
+function (rx, i) {
+if (i >= this.tp.ra_len) {
+throw  new ArrayIndexOutOfBoundsException ("i=" + i + ">=" + this.patterns ());
+}if (i < 0) {
+throw  new ArrayIndexOutOfBoundsException ("i=" + i + "< 0");
+}this.tp.ra[i] = rx;
+}, "com.stevesoft.pat.Regex,~N");
+Clazz.defineMethod (c$, "add", 
+function (rs) {
+var r = com.stevesoft.pat.Regex.perlCode (rs);
+if (r == null) {
+throw  new NullPointerException (com.stevesoft.pat.MessageManager.formatMessage ("exception.bad_pattern_to_regex_perl_code",  Clazz.newArray (-1, [rs])));
+}this.add (r);
+}, "~S");
+Clazz.defineMethod (c$, "add", 
+function (array) {
+for (var i = 0; i < array.length; i++) {
+this.add (array[i]);
+}
+}, "~A");
+Clazz.defineMethod (c$, "replaceAll", 
+function (s) {
+return this.dorep (s, 0, s.length);
+}, "~S");
+Clazz.defineMethod (c$, "replaceAll", 
+function (s) {
+return this.dorep (s, 0, s.length ());
+}, "com.stevesoft.pat.StringLike");
+Clazz.defineMethod (c$, "replaceAllFrom", 
+function (s, start) {
+return this.dorep (s, start, s.length);
+}, "~S,~N");
+Clazz.defineMethod (c$, "replaceAllRegion", 
+function (s, start, end) {
+return this.dorep (s, start, end);
+}, "~S,~N,~N");
+Clazz.defineMethod (c$, "dorep", 
+function (s, start, end) {
+var tfmd = this.repr.replaceAllRegion (s, this.rp, start, end);
+this.tp.lastMatchedTo = this.repr.$lastMatchedTo;
+return tfmd;
+}, "com.stevesoft.pat.StringLike,~N,~N");
+Clazz.defineMethod (c$, "dorep", 
+function (s, start, end) {
+return this.dorep ( new com.stevesoft.pat.wrap.StringWrap (s), start, end).toString ();
+}, "~S,~N,~N");
+Clazz.defineMethod (c$, "replaceFirst", 
+function (s) {
+return this.dorep (s, 0, s.length);
+}, "~S");
+Clazz.defineMethod (c$, "replaceFirstFrom", 
+function (s, start) {
+return this.dorep (s, start, s.length);
+}, "~S,~N");
+Clazz.defineMethod (c$, "replaceFirstRegion", 
+function (s, start, end) {
+return this.dorep (s, start, end);
+}, "~S,~N,~N");
+});