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