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