Merge branch 'features/pca_jaxb_datasetrefs_JAL-3171_JAL-3063_JAL-1767' into develop
[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    * Field _d.
56    */
57   private jalview.schemabinding.version2.D _d;
58
59   /**
60    * Field _e.
61    */
62   private jalview.schemabinding.version2.E _e;
63
64   // ----------------/
65   // - Constructors -/
66   // ----------------/
67
68   public DoubleMatrix()
69   {
70     super();
71     this._rowList = new java.util.Vector();
72   }
73
74   // -----------/
75   // - Methods -/
76   // -----------/
77
78   /**
79    * 
80    * 
81    * @param vRow
82    * @throws java.lang.IndexOutOfBoundsException
83    *           if the index given is outside the bounds of the collection
84    */
85   public void addRow(final jalview.schemabinding.version2.Row vRow)
86           throws java.lang.IndexOutOfBoundsException
87   {
88     this._rowList.addElement(vRow);
89   }
90
91   /**
92    * 
93    * 
94    * @param index
95    * @param vRow
96    * @throws java.lang.IndexOutOfBoundsException
97    *           if the index given is outside the bounds of the collection
98    */
99   public void addRow(final int index,
100           final jalview.schemabinding.version2.Row vRow)
101           throws java.lang.IndexOutOfBoundsException
102   {
103     this._rowList.add(index, vRow);
104   }
105
106   /**
107    */
108   public void deleteColumns()
109   {
110     this._has_columns = false;
111   }
112
113   /**
114    */
115   public void deleteRows()
116   {
117     this._has_rows = false;
118   }
119
120   /**
121    * Method enumerateRow.
122    * 
123    * @return an Enumeration over all jalview.schemabinding.version2.Row elements
124    */
125   public java.util.Enumeration enumerateRow()
126   {
127     return this._rowList.elements();
128   }
129
130   /**
131    * Returns the value of field 'columns'.
132    * 
133    * @return the value of field 'Columns'.
134    */
135   public int getColumns()
136   {
137     return this._columns;
138   }
139
140   /**
141    * Returns the value of field 'd'.
142    * 
143    * @return the value of field 'D'.
144    */
145   public jalview.schemabinding.version2.D getD()
146   {
147     return this._d;
148   }
149
150   /**
151    * Returns the value of field 'e'.
152    * 
153    * @return the value of field 'E'.
154    */
155   public jalview.schemabinding.version2.E getE()
156   {
157     return this._e;
158   }
159
160   /**
161    * Method getRow.
162    * 
163    * @param index
164    * @throws java.lang.IndexOutOfBoundsException
165    *           if the index given is outside the bounds of the collection
166    * @return the value of the jalview.schemabinding.version2.Row at the given
167    *         index
168    */
169   public jalview.schemabinding.version2.Row getRow(final int index)
170           throws java.lang.IndexOutOfBoundsException
171   {
172     // check bounds for index
173     if (index < 0 || index >= this._rowList.size())
174     {
175       throw new IndexOutOfBoundsException("getRow: Index value '" + index
176               + "' not in range [0.." + (this._rowList.size() - 1) + "]");
177     }
178
179     return (jalview.schemabinding.version2.Row) _rowList.get(index);
180   }
181
182   /**
183    * Method getRow.Returns the contents of the collection in an Array.
184    * <p>
185    * Note: Just in case the collection contents are changing in another thread,
186    * we pass a 0-length Array of the correct type into the API call. This way we
187    * <i>know</i> that the Array returned is of exactly the correct length.
188    * 
189    * @return this collection as an Array
190    */
191   public jalview.schemabinding.version2.Row[] getRow()
192   {
193     jalview.schemabinding.version2.Row[] array = new jalview.schemabinding.version2.Row[0];
194     return (jalview.schemabinding.version2.Row[]) this._rowList
195             .toArray(array);
196   }
197
198   /**
199    * Method getRowCount.
200    * 
201    * @return the size of this collection
202    */
203   public int getRowCount()
204   {
205     return this._rowList.size();
206   }
207
208   /**
209    * Returns the value of field 'rows'.
210    * 
211    * @return the value of field 'Rows'.
212    */
213   public int getRows()
214   {
215     return this._rows;
216   }
217
218   /**
219    * Method hasColumns.
220    * 
221    * @return true if at least one Columns has been added
222    */
223   public boolean hasColumns()
224   {
225     return this._has_columns;
226   }
227
228   /**
229    * Method hasRows.
230    * 
231    * @return true if at least one Rows has been added
232    */
233   public boolean hasRows()
234   {
235     return this._has_rows;
236   }
237
238   /**
239    * Method isValid.
240    * 
241    * @return true if this object is valid according to the schema
242    */
243   public boolean isValid()
244   {
245     try
246     {
247       validate();
248     } catch (org.exolab.castor.xml.ValidationException vex)
249     {
250       return false;
251     }
252     return true;
253   }
254
255   /**
256    * 
257    * 
258    * @param out
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    */
265   public void marshal(final java.io.Writer out)
266           throws org.exolab.castor.xml.MarshalException,
267           org.exolab.castor.xml.ValidationException
268   {
269     Marshaller.marshal(this, out);
270   }
271
272   /**
273    * 
274    * 
275    * @param handler
276    * @throws java.io.IOException
277    *           if an IOException occurs during marshaling
278    * @throws org.exolab.castor.xml.ValidationException
279    *           if this object is an invalid instance according to the schema
280    * @throws org.exolab.castor.xml.MarshalException
281    *           if object is null or if any SAXException is thrown during
282    *           marshaling
283    */
284   public void marshal(final org.xml.sax.ContentHandler handler)
285           throws java.io.IOException,
286           org.exolab.castor.xml.MarshalException,
287           org.exolab.castor.xml.ValidationException
288   {
289     Marshaller.marshal(this, handler);
290   }
291
292   /**
293    */
294   public void removeAllRow()
295   {
296     this._rowList.clear();
297   }
298
299   /**
300    * Method removeRow.
301    * 
302    * @param vRow
303    * @return true if the object was removed from the collection.
304    */
305   public boolean removeRow(final jalview.schemabinding.version2.Row vRow)
306   {
307     boolean removed = _rowList.remove(vRow);
308     return removed;
309   }
310
311   /**
312    * Method removeRowAt.
313    * 
314    * @param index
315    * @return the element removed from the collection
316    */
317   public jalview.schemabinding.version2.Row removeRowAt(final int index)
318   {
319     java.lang.Object obj = this._rowList.remove(index);
320     return (jalview.schemabinding.version2.Row) obj;
321   }
322
323   /**
324    * Sets the value of field 'columns'.
325    * 
326    * @param columns
327    *          the value of field 'columns'.
328    */
329   public void setColumns(final int columns)
330   {
331     this._columns = columns;
332     this._has_columns = true;
333   }
334
335   /**
336    * Sets the value of field 'd'.
337    * 
338    * @param d
339    *          the value of field 'd'.
340    */
341   public void setD(final jalview.schemabinding.version2.D d)
342   {
343     this._d = d;
344   }
345
346   /**
347    * Sets the value of field 'e'.
348    * 
349    * @param e
350    *          the value of field 'e'.
351    */
352   public void setE(final jalview.schemabinding.version2.E e)
353   {
354     this._e = e;
355   }
356
357   /**
358    * 
359    * 
360    * @param index
361    * @param vRow
362    * @throws java.lang.IndexOutOfBoundsException
363    *           if the index given is outside the bounds of the collection
364    */
365   public void setRow(final int index,
366           final jalview.schemabinding.version2.Row vRow)
367           throws java.lang.IndexOutOfBoundsException
368   {
369     // check bounds for index
370     if (index < 0 || index >= this._rowList.size())
371     {
372       throw new IndexOutOfBoundsException("setRow: Index value '" + index
373               + "' not in range [0.." + (this._rowList.size() - 1) + "]");
374     }
375
376     this._rowList.set(index, vRow);
377   }
378
379   /**
380    * 
381    * 
382    * @param vRowArray
383    */
384   public void setRow(final jalview.schemabinding.version2.Row[] vRowArray)
385   {
386     // -- copy array
387     _rowList.clear();
388
389     for (int i = 0; i < vRowArray.length; i++)
390     {
391       this._rowList.add(vRowArray[i]);
392     }
393   }
394
395   /**
396    * Sets the value of field 'rows'.
397    * 
398    * @param rows
399    *          the value of field 'rows'.
400    */
401   public void setRows(final int rows)
402   {
403     this._rows = rows;
404     this._has_rows = true;
405   }
406
407   /**
408    * Method unmarshal.
409    * 
410    * @param reader
411    * @throws org.exolab.castor.xml.MarshalException
412    *           if object is null or if any SAXException is thrown during
413    *           marshaling
414    * @throws org.exolab.castor.xml.ValidationException
415    *           if this object is an invalid instance according to the schema
416    * @return the unmarshaled jalview.schemabinding.version2.DoubleMatrix
417    */
418   public static jalview.schemabinding.version2.DoubleMatrix unmarshal(
419           final java.io.Reader reader)
420           throws org.exolab.castor.xml.MarshalException,
421           org.exolab.castor.xml.ValidationException
422   {
423     return (jalview.schemabinding.version2.DoubleMatrix) Unmarshaller
424             .unmarshal(jalview.schemabinding.version2.DoubleMatrix.class,
425                     reader);
426   }
427
428   /**
429    * 
430    * 
431    * @throws org.exolab.castor.xml.ValidationException
432    *           if this object is an invalid instance according to the schema
433    */
434   public void validate() throws org.exolab.castor.xml.ValidationException
435   {
436     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
437     validator.validate(this);
438   }
439
440 }