X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fcom%2Fstevesoft%2Fpat%2FDotMulti.js;h=172397b3dcc215606c5deed5ec14e800741a0ea4;hp=3584af16b20bbf3bcace8e4447c09e3116253d07;hb=7301a2415adab88038b291fc54caeeb3a5a47a44;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/com/stevesoft/pat/DotMulti.js b/bin/com/stevesoft/pat/DotMulti.js index 3584af1..172397b 100644 --- a/bin/com/stevesoft/pat/DotMulti.js +++ b/bin/com/stevesoft/pat/DotMulti.js @@ -1,129 +1,129 @@ -Clazz.declarePackage ("com.stevesoft.pat"); -Clazz.load (["com.stevesoft.pat.PatternSub"], "com.stevesoft.pat.DotMulti", null, function () { -c$ = Clazz.decorateAsClass (function () { -this.fewestMatches = null; -this.mostMatches = null; -this.matchFewest = false; -this.src = null; -this.srclength = 0; -this.dotDoesntMatchCR = true; -Clazz.instantialize (this, arguments); -}, com.stevesoft.pat, "DotMulti", com.stevesoft.pat.PatternSub); -Clazz.overrideMethod (c$, "minChars", -function () { -return this.fewestMatches; -}); -Clazz.overrideMethod (c$, "maxChars", -function () { -return this.mostMatches; -}); -Clazz.makeConstructor (c$, -function (a, b) { -Clazz.superConstructor (this, com.stevesoft.pat.DotMulti, []); -this.fewestMatches = a; -this.mostMatches = b; -}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt"); -Clazz.overrideMethod (c$, "toString", -function () { -return ".{" + this.fewestMatches + "," + this.mostMatches + "}" + (this.matchFewest ? "?" : "") + "(?# <= dot multi)" + this.nextString (); -}); -Clazz.defineMethod (c$, "submatchInternal", -function (pos, pt) { -if (pos < this.srclength) { -if (this.dotDoesntMatchCR) { -if (this.src.charAt (pos) != '\n') { -return 1 + pos; -}} else { -return 1 + pos; -}}return -1; -}, "~N,com.stevesoft.pat.Pthings"); -Clazz.overrideMethod (c$, "matchInternal", -function (pos, pt) { -var m = -1; -var i = pos; -this.src = pt.src; -this.srclength = this.src.length (); -this.dotDoesntMatchCR = pt.dotDoesntMatchCR; -if (this.matchFewest) { -var nMatches = 0; -while (this.fewestMatches.intValue () > nMatches) { -i = this.submatchInternal (i, pt); -if (i < 0) { -return -1; -}nMatches++; -} -if (i < 0) { -return -1; -}var ii = this.nextMatch (i, pt); -if (ii >= 0) { -return ii; -}if (!this.mostMatches.finite ()) { -while (i >= 0) { -i = this.submatchInternal (i, pt); -if (i < 0) { -return -1; -}ii = this.nextMatch (i, pt); -if (ii >= 0) { -return ii; -}} -} else { -while (i > 0) { -i = this.submatchInternal (i, pt); -if (i < 0) { -return -1; -}nMatches++; -if (nMatches > this.mostMatches.intValue ()) { -return -1; -}ii = this.nextMatch (i, pt); -if (ii >= 0) { -return ii; -}} -}return -1; -}var nMatches = 0; -while (this.fewestMatches.intValue () > nMatches) { -i = this.submatchInternal (i, pt); -if (i >= 0) { -nMatches++; -} else { -return -1; -}} -m = i; -if (this.mostMatches.finite ()) { -while (nMatches < this.mostMatches.intValue ()) { -i = this.submatchInternal (i, pt); -if (i >= 0) { -m = i; -nMatches++; -} else { -break; -}} -} else { -while (true) { -i = this.submatchInternal (i, pt); -if (i >= 0) { -m = i; -nMatches++; -} else { -break; -}} -}while (m >= pos) { -var r = this.nextMatch (m, pt); -if (r >= 0) { -return r; -}m -= 1; -nMatches--; -if (nMatches < this.fewestMatches.intValue ()) { -return -1; -}} -return -1; -}, "~N,com.stevesoft.pat.Pthings"); -Clazz.overrideMethod (c$, "clone1", -function (h) { -var dm = new com.stevesoft.pat.DotMulti (this.fewestMatches, this.mostMatches); -dm.matchFewest = this.matchFewest; -return dm; -}, "java.util.Hashtable"); -Clazz.defineStatics (c$, -"step", 1, -"idcount", 1); -}); +Clazz.declarePackage ("com.stevesoft.pat"); +Clazz.load (["com.stevesoft.pat.PatternSub"], "com.stevesoft.pat.DotMulti", null, function () { +c$ = Clazz.decorateAsClass (function () { +this.fewestMatches = null; +this.mostMatches = null; +this.matchFewest = false; +this.src = null; +this.srclength = 0; +this.dotDoesntMatchCR = true; +Clazz.instantialize (this, arguments); +}, com.stevesoft.pat, "DotMulti", com.stevesoft.pat.PatternSub); +Clazz.overrideMethod (c$, "minChars", +function () { +return this.fewestMatches; +}); +Clazz.overrideMethod (c$, "maxChars", +function () { +return this.mostMatches; +}); +Clazz.makeConstructor (c$, +function (a, b) { +Clazz.superConstructor (this, com.stevesoft.pat.DotMulti, []); +this.fewestMatches = a; +this.mostMatches = b; +}, "com.stevesoft.pat.patInt,com.stevesoft.pat.patInt"); +Clazz.overrideMethod (c$, "toString", +function () { +return ".{" + this.fewestMatches + "," + this.mostMatches + "}" + (this.matchFewest ? "?" : "") + "(?# <= dot multi)" + this.nextString (); +}); +Clazz.defineMethod (c$, "submatchInternal", +function (pos, pt) { +if (pos < this.srclength) { +if (this.dotDoesntMatchCR) { +if (this.src.charAt (pos) != '\n') { +return 1 + pos; +}} else { +return 1 + pos; +}}return -1; +}, "~N,com.stevesoft.pat.Pthings"); +Clazz.overrideMethod (c$, "matchInternal", +function (pos, pt) { +var m = -1; +var i = pos; +this.src = pt.src; +this.srclength = this.src.length (); +this.dotDoesntMatchCR = pt.dotDoesntMatchCR; +if (this.matchFewest) { +var nMatches = 0; +while (this.fewestMatches.intValue () > nMatches) { +i = this.submatchInternal (i, pt); +if (i < 0) { +return -1; +}nMatches++; +} +if (i < 0) { +return -1; +}var ii = this.nextMatch (i, pt); +if (ii >= 0) { +return ii; +}if (!this.mostMatches.finite ()) { +while (i >= 0) { +i = this.submatchInternal (i, pt); +if (i < 0) { +return -1; +}ii = this.nextMatch (i, pt); +if (ii >= 0) { +return ii; +}} +} else { +while (i > 0) { +i = this.submatchInternal (i, pt); +if (i < 0) { +return -1; +}nMatches++; +if (nMatches > this.mostMatches.intValue ()) { +return -1; +}ii = this.nextMatch (i, pt); +if (ii >= 0) { +return ii; +}} +}return -1; +}var nMatches = 0; +while (this.fewestMatches.intValue () > nMatches) { +i = this.submatchInternal (i, pt); +if (i >= 0) { +nMatches++; +} else { +return -1; +}} +m = i; +if (this.mostMatches.finite ()) { +while (nMatches < this.mostMatches.intValue ()) { +i = this.submatchInternal (i, pt); +if (i >= 0) { +m = i; +nMatches++; +} else { +break; +}} +} else { +while (true) { +i = this.submatchInternal (i, pt); +if (i >= 0) { +m = i; +nMatches++; +} else { +break; +}} +}while (m >= pos) { +var r = this.nextMatch (m, pt); +if (r >= 0) { +return r; +}m -= 1; +nMatches--; +if (nMatches < this.fewestMatches.intValue ()) { +return -1; +}} +return -1; +}, "~N,com.stevesoft.pat.Pthings"); +Clazz.overrideMethod (c$, "clone1", +function (h) { +var dm = new com.stevesoft.pat.DotMulti (this.fewestMatches, this.mostMatches); +dm.matchFewest = this.matchFewest; +return dm; +}, "java.util.Hashtable"); +Clazz.defineStatics (c$, +"step", 1, +"idcount", 1); +});