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