2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.schemabinding.version2;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
20 * @version $Revision$ $Date$
22 public class DoubleVector implements java.io.Serializable
25 // --------------------------/
26 // - Class/Member Variables -/
27 // --------------------------/
32 private java.util.Vector _dList;
41 this._dList = new java.util.Vector();
52 * @throws java.lang.IndexOutOfBoundsException
53 * if the index given is outside the bounds of the collection
55 public void addD(final double vD)
56 throws java.lang.IndexOutOfBoundsException
58 this._dList.addElement(new java.lang.Double(vD));
66 * @throws java.lang.IndexOutOfBoundsException
67 * if the index given is outside the bounds of the collection
69 public void addD(final int index, final double vD)
70 throws java.lang.IndexOutOfBoundsException
72 this._dList.add(index, new java.lang.Double(vD));
78 * @return an Enumeration over all double elements
80 public java.util.Enumeration enumerateD()
82 return this._dList.elements();
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
93 public double getD(final int index)
94 throws java.lang.IndexOutOfBoundsException
96 // check bounds for index
97 if (index < 0 || index >= this._dList.size())
99 throw new IndexOutOfBoundsException("getD: Index value '" + index
100 + "' not in range [0.." + (this._dList.size() - 1) + "]");
103 return ((java.lang.Double) _dList.get(index)).doubleValue();
107 * Method getD.Returns the contents of the collection in an Array.
109 * @return this collection as an Array
111 public double[] getD()
113 int size = this._dList.size();
114 double[] array = new double[size];
115 java.util.Iterator iter = _dList.iterator();
116 for (int index = 0; index < size; index++)
118 array[index] = ((java.lang.Double) iter.next()).doubleValue();
126 * @return the size of this collection
128 public int getDCount()
130 return this._dList.size();
136 * @return true if this object is valid according to the schema
138 public boolean isValid()
143 } catch (org.exolab.castor.xml.ValidationException vex)
154 * @throws org.exolab.castor.xml.MarshalException
155 * if object is null or if any SAXException is thrown during
157 * @throws org.exolab.castor.xml.ValidationException
158 * if this object is an invalid instance according to the schema
160 public void marshal(final java.io.Writer out)
161 throws org.exolab.castor.xml.MarshalException,
162 org.exolab.castor.xml.ValidationException
164 Marshaller.marshal(this, out);
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
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
184 Marshaller.marshal(this, handler);
189 public void removeAllD()
198 * @return true if the object was removed from the collection.
200 public boolean removeD(final double vD)
202 boolean removed = _dList.remove(new java.lang.Double(vD));
210 * @return the element removed from the collection
212 public double removeDAt(final int index)
214 java.lang.Object obj = this._dList.remove(index);
215 return ((java.lang.Double) obj).doubleValue();
223 * @throws java.lang.IndexOutOfBoundsException
224 * if the index given is outside the bounds of the collection
226 public void setD(final int index, final double vD)
227 throws java.lang.IndexOutOfBoundsException
229 // check bounds for index
230 if (index < 0 || index >= this._dList.size())
232 throw new IndexOutOfBoundsException("setD: Index value '" + index
233 + "' not in range [0.." + (this._dList.size() - 1) + "]");
236 this._dList.set(index, new java.lang.Double(vD));
244 public void setD(final double[] vDArray)
249 for (int i = 0; i < vDArray.length; i++)
251 this._dList.add(new java.lang.Double(vDArray[i]));
259 * @throws org.exolab.castor.xml.MarshalException
260 * if object is null or if any SAXException is thrown during
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
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
271 return (jalview.schemabinding.version2.DoubleVector) Unmarshaller
272 .unmarshal(jalview.schemabinding.version2.DoubleVector.class,
279 * @throws org.exolab.castor.xml.ValidationException
280 * if this object is an invalid instance according to the schema
282 public void validate() throws org.exolab.castor.xml.ValidationException
284 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
285 validator.validate(this);