JAL-1503 update version in GPL header
[jalview.git] / src / jalview / schemabinding / version2 / PdbentryItem.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  * Class PdbentryItem.
31  * 
32  * @version $Revision$ $Date$
33  */
34 public class PdbentryItem implements java.io.Serializable
35 {
36
37   // --------------------------/
38   // - Class/Member Variables -/
39   // --------------------------/
40
41   /**
42    * Field _propertyList.
43    */
44   private java.util.Vector _propertyList;
45
46   // ----------------/
47   // - Constructors -/
48   // ----------------/
49
50   public PdbentryItem()
51   {
52     super();
53     this._propertyList = new java.util.Vector();
54   }
55
56   // -----------/
57   // - Methods -/
58   // -----------/
59
60   /**
61    * 
62    * 
63    * @param vProperty
64    * @throws java.lang.IndexOutOfBoundsException
65    *           if the index given is outside the bounds of the collection
66    */
67   public void addProperty(
68           final jalview.schemabinding.version2.Property vProperty)
69           throws java.lang.IndexOutOfBoundsException
70   {
71     this._propertyList.addElement(vProperty);
72   }
73
74   /**
75    * 
76    * 
77    * @param index
78    * @param vProperty
79    * @throws java.lang.IndexOutOfBoundsException
80    *           if the index given is outside the bounds of the collection
81    */
82   public void addProperty(final int index,
83           final jalview.schemabinding.version2.Property vProperty)
84           throws java.lang.IndexOutOfBoundsException
85   {
86     this._propertyList.add(index, vProperty);
87   }
88
89   /**
90    * Method enumerateProperty.
91    * 
92    * @return an Enumeration over all jalview.schemabinding.version2.Property
93    *         elements
94    */
95   public java.util.Enumeration enumerateProperty()
96   {
97     return this._propertyList.elements();
98   }
99
100   /**
101    * Method getProperty.
102    * 
103    * @param index
104    * @throws java.lang.IndexOutOfBoundsException
105    *           if the index given is outside the bounds of the collection
106    * @return the value of the jalview.schemabinding.version2.Property at the
107    *         given index
108    */
109   public jalview.schemabinding.version2.Property getProperty(final int index)
110           throws java.lang.IndexOutOfBoundsException
111   {
112     // check bounds for index
113     if (index < 0 || index >= this._propertyList.size())
114     {
115       throw new IndexOutOfBoundsException("getProperty: Index value '"
116               + index + "' not in range [0.."
117               + (this._propertyList.size() - 1) + "]");
118     }
119
120     return (jalview.schemabinding.version2.Property) _propertyList
121             .get(index);
122   }
123
124   /**
125    * Method getProperty.Returns the contents of the collection in an Array.
126    * <p>
127    * Note: Just in case the collection contents are changing in another thread,
128    * we pass a 0-length Array of the correct type into the API call. This way we
129    * <i>know</i> that the Array returned is of exactly the correct length.
130    * 
131    * @return this collection as an Array
132    */
133   public jalview.schemabinding.version2.Property[] getProperty()
134   {
135     jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0];
136     return (jalview.schemabinding.version2.Property[]) this._propertyList
137             .toArray(array);
138   }
139
140   /**
141    * Method getPropertyCount.
142    * 
143    * @return the size of this collection
144    */
145   public int getPropertyCount()
146   {
147     return this._propertyList.size();
148   }
149
150   /**
151      */
152   public void removeAllProperty()
153   {
154     this._propertyList.clear();
155   }
156
157   /**
158    * Method removeProperty.
159    * 
160    * @param vProperty
161    * @return true if the object was removed from the collection.
162    */
163   public boolean removeProperty(
164           final jalview.schemabinding.version2.Property vProperty)
165   {
166     boolean removed = _propertyList.remove(vProperty);
167     return removed;
168   }
169
170   /**
171    * Method removePropertyAt.
172    * 
173    * @param index
174    * @return the element removed from the collection
175    */
176   public jalview.schemabinding.version2.Property removePropertyAt(
177           final int index)
178   {
179     java.lang.Object obj = this._propertyList.remove(index);
180     return (jalview.schemabinding.version2.Property) obj;
181   }
182
183   /**
184    * 
185    * 
186    * @param index
187    * @param vProperty
188    * @throws java.lang.IndexOutOfBoundsException
189    *           if the index given is outside the bounds of the collection
190    */
191   public void setProperty(final int index,
192           final jalview.schemabinding.version2.Property vProperty)
193           throws java.lang.IndexOutOfBoundsException
194   {
195     // check bounds for index
196     if (index < 0 || index >= this._propertyList.size())
197     {
198       throw new IndexOutOfBoundsException("setProperty: Index value '"
199               + index + "' not in range [0.."
200               + (this._propertyList.size() - 1) + "]");
201     }
202
203     this._propertyList.set(index, vProperty);
204   }
205
206   /**
207    * 
208    * 
209    * @param vPropertyArray
210    */
211   public void setProperty(
212           final jalview.schemabinding.version2.Property[] vPropertyArray)
213   {
214     // -- copy array
215     _propertyList.clear();
216
217     for (int i = 0; i < vPropertyArray.length; i++)
218     {
219       this._propertyList.add(vPropertyArray[i]);
220     }
221   }
222
223 }