X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fcom%2Fstevesoft%2Fpat%2FPattern.js;h=a3dddd41b476ce230633d08ff7af71252171259c;hp=a4dc10b222ef0401681872a56c70035efd6fe22e;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/j2s/com/stevesoft/pat/Pattern.js b/site/j2s/com/stevesoft/pat/Pattern.js index a4dc10b..a3dddd4 100644 --- a/site/j2s/com/stevesoft/pat/Pattern.js +++ b/site/j2s/com/stevesoft/pat/Pattern.js @@ -1,153 +1,153 @@ -Clazz.declarePackage ("com.stevesoft.pat"); -Clazz.load (null, "com.stevesoft.pat.Pattern", ["com.stevesoft.pat.MessageManager", "$.patInf", "$.patInt", "java.lang.Error", "$.StringBuffer"], function () { -c$ = Clazz.decorateAsClass (function () { -this.next = null; -this.parent = null; -this.mfrom = 0; -Clazz.instantialize (this, arguments); -}, com.stevesoft.pat, "Pattern"); -Clazz.defineMethod (c$, "getNext", -function () { -return this.next != null ? this.next : (this.parent == null ? null : this.parent.getNext ()); -}); -Clazz.defineMethod (c$, "setParent", -function (p) { -if (this.next != null) { -this.next.setParent (p); -} else { -this.parent = p; -}}, "com.stevesoft.pat.Pattern"); -Clazz.defineMethod (c$, "nextMatch", -function (i, pt) { -var p = this.getNext (); -return p == null ? i : p.matchInternal (i, pt); -}, "~N,com.stevesoft.pat.Pthings"); -Clazz.defineMethod (c$, "nextString", -function () { -if (this.next == null) { -return ""; -}return this.next.toString (); -}); -c$.inString = Clazz.defineMethod (c$, "inString", -function (c, s) { -var i; -for (i = 0; i < s.length; i++) { -if (s.charAt (i) == c) { -return true; -}} -return false; -}, "~S,~S"); -c$.protect = Clazz.defineMethod (c$, "protect", -function (s, PROTECT_THESE, esc) { -var i; -var sb = new StringBuffer (); -var p = PROTECT_THESE + esc; -for (i = 0; i < s.length; i++) { -var c = s.charAt (i); -if (com.stevesoft.pat.Pattern.inString (c, p)) { -sb.append (esc); -}sb.append (c); -} -return sb.toString (); -}, "~S,~S,~S"); -Clazz.defineMethod (c$, "match", -function (s, pt) { -return this.matchAt (s, 0, pt); -}, "com.stevesoft.pat.StringLike,com.stevesoft.pat.Pthings"); -Clazz.defineMethod (c$, "matchAt", -function (s, i, pt) { -pt.src = s; -var r = this.matchInternal (i, pt); -if (r < 0) { -return -1; -}this.mfrom = r < i ? r + 1 : i; -return r < i ? i - r - 1 : r - i; -}, "com.stevesoft.pat.StringLike,~N,com.stevesoft.pat.Pthings"); -Clazz.defineMethod (c$, "Masked", -function (i, pt) { -return pt.cbits == null ? false : pt.cbits.get (i); -}, "~N,com.stevesoft.pat.Pthings"); -Clazz.defineMethod (c$, "add", -function (p) { -if (this.next == null) { -if (p == null) { -return this; -}this.next = p; -p.parent = this.parent; -this.parent = null; -} else { -this.next.add (p); -}return this; -}, "com.stevesoft.pat.Pattern"); -Clazz.defineMethod (c$, "minChars", -function () { -return new com.stevesoft.pat.patInt (0); -}); -Clazz.defineMethod (c$, "maxChars", -function () { -return new com.stevesoft.pat.patInf (); -}); -Clazz.defineMethod (c$, "countMinChars", -function () { -var p = this; -var sum = new com.stevesoft.pat.patInt (0); -while (p != null) { -sum.pluseq (p.minChars ()); -p = p.next; -} -return sum; -}); -Clazz.defineMethod (c$, "countMaxChars", -function () { -var p = this; -var sum = new com.stevesoft.pat.patInt (0); -while (p != null) { -sum.pluseq (p.maxChars ()); -p = p.next; -} -return sum; -}); -Clazz.defineMethod (c$, "testMatch", -function (p, pos, pt) { -var tab = null; -if (pt.marks != null) { -try { -tab = Clazz.newIntArray (pt.marks.length, 0); -for (var i = 0; i < tab.length; i++) { -tab[i] = pt.marks[i]; -} -} catch (t) { -} -}var ret = p.matchInternal (pos, pt); -if (ret < 0) { -pt.marks = tab; -}return ret; -}, "com.stevesoft.pat.Pattern,~N,com.stevesoft.pat.Pthings"); -Clazz.defineMethod (c$, "clone1", -function (h) { -throw new Error (com.stevesoft.pat.MessageManager.formatMessage ("error.no_such_method_as_clone1_for", Clazz.newArray (-1, [this.getClass ().getName ()]))); -}, "java.util.Hashtable"); -Clazz.defineMethod (c$, "clone", -function (h) { -var p = h.get (this); -if (p != null) { -return p; -}p = this.clone1 (h); -if (p == null) { -throw new Error (com.stevesoft.pat.MessageManager.getString ("error.null_from_clone1")); -}h.put (this, p); -h.put (p, p); -if (this.next != null) { -p.next = this.next.clone (h); -}if (this.parent != null) { -p.parent = this.parent.clone (h); -}return p; -}, "java.util.Hashtable"); -Clazz.overrideMethod (c$, "equals", -function (o) { -return o === this; -}, "~O"); -Clazz.defineStatics (c$, -"ESC", '\\', -"PROTECT_THESE", "[]{}(),$,-\"^."); -}); +Clazz.declarePackage ("com.stevesoft.pat"); +Clazz.load (null, "com.stevesoft.pat.Pattern", ["com.stevesoft.pat.MessageManager", "$.patInf", "$.patInt", "java.lang.Error", "$.StringBuffer"], function () { +c$ = Clazz.decorateAsClass (function () { +this.next = null; +this.parent = null; +this.mfrom = 0; +Clazz.instantialize (this, arguments); +}, com.stevesoft.pat, "Pattern"); +Clazz.defineMethod (c$, "getNext", +function () { +return this.next != null ? this.next : (this.parent == null ? null : this.parent.getNext ()); +}); +Clazz.defineMethod (c$, "setParent", +function (p) { +if (this.next != null) { +this.next.setParent (p); +} else { +this.parent = p; +}}, "com.stevesoft.pat.Pattern"); +Clazz.defineMethod (c$, "nextMatch", +function (i, pt) { +var p = this.getNext (); +return p == null ? i : p.matchInternal (i, pt); +}, "~N,com.stevesoft.pat.Pthings"); +Clazz.defineMethod (c$, "nextString", +function () { +if (this.next == null) { +return ""; +}return this.next.toString (); +}); +c$.inString = Clazz.defineMethod (c$, "inString", +function (c, s) { +var i; +for (i = 0; i < s.length; i++) { +if (s.charAt (i) == c) { +return true; +}} +return false; +}, "~S,~S"); +c$.protect = Clazz.defineMethod (c$, "protect", +function (s, PROTECT_THESE, esc) { +var i; +var sb = new StringBuffer (); +var p = PROTECT_THESE + esc; +for (i = 0; i < s.length; i++) { +var c = s.charAt (i); +if (com.stevesoft.pat.Pattern.inString (c, p)) { +sb.append (esc); +}sb.append (c); +} +return sb.toString (); +}, "~S,~S,~S"); +Clazz.defineMethod (c$, "match", +function (s, pt) { +return this.matchAt (s, 0, pt); +}, "com.stevesoft.pat.StringLike,com.stevesoft.pat.Pthings"); +Clazz.defineMethod (c$, "matchAt", +function (s, i, pt) { +pt.src = s; +var r = this.matchInternal (i, pt); +if (r < 0) { +return -1; +}this.mfrom = r < i ? r + 1 : i; +return r < i ? i - r - 1 : r - i; +}, "com.stevesoft.pat.StringLike,~N,com.stevesoft.pat.Pthings"); +Clazz.defineMethod (c$, "Masked", +function (i, pt) { +return pt.cbits == null ? false : pt.cbits.get (i); +}, "~N,com.stevesoft.pat.Pthings"); +Clazz.defineMethod (c$, "add", +function (p) { +if (this.next == null) { +if (p == null) { +return this; +}this.next = p; +p.parent = this.parent; +this.parent = null; +} else { +this.next.add (p); +}return this; +}, "com.stevesoft.pat.Pattern"); +Clazz.defineMethod (c$, "minChars", +function () { +return new com.stevesoft.pat.patInt (0); +}); +Clazz.defineMethod (c$, "maxChars", +function () { +return new com.stevesoft.pat.patInf (); +}); +Clazz.defineMethod (c$, "countMinChars", +function () { +var p = this; +var sum = new com.stevesoft.pat.patInt (0); +while (p != null) { +sum.pluseq (p.minChars ()); +p = p.next; +} +return sum; +}); +Clazz.defineMethod (c$, "countMaxChars", +function () { +var p = this; +var sum = new com.stevesoft.pat.patInt (0); +while (p != null) { +sum.pluseq (p.maxChars ()); +p = p.next; +} +return sum; +}); +Clazz.defineMethod (c$, "testMatch", +function (p, pos, pt) { +var tab = null; +if (pt.marks != null) { +try { +tab = Clazz.newIntArray (pt.marks.length, 0); +for (var i = 0; i < tab.length; i++) { +tab[i] = pt.marks[i]; +} +} catch (t) { +} +}var ret = p.matchInternal (pos, pt); +if (ret < 0) { +pt.marks = tab; +}return ret; +}, "com.stevesoft.pat.Pattern,~N,com.stevesoft.pat.Pthings"); +Clazz.defineMethod (c$, "clone1", +function (h) { +throw new Error (com.stevesoft.pat.MessageManager.formatMessage ("error.no_such_method_as_clone1_for", Clazz.newArray (-1, [this.getClass ().getName ()]))); +}, "java.util.Hashtable"); +Clazz.defineMethod (c$, "clone", +function (h) { +var p = h.get (this); +if (p != null) { +return p; +}p = this.clone1 (h); +if (p == null) { +throw new Error (com.stevesoft.pat.MessageManager.getString ("error.null_from_clone1")); +}h.put (this, p); +h.put (p, p); +if (this.next != null) { +p.next = this.next.clone (h); +}if (this.parent != null) { +p.parent = this.parent.clone (h); +}return p; +}, "java.util.Hashtable"); +Clazz.overrideMethod (c$, "equals", +function (o) { +return o === this; +}, "~O"); +Clazz.defineStatics (c$, +"ESC", '\\', +"PROTECT_THESE", "[]{}(),$,-\"^."); +});