X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fcom%2Fstevesoft%2Fpat%2FTransformer.js;h=25ef39f7f7523136bc983a69ad4170c0755bb0e2;hp=3d169f94c595b6ce4e7088ffac82f60c2f723b42;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/j2s/com/stevesoft/pat/Transformer.js b/site/j2s/com/stevesoft/pat/Transformer.js index 3d169f9..25ef39f 100644 --- a/site/j2s/com/stevesoft/pat/Transformer.js +++ b/site/j2s/com/stevesoft/pat/Transformer.js @@ -1,130 +1,130 @@ -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"); -}); +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"); +});