2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package uk.ac.vamsas.objects.core;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import java.util.Enumeration;
19 import java.util.Vector;
20 import org.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.Marshaller;
22 import org.exolab.castor.xml.Unmarshaller;
23 import org.exolab.castor.xml.ValidationException;
24 import org.xml.sax.ContentHandler;
29 * @version $Revision$ $Date$
31 public class DataSet extends uk.ac.vamsas.client.Vobject
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Primary Key for vamsas object referencing
43 private java.lang.String _id;
48 private java.util.Vector _sequenceList;
51 * Field _dataSetAnnotationsList
53 private java.util.Vector _dataSetAnnotationsList;
56 * Field _alignmentList
58 private java.util.Vector _alignmentList;
63 private java.util.Vector _treeList;
68 private uk.ac.vamsas.objects.core.Provenance _provenance;
78 _sequenceList = new Vector();
79 _dataSetAnnotationsList = new Vector();
80 _alignmentList = new Vector();
81 _treeList = new Vector();
82 } //-- uk.ac.vamsas.objects.core.DataSet()
96 public void addAlignment(uk.ac.vamsas.objects.core.Alignment vAlignment)
97 throws java.lang.IndexOutOfBoundsException
99 _alignmentList.addElement(vAlignment);
100 } //-- void addAlignment(uk.ac.vamsas.objects.core.Alignment)
103 * Method addAlignment
110 public void addAlignment(int index, uk.ac.vamsas.objects.core.Alignment vAlignment)
111 throws java.lang.IndexOutOfBoundsException
113 _alignmentList.insertElementAt(vAlignment, index);
114 } //-- void addAlignment(int, uk.ac.vamsas.objects.core.Alignment)
117 * Method addDataSetAnnotations
121 * @param vDataSetAnnotations
123 public void addDataSetAnnotations(uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
124 throws java.lang.IndexOutOfBoundsException
126 _dataSetAnnotationsList.addElement(vDataSetAnnotations);
127 } //-- void addDataSetAnnotations(uk.ac.vamsas.objects.core.DataSetAnnotations)
130 * Method addDataSetAnnotations
135 * @param vDataSetAnnotations
137 public void addDataSetAnnotations(int index, uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
138 throws java.lang.IndexOutOfBoundsException
140 _dataSetAnnotationsList.insertElementAt(vDataSetAnnotations, index);
141 } //-- void addDataSetAnnotations(int, uk.ac.vamsas.objects.core.DataSetAnnotations)
150 public void addSequence(uk.ac.vamsas.objects.core.Sequence vSequence)
151 throws java.lang.IndexOutOfBoundsException
153 _sequenceList.addElement(vSequence);
154 } //-- void addSequence(uk.ac.vamsas.objects.core.Sequence)
164 public void addSequence(int index, uk.ac.vamsas.objects.core.Sequence vSequence)
165 throws java.lang.IndexOutOfBoundsException
167 _sequenceList.insertElementAt(vSequence, index);
168 } //-- void addSequence(int, uk.ac.vamsas.objects.core.Sequence)
177 public void addTree(uk.ac.vamsas.objects.core.Tree vTree)
178 throws java.lang.IndexOutOfBoundsException
180 _treeList.addElement(vTree);
181 } //-- void addTree(uk.ac.vamsas.objects.core.Tree)
191 public void addTree(int index, uk.ac.vamsas.objects.core.Tree vTree)
192 throws java.lang.IndexOutOfBoundsException
194 _treeList.insertElementAt(vTree, index);
195 } //-- void addTree(int, uk.ac.vamsas.objects.core.Tree)
198 * Method enumerateAlignment
202 * @return Enumeration
204 public java.util.Enumeration enumerateAlignment()
206 return _alignmentList.elements();
207 } //-- java.util.Enumeration enumerateAlignment()
210 * Method enumerateDataSetAnnotations
214 * @return Enumeration
216 public java.util.Enumeration enumerateDataSetAnnotations()
218 return _dataSetAnnotationsList.elements();
219 } //-- java.util.Enumeration enumerateDataSetAnnotations()
222 * Method enumerateSequence
226 * @return Enumeration
228 public java.util.Enumeration enumerateSequence()
230 return _sequenceList.elements();
231 } //-- java.util.Enumeration enumerateSequence()
234 * Method enumerateTree
238 * @return Enumeration
240 public java.util.Enumeration enumerateTree()
242 return _treeList.elements();
243 } //-- java.util.Enumeration enumerateTree()
246 * Note: hashCode() has not been overriden
251 public boolean equals(java.lang.Object obj)
256 if (super.equals(obj)==false)
259 if (obj instanceof DataSet) {
261 DataSet temp = (DataSet)obj;
262 if (this._id != null) {
263 if (temp._id == null) return false;
264 else if (!(this._id.equals(temp._id)))
267 else if (temp._id != null)
269 if (this._sequenceList != null) {
270 if (temp._sequenceList == null) return false;
271 else if (!(this._sequenceList.equals(temp._sequenceList)))
274 else if (temp._sequenceList != null)
276 if (this._dataSetAnnotationsList != null) {
277 if (temp._dataSetAnnotationsList == null) return false;
278 else if (!(this._dataSetAnnotationsList.equals(temp._dataSetAnnotationsList)))
281 else if (temp._dataSetAnnotationsList != null)
283 if (this._alignmentList != null) {
284 if (temp._alignmentList == null) return false;
285 else if (!(this._alignmentList.equals(temp._alignmentList)))
288 else if (temp._alignmentList != null)
290 if (this._treeList != null) {
291 if (temp._treeList == null) return false;
292 else if (!(this._treeList.equals(temp._treeList)))
295 else if (temp._treeList != null)
297 if (this._provenance != null) {
298 if (temp._provenance == null) return false;
299 else if (!(this._provenance.equals(temp._provenance)))
302 else if (temp._provenance != null)
307 } //-- boolean equals(java.lang.Object)
310 * Method getAlignment
317 public uk.ac.vamsas.objects.core.Alignment getAlignment(int index)
318 throws java.lang.IndexOutOfBoundsException
320 //-- check bounds for index
321 if ((index < 0) || (index > _alignmentList.size())) {
322 throw new IndexOutOfBoundsException("getAlignment: Index value '"+index+"' not in range [0.."+_alignmentList.size()+ "]");
325 return (uk.ac.vamsas.objects.core.Alignment) _alignmentList.elementAt(index);
326 } //-- uk.ac.vamsas.objects.core.Alignment getAlignment(int)
329 * Method getAlignment
335 public uk.ac.vamsas.objects.core.Alignment[] getAlignment()
337 int size = _alignmentList.size();
338 uk.ac.vamsas.objects.core.Alignment[] mArray = new uk.ac.vamsas.objects.core.Alignment[size];
339 for (int index = 0; index < size; index++) {
340 mArray[index] = (uk.ac.vamsas.objects.core.Alignment) _alignmentList.elementAt(index);
343 } //-- uk.ac.vamsas.objects.core.Alignment[] getAlignment()
346 * Method getAlignmentCount
352 public int getAlignmentCount()
354 return _alignmentList.size();
355 } //-- int getAlignmentCount()
358 * Method getDataSetAnnotations
363 * @return DataSetAnnotations
365 public uk.ac.vamsas.objects.core.DataSetAnnotations getDataSetAnnotations(int index)
366 throws java.lang.IndexOutOfBoundsException
368 //-- check bounds for index
369 if ((index < 0) || (index > _dataSetAnnotationsList.size())) {
370 throw new IndexOutOfBoundsException("getDataSetAnnotations: Index value '"+index+"' not in range [0.."+_dataSetAnnotationsList.size()+ "]");
373 return (uk.ac.vamsas.objects.core.DataSetAnnotations) _dataSetAnnotationsList.elementAt(index);
374 } //-- uk.ac.vamsas.objects.core.DataSetAnnotations getDataSetAnnotations(int)
377 * Method getDataSetAnnotations
381 * @return DataSetAnnotations
383 public uk.ac.vamsas.objects.core.DataSetAnnotations[] getDataSetAnnotations()
385 int size = _dataSetAnnotationsList.size();
386 uk.ac.vamsas.objects.core.DataSetAnnotations[] mArray = new uk.ac.vamsas.objects.core.DataSetAnnotations[size];
387 for (int index = 0; index < size; index++) {
388 mArray[index] = (uk.ac.vamsas.objects.core.DataSetAnnotations) _dataSetAnnotationsList.elementAt(index);
391 } //-- uk.ac.vamsas.objects.core.DataSetAnnotations[] getDataSetAnnotations()
394 * Method getDataSetAnnotationsCount
400 public int getDataSetAnnotationsCount()
402 return _dataSetAnnotationsList.size();
403 } //-- int getDataSetAnnotationsCount()
406 * Returns the value of field 'id'. The field 'id' has the
407 * following description: Primary Key for vamsas object
411 * @return the value of field 'id'.
413 public java.lang.String getId()
416 } //-- java.lang.String getId()
419 * Returns the value of field 'provenance'.
422 * @return the value of field 'provenance'.
424 public uk.ac.vamsas.objects.core.Provenance getProvenance()
426 return this._provenance;
427 } //-- uk.ac.vamsas.objects.core.Provenance getProvenance()
437 public uk.ac.vamsas.objects.core.Sequence getSequence(int index)
438 throws java.lang.IndexOutOfBoundsException
440 //-- check bounds for index
441 if ((index < 0) || (index > _sequenceList.size())) {
442 throw new IndexOutOfBoundsException("getSequence: Index value '"+index+"' not in range [0.."+_sequenceList.size()+ "]");
445 return (uk.ac.vamsas.objects.core.Sequence) _sequenceList.elementAt(index);
446 } //-- uk.ac.vamsas.objects.core.Sequence getSequence(int)
455 public uk.ac.vamsas.objects.core.Sequence[] getSequence()
457 int size = _sequenceList.size();
458 uk.ac.vamsas.objects.core.Sequence[] mArray = new uk.ac.vamsas.objects.core.Sequence[size];
459 for (int index = 0; index < size; index++) {
460 mArray[index] = (uk.ac.vamsas.objects.core.Sequence) _sequenceList.elementAt(index);
463 } //-- uk.ac.vamsas.objects.core.Sequence[] getSequence()
466 * Method getSequenceCount
472 public int getSequenceCount()
474 return _sequenceList.size();
475 } //-- int getSequenceCount()
485 public uk.ac.vamsas.objects.core.Tree getTree(int index)
486 throws java.lang.IndexOutOfBoundsException
488 //-- check bounds for index
489 if ((index < 0) || (index > _treeList.size())) {
490 throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
493 return (uk.ac.vamsas.objects.core.Tree) _treeList.elementAt(index);
494 } //-- uk.ac.vamsas.objects.core.Tree getTree(int)
503 public uk.ac.vamsas.objects.core.Tree[] getTree()
505 int size = _treeList.size();
506 uk.ac.vamsas.objects.core.Tree[] mArray = new uk.ac.vamsas.objects.core.Tree[size];
507 for (int index = 0; index < size; index++) {
508 mArray[index] = (uk.ac.vamsas.objects.core.Tree) _treeList.elementAt(index);
511 } //-- uk.ac.vamsas.objects.core.Tree[] getTree()
514 * Method getTreeCount
520 public int getTreeCount()
522 return _treeList.size();
523 } //-- int getTreeCount()
532 public boolean isValid()
537 catch (org.exolab.castor.xml.ValidationException vex) {
541 } //-- boolean isValid()
550 public void marshal(java.io.Writer out)
551 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
554 Marshaller.marshal(this, out);
555 } //-- void marshal(java.io.Writer)
564 public void marshal(org.xml.sax.ContentHandler handler)
565 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
568 Marshaller.marshal(this, handler);
569 } //-- void marshal(org.xml.sax.ContentHandler)
572 * Method removeAlignment
579 public uk.ac.vamsas.objects.core.Alignment removeAlignment(int index)
581 java.lang.Object obj = _alignmentList.elementAt(index);
582 _alignmentList.removeElementAt(index);
583 return (uk.ac.vamsas.objects.core.Alignment) obj;
584 } //-- uk.ac.vamsas.objects.core.Alignment removeAlignment(int)
587 * Method removeAllAlignment
590 public void removeAllAlignment()
592 _alignmentList.removeAllElements();
593 } //-- void removeAllAlignment()
596 * Method removeAllDataSetAnnotations
599 public void removeAllDataSetAnnotations()
601 _dataSetAnnotationsList.removeAllElements();
602 } //-- void removeAllDataSetAnnotations()
605 * Method removeAllSequence
608 public void removeAllSequence()
610 _sequenceList.removeAllElements();
611 } //-- void removeAllSequence()
614 * Method removeAllTree
617 public void removeAllTree()
619 _treeList.removeAllElements();
620 } //-- void removeAllTree()
623 * Method removeDataSetAnnotations
628 * @return DataSetAnnotations
630 public uk.ac.vamsas.objects.core.DataSetAnnotations removeDataSetAnnotations(int index)
632 java.lang.Object obj = _dataSetAnnotationsList.elementAt(index);
633 _dataSetAnnotationsList.removeElementAt(index);
634 return (uk.ac.vamsas.objects.core.DataSetAnnotations) obj;
635 } //-- uk.ac.vamsas.objects.core.DataSetAnnotations removeDataSetAnnotations(int)
638 * Method removeSequence
645 public uk.ac.vamsas.objects.core.Sequence removeSequence(int index)
647 java.lang.Object obj = _sequenceList.elementAt(index);
648 _sequenceList.removeElementAt(index);
649 return (uk.ac.vamsas.objects.core.Sequence) obj;
650 } //-- uk.ac.vamsas.objects.core.Sequence removeSequence(int)
660 public uk.ac.vamsas.objects.core.Tree removeTree(int index)
662 java.lang.Object obj = _treeList.elementAt(index);
663 _treeList.removeElementAt(index);
664 return (uk.ac.vamsas.objects.core.Tree) obj;
665 } //-- uk.ac.vamsas.objects.core.Tree removeTree(int)
668 * Method setAlignment
675 public void setAlignment(int index, uk.ac.vamsas.objects.core.Alignment vAlignment)
676 throws java.lang.IndexOutOfBoundsException
678 //-- check bounds for index
679 if ((index < 0) || (index > _alignmentList.size())) {
680 throw new IndexOutOfBoundsException("setAlignment: Index value '"+index+"' not in range [0.."+_alignmentList.size()+ "]");
682 _alignmentList.setElementAt(vAlignment, index);
683 } //-- void setAlignment(int, uk.ac.vamsas.objects.core.Alignment)
686 * Method setAlignment
690 * @param alignmentArray
692 public void setAlignment(uk.ac.vamsas.objects.core.Alignment[] alignmentArray)
695 _alignmentList.removeAllElements();
696 for (int i = 0; i < alignmentArray.length; i++) {
697 _alignmentList.addElement(alignmentArray[i]);
699 } //-- void setAlignment(uk.ac.vamsas.objects.core.Alignment)
702 * Method setDataSetAnnotations
707 * @param vDataSetAnnotations
709 public void setDataSetAnnotations(int index, uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
710 throws java.lang.IndexOutOfBoundsException
712 //-- check bounds for index
713 if ((index < 0) || (index > _dataSetAnnotationsList.size())) {
714 throw new IndexOutOfBoundsException("setDataSetAnnotations: Index value '"+index+"' not in range [0.."+_dataSetAnnotationsList.size()+ "]");
716 _dataSetAnnotationsList.setElementAt(vDataSetAnnotations, index);
717 } //-- void setDataSetAnnotations(int, uk.ac.vamsas.objects.core.DataSetAnnotations)
720 * Method setDataSetAnnotations
724 * @param dataSetAnnotationsArray
726 public void setDataSetAnnotations(uk.ac.vamsas.objects.core.DataSetAnnotations[] dataSetAnnotationsArray)
729 _dataSetAnnotationsList.removeAllElements();
730 for (int i = 0; i < dataSetAnnotationsArray.length; i++) {
731 _dataSetAnnotationsList.addElement(dataSetAnnotationsArray[i]);
733 } //-- void setDataSetAnnotations(uk.ac.vamsas.objects.core.DataSetAnnotations)
736 * Sets the value of field 'id'. The field 'id' has the
737 * following description: Primary Key for vamsas object
740 * @param id the value of field 'id'.
742 public void setId(java.lang.String id)
745 } //-- void setId(java.lang.String)
748 * Sets the value of field 'provenance'.
750 * @param provenance the value of field 'provenance'.
752 public void setProvenance(uk.ac.vamsas.objects.core.Provenance provenance)
754 this._provenance = provenance;
755 } //-- void setProvenance(uk.ac.vamsas.objects.core.Provenance)
765 public void setSequence(int index, uk.ac.vamsas.objects.core.Sequence vSequence)
766 throws java.lang.IndexOutOfBoundsException
768 //-- check bounds for index
769 if ((index < 0) || (index > _sequenceList.size())) {
770 throw new IndexOutOfBoundsException("setSequence: Index value '"+index+"' not in range [0.."+_sequenceList.size()+ "]");
772 _sequenceList.setElementAt(vSequence, index);
773 } //-- void setSequence(int, uk.ac.vamsas.objects.core.Sequence)
780 * @param sequenceArray
782 public void setSequence(uk.ac.vamsas.objects.core.Sequence[] sequenceArray)
785 _sequenceList.removeAllElements();
786 for (int i = 0; i < sequenceArray.length; i++) {
787 _sequenceList.addElement(sequenceArray[i]);
789 } //-- void setSequence(uk.ac.vamsas.objects.core.Sequence)
799 public void setTree(int index, uk.ac.vamsas.objects.core.Tree vTree)
800 throws java.lang.IndexOutOfBoundsException
802 //-- check bounds for index
803 if ((index < 0) || (index > _treeList.size())) {
804 throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
806 _treeList.setElementAt(vTree, index);
807 } //-- void setTree(int, uk.ac.vamsas.objects.core.Tree)
816 public void setTree(uk.ac.vamsas.objects.core.Tree[] treeArray)
819 _treeList.removeAllElements();
820 for (int i = 0; i < treeArray.length; i++) {
821 _treeList.addElement(treeArray[i]);
823 } //-- void setTree(uk.ac.vamsas.objects.core.Tree)
833 public static uk.ac.vamsas.objects.core.DataSet unmarshal(java.io.Reader reader)
834 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
836 return (uk.ac.vamsas.objects.core.DataSet) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.DataSet.class, reader);
837 } //-- uk.ac.vamsas.objects.core.DataSet unmarshal(java.io.Reader)
843 public void validate()
844 throws org.exolab.castor.xml.ValidationException
846 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
847 validator.validate(this);
848 } //-- void validate()