JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / jalview / datamodel / SequenceFeature.js
1 Clazz.declarePackage ("jalview.datamodel");\r
2 Clazz.load (null, "jalview.datamodel.SequenceFeature", ["java.util.Hashtable", "$.Vector"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.begin = 0;\r
5 this.end = 0;\r
6 this.score = 0;\r
7 this.type = null;\r
8 this.description = null;\r
9 this.otherDetails = null;\r
10 this.links = null;\r
11 this.featureGroup = null;\r
12 Clazz.instantialize (this, arguments);\r
13 }, jalview.datamodel, "SequenceFeature");\r
14 Clazz.makeConstructor (c$, \r
15 function () {\r
16 });\r
17 Clazz.makeConstructor (c$, \r
18 function (cpy) {\r
19 if (cpy != null) {\r
20 this.begin = cpy.begin;\r
21 this.end = cpy.end;\r
22 this.score = cpy.score;\r
23 if (cpy.type != null) {\r
24 this.type =  String.instantialize (cpy.type);\r
25 }if (cpy.description != null) {\r
26 this.description =  String.instantialize (cpy.description);\r
27 }if (cpy.featureGroup != null) {\r
28 this.featureGroup =  String.instantialize (cpy.featureGroup);\r
29 }if (cpy.otherDetails != null) {\r
30 try {\r
31 this.otherDetails = cpy.otherDetails.clone ();\r
32 } catch (e) {\r
33 if (Clazz.exceptionOf (e, Exception)) {\r
34 } else {\r
35 throw e;\r
36 }\r
37 }\r
38 }if (cpy.links != null && cpy.links.size () > 0) {\r
39 this.links =  new java.util.Vector ();\r
40 for (var i = 0, iSize = cpy.links.size (); i < iSize; i++) {\r
41 this.links.addElement (cpy.links.elementAt (i));\r
42 }\r
43 }}}, "jalview.datamodel.SequenceFeature");\r
44 Clazz.makeConstructor (c$, \r
45 function (type, desc, status, begin, end, featureGroup) {\r
46 this.type = type;\r
47 this.description = desc;\r
48 this.setValue ("status", status);\r
49 this.begin = begin;\r
50 this.end = end;\r
51 this.featureGroup = featureGroup;\r
52 }, "~S,~S,~S,~N,~N,~S");\r
53 Clazz.makeConstructor (c$, \r
54 function (type, desc, begin, end, score, featureGroup) {\r
55 this.type = type;\r
56 this.description = desc;\r
57 this.begin = begin;\r
58 this.end = end;\r
59 this.score = score;\r
60 this.featureGroup = featureGroup;\r
61 }, "~S,~S,~N,~N,~N,~S");\r
62 Clazz.defineMethod (c$, "equals", \r
63 function (sf) {\r
64 if (this.begin != sf.begin || this.end != sf.end || this.score != sf.score) {\r
65 return false;\r
66 }if (!(this.type + this.description + this.featureGroup).equals (sf.type + sf.description + sf.featureGroup)) {\r
67 return false;\r
68 }return true;\r
69 }, "jalview.datamodel.SequenceFeature");\r
70 Clazz.defineMethod (c$, "getBegin", \r
71 function () {\r
72 return this.begin;\r
73 });\r
74 Clazz.defineMethod (c$, "setBegin", \r
75 function (start) {\r
76 this.begin = start;\r
77 }, "~N");\r
78 Clazz.defineMethod (c$, "getEnd", \r
79 function () {\r
80 return this.end;\r
81 });\r
82 Clazz.defineMethod (c$, "setEnd", \r
83 function (end) {\r
84 this.end = end;\r
85 }, "~N");\r
86 Clazz.defineMethod (c$, "getType", \r
87 function () {\r
88 return this.type;\r
89 });\r
90 Clazz.defineMethod (c$, "setType", \r
91 function (type) {\r
92 this.type = type;\r
93 }, "~S");\r
94 Clazz.defineMethod (c$, "getDescription", \r
95 function () {\r
96 return this.description;\r
97 });\r
98 Clazz.defineMethod (c$, "setDescription", \r
99 function (desc) {\r
100 this.description = desc;\r
101 }, "~S");\r
102 Clazz.defineMethod (c$, "getFeatureGroup", \r
103 function () {\r
104 return this.featureGroup;\r
105 });\r
106 Clazz.defineMethod (c$, "setFeatureGroup", \r
107 function (featureGroup) {\r
108 this.featureGroup = featureGroup;\r
109 }, "~S");\r
110 Clazz.defineMethod (c$, "addLink", \r
111 function (labelLink) {\r
112 if (this.links == null) {\r
113 this.links =  new java.util.Vector ();\r
114 }this.links.insertElementAt (labelLink, 0);\r
115 }, "~S");\r
116 Clazz.defineMethod (c$, "getScore", \r
117 function () {\r
118 return this.score;\r
119 });\r
120 Clazz.defineMethod (c$, "setScore", \r
121 function (value) {\r
122 this.score = value;\r
123 }, "~N");\r
124 Clazz.defineMethod (c$, "getValue", \r
125 function (key) {\r
126 if (this.otherDetails == null) {\r
127 return null;\r
128 } else {\r
129 return this.otherDetails.get (key);\r
130 }}, "~S");\r
131 Clazz.defineMethod (c$, "setValue", \r
132 function (key, value) {\r
133 if (value != null) {\r
134 if (this.otherDetails == null) {\r
135 this.otherDetails =  new java.util.Hashtable ();\r
136 }this.otherDetails.put (key, value);\r
137 }}, "~S,~O");\r
138 Clazz.defineMethod (c$, "setStatus", \r
139 function (status) {\r
140 this.setValue ("status", status);\r
141 }, "~S");\r
142 Clazz.defineMethod (c$, "getStatus", \r
143 function () {\r
144 if (this.otherDetails != null) {\r
145 var stat = this.otherDetails.get ("status");\r
146 if (stat != null) {\r
147 return  String.instantialize (stat);\r
148 }}return null;\r
149 });\r
150 Clazz.defineMethod (c$, "setPosition", \r
151 function (pos) {\r
152 this.begin = pos;\r
153 this.end = pos;\r
154 }, "~N");\r
155 Clazz.defineMethod (c$, "getPosition", \r
156 function () {\r
157 return this.begin;\r
158 });\r
159 Clazz.defineMethod (c$, "getStrand", \r
160 function () {\r
161 var str;\r
162 if (this.otherDetails == null || (str = this.otherDetails.get ("STRAND").toString ()) == null) {\r
163 return 0;\r
164 }if (str.equals ("-")) {\r
165 return -1;\r
166 }if (str.equals ("+")) {\r
167 return 1;\r
168 }return 0;\r
169 });\r
170 });\r