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