2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package org.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 * Class AnnotationElement.
29 * @version $Revision$ $Date$
31 public class AnnotationElement extends org.vamsas.client.Vobject
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * position with respect to the coordinate frame
42 * defined by a rangeType specification
45 private int _position;
48 * keeps track of state for field: _position
50 private boolean _has_position;
53 * true means the annotation element appears
54 * between the specified position and the next
57 private boolean _after = false;
60 * keeps track of state for field: _after
62 private boolean _has_after;
65 * Primary Key for vamsas object referencing
68 private java.lang.String _id;
71 * Free text at this position
74 private java.lang.String _description;
77 * Discrete symbol - possibly graphically
81 private java.util.Vector _glyphList;
84 * Ordered set of float values - an application
85 * may treat the values together as a vector
86 * with common support for a set of annotation
87 * elements - but this is, again, not validated
88 * so applications should deal gracefully with
89 * varying numbers of dimensions
92 private java.util.Vector _valueList;
99 public AnnotationElement()
102 _glyphList = new Vector();
103 _valueList = new Vector();
104 } //-- org.vamsas.objects.core.AnnotationElement()
118 public void addGlyph(org.vamsas.objects.core.Glyph vGlyph)
119 throws java.lang.IndexOutOfBoundsException
121 _glyphList.addElement(vGlyph);
122 } //-- void addGlyph(org.vamsas.objects.core.Glyph)
132 public void addGlyph(int index, org.vamsas.objects.core.Glyph vGlyph)
133 throws java.lang.IndexOutOfBoundsException
135 _glyphList.insertElementAt(vGlyph, index);
136 } //-- void addGlyph(int, org.vamsas.objects.core.Glyph)
145 public void addValue(float vValue)
146 throws java.lang.IndexOutOfBoundsException
148 _valueList.addElement(new java.lang.Float(vValue));
149 } //-- void addValue(float)
159 public void addValue(int index, float vValue)
160 throws java.lang.IndexOutOfBoundsException
162 _valueList.insertElementAt(new java.lang.Float(vValue), index);
163 } //-- void addValue(int, float)
169 public void deleteAfter()
171 this._has_after= false;
172 } //-- void deleteAfter()
175 * Method deletePosition
178 public void deletePosition()
180 this._has_position= false;
181 } //-- void deletePosition()
184 * Method enumerateGlyph
188 * @return Enumeration
190 public java.util.Enumeration enumerateGlyph()
192 return _glyphList.elements();
193 } //-- java.util.Enumeration enumerateGlyph()
196 * Method enumerateValue
200 * @return Enumeration
202 public java.util.Enumeration enumerateValue()
204 return _valueList.elements();
205 } //-- java.util.Enumeration enumerateValue()
208 * Note: hashCode() has not been overriden
213 public boolean equals(java.lang.Object obj)
218 if (super.equals(obj)==false)
221 if (obj instanceof AnnotationElement) {
223 AnnotationElement temp = (AnnotationElement)obj;
224 if (this._position != temp._position)
226 if (this._has_position != temp._has_position)
228 if (this._after != temp._after)
230 if (this._has_after != temp._has_after)
232 if (this._id != null) {
233 if (temp._id == null) return false;
234 else if (!(this._id.equals(temp._id)))
237 else if (temp._id != null)
239 if (this._description != null) {
240 if (temp._description == null) return false;
241 else if (!(this._description.equals(temp._description)))
244 else if (temp._description != null)
246 if (this._glyphList != null) {
247 if (temp._glyphList == null) return false;
248 else if (!(this._glyphList.equals(temp._glyphList)))
251 else if (temp._glyphList != null)
253 if (this._valueList != null) {
254 if (temp._valueList == null) return false;
255 else if (!(this._valueList.equals(temp._valueList)))
258 else if (temp._valueList != null)
263 } //-- boolean equals(java.lang.Object)
266 * Returns the value of field 'after'. The field 'after' has
267 * the following description: true means the annotation element
269 * between the specified position and the next
273 * @return the value of field 'after'.
275 public boolean getAfter()
278 } //-- boolean getAfter()
281 * Returns the value of field 'description'. The field
282 * 'description' has the following description: Free text at
287 * @return the value of field 'description'.
289 public java.lang.String getDescription()
291 return this._description;
292 } //-- java.lang.String getDescription()
302 public org.vamsas.objects.core.Glyph getGlyph(int index)
303 throws java.lang.IndexOutOfBoundsException
305 //-- check bounds for index
306 if ((index < 0) || (index > _glyphList.size())) {
307 throw new IndexOutOfBoundsException("getGlyph: Index value '"+index+"' not in range [0.."+_glyphList.size()+ "]");
310 return (org.vamsas.objects.core.Glyph) _glyphList.elementAt(index);
311 } //-- org.vamsas.objects.core.Glyph getGlyph(int)
320 public org.vamsas.objects.core.Glyph[] getGlyph()
322 int size = _glyphList.size();
323 org.vamsas.objects.core.Glyph[] mArray = new org.vamsas.objects.core.Glyph[size];
324 for (int index = 0; index < size; index++) {
325 mArray[index] = (org.vamsas.objects.core.Glyph) _glyphList.elementAt(index);
328 } //-- org.vamsas.objects.core.Glyph[] getGlyph()
331 * Method getGlyphCount
337 public int getGlyphCount()
339 return _glyphList.size();
340 } //-- int getGlyphCount()
343 * Returns the value of field 'id'. The field 'id' has the
344 * following description: Primary Key for vamsas object
349 * @return the value of field 'id'.
351 public java.lang.String getId()
354 } //-- java.lang.String getId()
357 * Returns the value of field 'position'. The field 'position'
358 * has the following description: position with respect to the
360 * defined by a rangeType specification
364 * @return the value of field 'position'.
366 public int getPosition()
368 return this._position;
369 } //-- int getPosition()
379 public float getValue(int index)
380 throws java.lang.IndexOutOfBoundsException
382 //-- check bounds for index
383 if ((index < 0) || (index > _valueList.size())) {
384 throw new IndexOutOfBoundsException("getValue: Index value '"+index+"' not in range [0.."+_valueList.size()+ "]");
387 return ((java.lang.Float)_valueList.elementAt(index)).floatValue();
388 } //-- float getValue(int)
397 public float[] getValue()
399 int size = _valueList.size();
400 float[] mArray = new float[size];
401 for (int index = 0; index < size; index++) {
402 mArray[index] = ((java.lang.Float)_valueList.elementAt(index)).floatValue();
405 } //-- float[] getValue()
408 * Method getValueCount
414 public int getValueCount()
416 return _valueList.size();
417 } //-- int getValueCount()
426 public boolean hasAfter()
428 return this._has_after;
429 } //-- boolean hasAfter()
438 public boolean hasPosition()
440 return this._has_position;
441 } //-- boolean hasPosition()
450 public boolean isValid()
455 catch (org.exolab.castor.xml.ValidationException vex) {
459 } //-- boolean isValid()
468 public void marshal(java.io.Writer out)
469 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
472 Marshaller.marshal(this, out);
473 } //-- void marshal(java.io.Writer)
482 public void marshal(org.xml.sax.ContentHandler handler)
483 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
486 Marshaller.marshal(this, handler);
487 } //-- void marshal(org.xml.sax.ContentHandler)
490 * Method removeAllGlyph
493 public void removeAllGlyph()
495 _glyphList.removeAllElements();
496 } //-- void removeAllGlyph()
499 * Method removeAllValue
502 public void removeAllValue()
504 _valueList.removeAllElements();
505 } //-- void removeAllValue()
515 public org.vamsas.objects.core.Glyph removeGlyph(int index)
517 java.lang.Object obj = _glyphList.elementAt(index);
518 _glyphList.removeElementAt(index);
519 return (org.vamsas.objects.core.Glyph) obj;
520 } //-- org.vamsas.objects.core.Glyph removeGlyph(int)
530 public float removeValue(int index)
532 java.lang.Object obj = _valueList.elementAt(index);
533 _valueList.removeElementAt(index);
534 return ((java.lang.Float)obj).floatValue();
535 } //-- float removeValue(int)
538 * Sets the value of field 'after'. The field 'after' has the
539 * following description: true means the annotation element
541 * between the specified position and the next
544 * @param after the value of field 'after'.
546 public void setAfter(boolean after)
549 this._has_after = true;
550 } //-- void setAfter(boolean)
553 * Sets the value of field 'description'. The field
554 * 'description' has the following description: Free text at
558 * @param description the value of field 'description'.
560 public void setDescription(java.lang.String description)
562 this._description = description;
563 } //-- void setDescription(java.lang.String)
573 public void setGlyph(int index, org.vamsas.objects.core.Glyph vGlyph)
574 throws java.lang.IndexOutOfBoundsException
576 //-- check bounds for index
577 if ((index < 0) || (index > _glyphList.size())) {
578 throw new IndexOutOfBoundsException("setGlyph: Index value '"+index+"' not in range [0.."+_glyphList.size()+ "]");
580 _glyphList.setElementAt(vGlyph, index);
581 } //-- void setGlyph(int, org.vamsas.objects.core.Glyph)
590 public void setGlyph(org.vamsas.objects.core.Glyph[] glyphArray)
593 _glyphList.removeAllElements();
594 for (int i = 0; i < glyphArray.length; i++) {
595 _glyphList.addElement(glyphArray[i]);
597 } //-- void setGlyph(org.vamsas.objects.core.Glyph)
600 * Sets the value of field 'id'. The field 'id' has the
601 * following description: Primary Key for vamsas object
605 * @param id the value of field 'id'.
607 public void setId(java.lang.String id)
610 } //-- void setId(java.lang.String)
613 * Sets the value of field 'position'. The field 'position' has
614 * the following description: position with respect to the
616 * defined by a rangeType specification
619 * @param position the value of field 'position'.
621 public void setPosition(int position)
623 this._position = position;
624 this._has_position = true;
625 } //-- void setPosition(int)
635 public void setValue(int index, float vValue)
636 throws java.lang.IndexOutOfBoundsException
638 //-- check bounds for index
639 if ((index < 0) || (index > _valueList.size())) {
640 throw new IndexOutOfBoundsException("setValue: Index value '"+index+"' not in range [0.."+_valueList.size()+ "]");
642 _valueList.setElementAt(new java.lang.Float(vValue), index);
643 } //-- void setValue(int, float)
652 public void setValue(float[] valueArray)
655 _valueList.removeAllElements();
656 for (int i = 0; i < valueArray.length; i++) {
657 _valueList.addElement(new java.lang.Float(valueArray[i]));
659 } //-- void setValue(float)
667 * @return AnnotationElement
669 public static org.vamsas.objects.core.AnnotationElement unmarshal(java.io.Reader reader)
670 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
672 return (org.vamsas.objects.core.AnnotationElement) Unmarshaller.unmarshal(org.vamsas.objects.core.AnnotationElement.class, reader);
673 } //-- org.vamsas.objects.core.AnnotationElement unmarshal(java.io.Reader)
679 public void validate()
680 throws org.exolab.castor.xml.ValidationException
682 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
683 validator.validate(this);
684 } //-- void validate()