d578d156455c40de4d0ed3ea3aacdd18cdd3fb18
[jalviewjs.git] / site / swingjs / j2s / java / text / FieldPosition.js
1 Clazz.declarePackage ("java.text");\r
2 Clazz.load (["java.text.Format"], "java.text.FieldPosition", null, function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.field = 0;\r
5 this.endIndex = 0;\r
6 this.beginIndex = 0;\r
7 this.attribute = null;\r
8 if (!Clazz.isClassDefined ("java.text.FieldPosition.Delegate")) {\r
9 java.text.FieldPosition.$FieldPosition$Delegate$ ();\r
10 }\r
11 Clazz.instantialize (this, arguments);\r
12 }, java.text, "FieldPosition");\r
13 Clazz.makeConstructor (c$, \r
14 function (field) {\r
15 this.field = field;\r
16 }, "~N");\r
17 Clazz.makeConstructor (c$, \r
18 function (attribute) {\r
19 this.construct (attribute, -1);\r
20 }, "java.text.Format.Field");\r
21 Clazz.makeConstructor (c$, \r
22 function (attribute, fieldID) {\r
23 this.attribute = attribute;\r
24 this.field = fieldID;\r
25 }, "java.text.Format.Field,~N");\r
26 Clazz.defineMethod (c$, "getFieldAttribute", \r
27 function () {\r
28 return this.attribute;\r
29 });\r
30 Clazz.defineMethod (c$, "getField", \r
31 function () {\r
32 return this.field;\r
33 });\r
34 Clazz.defineMethod (c$, "getBeginIndex", \r
35 function () {\r
36 return this.beginIndex;\r
37 });\r
38 Clazz.defineMethod (c$, "getEndIndex", \r
39 function () {\r
40 return this.endIndex;\r
41 });\r
42 Clazz.defineMethod (c$, "setBeginIndex", \r
43 function (bi) {\r
44 this.beginIndex = bi;\r
45 }, "~N");\r
46 Clazz.defineMethod (c$, "setEndIndex", \r
47 function (ei) {\r
48 this.endIndex = ei;\r
49 }, "~N");\r
50 Clazz.defineMethod (c$, "getFieldDelegate", \r
51 function () {\r
52 return Clazz.innerTypeInstance (java.text.FieldPosition.Delegate, this, null);\r
53 });\r
54 Clazz.overrideMethod (c$, "equals", \r
55 function (obj) {\r
56 if (obj == null) return false;\r
57 if (!(Clazz.instanceOf (obj, java.text.FieldPosition))) return false;\r
58 var other = obj;\r
59 if (this.attribute == null) {\r
60 if (other.attribute != null) {\r
61 return false;\r
62 }} else if (!this.attribute.equals (other.attribute)) {\r
63 return false;\r
64 }return (this.beginIndex == other.beginIndex && this.endIndex == other.endIndex && this.field == other.field);\r
65 }, "~O");\r
66 Clazz.overrideMethod (c$, "hashCode", \r
67 function () {\r
68 return (this.field << 24) | (this.beginIndex << 16) | this.endIndex;\r
69 });\r
70 Clazz.overrideMethod (c$, "toString", \r
71 function () {\r
72 return this.getClass ().getName () + "[field=" + this.field + ",attribute=" + this.attribute + ",beginIndex=" + this.beginIndex + ",endIndex=" + this.endIndex + ']';\r
73 });\r
74 Clazz.defineMethod (c$, "matchesField", \r
75  function (attribute) {\r
76 if (this.attribute != null) {\r
77 return this.attribute.equals (attribute);\r
78 }return false;\r
79 }, "java.text.Format.Field");\r
80 Clazz.defineMethod (c$, "matchesField", \r
81  function (attribute, field) {\r
82 if (this.attribute != null) {\r
83 return this.attribute.equals (attribute);\r
84 }return (field == this.field);\r
85 }, "java.text.Format.Field,~N");\r
86 c$.$FieldPosition$Delegate$ = function () {\r
87 Clazz.pu$h(self.c$);\r
88 c$ = Clazz.decorateAsClass (function () {\r
89 Clazz.prepareCallback (this, arguments);\r
90 this.encounteredField = false;\r
91 Clazz.instantialize (this, arguments);\r
92 }, java.text.FieldPosition, "Delegate", null, java.text.Format.FieldDelegate);\r
93 Clazz.defineMethod (c$, "formatted", \r
94 function (a, b, c, d, e) {\r
95 if (!this.encounteredField && this.b$["java.text.FieldPosition"].matchesField (a)) {\r
96 this.b$["java.text.FieldPosition"].setBeginIndex (c);\r
97 this.b$["java.text.FieldPosition"].setEndIndex (d);\r
98 this.encounteredField = (c != d);\r
99 }}, "java.text.Format.Field,~O,~N,~N,StringBuffer");\r
100 Clazz.defineMethod (c$, "formatted", \r
101 function (a, b, c, d, e, f) {\r
102 if (!this.encounteredField && this.b$["java.text.FieldPosition"].matchesField (b, a)) {\r
103 this.b$["java.text.FieldPosition"].setBeginIndex (d);\r
104 this.b$["java.text.FieldPosition"].setEndIndex (e);\r
105 this.encounteredField = (d != e);\r
106 }}, "~N,java.text.Format.Field,~O,~N,~N,StringBuffer");\r
107 c$ = Clazz.p0p ();\r
108 };\r
109 });\r