93c46e0002b417f9ebab4d707eb017cb6eb0c4f1
[jalview.git] / src / jalview / binding / 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.binding;
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(final jalview.binding.Property vProperty)
49           throws java.lang.IndexOutOfBoundsException
50   {
51     this._propertyList.addElement(vProperty);
52   }
53
54   /**
55    * 
56    * 
57    * @param index
58    * @param vProperty
59    * @throws java.lang.IndexOutOfBoundsException
60    *           if the index given is outside the bounds of the collection
61    */
62   public void addProperty(final int index,
63           final jalview.binding.Property vProperty)
64           throws java.lang.IndexOutOfBoundsException
65   {
66     this._propertyList.add(index, vProperty);
67   }
68
69   /**
70    * Method enumerateProperty.
71    * 
72    * @return an Enumeration over all jalview.binding.Property elements
73    */
74   public java.util.Enumeration enumerateProperty()
75   {
76     return this._propertyList.elements();
77   }
78
79   /**
80    * Method getProperty.
81    * 
82    * @param index
83    * @throws java.lang.IndexOutOfBoundsException
84    *           if the index given is outside the bounds of the collection
85    * @return the value of the jalview.binding.Property at the given index
86    */
87   public jalview.binding.Property getProperty(final int index)
88           throws java.lang.IndexOutOfBoundsException
89   {
90     // check bounds for index
91     if (index < 0 || index >= this._propertyList.size())
92     {
93       throw new IndexOutOfBoundsException("getProperty: Index value '"
94               + index + "' not in range [0.."
95               + (this._propertyList.size() - 1) + "]");
96     }
97
98     return (jalview.binding.Property) _propertyList.get(index);
99   }
100
101   /**
102    * Method getProperty.Returns the contents of the collection in an Array.
103    * <p>
104    * Note: Just in case the collection contents are changing in another thread,
105    * we pass a 0-length Array of the correct type into the API call. This way we
106    * <i>know</i> that the Array returned is of exactly the correct length.
107    * 
108    * @return this collection as an Array
109    */
110   public jalview.binding.Property[] getProperty()
111   {
112     jalview.binding.Property[] array = new jalview.binding.Property[0];
113     return (jalview.binding.Property[]) this._propertyList.toArray(array);
114   }
115
116   /**
117    * Method getPropertyCount.
118    * 
119    * @return the size of this collection
120    */
121   public int getPropertyCount()
122   {
123     return this._propertyList.size();
124   }
125
126   /**
127      */
128   public void removeAllProperty()
129   {
130     this._propertyList.clear();
131   }
132
133   /**
134    * Method removeProperty.
135    * 
136    * @param vProperty
137    * @return true if the object was removed from the collection.
138    */
139   public boolean removeProperty(final jalview.binding.Property vProperty)
140   {
141     boolean removed = _propertyList.remove(vProperty);
142     return removed;
143   }
144
145   /**
146    * Method removePropertyAt.
147    * 
148    * @param index
149    * @return the element removed from the collection
150    */
151   public jalview.binding.Property removePropertyAt(final int index)
152   {
153     java.lang.Object obj = this._propertyList.remove(index);
154     return (jalview.binding.Property) obj;
155   }
156
157   /**
158    * 
159    * 
160    * @param index
161    * @param vProperty
162    * @throws java.lang.IndexOutOfBoundsException
163    *           if the index given is outside the bounds of the collection
164    */
165   public void setProperty(final int index,
166           final jalview.binding.Property vProperty)
167           throws java.lang.IndexOutOfBoundsException
168   {
169     // check bounds for index
170     if (index < 0 || index >= this._propertyList.size())
171     {
172       throw new IndexOutOfBoundsException("setProperty: Index value '"
173               + index + "' not in range [0.."
174               + (this._propertyList.size() - 1) + "]");
175     }
176
177     this._propertyList.set(index, vProperty);
178   }
179
180   /**
181    * 
182    * 
183    * @param vPropertyArray
184    */
185   public void setProperty(final jalview.binding.Property[] vPropertyArray)
186   {
187     // -- copy array
188     _propertyList.clear();
189
190     for (int i = 0; i < vPropertyArray.length; i++)
191     {
192       this._propertyList.add(vPropertyArray[i]);
193     }
194   }
195
196 }