JAL-1503 update version in GPL header
[jalview.git] / src / jalview / schemabinding / version2 / Pdbids.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 Pdbids.
38  * 
39  * @version $Revision$ $Date$
40  */
41 public class Pdbids extends jalview.schemabinding.version2.Pdbentry
42         implements java.io.Serializable
43 {
44
45   // --------------------------/
46   // - Class/Member Variables -/
47   // --------------------------/
48
49   /**
50    * Field _structureStateList.
51    */
52   private java.util.Vector _structureStateList;
53
54   // ----------------/
55   // - Constructors -/
56   // ----------------/
57
58   public Pdbids()
59   {
60     super();
61     this._structureStateList = new java.util.Vector();
62   }
63
64   // -----------/
65   // - Methods -/
66   // -----------/
67
68   /**
69    * 
70    * 
71    * @param vStructureState
72    * @throws java.lang.IndexOutOfBoundsException
73    *           if the index given is outside the bounds of the collection
74    */
75   public void addStructureState(
76           final jalview.schemabinding.version2.StructureState vStructureState)
77           throws java.lang.IndexOutOfBoundsException
78   {
79     this._structureStateList.addElement(vStructureState);
80   }
81
82   /**
83    * 
84    * 
85    * @param index
86    * @param vStructureState
87    * @throws java.lang.IndexOutOfBoundsException
88    *           if the index given is outside the bounds of the collection
89    */
90   public void addStructureState(
91           final int index,
92           final jalview.schemabinding.version2.StructureState vStructureState)
93           throws java.lang.IndexOutOfBoundsException
94   {
95     this._structureStateList.add(index, vStructureState);
96   }
97
98   /**
99    * Method enumerateStructureState.
100    * 
101    * @return an Enumeration over all
102    *         jalview.schemabinding.version2.StructureState elements
103    */
104   public java.util.Enumeration enumerateStructureState()
105   {
106     return this._structureStateList.elements();
107   }
108
109   /**
110    * Method getStructureState.
111    * 
112    * @param index
113    * @throws java.lang.IndexOutOfBoundsException
114    *           if the index given is outside the bounds of the collection
115    * @return the value of the jalview.schemabinding.version2.StructureState at
116    *         the given index
117    */
118   public jalview.schemabinding.version2.StructureState getStructureState(
119           final int index) throws java.lang.IndexOutOfBoundsException
120   {
121     // check bounds for index
122     if (index < 0 || index >= this._structureStateList.size())
123     {
124       throw new IndexOutOfBoundsException(
125               "getStructureState: Index value '" + index
126                       + "' not in range [0.."
127                       + (this._structureStateList.size() - 1) + "]");
128     }
129
130     return (jalview.schemabinding.version2.StructureState) _structureStateList
131             .get(index);
132   }
133
134   /**
135    * Method getStructureState.Returns the contents of the collection in an
136    * Array.
137    * <p>
138    * Note: Just in case the collection contents are changing in another thread,
139    * we pass a 0-length Array of the correct type into the API call. This way we
140    * <i>know</i> that the Array returned is of exactly the correct length.
141    * 
142    * @return this collection as an Array
143    */
144   public jalview.schemabinding.version2.StructureState[] getStructureState()
145   {
146     jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
147     return (jalview.schemabinding.version2.StructureState[]) this._structureStateList
148             .toArray(array);
149   }
150
151   /**
152    * Method getStructureStateCount.
153    * 
154    * @return the size of this collection
155    */
156   public int getStructureStateCount()
157   {
158     return this._structureStateList.size();
159   }
160
161   /**
162    * Method isValid.
163    * 
164    * @return true if this object is valid according to the schema
165    */
166   public boolean isValid()
167   {
168     try
169     {
170       validate();
171     } catch (org.exolab.castor.xml.ValidationException vex)
172     {
173       return false;
174     }
175     return true;
176   }
177
178   /**
179    * 
180    * 
181    * @param out
182    * @throws org.exolab.castor.xml.MarshalException
183    *           if object is null or if any SAXException is thrown during
184    *           marshaling
185    * @throws org.exolab.castor.xml.ValidationException
186    *           if this object is an invalid instance according to the schema
187    */
188   public void marshal(final java.io.Writer out)
189           throws org.exolab.castor.xml.MarshalException,
190           org.exolab.castor.xml.ValidationException
191   {
192     Marshaller.marshal(this, out);
193   }
194
195   /**
196    * 
197    * 
198    * @param handler
199    * @throws java.io.IOException
200    *           if an IOException occurs during marshaling
201    * @throws org.exolab.castor.xml.ValidationException
202    *           if this object is an invalid instance according to the schema
203    * @throws org.exolab.castor.xml.MarshalException
204    *           if object is null or if any SAXException is thrown during
205    *           marshaling
206    */
207   public void marshal(final org.xml.sax.ContentHandler handler)
208           throws java.io.IOException,
209           org.exolab.castor.xml.MarshalException,
210           org.exolab.castor.xml.ValidationException
211   {
212     Marshaller.marshal(this, handler);
213   }
214
215   /**
216      */
217   public void removeAllStructureState()
218   {
219     this._structureStateList.clear();
220   }
221
222   /**
223    * Method removeStructureState.
224    * 
225    * @param vStructureState
226    * @return true if the object was removed from the collection.
227    */
228   public boolean removeStructureState(
229           final jalview.schemabinding.version2.StructureState vStructureState)
230   {
231     boolean removed = _structureStateList.remove(vStructureState);
232     return removed;
233   }
234
235   /**
236    * Method removeStructureStateAt.
237    * 
238    * @param index
239    * @return the element removed from the collection
240    */
241   public jalview.schemabinding.version2.StructureState removeStructureStateAt(
242           final int index)
243   {
244     java.lang.Object obj = this._structureStateList.remove(index);
245     return (jalview.schemabinding.version2.StructureState) obj;
246   }
247
248   /**
249    * 
250    * 
251    * @param index
252    * @param vStructureState
253    * @throws java.lang.IndexOutOfBoundsException
254    *           if the index given is outside the bounds of the collection
255    */
256   public void setStructureState(
257           final int index,
258           final jalview.schemabinding.version2.StructureState vStructureState)
259           throws java.lang.IndexOutOfBoundsException
260   {
261     // check bounds for index
262     if (index < 0 || index >= this._structureStateList.size())
263     {
264       throw new IndexOutOfBoundsException(
265               "setStructureState: Index value '" + index
266                       + "' not in range [0.."
267                       + (this._structureStateList.size() - 1) + "]");
268     }
269
270     this._structureStateList.set(index, vStructureState);
271   }
272
273   /**
274    * 
275    * 
276    * @param vStructureStateArray
277    */
278   public void setStructureState(
279           final jalview.schemabinding.version2.StructureState[] vStructureStateArray)
280   {
281     // -- copy array
282     _structureStateList.clear();
283
284     for (int i = 0; i < vStructureStateArray.length; i++)
285     {
286       this._structureStateList.add(vStructureStateArray[i]);
287     }
288   }
289
290   /**
291    * Method unmarshal.
292    * 
293    * @param reader
294    * @throws org.exolab.castor.xml.MarshalException
295    *           if object is null or if any SAXException is thrown during
296    *           marshaling
297    * @throws org.exolab.castor.xml.ValidationException
298    *           if this object is an invalid instance according to the schema
299    * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
300    */
301   public static jalview.schemabinding.version2.Pdbentry unmarshal(
302           final java.io.Reader reader)
303           throws org.exolab.castor.xml.MarshalException,
304           org.exolab.castor.xml.ValidationException
305   {
306     return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
307             .unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
308   }
309
310   /**
311    * 
312    * 
313    * @throws org.exolab.castor.xml.ValidationException
314    *           if this object is an invalid instance according to the schema
315    */
316   public void validate() throws org.exolab.castor.xml.ValidationException
317   {
318     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
319     validator.validate(this);
320   }
321
322 }