JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / com / stevesoft / pat / patInt.js
1 Clazz.declarePackage ("com.stevesoft.pat");\r
2 c$ = Clazz.decorateAsClass (function () {\r
3 this.i = 0;\r
4 this.inf = false;\r
5 Clazz.instantialize (this, arguments);\r
6 }, com.stevesoft.pat, "patInt");\r
7 Clazz.makeConstructor (c$, \r
8 function () {\r
9 this.i = 0;\r
10 this.inf = false;\r
11 });\r
12 Clazz.makeConstructor (c$, \r
13 function (init) {\r
14 this.i = init;\r
15 this.inf = false;\r
16 }, "~N");\r
17 Clazz.makeConstructor (c$, \r
18 function (p) {\r
19 this.i = p.i;\r
20 this.inf = p.inf;\r
21 }, "com.stevesoft.pat.patInt");\r
22 Clazz.defineMethod (c$, "setInf", \r
23 function (b) {\r
24 this.inf = b;\r
25 if (b) {\r
26 this.i = 2147483647;\r
27 }}, "~B");\r
28 Clazz.defineMethod (c$, "inc", \r
29 function () {\r
30 if (!this.inf) {\r
31 this.i++;\r
32 }});\r
33 Clazz.defineMethod (c$, "dec", \r
34 function () {\r
35 if (!this.inf) {\r
36 this.i--;\r
37 }});\r
38 Clazz.defineMethod (c$, "lessEq", \r
39 function (j) {\r
40 return !this.inf && (j.inf || this.i <= j.i);\r
41 }, "com.stevesoft.pat.patInt");\r
42 Clazz.defineMethod (c$, "equals", \r
43 function (j) {\r
44 return !j.inf && !this.inf && this.i == j.i;\r
45 }, "com.stevesoft.pat.patInt");\r
46 Clazz.overrideMethod (c$, "toString", \r
47 function () {\r
48 if (this.inf) {\r
49 return "";\r
50 } else {\r
51 return "" + this.i;\r
52 }});\r
53 Clazz.defineMethod (c$, "pluseq", \r
54 function (p) {\r
55 if (this.inf || p.inf) {\r
56 this.setInf (true);\r
57 } else {\r
58 this.i += p.i;\r
59 }return this;\r
60 }, "com.stevesoft.pat.patInt");\r
61 Clazz.defineMethod (c$, "mul", \r
62 function (p) {\r
63 if (this.inf || p.inf) {\r
64 return  new com.stevesoft.pat.patInf ();\r
65 }return  new com.stevesoft.pat.patInt (this.i * p.i);\r
66 }, "com.stevesoft.pat.patInt");\r
67 Clazz.defineMethod (c$, "mineq", \r
68 function (p) {\r
69 if (p.inf) {\r
70 return this;\r
71 }if (this.inf) {\r
72 this.i = p.i;\r
73 } else if (p.i < this.i) {\r
74 this.i = p.i;\r
75 }this.setInf (false);\r
76 return this;\r
77 }, "com.stevesoft.pat.patInt");\r
78 Clazz.defineMethod (c$, "maxeq", \r
79 function (p) {\r
80 if (this.inf || p.inf) {\r
81 this.setInf (true);\r
82 return this;\r
83 }if (p.i > this.i) {\r
84 this.i = p.i;\r
85 }return this;\r
86 }, "com.stevesoft.pat.patInt");\r
87 Clazz.defineMethod (c$, "finite", \r
88 function () {\r
89 return !this.inf;\r
90 });\r
91 Clazz.defineMethod (c$, "intValue", \r
92 function () {\r
93 return this.inf ? 2147483647 : this.i;\r
94 });\r