JAL-1767 save PCA D and E vectors instead of 'details' text
[jalview.git] / src / jalview / schemabinding / version2 / DoubleMatrix.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 DoubleMatrix.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class DoubleMatrix implements java.io.Serializable
23 {
24
25   // --------------------------/
26   // - Class/Member Variables -/
27   // --------------------------/
28
29   /**
30    * Field _rows.
31    */
32   private int _rows;
33
34   /**
35    * keeps track of state for field: _rows
36    */
37   private boolean _has_rows;
38
39   /**
40    * Field _columns.
41    */
42   private int _columns;
43
44   /**
45    * keeps track of state for field: _columns
46    */
47   private boolean _has_columns;
48
49   /**
50    * Field _rowList.
51    */
52   private java.util.Vector _rowList;
53
54   // ----------------/
55   // - Constructors -/
56   // ----------------/
57
58   public DoubleMatrix()
59   {
60     super();
61     this._rowList = new java.util.Vector();
62   }
63
64   // -----------/
65   // - Methods -/
66   // -----------/
67
68   /**
69    * 
70    * 
71    * @param vRow
72    * @throws java.lang.IndexOutOfBoundsException
73    *           if the index given is outside the bounds of the collection
74    */
75   public void addRow(final jalview.schemabinding.version2.Row vRow)
76           throws java.lang.IndexOutOfBoundsException
77   {
78     this._rowList.addElement(vRow);
79   }
80
81   /**
82    * 
83    * 
84    * @param index
85    * @param vRow
86    * @throws java.lang.IndexOutOfBoundsException
87    *           if the index given is outside the bounds of the collection
88    */
89   public void addRow(final int index,
90           final jalview.schemabinding.version2.Row vRow)
91           throws java.lang.IndexOutOfBoundsException
92   {
93     this._rowList.add(index, vRow);
94   }
95
96   /**
97    */
98   public void deleteColumns()
99   {
100     this._has_columns = false;
101   }
102
103   /**
104    */
105   public void deleteRows()
106   {
107     this._has_rows = false;
108   }
109
110   /**
111    * Method enumerateRow.
112    * 
113    * @return an Enumeration over all jalview.schemabinding.version2.Row elements
114    */
115   public java.util.Enumeration enumerateRow()
116   {
117     return this._rowList.elements();
118   }
119
120   /**
121    * Returns the value of field 'columns'.
122    * 
123    * @return the value of field 'Columns'.
124    */
125   public int getColumns()
126   {
127     return this._columns;
128   }
129
130   /**
131    * Method getRow.
132    * 
133    * @param index
134    * @throws java.lang.IndexOutOfBoundsException
135    *           if the index given is outside the bounds of the collection
136    * @return the value of the jalview.schemabinding.version2.Row at the given
137    *         index
138    */
139   public jalview.schemabinding.version2.Row getRow(final int index)
140           throws java.lang.IndexOutOfBoundsException
141   {
142     // check bounds for index
143     if (index < 0 || index >= this._rowList.size())
144     {
145       throw new IndexOutOfBoundsException("getRow: Index value '" + index
146               + "' not in range [0.." + (this._rowList.size() - 1) + "]");
147     }
148
149     return (jalview.schemabinding.version2.Row) _rowList.get(index);
150   }
151
152   /**
153    * Method getRow.Returns the contents of the collection in an Array.
154    * <p>
155    * Note: Just in case the collection contents are changing in another thread,
156    * we pass a 0-length Array of the correct type into the API call. This way we
157    * <i>know</i> that the Array returned is of exactly the correct length.
158    * 
159    * @return this collection as an Array
160    */
161   public jalview.schemabinding.version2.Row[] getRow()
162   {
163     jalview.schemabinding.version2.Row[] array = new jalview.schemabinding.version2.Row[0];
164     return (jalview.schemabinding.version2.Row[]) this._rowList
165             .toArray(array);
166   }
167
168   /**
169    * Method getRowCount.
170    * 
171    * @return the size of this collection
172    */
173   public int getRowCount()
174   {
175     return this._rowList.size();
176   }
177
178   /**
179    * Returns the value of field 'rows'.
180    * 
181    * @return the value of field 'Rows'.
182    */
183   public int getRows()
184   {
185     return this._rows;
186   }
187
188   /**
189    * Method hasColumns.
190    * 
191    * @return true if at least one Columns has been added
192    */
193   public boolean hasColumns()
194   {
195     return this._has_columns;
196   }
197
198   /**
199    * Method hasRows.
200    * 
201    * @return true if at least one Rows has been added
202    */
203   public boolean hasRows()
204   {
205     return this._has_rows;
206   }
207
208   /**
209    * Method isValid.
210    * 
211    * @return true if this object is valid according to the schema
212    */
213   public boolean isValid()
214   {
215     try
216     {
217       validate();
218     } catch (org.exolab.castor.xml.ValidationException vex)
219     {
220       return false;
221     }
222     return true;
223   }
224
225   /**
226    * 
227    * 
228    * @param out
229    * @throws org.exolab.castor.xml.MarshalException
230    *           if object is null or if any SAXException is thrown during
231    *           marshaling
232    * @throws org.exolab.castor.xml.ValidationException
233    *           if this object is an invalid instance according to the schema
234    */
235   public void marshal(final java.io.Writer out)
236           throws org.exolab.castor.xml.MarshalException,
237           org.exolab.castor.xml.ValidationException
238   {
239     Marshaller.marshal(this, out);
240   }
241
242   /**
243    * 
244    * 
245    * @param handler
246    * @throws java.io.IOException
247    *           if an IOException occurs during marshaling
248    * @throws org.exolab.castor.xml.ValidationException
249    *           if this object is an invalid instance according to the schema
250    * @throws org.exolab.castor.xml.MarshalException
251    *           if object is null or if any SAXException is thrown during
252    *           marshaling
253    */
254   public void marshal(final org.xml.sax.ContentHandler handler)
255           throws java.io.IOException,
256           org.exolab.castor.xml.MarshalException,
257           org.exolab.castor.xml.ValidationException
258   {
259     Marshaller.marshal(this, handler);
260   }
261
262   /**
263    */
264   public void removeAllRow()
265   {
266     this._rowList.clear();
267   }
268
269   /**
270    * Method removeRow.
271    * 
272    * @param vRow
273    * @return true if the object was removed from the collection.
274    */
275   public boolean removeRow(final jalview.schemabinding.version2.Row vRow)
276   {
277     boolean removed = _rowList.remove(vRow);
278     return removed;
279   }
280
281   /**
282    * Method removeRowAt.
283    * 
284    * @param index
285    * @return the element removed from the collection
286    */
287   public jalview.schemabinding.version2.Row removeRowAt(final int index)
288   {
289     java.lang.Object obj = this._rowList.remove(index);
290     return (jalview.schemabinding.version2.Row) obj;
291   }
292
293   /**
294    * Sets the value of field 'columns'.
295    * 
296    * @param columns
297    *          the value of field 'columns'.
298    */
299   public void setColumns(final int columns)
300   {
301     this._columns = columns;
302     this._has_columns = true;
303   }
304
305   /**
306    * 
307    * 
308    * @param index
309    * @param vRow
310    * @throws java.lang.IndexOutOfBoundsException
311    *           if the index given is outside the bounds of the collection
312    */
313   public void setRow(final int index,
314           final jalview.schemabinding.version2.Row vRow)
315           throws java.lang.IndexOutOfBoundsException
316   {
317     // check bounds for index
318     if (index < 0 || index >= this._rowList.size())
319     {
320       throw new IndexOutOfBoundsException("setRow: Index value '" + index
321               + "' not in range [0.." + (this._rowList.size() - 1) + "]");
322     }
323
324     this._rowList.set(index, vRow);
325   }
326
327   /**
328    * 
329    * 
330    * @param vRowArray
331    */
332   public void setRow(final jalview.schemabinding.version2.Row[] vRowArray)
333   {
334     // -- copy array
335     _rowList.clear();
336
337     for (int i = 0; i < vRowArray.length; i++)
338     {
339       this._rowList.add(vRowArray[i]);
340     }
341   }
342
343   /**
344    * Sets the value of field 'rows'.
345    * 
346    * @param rows
347    *          the value of field 'rows'.
348    */
349   public void setRows(final int rows)
350   {
351     this._rows = rows;
352     this._has_rows = true;
353   }
354
355   /**
356    * Method unmarshal.
357    * 
358    * @param reader
359    * @throws org.exolab.castor.xml.MarshalException
360    *           if object is null or if any SAXException is thrown during
361    *           marshaling
362    * @throws org.exolab.castor.xml.ValidationException
363    *           if this object is an invalid instance according to the schema
364    * @return the unmarshaled jalview.schemabinding.version2.DoubleMatrix
365    */
366   public static jalview.schemabinding.version2.DoubleMatrix unmarshal(
367           final java.io.Reader reader)
368           throws org.exolab.castor.xml.MarshalException,
369           org.exolab.castor.xml.ValidationException
370   {
371     return (jalview.schemabinding.version2.DoubleMatrix) Unmarshaller
372             .unmarshal(jalview.schemabinding.version2.DoubleMatrix.class,
373                     reader);
374   }
375
376   /**
377    * 
378    * 
379    * @throws org.exolab.castor.xml.ValidationException
380    *           if this object is an invalid instance according to the schema
381    */
382   public void validate() throws org.exolab.castor.xml.ValidationException
383   {
384     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
385     validator.validate(this);
386   }
387
388 }