2 * This file is part of the Vamsas Client version 0.1.
\r
3 * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
\r
4 * Andrew Waterhouse and Dominik Lindner.
\r
6 * Earlier versions have also been incorporated into Jalview version 2.4
\r
7 * since 2008, and TOPALi version 2 since 2007.
\r
9 * The Vamsas Client is free software: you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation, either version 3 of the License, or
\r
12 * (at your option) any later version.
\r
14 * The Vamsas Client is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public License
\r
20 * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
\r
22 package uk.ac.vamsas.objects.core;
\r
24 //---------------------------------/
\r
25 //- Imported classes and packages -/
\r
26 //---------------------------------/
\r
28 import org.exolab.castor.xml.Marshaller;
\r
29 import org.exolab.castor.xml.Unmarshaller;
\r
32 * Annotation for a rangeSpec - values can be attached for the whole
\r
33 * specification, and to each position within the spec. following the
\r
34 * orientation specified by the ordered set of rangeSpec (pos, seg) elements.
\r
36 * @version $Revision$ $Date$
\r
38 public class RangeAnnotation extends uk.ac.vamsas.objects.core.RangeType
\r
39 implements java.io.Serializable {
\r
41 // --------------------------/
\r
42 // - Class/Member Variables -/
\r
43 // --------------------------/
\r
46 * Primary Key for vamsas object referencing
\r
49 private java.lang.String _id;
\r
52 * Field _modifiable.
\r
54 private java.lang.String _modifiable;
\r
57 * Annotation with the same non-empty group name are grouped together
\r
59 private java.lang.String _group = "";
\r
62 * A Das Feature has both a type and a Type ID. We go the route of requiring
\r
63 * the type string to be taken from a controlled vocabulary if an application
\r
64 * expects others to make sense of it. The type may qualified - so
\r
65 * uniprot:CHAIN is a valid type name, and considered distinct from
\r
68 private java.lang.String _type;
\r
71 * Short, meaningful name for the annotation - if this is absent, then the
\r
72 * type string should be used in its place.
\r
75 private java.lang.String _label;
\r
78 * Human readable description of the annotation
\r
81 private java.lang.String _description;
\r
84 * TODO: specify this - we have considered taking the GO evidence codes as a
\r
85 * model for assessing a measure of quality to an annotation.
\r
87 private java.lang.String _status;
\r
90 * Annotation Element position maps to ordered positions defined by the
\r
91 * sequence of rangeType pos positions or concatenated seg start/end segments.
\r
93 private java.util.Vector _annotationElementList;
\r
96 * Ordered set of optionally named float values for the whole annotation
\r
98 private java.util.Vector _scoreList;
\r
103 private java.util.Vector _linkList;
\r
106 * Note:These are mutable so an application should check them each time.
\r
108 private java.util.Vector _propertyList;
\r
110 // ----------------/
\r
111 // - Constructors -/
\r
112 // ----------------/
\r
114 public RangeAnnotation() {
\r
117 this._annotationElementList = new java.util.Vector();
\r
118 this._scoreList = new java.util.Vector();
\r
119 this._linkList = new java.util.Vector();
\r
120 this._propertyList = new java.util.Vector();
\r
130 * @param vAnnotationElement
\r
131 * @throws java.lang.IndexOutOfBoundsException
\r
132 * if the index given is outside the bounds of the collection
\r
134 public void addAnnotationElement(
\r
135 final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement)
\r
136 throws java.lang.IndexOutOfBoundsException {
\r
137 this._annotationElementList.addElement(vAnnotationElement);
\r
144 * @param vAnnotationElement
\r
145 * @throws java.lang.IndexOutOfBoundsException
\r
146 * if the index given is outside the bounds of the collection
\r
148 public void addAnnotationElement(final int index,
\r
149 final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement)
\r
150 throws java.lang.IndexOutOfBoundsException {
\r
151 this._annotationElementList.add(index, vAnnotationElement);
\r
158 * @throws java.lang.IndexOutOfBoundsException
\r
159 * if the index given is outside the bounds of the collection
\r
161 public void addLink(final uk.ac.vamsas.objects.core.Link vLink)
\r
162 throws java.lang.IndexOutOfBoundsException {
\r
163 this._linkList.addElement(vLink);
\r
171 * @throws java.lang.IndexOutOfBoundsException
\r
172 * if the index given is outside the bounds of the collection
\r
174 public void addLink(final int index,
\r
175 final uk.ac.vamsas.objects.core.Link vLink)
\r
176 throws java.lang.IndexOutOfBoundsException {
\r
177 this._linkList.add(index, vLink);
\r
184 * @throws java.lang.IndexOutOfBoundsException
\r
185 * if the index given is outside the bounds of the collection
\r
187 public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)
\r
188 throws java.lang.IndexOutOfBoundsException {
\r
189 this._propertyList.addElement(vProperty);
\r
197 * @throws java.lang.IndexOutOfBoundsException
\r
198 * if the index given is outside the bounds of the collection
\r
200 public void addProperty(final int index,
\r
201 final uk.ac.vamsas.objects.core.Property vProperty)
\r
202 throws java.lang.IndexOutOfBoundsException {
\r
203 this._propertyList.add(index, vProperty);
\r
210 * @throws java.lang.IndexOutOfBoundsException
\r
211 * if the index given is outside the bounds of the collection
\r
213 public void addScore(final uk.ac.vamsas.objects.core.Score vScore)
\r
214 throws java.lang.IndexOutOfBoundsException {
\r
215 this._scoreList.addElement(vScore);
\r
223 * @throws java.lang.IndexOutOfBoundsException
\r
224 * if the index given is outside the bounds of the collection
\r
226 public void addScore(final int index,
\r
227 final uk.ac.vamsas.objects.core.Score vScore)
\r
228 throws java.lang.IndexOutOfBoundsException {
\r
229 this._scoreList.add(index, vScore);
\r
233 * Method enumerateAnnotationElement.
\r
235 * @return an Enumeration over all uk.ac.vamsas.objects.core.AnnotationElement
\r
238 public java.util.Enumeration enumerateAnnotationElement() {
\r
239 return this._annotationElementList.elements();
\r
243 * Method enumerateLink.
\r
245 * @return an Enumeration over all uk.ac.vamsas.objects.core.Link elements
\r
247 public java.util.Enumeration enumerateLink() {
\r
248 return this._linkList.elements();
\r
252 * Method enumerateProperty.
\r
254 * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements
\r
256 public java.util.Enumeration enumerateProperty() {
\r
257 return this._propertyList.elements();
\r
261 * Method enumerateScore.
\r
263 * @return an Enumeration over all uk.ac.vamsas.objects.core.Score elements
\r
265 public java.util.Enumeration enumerateScore() {
\r
266 return this._scoreList.elements();
\r
270 * Overrides the java.lang.Object.equals method.
\r
273 * @return true if the objects are equal.
\r
275 public boolean equals(final java.lang.Object obj) {
\r
279 if (super.equals(obj) == false)
\r
282 if (obj instanceof RangeAnnotation) {
\r
284 RangeAnnotation temp = (RangeAnnotation) obj;
\r
287 if (this._id != null) {
\r
288 if (temp._id == null)
\r
290 if (this._id != temp._id) {
\r
291 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
\r
292 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
\r
293 if (thcycle != tmcycle) {
\r
295 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
\r
299 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
\r
305 if (!this._id.equals(temp._id)) {
\r
306 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
\r
307 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
\r
310 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
\r
311 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
\r
314 } else if (temp._id != null)
\r
316 if (this._modifiable != null) {
\r
317 if (temp._modifiable == null)
\r
319 if (this._modifiable != temp._modifiable) {
\r
320 thcycle = org.castor.util.CycleBreaker
\r
321 .startingToCycle(this._modifiable);
\r
322 tmcycle = org.castor.util.CycleBreaker
\r
323 .startingToCycle(temp._modifiable);
\r
324 if (thcycle != tmcycle) {
\r
326 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
\r
330 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
\r
336 if (!this._modifiable.equals(temp._modifiable)) {
\r
337 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
\r
338 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
\r
341 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
\r
342 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
\r
345 } else if (temp._modifiable != null)
\r
347 if (this._group != null) {
\r
348 if (temp._group == null)
\r
350 if (this._group != temp._group) {
\r
351 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._group);
\r
352 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._group);
\r
353 if (thcycle != tmcycle) {
\r
355 org.castor.util.CycleBreaker.releaseCycleHandle(this._group);
\r
359 org.castor.util.CycleBreaker.releaseCycleHandle(temp._group);
\r
365 if (!this._group.equals(temp._group)) {
\r
366 org.castor.util.CycleBreaker.releaseCycleHandle(this._group);
\r
367 org.castor.util.CycleBreaker.releaseCycleHandle(temp._group);
\r
370 org.castor.util.CycleBreaker.releaseCycleHandle(this._group);
\r
371 org.castor.util.CycleBreaker.releaseCycleHandle(temp._group);
\r
374 } else if (temp._group != null)
\r
376 if (this._type != null) {
\r
377 if (temp._type == null)
\r
379 if (this._type != temp._type) {
\r
380 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._type);
\r
381 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._type);
\r
382 if (thcycle != tmcycle) {
\r
384 org.castor.util.CycleBreaker.releaseCycleHandle(this._type);
\r
388 org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);
\r
394 if (!this._type.equals(temp._type)) {
\r
395 org.castor.util.CycleBreaker.releaseCycleHandle(this._type);
\r
396 org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);
\r
399 org.castor.util.CycleBreaker.releaseCycleHandle(this._type);
\r
400 org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);
\r
403 } else if (temp._type != null)
\r
405 if (this._label != null) {
\r
406 if (temp._label == null)
\r
408 if (this._label != temp._label) {
\r
409 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._label);
\r
410 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._label);
\r
411 if (thcycle != tmcycle) {
\r
413 org.castor.util.CycleBreaker.releaseCycleHandle(this._label);
\r
417 org.castor.util.CycleBreaker.releaseCycleHandle(temp._label);
\r
423 if (!this._label.equals(temp._label)) {
\r
424 org.castor.util.CycleBreaker.releaseCycleHandle(this._label);
\r
425 org.castor.util.CycleBreaker.releaseCycleHandle(temp._label);
\r
428 org.castor.util.CycleBreaker.releaseCycleHandle(this._label);
\r
429 org.castor.util.CycleBreaker.releaseCycleHandle(temp._label);
\r
432 } else if (temp._label != null)
\r
434 if (this._description != null) {
\r
435 if (temp._description == null)
\r
437 if (this._description != temp._description) {
\r
438 thcycle = org.castor.util.CycleBreaker
\r
439 .startingToCycle(this._description);
\r
440 tmcycle = org.castor.util.CycleBreaker
\r
441 .startingToCycle(temp._description);
\r
442 if (thcycle != tmcycle) {
\r
444 org.castor.util.CycleBreaker
\r
445 .releaseCycleHandle(this._description);
\r
449 org.castor.util.CycleBreaker
\r
450 .releaseCycleHandle(temp._description);
\r
456 if (!this._description.equals(temp._description)) {
\r
457 org.castor.util.CycleBreaker
\r
458 .releaseCycleHandle(this._description);
\r
459 org.castor.util.CycleBreaker
\r
460 .releaseCycleHandle(temp._description);
\r
463 org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
\r
464 org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
\r
467 } else if (temp._description != null)
\r
469 if (this._status != null) {
\r
470 if (temp._status == null)
\r
472 if (this._status != temp._status) {
\r
473 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._status);
\r
474 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._status);
\r
475 if (thcycle != tmcycle) {
\r
477 org.castor.util.CycleBreaker.releaseCycleHandle(this._status);
\r
481 org.castor.util.CycleBreaker.releaseCycleHandle(temp._status);
\r
487 if (!this._status.equals(temp._status)) {
\r
488 org.castor.util.CycleBreaker.releaseCycleHandle(this._status);
\r
489 org.castor.util.CycleBreaker.releaseCycleHandle(temp._status);
\r
492 org.castor.util.CycleBreaker.releaseCycleHandle(this._status);
\r
493 org.castor.util.CycleBreaker.releaseCycleHandle(temp._status);
\r
496 } else if (temp._status != null)
\r
498 if (this._annotationElementList != null) {
\r
499 if (temp._annotationElementList == null)
\r
501 if (this._annotationElementList != temp._annotationElementList) {
\r
502 thcycle = org.castor.util.CycleBreaker
\r
503 .startingToCycle(this._annotationElementList);
\r
504 tmcycle = org.castor.util.CycleBreaker
\r
505 .startingToCycle(temp._annotationElementList);
\r
506 if (thcycle != tmcycle) {
\r
508 org.castor.util.CycleBreaker
\r
509 .releaseCycleHandle(this._annotationElementList);
\r
513 org.castor.util.CycleBreaker
\r
514 .releaseCycleHandle(temp._annotationElementList);
\r
520 if (!this._annotationElementList
\r
521 .equals(temp._annotationElementList)) {
\r
522 org.castor.util.CycleBreaker
\r
523 .releaseCycleHandle(this._annotationElementList);
\r
524 org.castor.util.CycleBreaker
\r
525 .releaseCycleHandle(temp._annotationElementList);
\r
528 org.castor.util.CycleBreaker
\r
529 .releaseCycleHandle(this._annotationElementList);
\r
530 org.castor.util.CycleBreaker
\r
531 .releaseCycleHandle(temp._annotationElementList);
\r
534 } else if (temp._annotationElementList != null)
\r
536 if (this._scoreList != null) {
\r
537 if (temp._scoreList == null)
\r
539 if (this._scoreList != temp._scoreList) {
\r
540 thcycle = org.castor.util.CycleBreaker
\r
541 .startingToCycle(this._scoreList);
\r
542 tmcycle = org.castor.util.CycleBreaker
\r
543 .startingToCycle(temp._scoreList);
\r
544 if (thcycle != tmcycle) {
\r
546 org.castor.util.CycleBreaker.releaseCycleHandle(this._scoreList);
\r
550 org.castor.util.CycleBreaker.releaseCycleHandle(temp._scoreList);
\r
556 if (!this._scoreList.equals(temp._scoreList)) {
\r
557 org.castor.util.CycleBreaker.releaseCycleHandle(this._scoreList);
\r
558 org.castor.util.CycleBreaker.releaseCycleHandle(temp._scoreList);
\r
561 org.castor.util.CycleBreaker.releaseCycleHandle(this._scoreList);
\r
562 org.castor.util.CycleBreaker.releaseCycleHandle(temp._scoreList);
\r
565 } else if (temp._scoreList != null)
\r
567 if (this._linkList != null) {
\r
568 if (temp._linkList == null)
\r
570 if (this._linkList != temp._linkList) {
\r
571 thcycle = org.castor.util.CycleBreaker
\r
572 .startingToCycle(this._linkList);
\r
573 tmcycle = org.castor.util.CycleBreaker
\r
574 .startingToCycle(temp._linkList);
\r
575 if (thcycle != tmcycle) {
\r
577 org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
\r
581 org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
\r
587 if (!this._linkList.equals(temp._linkList)) {
\r
588 org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
\r
589 org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
\r
592 org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
\r
593 org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
\r
596 } else if (temp._linkList != null)
\r
598 if (this._propertyList != null) {
\r
599 if (temp._propertyList == null)
\r
601 if (this._propertyList != temp._propertyList) {
\r
602 thcycle = org.castor.util.CycleBreaker
\r
603 .startingToCycle(this._propertyList);
\r
604 tmcycle = org.castor.util.CycleBreaker
\r
605 .startingToCycle(temp._propertyList);
\r
606 if (thcycle != tmcycle) {
\r
608 org.castor.util.CycleBreaker
\r
609 .releaseCycleHandle(this._propertyList);
\r
613 org.castor.util.CycleBreaker
\r
614 .releaseCycleHandle(temp._propertyList);
\r
620 if (!this._propertyList.equals(temp._propertyList)) {
\r
621 org.castor.util.CycleBreaker
\r
622 .releaseCycleHandle(this._propertyList);
\r
623 org.castor.util.CycleBreaker
\r
624 .releaseCycleHandle(temp._propertyList);
\r
627 org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
\r
628 org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
\r
631 } else if (temp._propertyList != null)
\r
639 * Method getAnnotationElement.
\r
642 * @throws java.lang.IndexOutOfBoundsException
\r
643 * if the index given is outside the bounds of the collection
\r
644 * @return the value of the uk.ac.vamsas.objects.core.AnnotationElement at the
\r
647 public uk.ac.vamsas.objects.core.AnnotationElement getAnnotationElement(
\r
648 final int index) throws java.lang.IndexOutOfBoundsException {
\r
649 // check bounds for index
\r
650 if (index < 0 || index >= this._annotationElementList.size()) {
\r
651 throw new IndexOutOfBoundsException("getAnnotationElement: Index value '"
\r
652 + index + "' not in range [0.."
\r
653 + (this._annotationElementList.size() - 1) + "]");
\r
656 return (uk.ac.vamsas.objects.core.AnnotationElement) _annotationElementList
\r
661 * Method getAnnotationElement.Returns the contents of the collection in an
\r
664 * Note: Just in case the collection contents are changing in another thread,
\r
665 * we pass a 0-length Array of the correct type into the API call. This way we
\r
666 * <i>know</i> that the Array returned is of exactly the correct length.
\r
668 * @return this collection as an Array
\r
670 public uk.ac.vamsas.objects.core.AnnotationElement[] getAnnotationElement() {
\r
671 uk.ac.vamsas.objects.core.AnnotationElement[] array = new uk.ac.vamsas.objects.core.AnnotationElement[0];
\r
672 return (uk.ac.vamsas.objects.core.AnnotationElement[]) this._annotationElementList
\r
677 * Method getAnnotationElementAsReference.Returns a reference to
\r
678 * '_annotationElementList'. No type checking is performed on any
\r
679 * modifications to the Vector.
\r
681 * @return a reference to the Vector backing this class
\r
683 public java.util.Vector getAnnotationElementAsReference() {
\r
684 return this._annotationElementList;
\r
688 * Method getAnnotationElementCount.
\r
690 * @return the size of this collection
\r
692 public int getAnnotationElementCount() {
\r
693 return this._annotationElementList.size();
\r
697 * Returns the value of field 'description'. The field 'description' has the
\r
698 * following description: Human readable description of the annotation
\r
701 * @return the value of field 'Description'.
\r
703 public java.lang.String getDescription() {
\r
704 return this._description;
\r
708 * Returns the value of field 'group'. The field 'group' has the following
\r
709 * description: Annotation with the same non-empty group name are grouped
\r
712 * @return the value of field 'Group'.
\r
714 public java.lang.String getGroup() {
\r
715 return this._group;
\r
719 * Returns the value of field 'id'. The field 'id' has the following
\r
720 * description: Primary Key for vamsas object referencing
\r
723 * @return the value of field 'Id'.
\r
725 public java.lang.String getId() {
\r
730 * Returns the value of field 'label'. The field 'label' has the following
\r
731 * description: Short, meaningful name for the annotation - if this is absent,
\r
732 * then the type string should be used in its place.
\r
735 * @return the value of field 'Label'.
\r
737 public java.lang.String getLabel() {
\r
738 return this._label;
\r
745 * @throws java.lang.IndexOutOfBoundsException
\r
746 * if the index given is outside the bounds of the collection
\r
747 * @return the value of the uk.ac.vamsas.objects.core.Link at the given index
\r
749 public uk.ac.vamsas.objects.core.Link getLink(final int index)
\r
750 throws java.lang.IndexOutOfBoundsException {
\r
751 // check bounds for index
\r
752 if (index < 0 || index >= this._linkList.size()) {
\r
753 throw new IndexOutOfBoundsException("getLink: Index value '" + index
\r
754 + "' not in range [0.." + (this._linkList.size() - 1) + "]");
\r
757 return (uk.ac.vamsas.objects.core.Link) _linkList.get(index);
\r
761 * Method getLink.Returns the contents of the collection in an Array.
\r
763 * Note: Just in case the collection contents are changing in another thread,
\r
764 * we pass a 0-length Array of the correct type into the API call. This way we
\r
765 * <i>know</i> that the Array returned is of exactly the correct length.
\r
767 * @return this collection as an Array
\r
769 public uk.ac.vamsas.objects.core.Link[] getLink() {
\r
770 uk.ac.vamsas.objects.core.Link[] array = new uk.ac.vamsas.objects.core.Link[0];
\r
771 return (uk.ac.vamsas.objects.core.Link[]) this._linkList.toArray(array);
\r
775 * Method getLinkAsReference.Returns a reference to '_linkList'. No type
\r
776 * checking is performed on any modifications to the Vector.
\r
778 * @return a reference to the Vector backing this class
\r
780 public java.util.Vector getLinkAsReference() {
\r
781 return this._linkList;
\r
785 * Method getLinkCount.
\r
787 * @return the size of this collection
\r
789 public int getLinkCount() {
\r
790 return this._linkList.size();
\r
794 * Returns the value of field 'modifiable'.
\r
796 * @return the value of field 'Modifiable'.
\r
798 public java.lang.String getModifiable() {
\r
799 return this._modifiable;
\r
803 * Method getProperty.
\r
806 * @throws java.lang.IndexOutOfBoundsException
\r
807 * if the index given is outside the bounds of the collection
\r
808 * @return the value of the uk.ac.vamsas.objects.core.Property at the given
\r
811 public uk.ac.vamsas.objects.core.Property getProperty(final int index)
\r
812 throws java.lang.IndexOutOfBoundsException {
\r
813 // check bounds for index
\r
814 if (index < 0 || index >= this._propertyList.size()) {
\r
815 throw new IndexOutOfBoundsException("getProperty: Index value '" + index
\r
816 + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
\r
819 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
\r
823 * Method getProperty.Returns the contents of the collection in an Array.
\r
825 * Note: Just in case the collection contents are changing in another thread,
\r
826 * we pass a 0-length Array of the correct type into the API call. This way we
\r
827 * <i>know</i> that the Array returned is of exactly the correct length.
\r
829 * @return this collection as an Array
\r
831 public uk.ac.vamsas.objects.core.Property[] getProperty() {
\r
832 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
\r
833 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList
\r
838 * Method getPropertyAsReference.Returns a reference to '_propertyList'. No
\r
839 * type checking is performed on any modifications to the Vector.
\r
841 * @return a reference to the Vector backing this class
\r
843 public java.util.Vector getPropertyAsReference() {
\r
844 return this._propertyList;
\r
848 * Method getPropertyCount.
\r
850 * @return the size of this collection
\r
852 public int getPropertyCount() {
\r
853 return this._propertyList.size();
\r
860 * @throws java.lang.IndexOutOfBoundsException
\r
861 * if the index given is outside the bounds of the collection
\r
862 * @return the value of the uk.ac.vamsas.objects.core.Score at the given index
\r
864 public uk.ac.vamsas.objects.core.Score getScore(final int index)
\r
865 throws java.lang.IndexOutOfBoundsException {
\r
866 // check bounds for index
\r
867 if (index < 0 || index >= this._scoreList.size()) {
\r
868 throw new IndexOutOfBoundsException("getScore: Index value '" + index
\r
869 + "' not in range [0.." + (this._scoreList.size() - 1) + "]");
\r
872 return (uk.ac.vamsas.objects.core.Score) _scoreList.get(index);
\r
876 * Method getScore.Returns the contents of the collection in an Array.
\r
878 * Note: Just in case the collection contents are changing in another thread,
\r
879 * we pass a 0-length Array of the correct type into the API call. This way we
\r
880 * <i>know</i> that the Array returned is of exactly the correct length.
\r
882 * @return this collection as an Array
\r
884 public uk.ac.vamsas.objects.core.Score[] getScore() {
\r
885 uk.ac.vamsas.objects.core.Score[] array = new uk.ac.vamsas.objects.core.Score[0];
\r
886 return (uk.ac.vamsas.objects.core.Score[]) this._scoreList.toArray(array);
\r
890 * Method getScoreAsReference.Returns a reference to '_scoreList'. No type
\r
891 * checking is performed on any modifications to the Vector.
\r
893 * @return a reference to the Vector backing this class
\r
895 public java.util.Vector getScoreAsReference() {
\r
896 return this._scoreList;
\r
900 * Method getScoreCount.
\r
902 * @return the size of this collection
\r
904 public int getScoreCount() {
\r
905 return this._scoreList.size();
\r
909 * Returns the value of field 'status'. The field 'status' has the following
\r
910 * description: TODO: specify this - we have considered taking the GO evidence
\r
911 * codes as a model for assessing a measure of quality to an annotation.
\r
913 * @return the value of field 'Status'.
\r
915 public java.lang.String getStatus() {
\r
916 return this._status;
\r
920 * Returns the value of field 'type'. The field 'type' has the following
\r
921 * description: A Das Feature has both a type and a Type ID. We go the route
\r
922 * of requiring the type string to be taken from a controlled vocabulary if an
\r
923 * application expects others to make sense of it. The type may qualified - so
\r
924 * uniprot:CHAIN is a valid type name, and considered distinct from
\r
925 * someotherDB:CHAIN
\r
927 * @return the value of field 'Type'.
\r
929 public java.lang.String getType() {
\r
934 * Overrides the java.lang.Object.hashCode method.
\r
936 * The following steps came from <b>Effective Java Programming Language
\r
937 * Guide</b> by Joshua Bloch, Chapter 3
\r
939 * @return a hash code value for the object.
\r
941 public int hashCode() {
\r
942 int result = super.hashCode();
\r
945 if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
\r
946 result = 37 * result + _id.hashCode();
\r
947 org.castor.util.CycleBreaker.releaseCycleHandle(_id);
\r
949 if (_modifiable != null
\r
950 && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
\r
951 result = 37 * result + _modifiable.hashCode();
\r
952 org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
\r
954 if (_group != null && !org.castor.util.CycleBreaker.startingToCycle(_group)) {
\r
955 result = 37 * result + _group.hashCode();
\r
956 org.castor.util.CycleBreaker.releaseCycleHandle(_group);
\r
958 if (_type != null && !org.castor.util.CycleBreaker.startingToCycle(_type)) {
\r
959 result = 37 * result + _type.hashCode();
\r
960 org.castor.util.CycleBreaker.releaseCycleHandle(_type);
\r
962 if (_label != null && !org.castor.util.CycleBreaker.startingToCycle(_label)) {
\r
963 result = 37 * result + _label.hashCode();
\r
964 org.castor.util.CycleBreaker.releaseCycleHandle(_label);
\r
966 if (_description != null
\r
967 && !org.castor.util.CycleBreaker.startingToCycle(_description)) {
\r
968 result = 37 * result + _description.hashCode();
\r
969 org.castor.util.CycleBreaker.releaseCycleHandle(_description);
\r
971 if (_status != null
\r
972 && !org.castor.util.CycleBreaker.startingToCycle(_status)) {
\r
973 result = 37 * result + _status.hashCode();
\r
974 org.castor.util.CycleBreaker.releaseCycleHandle(_status);
\r
976 if (_annotationElementList != null
\r
977 && !org.castor.util.CycleBreaker
\r
978 .startingToCycle(_annotationElementList)) {
\r
979 result = 37 * result + _annotationElementList.hashCode();
\r
980 org.castor.util.CycleBreaker.releaseCycleHandle(_annotationElementList);
\r
982 if (_scoreList != null
\r
983 && !org.castor.util.CycleBreaker.startingToCycle(_scoreList)) {
\r
984 result = 37 * result + _scoreList.hashCode();
\r
985 org.castor.util.CycleBreaker.releaseCycleHandle(_scoreList);
\r
987 if (_linkList != null
\r
988 && !org.castor.util.CycleBreaker.startingToCycle(_linkList)) {
\r
989 result = 37 * result + _linkList.hashCode();
\r
990 org.castor.util.CycleBreaker.releaseCycleHandle(_linkList);
\r
992 if (_propertyList != null
\r
993 && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
\r
994 result = 37 * result + _propertyList.hashCode();
\r
995 org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
\r
1004 * @return true if this object is valid according to the schema
\r
1006 public boolean isValid() {
\r
1009 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
1019 * @throws org.exolab.castor.xml.MarshalException
\r
1020 * if object is null or if any SAXException is thrown during
\r
1022 * @throws org.exolab.castor.xml.ValidationException
\r
1023 * if this object is an invalid instance according to the schema
\r
1025 public void marshal(final java.io.Writer out)
\r
1026 throws org.exolab.castor.xml.MarshalException,
\r
1027 org.exolab.castor.xml.ValidationException {
\r
1028 Marshaller.marshal(this, out);
\r
1035 * @throws java.io.IOException
\r
1036 * if an IOException occurs during marshaling
\r
1037 * @throws org.exolab.castor.xml.ValidationException
\r
1038 * if this object is an invalid instance according to the schema
\r
1039 * @throws org.exolab.castor.xml.MarshalException
\r
1040 * if object is null or if any SAXException is thrown during
\r
1043 public void marshal(final org.xml.sax.ContentHandler handler)
\r
1044 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
\r
1045 org.exolab.castor.xml.ValidationException {
\r
1046 Marshaller.marshal(this, handler);
\r
1051 public void removeAllAnnotationElement() {
\r
1052 this._annotationElementList.clear();
\r
1057 public void removeAllLink() {
\r
1058 this._linkList.clear();
\r
1063 public void removeAllProperty() {
\r
1064 this._propertyList.clear();
\r
1069 public void removeAllScore() {
\r
1070 this._scoreList.clear();
\r
1074 * Method removeAnnotationElement.
\r
1076 * @param vAnnotationElement
\r
1077 * @return true if the object was removed from the collection.
\r
1079 public boolean removeAnnotationElement(
\r
1080 final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement) {
\r
1081 boolean removed = _annotationElementList.remove(vAnnotationElement);
\r
1086 * Method removeAnnotationElementAt.
\r
1089 * @return the element removed from the collection
\r
1091 public uk.ac.vamsas.objects.core.AnnotationElement removeAnnotationElementAt(
\r
1092 final int index) {
\r
1093 java.lang.Object obj = this._annotationElementList.remove(index);
\r
1094 return (uk.ac.vamsas.objects.core.AnnotationElement) obj;
\r
1098 * Method removeLink.
\r
1101 * @return true if the object was removed from the collection.
\r
1103 public boolean removeLink(final uk.ac.vamsas.objects.core.Link vLink) {
\r
1104 boolean removed = _linkList.remove(vLink);
\r
1109 * Method removeLinkAt.
\r
1112 * @return the element removed from the collection
\r
1114 public uk.ac.vamsas.objects.core.Link removeLinkAt(final int index) {
\r
1115 java.lang.Object obj = this._linkList.remove(index);
\r
1116 return (uk.ac.vamsas.objects.core.Link) obj;
\r
1120 * Method removeProperty.
\r
1122 * @param vProperty
\r
1123 * @return true if the object was removed from the collection.
\r
1125 public boolean removeProperty(
\r
1126 final uk.ac.vamsas.objects.core.Property vProperty) {
\r
1127 boolean removed = _propertyList.remove(vProperty);
\r
1132 * Method removePropertyAt.
\r
1135 * @return the element removed from the collection
\r
1137 public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {
\r
1138 java.lang.Object obj = this._propertyList.remove(index);
\r
1139 return (uk.ac.vamsas.objects.core.Property) obj;
\r
1143 * Method removeScore.
\r
1146 * @return true if the object was removed from the collection.
\r
1148 public boolean removeScore(final uk.ac.vamsas.objects.core.Score vScore) {
\r
1149 boolean removed = _scoreList.remove(vScore);
\r
1154 * Method removeScoreAt.
\r
1157 * @return the element removed from the collection
\r
1159 public uk.ac.vamsas.objects.core.Score removeScoreAt(final int index) {
\r
1160 java.lang.Object obj = this._scoreList.remove(index);
\r
1161 return (uk.ac.vamsas.objects.core.Score) obj;
\r
1168 * @param vAnnotationElement
\r
1169 * @throws java.lang.IndexOutOfBoundsException
\r
1170 * if the index given is outside the bounds of the collection
\r
1172 public void setAnnotationElement(final int index,
\r
1173 final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement)
\r
1174 throws java.lang.IndexOutOfBoundsException {
\r
1175 // check bounds for index
\r
1176 if (index < 0 || index >= this._annotationElementList.size()) {
\r
1177 throw new IndexOutOfBoundsException("setAnnotationElement: Index value '"
\r
1178 + index + "' not in range [0.."
\r
1179 + (this._annotationElementList.size() - 1) + "]");
\r
1182 this._annotationElementList.set(index, vAnnotationElement);
\r
1188 * @param vAnnotationElementArray
\r
1190 public void setAnnotationElement(
\r
1191 final uk.ac.vamsas.objects.core.AnnotationElement[] vAnnotationElementArray) {
\r
1193 _annotationElementList.clear();
\r
1195 for (int i = 0; i < vAnnotationElementArray.length; i++) {
\r
1196 this._annotationElementList.add(vAnnotationElementArray[i]);
\r
1201 * Sets the value of '_annotationElementList' by copying the given Vector. All
\r
1202 * elements will be checked for type safety.
\r
1204 * @param vAnnotationElementList
\r
1205 * the Vector to copy.
\r
1207 public void setAnnotationElement(final java.util.Vector vAnnotationElementList) {
\r
1209 this._annotationElementList.clear();
\r
1211 this._annotationElementList.addAll(vAnnotationElementList);
\r
1215 * Sets the value of '_annotationElementList' by setting it to the given
\r
1216 * Vector. No type checking is performed.
\r
1220 * @param annotationElementVector
\r
1221 * the Vector to set.
\r
1223 public void setAnnotationElementAsReference(
\r
1224 final java.util.Vector annotationElementVector) {
\r
1225 this._annotationElementList = annotationElementVector;
\r
1229 * Sets the value of field 'description'. The field 'description' has the
\r
1230 * following description: Human readable description of the annotation
\r
1233 * @param description
\r
1234 * the value of field 'description'.
\r
1236 public void setDescription(final java.lang.String description) {
\r
1237 this._description = description;
\r
1241 * Sets the value of field 'group'. The field 'group' has the following
\r
1242 * description: Annotation with the same non-empty group name are grouped
\r
1246 * the value of field 'group'.
\r
1248 public void setGroup(final java.lang.String group) {
\r
1249 this._group = group;
\r
1253 * Sets the value of field 'id'. The field 'id' has the following description:
\r
1254 * Primary Key for vamsas object referencing
\r
1258 * the value of field 'id'.
\r
1260 public void setId(final java.lang.String id) {
\r
1265 * Sets the value of field 'label'. The field 'label' has the following
\r
1266 * description: Short, meaningful name for the annotation - if this is absent,
\r
1267 * then the type string should be used in its place.
\r
1271 * the value of field 'label'.
\r
1273 public void setLabel(final java.lang.String label) {
\r
1274 this._label = label;
\r
1282 * @throws java.lang.IndexOutOfBoundsException
\r
1283 * if the index given is outside the bounds of the collection
\r
1285 public void setLink(final int index,
\r
1286 final uk.ac.vamsas.objects.core.Link vLink)
\r
1287 throws java.lang.IndexOutOfBoundsException {
\r
1288 // check bounds for index
\r
1289 if (index < 0 || index >= this._linkList.size()) {
\r
1290 throw new IndexOutOfBoundsException("setLink: Index value '" + index
\r
1291 + "' not in range [0.." + (this._linkList.size() - 1) + "]");
\r
1294 this._linkList.set(index, vLink);
\r
1300 * @param vLinkArray
\r
1302 public void setLink(final uk.ac.vamsas.objects.core.Link[] vLinkArray) {
\r
1304 _linkList.clear();
\r
1306 for (int i = 0; i < vLinkArray.length; i++) {
\r
1307 this._linkList.add(vLinkArray[i]);
\r
1312 * Sets the value of '_linkList' by copying the given Vector. All elements
\r
1313 * will be checked for type safety.
\r
1315 * @param vLinkList
\r
1316 * the Vector to copy.
\r
1318 public void setLink(final java.util.Vector vLinkList) {
\r
1320 this._linkList.clear();
\r
1322 this._linkList.addAll(vLinkList);
\r
1326 * Sets the value of '_linkList' by setting it to the given Vector. No type
\r
1327 * checking is performed.
\r
1331 * @param linkVector
\r
1332 * the Vector to set.
\r
1334 public void setLinkAsReference(final java.util.Vector linkVector) {
\r
1335 this._linkList = linkVector;
\r
1339 * Sets the value of field 'modifiable'.
\r
1341 * @param modifiable
\r
1342 * the value of field 'modifiable'.
\r
1344 public void setModifiable(final java.lang.String modifiable) {
\r
1345 this._modifiable = modifiable;
\r
1352 * @param vProperty
\r
1353 * @throws java.lang.IndexOutOfBoundsException
\r
1354 * if the index given is outside the bounds of the collection
\r
1356 public void setProperty(final int index,
\r
1357 final uk.ac.vamsas.objects.core.Property vProperty)
\r
1358 throws java.lang.IndexOutOfBoundsException {
\r
1359 // check bounds for index
\r
1360 if (index < 0 || index >= this._propertyList.size()) {
\r
1361 throw new IndexOutOfBoundsException("setProperty: Index value '" + index
\r
1362 + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
\r
1365 this._propertyList.set(index, vProperty);
\r
1371 * @param vPropertyArray
\r
1373 public void setProperty(
\r
1374 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
\r
1376 _propertyList.clear();
\r
1378 for (int i = 0; i < vPropertyArray.length; i++) {
\r
1379 this._propertyList.add(vPropertyArray[i]);
\r
1384 * Sets the value of '_propertyList' by copying the given Vector. All elements
\r
1385 * will be checked for type safety.
\r
1387 * @param vPropertyList
\r
1388 * the Vector to copy.
\r
1390 public void setProperty(final java.util.Vector vPropertyList) {
\r
1392 this._propertyList.clear();
\r
1394 this._propertyList.addAll(vPropertyList);
\r
1398 * Sets the value of '_propertyList' by setting it to the given Vector. No
\r
1399 * type checking is performed.
\r
1403 * @param propertyVector
\r
1404 * the Vector to set.
\r
1406 public void setPropertyAsReference(final java.util.Vector propertyVector) {
\r
1407 this._propertyList = propertyVector;
\r
1415 * @throws java.lang.IndexOutOfBoundsException
\r
1416 * if the index given is outside the bounds of the collection
\r
1418 public void setScore(final int index,
\r
1419 final uk.ac.vamsas.objects.core.Score vScore)
\r
1420 throws java.lang.IndexOutOfBoundsException {
\r
1421 // check bounds for index
\r
1422 if (index < 0 || index >= this._scoreList.size()) {
\r
1423 throw new IndexOutOfBoundsException("setScore: Index value '" + index
\r
1424 + "' not in range [0.." + (this._scoreList.size() - 1) + "]");
\r
1427 this._scoreList.set(index, vScore);
\r
1433 * @param vScoreArray
\r
1435 public void setScore(final uk.ac.vamsas.objects.core.Score[] vScoreArray) {
\r
1437 _scoreList.clear();
\r
1439 for (int i = 0; i < vScoreArray.length; i++) {
\r
1440 this._scoreList.add(vScoreArray[i]);
\r
1445 * Sets the value of '_scoreList' by copying the given Vector. All elements
\r
1446 * will be checked for type safety.
\r
1448 * @param vScoreList
\r
1449 * the Vector to copy.
\r
1451 public void setScore(final java.util.Vector vScoreList) {
\r
1453 this._scoreList.clear();
\r
1455 this._scoreList.addAll(vScoreList);
\r
1459 * Sets the value of '_scoreList' by setting it to the given Vector. No type
\r
1460 * checking is performed.
\r
1464 * @param scoreVector
\r
1465 * the Vector to set.
\r
1467 public void setScoreAsReference(final java.util.Vector scoreVector) {
\r
1468 this._scoreList = scoreVector;
\r
1472 * Sets the value of field 'status'. The field 'status' has the following
\r
1473 * description: TODO: specify this - we have considered taking the GO evidence
\r
1474 * codes as a model for assessing a measure of quality to an annotation.
\r
1477 * the value of field 'status'.
\r
1479 public void setStatus(final java.lang.String status) {
\r
1480 this._status = status;
\r
1484 * Sets the value of field 'type'. The field 'type' has the following
\r
1485 * description: A Das Feature has both a type and a Type ID. We go the route
\r
1486 * of requiring the type string to be taken from a controlled vocabulary if an
\r
1487 * application expects others to make sense of it. The type may qualified - so
\r
1488 * uniprot:CHAIN is a valid type name, and considered distinct from
\r
1489 * someotherDB:CHAIN
\r
1492 * the value of field 'type'.
\r
1494 public void setType(final java.lang.String type) {
\r
1495 this._type = type;
\r
1499 * Method unmarshal.
\r
1502 * @throws org.exolab.castor.xml.MarshalException
\r
1503 * if object is null or if any SAXException is thrown during
\r
1505 * @throws org.exolab.castor.xml.ValidationException
\r
1506 * if this object is an invalid instance according to the schema
\r
1507 * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType
\r
1509 public static uk.ac.vamsas.objects.core.RangeType unmarshal(
\r
1510 final java.io.Reader reader)
\r
1511 throws org.exolab.castor.xml.MarshalException,
\r
1512 org.exolab.castor.xml.ValidationException {
\r
1513 return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(
\r
1514 uk.ac.vamsas.objects.core.RangeAnnotation.class, reader);
\r
1520 * @throws org.exolab.castor.xml.ValidationException
\r
1521 * if this object is an invalid instance according to the schema
\r
1523 public void validate() throws org.exolab.castor.xml.ValidationException {
\r
1524 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
1525 validator.validate(this);
\r