extended Colour element with additional optional attributes for graduated colour
[jalview.git] / src / jalview / schemabinding / version2 / Pdbentry.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4.1)\r
3  * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4  * \r
5  * This program is free software; you can redistribute it and/or\r
6  * modify it under the terms of the GNU General Public License\r
7  * as published by the Free Software Foundation; either version 2\r
8  * of the License, or (at your option) any later version.\r
9  * \r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  * \r
15  * You should have received a copy of the GNU General Public License\r
16  * along with this program; if not, write to the Free Software\r
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18  */\r
19 package jalview.schemabinding.version2;\r
20 \r
21   //---------------------------------/\r
22  //- Imported classes and packages -/\r
23 //---------------------------------/\r
24 \r
25 import org.exolab.castor.xml.Marshaller;\r
26 import org.exolab.castor.xml.Unmarshaller;\r
27 \r
28 /**\r
29  * Class Pdbentry.\r
30  * \r
31  * @version $Revision$ $Date$\r
32  */\r
33 public class Pdbentry implements java.io.Serializable {\r
34 \r
35 \r
36       //--------------------------/\r
37      //- Class/Member Variables -/\r
38     //--------------------------/\r
39 \r
40     /**\r
41      * Field _id.\r
42      */\r
43     private java.lang.String _id;\r
44 \r
45     /**\r
46      * Field _type.\r
47      */\r
48     private java.lang.String _type;\r
49 \r
50     /**\r
51      * Field _file.\r
52      */\r
53     private java.lang.String _file;\r
54 \r
55     /**\r
56      * Field _items.\r
57      */\r
58     private java.util.Vector _items;\r
59 \r
60 \r
61       //----------------/\r
62      //- Constructors -/\r
63     //----------------/\r
64 \r
65     public Pdbentry() {\r
66         super();\r
67         this._items = new java.util.Vector();\r
68     }\r
69 \r
70 \r
71       //-----------/\r
72      //- Methods -/\r
73     //-----------/\r
74 \r
75     /**\r
76      * \r
77      * \r
78      * @param vPdbentryItem\r
79      * @throws java.lang.IndexOutOfBoundsException if the index\r
80      * given is outside the bounds of the collection\r
81      */\r
82     public void addPdbentryItem(\r
83             final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)\r
84     throws java.lang.IndexOutOfBoundsException {\r
85         this._items.addElement(vPdbentryItem);\r
86     }\r
87 \r
88     /**\r
89      * \r
90      * \r
91      * @param index\r
92      * @param vPdbentryItem\r
93      * @throws java.lang.IndexOutOfBoundsException if the index\r
94      * given is outside the bounds of the collection\r
95      */\r
96     public void addPdbentryItem(\r
97             final int index,\r
98             final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)\r
99     throws java.lang.IndexOutOfBoundsException {\r
100         this._items.add(index, vPdbentryItem);\r
101     }\r
102 \r
103     /**\r
104      * Method enumeratePdbentryItem.\r
105      * \r
106      * @return an Enumeration over all\r
107      * jalview.schemabinding.version2.PdbentryItem elements\r
108      */\r
109     public java.util.Enumeration enumeratePdbentryItem(\r
110     ) {\r
111         return this._items.elements();\r
112     }\r
113 \r
114     /**\r
115      * Returns the value of field 'file'.\r
116      * \r
117      * @return the value of field 'File'.\r
118      */\r
119     public java.lang.String getFile(\r
120     ) {\r
121         return this._file;\r
122     }\r
123 \r
124     /**\r
125      * Returns the value of field 'id'.\r
126      * \r
127      * @return the value of field 'Id'.\r
128      */\r
129     public java.lang.String getId(\r
130     ) {\r
131         return this._id;\r
132     }\r
133 \r
134     /**\r
135      * Method getPdbentryItem.\r
136      * \r
137      * @param index\r
138      * @throws java.lang.IndexOutOfBoundsException if the index\r
139      * given is outside the bounds of the collection\r
140      * @return the value of the\r
141      * jalview.schemabinding.version2.PdbentryItem at the given inde\r
142      */\r
143     public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(\r
144             final int index)\r
145     throws java.lang.IndexOutOfBoundsException {\r
146         // check bounds for index\r
147         if (index < 0 || index >= this._items.size()) {\r
148             throw new IndexOutOfBoundsException("getPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]");\r
149         }\r
150         \r
151         return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);\r
152     }\r
153 \r
154     /**\r
155      * Method getPdbentryItem.Returns the contents of the\r
156      * collection in an Array.  <p>Note:  Just in case the\r
157      * collection contents are changing in another thread, we pass\r
158      * a 0-length Array of the correct type into the API call. \r
159      * This way we <i>know</i> that the Array returned is of\r
160      * exactly the correct length.\r
161      * \r
162      * @return this collection as an Array\r
163      */\r
164     public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem(\r
165     ) {\r
166         jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];\r
167         return (jalview.schemabinding.version2.PdbentryItem[]) this._items.toArray(array);\r
168     }\r
169 \r
170     /**\r
171      * Method getPdbentryItemCount.\r
172      * \r
173      * @return the size of this collection\r
174      */\r
175     public int getPdbentryItemCount(\r
176     ) {\r
177         return this._items.size();\r
178     }\r
179 \r
180     /**\r
181      * Returns the value of field 'type'.\r
182      * \r
183      * @return the value of field 'Type'.\r
184      */\r
185     public java.lang.String getType(\r
186     ) {\r
187         return this._type;\r
188     }\r
189 \r
190     /**\r
191      * Method isValid.\r
192      * \r
193      * @return true if this object is valid according to the schema\r
194      */\r
195     public boolean isValid(\r
196     ) {\r
197         try {\r
198             validate();\r
199         } catch (org.exolab.castor.xml.ValidationException vex) {\r
200             return false;\r
201         }\r
202         return true;\r
203     }\r
204 \r
205     /**\r
206      * \r
207      * \r
208      * @param out\r
209      * @throws org.exolab.castor.xml.MarshalException if object is\r
210      * null or if any SAXException is thrown during marshaling\r
211      * @throws org.exolab.castor.xml.ValidationException if this\r
212      * object is an invalid instance according to the schema\r
213      */\r
214     public void marshal(\r
215             final java.io.Writer out)\r
216     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
217         Marshaller.marshal(this, out);\r
218     }\r
219 \r
220     /**\r
221      * \r
222      * \r
223      * @param handler\r
224      * @throws java.io.IOException if an IOException occurs during\r
225      * marshaling\r
226      * @throws org.exolab.castor.xml.ValidationException if this\r
227      * object is an invalid instance according to the schema\r
228      * @throws org.exolab.castor.xml.MarshalException if object is\r
229      * null or if any SAXException is thrown during marshaling\r
230      */\r
231     public void marshal(\r
232             final org.xml.sax.ContentHandler handler)\r
233     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
234         Marshaller.marshal(this, handler);\r
235     }\r
236 \r
237     /**\r
238      */\r
239     public void removeAllPdbentryItem(\r
240     ) {\r
241         this._items.clear();\r
242     }\r
243 \r
244     /**\r
245      * Method removePdbentryItem.\r
246      * \r
247      * @param vPdbentryItem\r
248      * @return true if the object was removed from the collection.\r
249      */\r
250     public boolean removePdbentryItem(\r
251             final jalview.schemabinding.version2.PdbentryItem vPdbentryItem) {\r
252         boolean removed = _items.remove(vPdbentryItem);\r
253         return removed;\r
254     }\r
255 \r
256     /**\r
257      * Method removePdbentryItemAt.\r
258      * \r
259      * @param index\r
260      * @return the element removed from the collection\r
261      */\r
262     public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(\r
263             final int index) {\r
264         java.lang.Object obj = this._items.remove(index);\r
265         return (jalview.schemabinding.version2.PdbentryItem) obj;\r
266     }\r
267 \r
268     /**\r
269      * Sets the value of field 'file'.\r
270      * \r
271      * @param file the value of field 'file'.\r
272      */\r
273     public void setFile(\r
274             final java.lang.String file) {\r
275         this._file = file;\r
276     }\r
277 \r
278     /**\r
279      * Sets the value of field 'id'.\r
280      * \r
281      * @param id the value of field 'id'.\r
282      */\r
283     public void setId(\r
284             final java.lang.String id) {\r
285         this._id = id;\r
286     }\r
287 \r
288     /**\r
289      * \r
290      * \r
291      * @param index\r
292      * @param vPdbentryItem\r
293      * @throws java.lang.IndexOutOfBoundsException if the index\r
294      * given is outside the bounds of the collection\r
295      */\r
296     public void setPdbentryItem(\r
297             final int index,\r
298             final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)\r
299     throws java.lang.IndexOutOfBoundsException {\r
300         // check bounds for index\r
301         if (index < 0 || index >= this._items.size()) {\r
302             throw new IndexOutOfBoundsException("setPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]");\r
303         }\r
304         \r
305         this._items.set(index, vPdbentryItem);\r
306     }\r
307 \r
308     /**\r
309      * \r
310      * \r
311      * @param vPdbentryItemArray\r
312      */\r
313     public void setPdbentryItem(\r
314             final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray) {\r
315         //-- copy array\r
316         _items.clear();\r
317         \r
318         for (int i = 0; i < vPdbentryItemArray.length; i++) {\r
319                 this._items.add(vPdbentryItemArray[i]);\r
320         }\r
321     }\r
322 \r
323     /**\r
324      * Sets the value of field 'type'.\r
325      * \r
326      * @param type the value of field 'type'.\r
327      */\r
328     public void setType(\r
329             final java.lang.String type) {\r
330         this._type = type;\r
331     }\r
332 \r
333     /**\r
334      * Method unmarshal.\r
335      * \r
336      * @param reader\r
337      * @throws org.exolab.castor.xml.MarshalException if object is\r
338      * null or if any SAXException is thrown during marshaling\r
339      * @throws org.exolab.castor.xml.ValidationException if this\r
340      * object is an invalid instance according to the schema\r
341      * @return the unmarshaled\r
342      * jalview.schemabinding.version2.Pdbentry\r
343      */\r
344     public static jalview.schemabinding.version2.Pdbentry unmarshal(\r
345             final java.io.Reader reader)\r
346     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
347         return (jalview.schemabinding.version2.Pdbentry) Unmarshaller.unmarshal(jalview.schemabinding.version2.Pdbentry.class, reader);\r
348     }\r
349 \r
350     /**\r
351      * \r
352      * \r
353      * @throws org.exolab.castor.xml.ValidationException if this\r
354      * object is an invalid instance according to the schema\r
355      */\r
356     public void validate(\r
357     )\r
358     throws org.exolab.castor.xml.ValidationException {\r
359         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
360         validator.validate(this);\r
361     }\r
362 \r
363 }\r