2 * This file is part of the Vamsas Client version 0.2.
3 * Copyright 2010 by Jim Procter, Iain Milne, Pierre Marguerite,
4 * Andrew Waterhouse and Dominik Lindner.
6 * Earlier versions have also been incorporated into Jalview version 2.4
7 * since 2008, and TOPALi version 2 since 2007.
9 * The Vamsas Client is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * The Vamsas Client is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
22 package uk.ac.vamsas.objects.core;
24 //---------------------------------/
25 //- Imported classes and packages -/
26 //---------------------------------/
28 import org.exolab.castor.xml.Marshaller;
29 import org.exolab.castor.xml.Unmarshaller;
32 * Store a list of database references for this sequence record - with optional
33 * mapping from database sequence to the given sequence record
35 * @version $Revision$ $Date: 2007-06-29 13:23:12 +0100 (Fri, 29 Jun 2007)
38 public class DbRef extends uk.ac.vamsas.client.Vobject implements
39 java.io.Serializable {
41 // --------------------------/
42 // - Class/Member Variables -/
43 // --------------------------/
46 * TODO Database Naming Convention: either start using LSID (so change type to
47 * URI) or leave this as an uncontrolled/unspecified string ID
50 private java.lang.String _source;
53 * Version must be specified -
56 private java.lang.String _version;
59 * TODO: make some specification of the database field from which this
60 * accessionId is taken from - should that be a special property of the dbRef
64 private java.lang.String _accessionId;
67 * Primary Key for vamsas object referencing
69 private java.lang.String _id;
72 * the local mapType maps from the parent sequence coordinate frame to the
73 * reference frame defined by the dbRef element. The mapped mapType is the
74 * mapped range defined on the dbRef element's reference frame.
75 * Conventionally, the unit attribute defaults to 1, or will be inferred from
76 * the local sequence's dictionary type and any dictionary type associated
77 * with the database being mapped to. However, it may be used to avoid
81 private java.util.Vector _mapList;
86 private java.util.Vector _linkList;
89 * Field _propertyList.
91 private java.util.Vector _propertyList;
99 this._mapList = new java.util.Vector();
100 this._linkList = new java.util.Vector();
101 this._propertyList = new java.util.Vector();
112 * @throws java.lang.IndexOutOfBoundsException
113 * if the index given is outside the bounds of the collection
115 public void addLink(final uk.ac.vamsas.objects.core.Link vLink)
116 throws java.lang.IndexOutOfBoundsException {
117 this._linkList.addElement(vLink);
125 * @throws java.lang.IndexOutOfBoundsException
126 * if the index given is outside the bounds of the collection
128 public void addLink(final int index,
129 final uk.ac.vamsas.objects.core.Link vLink)
130 throws java.lang.IndexOutOfBoundsException {
131 this._linkList.add(index, vLink);
138 * @throws java.lang.IndexOutOfBoundsException
139 * if the index given is outside the bounds of the collection
141 public void addMap(final uk.ac.vamsas.objects.core.Map vMap)
142 throws java.lang.IndexOutOfBoundsException {
143 this._mapList.addElement(vMap);
151 * @throws java.lang.IndexOutOfBoundsException
152 * if the index given is outside the bounds of the collection
154 public void addMap(final int index, final uk.ac.vamsas.objects.core.Map vMap)
155 throws java.lang.IndexOutOfBoundsException {
156 this._mapList.add(index, vMap);
163 * @throws java.lang.IndexOutOfBoundsException
164 * if the index given is outside the bounds of the collection
166 public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)
167 throws java.lang.IndexOutOfBoundsException {
168 this._propertyList.addElement(vProperty);
176 * @throws java.lang.IndexOutOfBoundsException
177 * if the index given is outside the bounds of the collection
179 public void addProperty(final int index,
180 final uk.ac.vamsas.objects.core.Property vProperty)
181 throws java.lang.IndexOutOfBoundsException {
182 this._propertyList.add(index, vProperty);
186 * Method enumerateLink.
188 * @return an Enumeration over all uk.ac.vamsas.objects.core.Link elements
190 public java.util.Enumeration enumerateLink() {
191 return this._linkList.elements();
195 * Method enumerateMap.
197 * @return an Enumeration over all uk.ac.vamsas.objects.core.Map elements
199 public java.util.Enumeration enumerateMap() {
200 return this._mapList.elements();
204 * Method enumerateProperty.
206 * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements
208 public java.util.Enumeration enumerateProperty() {
209 return this._propertyList.elements();
213 * Overrides the java.lang.Object.equals method.
216 * @return true if the objects are equal.
218 public boolean equals(final java.lang.Object obj) {
222 if (super.equals(obj) == false)
225 if (obj instanceof DbRef) {
227 DbRef temp = (DbRef) obj;
230 if (this._source != null) {
231 if (temp._source == null)
233 if (this._source != temp._source) {
234 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._source);
235 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._source);
236 if (thcycle != tmcycle) {
238 org.castor.util.CycleBreaker.releaseCycleHandle(this._source);
242 org.castor.util.CycleBreaker.releaseCycleHandle(temp._source);
248 if (!this._source.equals(temp._source)) {
249 org.castor.util.CycleBreaker.releaseCycleHandle(this._source);
250 org.castor.util.CycleBreaker.releaseCycleHandle(temp._source);
253 org.castor.util.CycleBreaker.releaseCycleHandle(this._source);
254 org.castor.util.CycleBreaker.releaseCycleHandle(temp._source);
257 } else if (temp._source != null)
259 if (this._version != null) {
260 if (temp._version == null)
262 if (this._version != temp._version) {
263 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._version);
264 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._version);
265 if (thcycle != tmcycle) {
267 org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
271 org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
277 if (!this._version.equals(temp._version)) {
278 org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
279 org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
282 org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
283 org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
286 } else if (temp._version != null)
288 if (this._accessionId != null) {
289 if (temp._accessionId == null)
291 if (this._accessionId != temp._accessionId) {
292 thcycle = org.castor.util.CycleBreaker
293 .startingToCycle(this._accessionId);
294 tmcycle = org.castor.util.CycleBreaker
295 .startingToCycle(temp._accessionId);
296 if (thcycle != tmcycle) {
298 org.castor.util.CycleBreaker
299 .releaseCycleHandle(this._accessionId);
303 org.castor.util.CycleBreaker
304 .releaseCycleHandle(temp._accessionId);
310 if (!this._accessionId.equals(temp._accessionId)) {
311 org.castor.util.CycleBreaker
312 .releaseCycleHandle(this._accessionId);
313 org.castor.util.CycleBreaker
314 .releaseCycleHandle(temp._accessionId);
317 org.castor.util.CycleBreaker.releaseCycleHandle(this._accessionId);
318 org.castor.util.CycleBreaker.releaseCycleHandle(temp._accessionId);
321 } else if (temp._accessionId != null)
323 if (this._id != null) {
324 if (temp._id == null)
326 if (this._id != temp._id) {
327 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
328 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
329 if (thcycle != tmcycle) {
331 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
335 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
341 if (!this._id.equals(temp._id)) {
342 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
343 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
346 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
347 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
350 } else if (temp._id != null)
352 if (this._mapList != null) {
353 if (temp._mapList == null)
355 if (this._mapList != temp._mapList) {
356 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._mapList);
357 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._mapList);
358 if (thcycle != tmcycle) {
360 org.castor.util.CycleBreaker.releaseCycleHandle(this._mapList);
364 org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapList);
370 if (!this._mapList.equals(temp._mapList)) {
371 org.castor.util.CycleBreaker.releaseCycleHandle(this._mapList);
372 org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapList);
375 org.castor.util.CycleBreaker.releaseCycleHandle(this._mapList);
376 org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapList);
379 } else if (temp._mapList != null)
381 if (this._linkList != null) {
382 if (temp._linkList == null)
384 if (this._linkList != temp._linkList) {
385 thcycle = org.castor.util.CycleBreaker
386 .startingToCycle(this._linkList);
387 tmcycle = org.castor.util.CycleBreaker
388 .startingToCycle(temp._linkList);
389 if (thcycle != tmcycle) {
391 org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
395 org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
401 if (!this._linkList.equals(temp._linkList)) {
402 org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
403 org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
406 org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
407 org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
410 } else if (temp._linkList != null)
412 if (this._propertyList != null) {
413 if (temp._propertyList == null)
415 if (this._propertyList != temp._propertyList) {
416 thcycle = org.castor.util.CycleBreaker
417 .startingToCycle(this._propertyList);
418 tmcycle = org.castor.util.CycleBreaker
419 .startingToCycle(temp._propertyList);
420 if (thcycle != tmcycle) {
422 org.castor.util.CycleBreaker
423 .releaseCycleHandle(this._propertyList);
427 org.castor.util.CycleBreaker
428 .releaseCycleHandle(temp._propertyList);
434 if (!this._propertyList.equals(temp._propertyList)) {
435 org.castor.util.CycleBreaker
436 .releaseCycleHandle(this._propertyList);
437 org.castor.util.CycleBreaker
438 .releaseCycleHandle(temp._propertyList);
441 org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
442 org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
445 } else if (temp._propertyList != null)
453 * Returns the value of field 'accessionId'. The field 'accessionId' has the
454 * following description: TODO: make some specification of the database field
455 * from which this accessionId is taken from - should that be a special
456 * property of the dbRef object ?
459 * @return the value of field 'AccessionId'.
461 public java.lang.String getAccessionId() {
462 return this._accessionId;
466 * Returns the value of field 'id'. The field 'id' has the following
467 * description: Primary Key for vamsas object referencing
469 * @return the value of field 'Id'.
471 public java.lang.String getId() {
479 * @throws java.lang.IndexOutOfBoundsException
480 * if the index given is outside the bounds of the collection
481 * @return the value of the uk.ac.vamsas.objects.core.Link at the given index
483 public uk.ac.vamsas.objects.core.Link getLink(final int index)
484 throws java.lang.IndexOutOfBoundsException {
485 // check bounds for index
486 if (index < 0 || index >= this._linkList.size()) {
487 throw new IndexOutOfBoundsException("getLink: Index value '" + index
488 + "' not in range [0.." + (this._linkList.size() - 1) + "]");
491 return (uk.ac.vamsas.objects.core.Link) _linkList.get(index);
495 * Method getLink.Returns the contents of the collection in an Array.
497 * Note: Just in case the collection contents are changing in another thread,
498 * we pass a 0-length Array of the correct type into the API call. This way we
499 * <i>know</i> that the Array returned is of exactly the correct length.
501 * @return this collection as an Array
503 public uk.ac.vamsas.objects.core.Link[] getLink() {
504 uk.ac.vamsas.objects.core.Link[] array = new uk.ac.vamsas.objects.core.Link[0];
505 return (uk.ac.vamsas.objects.core.Link[]) this._linkList.toArray(array);
509 * Method getLinkAsReference.Returns a reference to '_linkList'. No type
510 * checking is performed on any modifications to the Vector.
512 * @return a reference to the Vector backing this class
514 public java.util.Vector getLinkAsReference() {
515 return this._linkList;
519 * Method getLinkCount.
521 * @return the size of this collection
523 public int getLinkCount() {
524 return this._linkList.size();
531 * @throws java.lang.IndexOutOfBoundsException
532 * if the index given is outside the bounds of the collection
533 * @return the value of the uk.ac.vamsas.objects.core.Map at the given index
535 public uk.ac.vamsas.objects.core.Map getMap(final int index)
536 throws java.lang.IndexOutOfBoundsException {
537 // check bounds for index
538 if (index < 0 || index >= this._mapList.size()) {
539 throw new IndexOutOfBoundsException("getMap: Index value '" + index
540 + "' not in range [0.." + (this._mapList.size() - 1) + "]");
543 return (uk.ac.vamsas.objects.core.Map) _mapList.get(index);
547 * Method getMap.Returns the contents of the collection in an Array.
549 * Note: Just in case the collection contents are changing in another thread,
550 * we pass a 0-length Array of the correct type into the API call. This way we
551 * <i>know</i> that the Array returned is of exactly the correct length.
553 * @return this collection as an Array
555 public uk.ac.vamsas.objects.core.Map[] getMap() {
556 uk.ac.vamsas.objects.core.Map[] array = new uk.ac.vamsas.objects.core.Map[0];
557 return (uk.ac.vamsas.objects.core.Map[]) this._mapList.toArray(array);
561 * Method getMapAsReference.Returns a reference to '_mapList'. No type
562 * checking is performed on any modifications to the Vector.
564 * @return a reference to the Vector backing this class
566 public java.util.Vector getMapAsReference() {
567 return this._mapList;
571 * Method getMapCount.
573 * @return the size of this collection
575 public int getMapCount() {
576 return this._mapList.size();
580 * Method getProperty.
583 * @throws java.lang.IndexOutOfBoundsException
584 * if the index given is outside the bounds of the collection
585 * @return the value of the uk.ac.vamsas.objects.core.Property at the given
588 public uk.ac.vamsas.objects.core.Property getProperty(final int index)
589 throws java.lang.IndexOutOfBoundsException {
590 // check bounds for index
591 if (index < 0 || index >= this._propertyList.size()) {
592 throw new IndexOutOfBoundsException("getProperty: Index value '" + index
593 + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
596 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
600 * Method getProperty.Returns the contents of the collection in an Array.
602 * Note: Just in case the collection contents are changing in another thread,
603 * we pass a 0-length Array of the correct type into the API call. This way we
604 * <i>know</i> that the Array returned is of exactly the correct length.
606 * @return this collection as an Array
608 public uk.ac.vamsas.objects.core.Property[] getProperty() {
609 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
610 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList
615 * Method getPropertyAsReference.Returns a reference to '_propertyList'. No
616 * type checking is performed on any modifications to the Vector.
618 * @return a reference to the Vector backing this class
620 public java.util.Vector getPropertyAsReference() {
621 return this._propertyList;
625 * Method getPropertyCount.
627 * @return the size of this collection
629 public int getPropertyCount() {
630 return this._propertyList.size();
634 * Returns the value of field 'source'. The field 'source' has the following
635 * description: TODO Database Naming Convention: either start using LSID (so
636 * change type to URI) or leave this as an uncontrolled/unspecified string ID
639 * @return the value of field 'Source'.
641 public java.lang.String getSource() {
646 * Returns the value of field 'version'. The field 'version' has the following
647 * description: Version must be specified -
650 * @return the value of field 'Version'.
652 public java.lang.String getVersion() {
653 return this._version;
657 * Overrides the java.lang.Object.hashCode method.
659 * The following steps came from <b>Effective Java Programming Language
660 * Guide</b> by Joshua Bloch, Chapter 3
662 * @return a hash code value for the object.
664 public int hashCode() {
665 int result = super.hashCode();
669 && !org.castor.util.CycleBreaker.startingToCycle(_source)) {
670 result = 37 * result + _source.hashCode();
671 org.castor.util.CycleBreaker.releaseCycleHandle(_source);
674 && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
675 result = 37 * result + _version.hashCode();
676 org.castor.util.CycleBreaker.releaseCycleHandle(_version);
678 if (_accessionId != null
679 && !org.castor.util.CycleBreaker.startingToCycle(_accessionId)) {
680 result = 37 * result + _accessionId.hashCode();
681 org.castor.util.CycleBreaker.releaseCycleHandle(_accessionId);
683 if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
684 result = 37 * result + _id.hashCode();
685 org.castor.util.CycleBreaker.releaseCycleHandle(_id);
688 && !org.castor.util.CycleBreaker.startingToCycle(_mapList)) {
689 result = 37 * result + _mapList.hashCode();
690 org.castor.util.CycleBreaker.releaseCycleHandle(_mapList);
692 if (_linkList != null
693 && !org.castor.util.CycleBreaker.startingToCycle(_linkList)) {
694 result = 37 * result + _linkList.hashCode();
695 org.castor.util.CycleBreaker.releaseCycleHandle(_linkList);
697 if (_propertyList != null
698 && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
699 result = 37 * result + _propertyList.hashCode();
700 org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
709 * @return true if this object is valid according to the schema
711 public boolean isValid() {
714 } catch (org.exolab.castor.xml.ValidationException vex) {
724 * @throws org.exolab.castor.xml.MarshalException
725 * if object is null or if any SAXException is thrown during
727 * @throws org.exolab.castor.xml.ValidationException
728 * if this object is an invalid instance according to the schema
730 public void marshal(final java.io.Writer out)
731 throws org.exolab.castor.xml.MarshalException,
732 org.exolab.castor.xml.ValidationException {
733 Marshaller.marshal(this, out);
740 * @throws java.io.IOException
741 * if an IOException occurs during marshaling
742 * @throws org.exolab.castor.xml.ValidationException
743 * if this object is an invalid instance according to the schema
744 * @throws org.exolab.castor.xml.MarshalException
745 * if object is null or if any SAXException is thrown during
748 public void marshal(final org.xml.sax.ContentHandler handler)
749 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
750 org.exolab.castor.xml.ValidationException {
751 Marshaller.marshal(this, handler);
756 public void removeAllLink() {
757 this._linkList.clear();
762 public void removeAllMap() {
763 this._mapList.clear();
768 public void removeAllProperty() {
769 this._propertyList.clear();
776 * @return true if the object was removed from the collection.
778 public boolean removeLink(final uk.ac.vamsas.objects.core.Link vLink) {
779 boolean removed = _linkList.remove(vLink);
784 * Method removeLinkAt.
787 * @return the element removed from the collection
789 public uk.ac.vamsas.objects.core.Link removeLinkAt(final int index) {
790 java.lang.Object obj = this._linkList.remove(index);
791 return (uk.ac.vamsas.objects.core.Link) obj;
798 * @return true if the object was removed from the collection.
800 public boolean removeMap(final uk.ac.vamsas.objects.core.Map vMap) {
801 boolean removed = _mapList.remove(vMap);
806 * Method removeMapAt.
809 * @return the element removed from the collection
811 public uk.ac.vamsas.objects.core.Map removeMapAt(final int index) {
812 java.lang.Object obj = this._mapList.remove(index);
813 return (uk.ac.vamsas.objects.core.Map) obj;
817 * Method removeProperty.
820 * @return true if the object was removed from the collection.
822 public boolean removeProperty(
823 final uk.ac.vamsas.objects.core.Property vProperty) {
824 boolean removed = _propertyList.remove(vProperty);
829 * Method removePropertyAt.
832 * @return the element removed from the collection
834 public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {
835 java.lang.Object obj = this._propertyList.remove(index);
836 return (uk.ac.vamsas.objects.core.Property) obj;
840 * Sets the value of field 'accessionId'. The field 'accessionId' has the
841 * following description: TODO: make some specification of the database field
842 * from which this accessionId is taken from - should that be a special
843 * property of the dbRef object ?
847 * the value of field 'accessionId'.
849 public void setAccessionId(final java.lang.String accessionId) {
850 this._accessionId = accessionId;
854 * Sets the value of field 'id'. The field 'id' has the following description:
855 * Primary Key for vamsas object referencing
858 * the value of field 'id'.
860 public void setId(final java.lang.String id) {
869 * @throws java.lang.IndexOutOfBoundsException
870 * if the index given is outside the bounds of the collection
872 public void setLink(final int index,
873 final uk.ac.vamsas.objects.core.Link vLink)
874 throws java.lang.IndexOutOfBoundsException {
875 // check bounds for index
876 if (index < 0 || index >= this._linkList.size()) {
877 throw new IndexOutOfBoundsException("setLink: Index value '" + index
878 + "' not in range [0.." + (this._linkList.size() - 1) + "]");
881 this._linkList.set(index, vLink);
889 public void setLink(final uk.ac.vamsas.objects.core.Link[] vLinkArray) {
893 for (int i = 0; i < vLinkArray.length; i++) {
894 this._linkList.add(vLinkArray[i]);
899 * Sets the value of '_linkList' by copying the given Vector. All elements
900 * will be checked for type safety.
903 * the Vector to copy.
905 public void setLink(final java.util.Vector vLinkList) {
907 this._linkList.clear();
909 this._linkList.addAll(vLinkList);
913 * Sets the value of '_linkList' by setting it to the given Vector. No type
914 * checking is performed.
921 public void setLinkAsReference(final java.util.Vector linkVector) {
922 this._linkList = linkVector;
930 * @throws java.lang.IndexOutOfBoundsException
931 * if the index given is outside the bounds of the collection
933 public void setMap(final int index, final uk.ac.vamsas.objects.core.Map vMap)
934 throws java.lang.IndexOutOfBoundsException {
935 // check bounds for index
936 if (index < 0 || index >= this._mapList.size()) {
937 throw new IndexOutOfBoundsException("setMap: Index value '" + index
938 + "' not in range [0.." + (this._mapList.size() - 1) + "]");
941 this._mapList.set(index, vMap);
949 public void setMap(final uk.ac.vamsas.objects.core.Map[] vMapArray) {
953 for (int i = 0; i < vMapArray.length; i++) {
954 this._mapList.add(vMapArray[i]);
959 * Sets the value of '_mapList' by copying the given Vector. All elements will
960 * be checked for type safety.
963 * the Vector to copy.
965 public void setMap(final java.util.Vector vMapList) {
967 this._mapList.clear();
969 this._mapList.addAll(vMapList);
973 * Sets the value of '_mapList' by setting it to the given Vector. No type
974 * checking is performed.
981 public void setMapAsReference(final java.util.Vector mapVector) {
982 this._mapList = mapVector;
990 * @throws java.lang.IndexOutOfBoundsException
991 * if the index given is outside the bounds of the collection
993 public void setProperty(final int index,
994 final uk.ac.vamsas.objects.core.Property vProperty)
995 throws java.lang.IndexOutOfBoundsException {
996 // check bounds for index
997 if (index < 0 || index >= this._propertyList.size()) {
998 throw new IndexOutOfBoundsException("setProperty: Index value '" + index
999 + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
1002 this._propertyList.set(index, vProperty);
1008 * @param vPropertyArray
1010 public void setProperty(
1011 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
1013 _propertyList.clear();
1015 for (int i = 0; i < vPropertyArray.length; i++) {
1016 this._propertyList.add(vPropertyArray[i]);
1021 * Sets the value of '_propertyList' by copying the given Vector. All elements
1022 * will be checked for type safety.
1024 * @param vPropertyList
1025 * the Vector to copy.
1027 public void setProperty(final java.util.Vector vPropertyList) {
1029 this._propertyList.clear();
1031 this._propertyList.addAll(vPropertyList);
1035 * Sets the value of '_propertyList' by setting it to the given Vector. No
1036 * type checking is performed.
1040 * @param propertyVector
1041 * the Vector to set.
1043 public void setPropertyAsReference(final java.util.Vector propertyVector) {
1044 this._propertyList = propertyVector;
1048 * Sets the value of field 'source'. The field 'source' has the following
1049 * description: TODO Database Naming Convention: either start using LSID (so
1050 * change type to URI) or leave this as an uncontrolled/unspecified string ID
1054 * the value of field 'source'.
1056 public void setSource(final java.lang.String source) {
1057 this._source = source;
1061 * Sets the value of field 'version'. The field 'version' has the following
1062 * description: Version must be specified -
1066 * the value of field 'version'.
1068 public void setVersion(final java.lang.String version) {
1069 this._version = version;
1076 * @throws org.exolab.castor.xml.MarshalException
1077 * if object is null or if any SAXException is thrown during
1079 * @throws org.exolab.castor.xml.ValidationException
1080 * if this object is an invalid instance according to the schema
1081 * @return the unmarshaled uk.ac.vamsas.objects.core.DbRef
1083 public static uk.ac.vamsas.objects.core.DbRef unmarshal(
1084 final java.io.Reader reader)
1085 throws org.exolab.castor.xml.MarshalException,
1086 org.exolab.castor.xml.ValidationException {
1087 return (uk.ac.vamsas.objects.core.DbRef) Unmarshaller.unmarshal(
1088 uk.ac.vamsas.objects.core.DbRef.class, reader);
1094 * @throws org.exolab.castor.xml.ValidationException
1095 * if this object is an invalid instance according to the schema
1097 public void validate() throws org.exolab.castor.xml.ValidationException {
1098 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1099 validator.validate(this);