Merge branch 'features/pca_jaxb_datasetrefs_JAL-3171_JAL-3063_JAL-1767' into develop
[jalview.git] / src / jalview / schemabinding / version2 / DoubleVector.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 //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class DoubleVector.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class DoubleVector implements java.io.Serializable
23 {
24
25   // --------------------------/
26   // - Class/Member Variables -/
27   // --------------------------/
28
29   /**
30    * Field _vList.
31    */
32   private java.util.Vector _vList;
33
34   // ----------------/
35   // - Constructors -/
36   // ----------------/
37
38   public DoubleVector()
39   {
40     super();
41     this._vList = new java.util.Vector();
42   }
43
44   // -----------/
45   // - Methods -/
46   // -----------/
47
48   /**
49    * 
50    * 
51    * @param vV
52    * @throws java.lang.IndexOutOfBoundsException
53    *           if the index given is outside the bounds of the collection
54    */
55   public void addV(final double vV)
56           throws java.lang.IndexOutOfBoundsException
57   {
58     this._vList.addElement(new java.lang.Double(vV));
59   }
60
61   /**
62    * 
63    * 
64    * @param index
65    * @param vV
66    * @throws java.lang.IndexOutOfBoundsException
67    *           if the index given is outside the bounds of the collection
68    */
69   public void addV(final int index, final double vV)
70           throws java.lang.IndexOutOfBoundsException
71   {
72     this._vList.add(index, new java.lang.Double(vV));
73   }
74
75   /**
76    * Method enumerateV.
77    * 
78    * @return an Enumeration over all double elements
79    */
80   public java.util.Enumeration enumerateV()
81   {
82     return this._vList.elements();
83   }
84
85   /**
86    * Method getV.
87    * 
88    * @param index
89    * @throws java.lang.IndexOutOfBoundsException
90    *           if the index given is outside the bounds of the collection
91    * @return the value of the double at the given index
92    */
93   public double getV(final int index)
94           throws java.lang.IndexOutOfBoundsException
95   {
96     // check bounds for index
97     if (index < 0 || index >= this._vList.size())
98     {
99       throw new IndexOutOfBoundsException("getV: Index value '" + index
100               + "' not in range [0.." + (this._vList.size() - 1) + "]");
101     }
102
103     return ((java.lang.Double) _vList.get(index)).doubleValue();
104   }
105
106   /**
107    * Method getV.Returns the contents of the collection in an Array.
108    * 
109    * @return this collection as an Array
110    */
111   public double[] getV()
112   {
113     int size = this._vList.size();
114     double[] array = new double[size];
115     java.util.Iterator iter = _vList.iterator();
116     for (int index = 0; index < size; index++)
117     {
118       array[index] = ((java.lang.Double) iter.next()).doubleValue();
119     }
120     return array;
121   }
122
123   /**
124    * Method getVCount.
125    * 
126    * @return the size of this collection
127    */
128   public int getVCount()
129   {
130     return this._vList.size();
131   }
132
133   /**
134    * Method isValid.
135    * 
136    * @return true if this object is valid according to the schema
137    */
138   public boolean isValid()
139   {
140     try
141     {
142       validate();
143     } catch (org.exolab.castor.xml.ValidationException vex)
144     {
145       return false;
146     }
147     return true;
148   }
149
150   /**
151    * 
152    * 
153    * @param out
154    * @throws org.exolab.castor.xml.MarshalException
155    *           if object is null or if any SAXException is thrown during
156    *           marshaling
157    * @throws org.exolab.castor.xml.ValidationException
158    *           if this object is an invalid instance according to the schema
159    */
160   public void marshal(final java.io.Writer out)
161           throws org.exolab.castor.xml.MarshalException,
162           org.exolab.castor.xml.ValidationException
163   {
164     Marshaller.marshal(this, out);
165   }
166
167   /**
168    * 
169    * 
170    * @param handler
171    * @throws java.io.IOException
172    *           if an IOException occurs during marshaling
173    * @throws org.exolab.castor.xml.ValidationException
174    *           if this object is an invalid instance according to the schema
175    * @throws org.exolab.castor.xml.MarshalException
176    *           if object is null or if any SAXException is thrown during
177    *           marshaling
178    */
179   public void marshal(final org.xml.sax.ContentHandler handler)
180           throws java.io.IOException,
181           org.exolab.castor.xml.MarshalException,
182           org.exolab.castor.xml.ValidationException
183   {
184     Marshaller.marshal(this, handler);
185   }
186
187   /**
188    */
189   public void removeAllV()
190   {
191     this._vList.clear();
192   }
193
194   /**
195    * Method removeV.
196    * 
197    * @param vV
198    * @return true if the object was removed from the collection.
199    */
200   public boolean removeV(final double vV)
201   {
202     boolean removed = _vList.remove(new java.lang.Double(vV));
203     return removed;
204   }
205
206   /**
207    * Method removeVAt.
208    * 
209    * @param index
210    * @return the element removed from the collection
211    */
212   public double removeVAt(final int index)
213   {
214     java.lang.Object obj = this._vList.remove(index);
215     return ((java.lang.Double) obj).doubleValue();
216   }
217
218   /**
219    * 
220    * 
221    * @param index
222    * @param vV
223    * @throws java.lang.IndexOutOfBoundsException
224    *           if the index given is outside the bounds of the collection
225    */
226   public void setV(final int index, final double vV)
227           throws java.lang.IndexOutOfBoundsException
228   {
229     // check bounds for index
230     if (index < 0 || index >= this._vList.size())
231     {
232       throw new IndexOutOfBoundsException("setV: Index value '" + index
233               + "' not in range [0.." + (this._vList.size() - 1) + "]");
234     }
235
236     this._vList.set(index, new java.lang.Double(vV));
237   }
238
239   /**
240    * 
241    * 
242    * @param vVArray
243    */
244   public void setV(final double[] vVArray)
245   {
246     // -- copy array
247     _vList.clear();
248
249     for (int i = 0; i < vVArray.length; i++)
250     {
251       this._vList.add(new java.lang.Double(vVArray[i]));
252     }
253   }
254
255   /**
256    * Method unmarshal.
257    * 
258    * @param reader
259    * @throws org.exolab.castor.xml.MarshalException
260    *           if object is null or if any SAXException is thrown during
261    *           marshaling
262    * @throws org.exolab.castor.xml.ValidationException
263    *           if this object is an invalid instance according to the schema
264    * @return the unmarshaled jalview.schemabinding.version2.DoubleVector
265    */
266   public static jalview.schemabinding.version2.DoubleVector unmarshal(
267           final java.io.Reader reader)
268           throws org.exolab.castor.xml.MarshalException,
269           org.exolab.castor.xml.ValidationException
270   {
271     return (jalview.schemabinding.version2.DoubleVector) Unmarshaller
272             .unmarshal(jalview.schemabinding.version2.DoubleVector.class,
273                     reader);
274   }
275
276   /**
277    * 
278    * 
279    * @throws org.exolab.castor.xml.ValidationException
280    *           if this object is an invalid instance according to the schema
281    */
282   public void validate() throws org.exolab.castor.xml.ValidationException
283   {
284     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
285     validator.validate(this);
286   }
287
288 }