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