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