2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.binding;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
20 * @version $Revision$ $Date$
22 public class JSeq implements java.io.Serializable
25 // --------------------------/
26 // - Class/Member Variables -/
27 // --------------------------/
35 * keeps track of state for field: _colour
37 private boolean _has_colour;
45 * keeps track of state for field: _start
47 private boolean _has_start;
55 * keeps track of state for field: _end
57 private boolean _has_end;
65 * keeps track of state for field: _id
67 private boolean _has_id;
70 * Field _featuresList.
72 private java.util.Vector _featuresList;
77 private java.util.Vector _pdbidsList;
86 this._featuresList = new java.util.Vector();
87 this._pdbidsList = new java.util.Vector();
98 * @throws java.lang.IndexOutOfBoundsException
99 * if the index given is outside the bounds of the collection
101 public void addFeatures(final jalview.binding.Features vFeatures)
102 throws java.lang.IndexOutOfBoundsException
104 this._featuresList.addElement(vFeatures);
112 * @throws java.lang.IndexOutOfBoundsException
113 * if the index given is outside the bounds of the collection
115 public void addFeatures(final int index,
116 final jalview.binding.Features vFeatures)
117 throws java.lang.IndexOutOfBoundsException
119 this._featuresList.add(index, vFeatures);
126 * @throws java.lang.IndexOutOfBoundsException
127 * if the index given is outside the bounds of the collection
129 public void addPdbids(final jalview.binding.Pdbids vPdbids)
130 throws java.lang.IndexOutOfBoundsException
132 this._pdbidsList.addElement(vPdbids);
140 * @throws java.lang.IndexOutOfBoundsException
141 * if the index given is outside the bounds of the collection
143 public void addPdbids(final int index,
144 final jalview.binding.Pdbids vPdbids)
145 throws java.lang.IndexOutOfBoundsException
147 this._pdbidsList.add(index, vPdbids);
152 public void deleteColour()
154 this._has_colour = false;
159 public void deleteEnd()
161 this._has_end = false;
166 public void deleteId()
168 this._has_id = false;
173 public void deleteStart()
175 this._has_start = false;
179 * Method enumerateFeatures.
181 * @return an Enumeration over all jalview.binding.Features elements
183 public java.util.Enumeration enumerateFeatures()
185 return this._featuresList.elements();
189 * Method enumeratePdbids.
191 * @return an Enumeration over all jalview.binding.Pdbids elements
193 public java.util.Enumeration enumeratePdbids()
195 return this._pdbidsList.elements();
199 * Returns the value of field 'colour'.
201 * @return the value of field 'Colour'.
203 public int getColour()
209 * Returns the value of field 'end'.
211 * @return the value of field 'End'.
219 * Method getFeatures.
222 * @throws java.lang.IndexOutOfBoundsException
223 * if the index given is outside the bounds of the collection
224 * @return the value of the jalview.binding.Features at the given index
226 public jalview.binding.Features getFeatures(final int index)
227 throws java.lang.IndexOutOfBoundsException
229 // check bounds for index
230 if (index < 0 || index >= this._featuresList.size())
232 throw new IndexOutOfBoundsException("getFeatures: Index value '"
233 + index + "' not in range [0.."
234 + (this._featuresList.size() - 1) + "]");
237 return (jalview.binding.Features) _featuresList.get(index);
241 * Method getFeatures.Returns the contents of the collection in an Array.
243 * Note: Just in case the collection contents are changing in another thread,
244 * we pass a 0-length Array of the correct type into the API call. This way we
245 * <i>know</i> that the Array returned is of exactly the correct length.
247 * @return this collection as an Array
249 public jalview.binding.Features[] getFeatures()
251 jalview.binding.Features[] array = new jalview.binding.Features[0];
252 return (jalview.binding.Features[]) this._featuresList.toArray(array);
256 * Method getFeaturesCount.
258 * @return the size of this collection
260 public int getFeaturesCount()
262 return this._featuresList.size();
266 * Returns the value of field 'id'.
268 * @return the value of field 'Id'.
279 * @throws java.lang.IndexOutOfBoundsException
280 * if the index given is outside the bounds of the collection
281 * @return the value of the jalview.binding.Pdbids at the given index
283 public jalview.binding.Pdbids getPdbids(final int index)
284 throws java.lang.IndexOutOfBoundsException
286 // check bounds for index
287 if (index < 0 || index >= this._pdbidsList.size())
289 throw new IndexOutOfBoundsException("getPdbids: Index value '"
290 + index + "' not in range [0.."
291 + (this._pdbidsList.size() - 1) + "]");
294 return (jalview.binding.Pdbids) _pdbidsList.get(index);
298 * Method getPdbids.Returns the contents of the collection in an Array.
300 * Note: Just in case the collection contents are changing in another thread,
301 * we pass a 0-length Array of the correct type into the API call. This way we
302 * <i>know</i> that the Array returned is of exactly the correct length.
304 * @return this collection as an Array
306 public jalview.binding.Pdbids[] getPdbids()
308 jalview.binding.Pdbids[] array = new jalview.binding.Pdbids[0];
309 return (jalview.binding.Pdbids[]) this._pdbidsList.toArray(array);
313 * Method getPdbidsCount.
315 * @return the size of this collection
317 public int getPdbidsCount()
319 return this._pdbidsList.size();
323 * Returns the value of field 'start'.
325 * @return the value of field 'Start'.
327 public int getStart()
335 * @return true if at least one Colour has been added
337 public boolean hasColour()
339 return this._has_colour;
345 * @return true if at least one End has been added
347 public boolean hasEnd()
349 return this._has_end;
355 * @return true if at least one Id has been added
357 public boolean hasId()
365 * @return true if at least one Start has been added
367 public boolean hasStart()
369 return this._has_start;
375 * @return true if this object is valid according to the schema
377 public boolean isValid()
382 } catch (org.exolab.castor.xml.ValidationException vex)
393 * @throws org.exolab.castor.xml.MarshalException
394 * if object is null or if any SAXException is thrown during
396 * @throws org.exolab.castor.xml.ValidationException
397 * if this object is an invalid instance according to the schema
399 public void marshal(final java.io.Writer out)
400 throws org.exolab.castor.xml.MarshalException,
401 org.exolab.castor.xml.ValidationException
403 Marshaller.marshal(this, out);
410 * @throws java.io.IOException
411 * if an IOException occurs during marshaling
412 * @throws org.exolab.castor.xml.ValidationException
413 * if this object is an invalid instance according to the schema
414 * @throws org.exolab.castor.xml.MarshalException
415 * if object is null or if any SAXException is thrown during
418 public void marshal(final org.xml.sax.ContentHandler handler)
419 throws java.io.IOException,
420 org.exolab.castor.xml.MarshalException,
421 org.exolab.castor.xml.ValidationException
423 Marshaller.marshal(this, handler);
428 public void removeAllFeatures()
430 this._featuresList.clear();
435 public void removeAllPdbids()
437 this._pdbidsList.clear();
441 * Method removeFeatures.
444 * @return true if the object was removed from the collection.
446 public boolean removeFeatures(final jalview.binding.Features vFeatures)
448 boolean removed = _featuresList.remove(vFeatures);
453 * Method removeFeaturesAt.
456 * @return the element removed from the collection
458 public jalview.binding.Features removeFeaturesAt(final int index)
460 java.lang.Object obj = this._featuresList.remove(index);
461 return (jalview.binding.Features) obj;
465 * Method removePdbids.
468 * @return true if the object was removed from the collection.
470 public boolean removePdbids(final jalview.binding.Pdbids vPdbids)
472 boolean removed = _pdbidsList.remove(vPdbids);
477 * Method removePdbidsAt.
480 * @return the element removed from the collection
482 public jalview.binding.Pdbids removePdbidsAt(final int index)
484 java.lang.Object obj = this._pdbidsList.remove(index);
485 return (jalview.binding.Pdbids) obj;
489 * Sets the value of field 'colour'.
492 * the value of field 'colour'.
494 public void setColour(final int colour)
496 this._colour = colour;
497 this._has_colour = true;
501 * Sets the value of field 'end'.
504 * the value of field 'end'.
506 public void setEnd(final int end)
509 this._has_end = true;
517 * @throws java.lang.IndexOutOfBoundsException
518 * if the index given is outside the bounds of the collection
520 public void setFeatures(final int index,
521 final jalview.binding.Features vFeatures)
522 throws java.lang.IndexOutOfBoundsException
524 // check bounds for index
525 if (index < 0 || index >= this._featuresList.size())
527 throw new IndexOutOfBoundsException("setFeatures: Index value '"
528 + index + "' not in range [0.."
529 + (this._featuresList.size() - 1) + "]");
532 this._featuresList.set(index, vFeatures);
538 * @param vFeaturesArray
540 public void setFeatures(final jalview.binding.Features[] vFeaturesArray)
543 _featuresList.clear();
545 for (int i = 0; i < vFeaturesArray.length; i++)
547 this._featuresList.add(vFeaturesArray[i]);
552 * Sets the value of field 'id'.
555 * the value of field 'id'.
557 public void setId(final int id)
568 * @throws java.lang.IndexOutOfBoundsException
569 * if the index given is outside the bounds of the collection
571 public void setPdbids(final int index,
572 final jalview.binding.Pdbids vPdbids)
573 throws java.lang.IndexOutOfBoundsException
575 // check bounds for index
576 if (index < 0 || index >= this._pdbidsList.size())
578 throw new IndexOutOfBoundsException("setPdbids: Index value '"
579 + index + "' not in range [0.."
580 + (this._pdbidsList.size() - 1) + "]");
583 this._pdbidsList.set(index, vPdbids);
589 * @param vPdbidsArray
591 public void setPdbids(final jalview.binding.Pdbids[] vPdbidsArray)
596 for (int i = 0; i < vPdbidsArray.length; i++)
598 this._pdbidsList.add(vPdbidsArray[i]);
603 * Sets the value of field 'start'.
606 * the value of field 'start'.
608 public void setStart(final int start)
611 this._has_start = true;
618 * @throws org.exolab.castor.xml.MarshalException
619 * if object is null or if any SAXException is thrown during
621 * @throws org.exolab.castor.xml.ValidationException
622 * if this object is an invalid instance according to the schema
623 * @return the unmarshaled jalview.binding.JSeq
625 public static jalview.binding.JSeq unmarshal(final java.io.Reader reader)
626 throws org.exolab.castor.xml.MarshalException,
627 org.exolab.castor.xml.ValidationException
629 return (jalview.binding.JSeq) Unmarshaller.unmarshal(
630 jalview.binding.JSeq.class, reader);
636 * @throws org.exolab.castor.xml.ValidationException
637 * if this object is an invalid instance according to the schema
639 public void validate() throws org.exolab.castor.xml.ValidationException
641 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
642 validator.validate(this);