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;
27 * Store a list of database references
28 * for this sequence record - with optional mapping
29 * from database sequence to the given sequence record
31 * @version $Revision$ $Date$
33 public class DbRef extends uk.ac.vamsas.client.Vobject
34 implements java.io.Serializable
38 //--------------------------/
39 //- Class/Member Variables -/
40 //--------------------------/
43 * TODO Database Naming
44 * Convention: either start using LSID (so
45 * change type to URI) or leave this as an
46 * uncontrolled/unspecified string ID
49 private java.lang.String _source;
52 * Version must be specified -
55 private java.lang.String _version;
58 * TODO: make some specification
59 * of the database field from which this
60 * accessionId is taken from - should that be a
61 * special property of the dbRef object ?
64 private java.lang.String _accessionId;
67 * Primary Key for vamsas object
70 private java.lang.String _id;
73 * From: Offset to first
74 * position in dataset sequence record that
75 * this database entry maps to To: Offset
76 * to last position in dataset sequence
77 * record that this database entry maps to
78 * Start: Offset to first last position in
79 * database entry that first (or offset)
80 * position in sequence maps to End: Offset
81 * to last position in database entry that
82 * last (offset) position in sequence maps
85 private java.util.Vector _mapList;
90 private java.util.Vector _linkList;
95 private java.util.Vector _propertyList;
105 _mapList = new Vector();
106 _linkList = new Vector();
107 _propertyList = new Vector();
108 } //-- uk.ac.vamsas.objects.core.DbRef()
122 public void addLink(uk.ac.vamsas.objects.core.Link vLink)
123 throws java.lang.IndexOutOfBoundsException
125 _linkList.addElement(vLink);
126 } //-- void addLink(uk.ac.vamsas.objects.core.Link)
136 public void addLink(int index, uk.ac.vamsas.objects.core.Link vLink)
137 throws java.lang.IndexOutOfBoundsException
139 _linkList.insertElementAt(vLink, index);
140 } //-- void addLink(int, uk.ac.vamsas.objects.core.Link)
149 public void addMap(uk.ac.vamsas.objects.core.Map vMap)
150 throws java.lang.IndexOutOfBoundsException
152 _mapList.addElement(vMap);
153 } //-- void addMap(uk.ac.vamsas.objects.core.Map)
163 public void addMap(int index, uk.ac.vamsas.objects.core.Map vMap)
164 throws java.lang.IndexOutOfBoundsException
166 _mapList.insertElementAt(vMap, index);
167 } //-- void addMap(int, uk.ac.vamsas.objects.core.Map)
176 public void addProperty(uk.ac.vamsas.objects.core.Property vProperty)
177 throws java.lang.IndexOutOfBoundsException
179 _propertyList.addElement(vProperty);
180 } //-- void addProperty(uk.ac.vamsas.objects.core.Property)
190 public void addProperty(int index, uk.ac.vamsas.objects.core.Property vProperty)
191 throws java.lang.IndexOutOfBoundsException
193 _propertyList.insertElementAt(vProperty, index);
194 } //-- void addProperty(int, uk.ac.vamsas.objects.core.Property)
197 * Method enumerateLink
201 * @return Enumeration
203 public java.util.Enumeration enumerateLink()
205 return _linkList.elements();
206 } //-- java.util.Enumeration enumerateLink()
209 * Method enumerateMap
213 * @return Enumeration
215 public java.util.Enumeration enumerateMap()
217 return _mapList.elements();
218 } //-- java.util.Enumeration enumerateMap()
221 * Method enumerateProperty
225 * @return Enumeration
227 public java.util.Enumeration enumerateProperty()
229 return _propertyList.elements();
230 } //-- java.util.Enumeration enumerateProperty()
233 * Note: hashCode() has not been overriden
238 public boolean equals(java.lang.Object obj)
243 if (super.equals(obj)==false)
246 if (obj instanceof DbRef) {
248 DbRef temp = (DbRef)obj;
249 if (this._source != null) {
250 if (temp._source == null) return false;
251 else if (!(this._source.equals(temp._source)))
254 else if (temp._source != null)
256 if (this._version != null) {
257 if (temp._version == null) return false;
258 else if (!(this._version.equals(temp._version)))
261 else if (temp._version != null)
263 if (this._accessionId != null) {
264 if (temp._accessionId == null) return false;
265 else if (!(this._accessionId.equals(temp._accessionId)))
268 else if (temp._accessionId != null)
270 if (this._id != null) {
271 if (temp._id == null) return false;
272 else if (!(this._id.equals(temp._id)))
275 else if (temp._id != null)
277 if (this._mapList != null) {
278 if (temp._mapList == null) return false;
279 else if (!(this._mapList.equals(temp._mapList)))
282 else if (temp._mapList != null)
284 if (this._linkList != null) {
285 if (temp._linkList == null) return false;
286 else if (!(this._linkList.equals(temp._linkList)))
289 else if (temp._linkList != null)
291 if (this._propertyList != null) {
292 if (temp._propertyList == null) return false;
293 else if (!(this._propertyList.equals(temp._propertyList)))
296 else if (temp._propertyList != null)
301 } //-- boolean equals(java.lang.Object)
304 * Returns the value of field 'accessionId'. The field
305 * 'accessionId' has the following description: TODO: make some
307 * of the database field from which this
308 * accessionId is taken from - should that be a
309 * special property of the dbRef object ?
313 * @return the value of field 'accessionId'.
315 public java.lang.String getAccessionId()
317 return this._accessionId;
318 } //-- java.lang.String getAccessionId()
321 * Returns the value of field 'id'. The field 'id' has the
322 * following description: Primary Key for vamsas object
326 * @return the value of field 'id'.
328 public java.lang.String getId()
331 } //-- java.lang.String getId()
341 public uk.ac.vamsas.objects.core.Link getLink(int index)
342 throws java.lang.IndexOutOfBoundsException
344 //-- check bounds for index
345 if ((index < 0) || (index > _linkList.size())) {
346 throw new IndexOutOfBoundsException("getLink: Index value '"+index+"' not in range [0.."+_linkList.size()+ "]");
349 return (uk.ac.vamsas.objects.core.Link) _linkList.elementAt(index);
350 } //-- uk.ac.vamsas.objects.core.Link getLink(int)
359 public uk.ac.vamsas.objects.core.Link[] getLink()
361 int size = _linkList.size();
362 uk.ac.vamsas.objects.core.Link[] mArray = new uk.ac.vamsas.objects.core.Link[size];
363 for (int index = 0; index < size; index++) {
364 mArray[index] = (uk.ac.vamsas.objects.core.Link) _linkList.elementAt(index);
367 } //-- uk.ac.vamsas.objects.core.Link[] getLink()
370 * Method getLinkCount
376 public int getLinkCount()
378 return _linkList.size();
379 } //-- int getLinkCount()
389 public uk.ac.vamsas.objects.core.Map getMap(int index)
390 throws java.lang.IndexOutOfBoundsException
392 //-- check bounds for index
393 if ((index < 0) || (index > _mapList.size())) {
394 throw new IndexOutOfBoundsException("getMap: Index value '"+index+"' not in range [0.."+_mapList.size()+ "]");
397 return (uk.ac.vamsas.objects.core.Map) _mapList.elementAt(index);
398 } //-- uk.ac.vamsas.objects.core.Map getMap(int)
407 public uk.ac.vamsas.objects.core.Map[] getMap()
409 int size = _mapList.size();
410 uk.ac.vamsas.objects.core.Map[] mArray = new uk.ac.vamsas.objects.core.Map[size];
411 for (int index = 0; index < size; index++) {
412 mArray[index] = (uk.ac.vamsas.objects.core.Map) _mapList.elementAt(index);
415 } //-- uk.ac.vamsas.objects.core.Map[] getMap()
424 public int getMapCount()
426 return _mapList.size();
427 } //-- int getMapCount()
437 public uk.ac.vamsas.objects.core.Property getProperty(int index)
438 throws java.lang.IndexOutOfBoundsException
440 //-- check bounds for index
441 if ((index < 0) || (index > _propertyList.size())) {
442 throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
445 return (uk.ac.vamsas.objects.core.Property) _propertyList.elementAt(index);
446 } //-- uk.ac.vamsas.objects.core.Property getProperty(int)
455 public uk.ac.vamsas.objects.core.Property[] getProperty()
457 int size = _propertyList.size();
458 uk.ac.vamsas.objects.core.Property[] mArray = new uk.ac.vamsas.objects.core.Property[size];
459 for (int index = 0; index < size; index++) {
460 mArray[index] = (uk.ac.vamsas.objects.core.Property) _propertyList.elementAt(index);
463 } //-- uk.ac.vamsas.objects.core.Property[] getProperty()
466 * Method getPropertyCount
472 public int getPropertyCount()
474 return _propertyList.size();
475 } //-- int getPropertyCount()
478 * Returns the value of field 'source'. The field 'source' has
479 * the following description: TODO Database Naming
480 * Convention: either start using LSID (so
481 * change type to URI) or leave this as an
482 * uncontrolled/unspecified string ID
486 * @return the value of field 'source'.
488 public java.lang.String getSource()
491 } //-- java.lang.String getSource()
494 * Returns the value of field 'version'. The field 'version'
495 * has the following description: Version must be specified -
499 * @return the value of field 'version'.
501 public java.lang.String getVersion()
503 return this._version;
504 } //-- java.lang.String getVersion()
513 public boolean isValid()
518 catch (org.exolab.castor.xml.ValidationException vex) {
522 } //-- boolean isValid()
531 public void marshal(java.io.Writer out)
532 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
535 Marshaller.marshal(this, out);
536 } //-- void marshal(java.io.Writer)
545 public void marshal(org.xml.sax.ContentHandler handler)
546 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
549 Marshaller.marshal(this, handler);
550 } //-- void marshal(org.xml.sax.ContentHandler)
553 * Method removeAllLink
556 public void removeAllLink()
558 _linkList.removeAllElements();
559 } //-- void removeAllLink()
562 * Method removeAllMap
565 public void removeAllMap()
567 _mapList.removeAllElements();
568 } //-- void removeAllMap()
571 * Method removeAllProperty
574 public void removeAllProperty()
576 _propertyList.removeAllElements();
577 } //-- void removeAllProperty()
587 public uk.ac.vamsas.objects.core.Link removeLink(int index)
589 java.lang.Object obj = _linkList.elementAt(index);
590 _linkList.removeElementAt(index);
591 return (uk.ac.vamsas.objects.core.Link) obj;
592 } //-- uk.ac.vamsas.objects.core.Link removeLink(int)
602 public uk.ac.vamsas.objects.core.Map removeMap(int index)
604 java.lang.Object obj = _mapList.elementAt(index);
605 _mapList.removeElementAt(index);
606 return (uk.ac.vamsas.objects.core.Map) obj;
607 } //-- uk.ac.vamsas.objects.core.Map removeMap(int)
610 * Method removeProperty
617 public uk.ac.vamsas.objects.core.Property removeProperty(int index)
619 java.lang.Object obj = _propertyList.elementAt(index);
620 _propertyList.removeElementAt(index);
621 return (uk.ac.vamsas.objects.core.Property) obj;
622 } //-- uk.ac.vamsas.objects.core.Property removeProperty(int)
625 * Sets the value of field 'accessionId'. The field
626 * 'accessionId' has the following description: TODO: make some
628 * of the database field from which this
629 * accessionId is taken from - should that be a
630 * special property of the dbRef object ?
633 * @param accessionId the value of field 'accessionId'.
635 public void setAccessionId(java.lang.String accessionId)
637 this._accessionId = accessionId;
638 } //-- void setAccessionId(java.lang.String)
641 * Sets the value of field 'id'. The field 'id' has the
642 * following description: Primary Key for vamsas object
645 * @param id the value of field 'id'.
647 public void setId(java.lang.String id)
650 } //-- void setId(java.lang.String)
660 public void setLink(int index, uk.ac.vamsas.objects.core.Link vLink)
661 throws java.lang.IndexOutOfBoundsException
663 //-- check bounds for index
664 if ((index < 0) || (index > _linkList.size())) {
665 throw new IndexOutOfBoundsException("setLink: Index value '"+index+"' not in range [0.."+_linkList.size()+ "]");
667 _linkList.setElementAt(vLink, index);
668 } //-- void setLink(int, uk.ac.vamsas.objects.core.Link)
677 public void setLink(uk.ac.vamsas.objects.core.Link[] linkArray)
680 _linkList.removeAllElements();
681 for (int i = 0; i < linkArray.length; i++) {
682 _linkList.addElement(linkArray[i]);
684 } //-- void setLink(uk.ac.vamsas.objects.core.Link)
694 public void setMap(int index, uk.ac.vamsas.objects.core.Map vMap)
695 throws java.lang.IndexOutOfBoundsException
697 //-- check bounds for index
698 if ((index < 0) || (index > _mapList.size())) {
699 throw new IndexOutOfBoundsException("setMap: Index value '"+index+"' not in range [0.."+_mapList.size()+ "]");
701 _mapList.setElementAt(vMap, index);
702 } //-- void setMap(int, uk.ac.vamsas.objects.core.Map)
711 public void setMap(uk.ac.vamsas.objects.core.Map[] mapArray)
714 _mapList.removeAllElements();
715 for (int i = 0; i < mapArray.length; i++) {
716 _mapList.addElement(mapArray[i]);
718 } //-- void setMap(uk.ac.vamsas.objects.core.Map)
728 public void setProperty(int index, uk.ac.vamsas.objects.core.Property vProperty)
729 throws java.lang.IndexOutOfBoundsException
731 //-- check bounds for index
732 if ((index < 0) || (index > _propertyList.size())) {
733 throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
735 _propertyList.setElementAt(vProperty, index);
736 } //-- void setProperty(int, uk.ac.vamsas.objects.core.Property)
743 * @param propertyArray
745 public void setProperty(uk.ac.vamsas.objects.core.Property[] propertyArray)
748 _propertyList.removeAllElements();
749 for (int i = 0; i < propertyArray.length; i++) {
750 _propertyList.addElement(propertyArray[i]);
752 } //-- void setProperty(uk.ac.vamsas.objects.core.Property)
755 * Sets the value of field 'source'. The field 'source' has the
756 * following description: TODO Database Naming
757 * Convention: either start using LSID (so
758 * change type to URI) or leave this as an
759 * uncontrolled/unspecified string ID
762 * @param source the value of field 'source'.
764 public void setSource(java.lang.String source)
766 this._source = source;
767 } //-- void setSource(java.lang.String)
770 * Sets the value of field 'version'. The field 'version' has
771 * the following description: Version must be specified -
774 * @param version the value of field 'version'.
776 public void setVersion(java.lang.String version)
778 this._version = version;
779 } //-- void setVersion(java.lang.String)
789 public static uk.ac.vamsas.objects.core.DbRef unmarshal(java.io.Reader reader)
790 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
792 return (uk.ac.vamsas.objects.core.DbRef) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.DbRef.class, reader);
793 } //-- uk.ac.vamsas.objects.core.DbRef unmarshal(java.io.Reader)
799 public void validate()
800 throws org.exolab.castor.xml.ValidationException
802 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
803 validator.validate(this);
804 } //-- void validate()