Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / com / stevesoft / pat / Boundary.js
1 Clazz.declarePackage ("com.stevesoft.pat");
2 Clazz.load (["com.stevesoft.pat.Pattern"], "com.stevesoft.pat.Boundary", ["com.stevesoft.pat.patInt"], function () {
3 c$ = Clazz.declareType (com.stevesoft.pat, "Boundary", com.stevesoft.pat.Pattern);
4 Clazz.overrideMethod (c$, "toString", 
5 function () {
6 return "\\b" + this.nextString ();
7 });
8 Clazz.defineMethod (c$, "isAChar", 
9 function (c) {
10 if (c >= 'a' && c <= 'z') {
11 return true;
12 }if (c >= 'A' && c <= 'Z') {
13 return true;
14 }if (c >= '0' && c <= '9') {
15 return true;
16 }if (c == '_') {
17 return true;
18 }return false;
19 }, "~S");
20 Clazz.defineMethod (c$, "matchLeft", 
21 function (pos, pt) {
22 if (pos <= 0) {
23 return true;
24 }if (this.isAChar (pt.src.charAt (pos)) && this.isAChar (pt.src.charAt (pos - 1))) {
25 return false;
26 }return true;
27 }, "~N,com.stevesoft.pat.Pthings");
28 Clazz.defineMethod (c$, "matchRight", 
29 function (pos, pt) {
30 if (pos < 0) {
31 return false;
32 }if (pos + 1 >= pt.src.length ()) {
33 return true;
34 }if (this.isAChar (pt.src.charAt (pos)) && this.isAChar (pt.src.charAt (pos + 1))) {
35 return false;
36 }return true;
37 }, "~N,com.stevesoft.pat.Pthings");
38 Clazz.overrideMethod (c$, "matchInternal", 
39 function (pos, pt) {
40 if (this.matchRight (pos - 1, pt) || this.matchLeft (pos, pt)) {
41 return this.nextMatch (pos, pt);
42 }return -1;
43 }, "~N,com.stevesoft.pat.Pthings");
44 Clazz.overrideMethod (c$, "maxChars", 
45 function () {
46 return  new com.stevesoft.pat.patInt (0);
47 });
48 Clazz.overrideMethod (c$, "clone1", 
49 function (h) {
50 return  new com.stevesoft.pat.Boundary ();
51 }, "java.util.Hashtable");
52 });