2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.schemabinding.version2;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
18 * developed after mapRangeType from
19 * http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes
21 * This effectively represents a java.util.MapList object
24 * @version $Revision$ $Date$
26 public class MapListType implements java.io.Serializable
29 // --------------------------/
30 // - Class/Member Variables -/
31 // --------------------------/
34 * number of dictionary symbol widths involved in each mapped position on this
35 * sequence (for example, 3 for a dna sequence exon region that is being
36 * mapped to a protein sequence). This is optional, since the unit can be
37 * usually be inferred from the dictionary type of each sequence involved in
40 private long _mapFromUnit;
43 * keeps track of state for field: _mapFromUnit
45 private boolean _has_mapFromUnit;
48 * number of dictionary symbol widths involved in each mapped position on this
49 * sequence (for example, 3 for a dna sequence exon region that is being
50 * mapped to a protein sequence). This is optional, since the unit can be
51 * usually be inferred from the dictionary type of each sequence involved in
54 private long _mapToUnit;
57 * keeps track of state for field: _mapToUnit
59 private boolean _has_mapToUnit;
62 * a region from start to end inclusive
64 private java.util.Vector _mapListFromList;
67 * a region from start to end inclusive
69 private java.util.Vector _mapListToList;
78 this._mapListFromList = new java.util.Vector();
79 this._mapListToList = new java.util.Vector();
90 * @throws java.lang.IndexOutOfBoundsException
91 * if the index given is outside the bounds of the collection
93 public void addMapListFrom(
94 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
95 throws java.lang.IndexOutOfBoundsException
97 this._mapListFromList.addElement(vMapListFrom);
104 * @param vMapListFrom
105 * @throws java.lang.IndexOutOfBoundsException
106 * if the index given is outside the bounds of the collection
108 public void addMapListFrom(final int index,
109 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
110 throws java.lang.IndexOutOfBoundsException
112 this._mapListFromList.add(index, vMapListFrom);
119 * @throws java.lang.IndexOutOfBoundsException
120 * if the index given is outside the bounds of the collection
122 public void addMapListTo(
123 final jalview.schemabinding.version2.MapListTo vMapListTo)
124 throws java.lang.IndexOutOfBoundsException
126 this._mapListToList.addElement(vMapListTo);
134 * @throws java.lang.IndexOutOfBoundsException
135 * if the index given is outside the bounds of the collection
137 public void addMapListTo(final int index,
138 final jalview.schemabinding.version2.MapListTo vMapListTo)
139 throws java.lang.IndexOutOfBoundsException
141 this._mapListToList.add(index, vMapListTo);
146 public void deleteMapFromUnit()
148 this._has_mapFromUnit = false;
153 public void deleteMapToUnit()
155 this._has_mapToUnit = false;
159 * Method enumerateMapListFrom.
161 * @return an Enumeration over all jalview.schemabinding.version2.MapListFrom
164 public java.util.Enumeration enumerateMapListFrom()
166 return this._mapListFromList.elements();
170 * Method enumerateMapListTo.
172 * @return an Enumeration over all jalview.schemabinding.version2.MapListTo
175 public java.util.Enumeration enumerateMapListTo()
177 return this._mapListToList.elements();
181 * Returns the value of field 'mapFromUnit'. The field 'mapFromUnit' has the
182 * following description: number of dictionary symbol widths involved in each
183 * mapped position on this sequence (for example, 3 for a dna sequence exon
184 * region that is being mapped to a protein sequence). This is optional, since
185 * the unit can be usually be inferred from the dictionary type of each
186 * sequence involved in the mapping.
188 * @return the value of field 'MapFromUnit'.
190 public long getMapFromUnit()
192 return this._mapFromUnit;
196 * Method getMapListFrom.
199 * @throws java.lang.IndexOutOfBoundsException
200 * if the index given is outside the bounds of the collection
201 * @return the value of the jalview.schemabinding.version2.MapListFrom at the
204 public jalview.schemabinding.version2.MapListFrom getMapListFrom(
205 final int index) throws java.lang.IndexOutOfBoundsException
207 // check bounds for index
208 if (index < 0 || index >= this._mapListFromList.size())
210 throw new IndexOutOfBoundsException("getMapListFrom: Index value '"
211 + index + "' not in range [0.."
212 + (this._mapListFromList.size() - 1) + "]");
215 return (jalview.schemabinding.version2.MapListFrom) _mapListFromList
220 * Method getMapListFrom.Returns the contents of the collection in an Array.
222 * Note: Just in case the collection contents are changing in another thread,
223 * we pass a 0-length Array of the correct type into the API call. This way we
224 * <i>know</i> that the Array returned is of exactly the correct length.
226 * @return this collection as an Array
228 public jalview.schemabinding.version2.MapListFrom[] getMapListFrom()
230 jalview.schemabinding.version2.MapListFrom[] array = new jalview.schemabinding.version2.MapListFrom[0];
231 return (jalview.schemabinding.version2.MapListFrom[]) this._mapListFromList
236 * Method getMapListFromCount.
238 * @return the size of this collection
240 public int getMapListFromCount()
242 return this._mapListFromList.size();
246 * Method getMapListTo.
249 * @throws java.lang.IndexOutOfBoundsException
250 * if the index given is outside the bounds of the collection
251 * @return the value of the jalview.schemabinding.version2.MapListTo at the
254 public jalview.schemabinding.version2.MapListTo getMapListTo(
255 final int index) throws java.lang.IndexOutOfBoundsException
257 // check bounds for index
258 if (index < 0 || index >= this._mapListToList.size())
260 throw new IndexOutOfBoundsException("getMapListTo: Index value '"
261 + index + "' not in range [0.."
262 + (this._mapListToList.size() - 1) + "]");
265 return (jalview.schemabinding.version2.MapListTo) _mapListToList
270 * Method getMapListTo.Returns the contents of the collection in an Array.
272 * Note: Just in case the collection contents are changing in another thread,
273 * we pass a 0-length Array of the correct type into the API call. This way we
274 * <i>know</i> that the Array returned is of exactly the correct length.
276 * @return this collection as an Array
278 public jalview.schemabinding.version2.MapListTo[] getMapListTo()
280 jalview.schemabinding.version2.MapListTo[] array = new jalview.schemabinding.version2.MapListTo[0];
281 return (jalview.schemabinding.version2.MapListTo[]) this._mapListToList
286 * Method getMapListToCount.
288 * @return the size of this collection
290 public int getMapListToCount()
292 return this._mapListToList.size();
296 * Returns the value of field 'mapToUnit'. The field 'mapToUnit' has the
297 * following description: number of dictionary symbol widths involved in each
298 * mapped position on this sequence (for example, 3 for a dna sequence exon
299 * region that is being mapped to a protein sequence). This is optional, since
300 * the unit can be usually be inferred from the dictionary type of each
301 * sequence involved in the mapping.
303 * @return the value of field 'MapToUnit'.
305 public long getMapToUnit()
307 return this._mapToUnit;
311 * Method hasMapFromUnit.
313 * @return true if at least one MapFromUnit has been added
315 public boolean hasMapFromUnit()
317 return this._has_mapFromUnit;
321 * Method hasMapToUnit.
323 * @return true if at least one MapToUnit has been added
325 public boolean hasMapToUnit()
327 return this._has_mapToUnit;
333 * @return true if this object is valid according to the schema
335 public boolean isValid()
340 } catch (org.exolab.castor.xml.ValidationException vex)
351 * @throws org.exolab.castor.xml.MarshalException
352 * if object is null or if any SAXException is thrown during
354 * @throws org.exolab.castor.xml.ValidationException
355 * if this object is an invalid instance according to the schema
357 public void marshal(final java.io.Writer out)
358 throws org.exolab.castor.xml.MarshalException,
359 org.exolab.castor.xml.ValidationException
361 Marshaller.marshal(this, out);
368 * @throws java.io.IOException
369 * if an IOException occurs during marshaling
370 * @throws org.exolab.castor.xml.ValidationException
371 * if this object is an invalid instance according to the schema
372 * @throws org.exolab.castor.xml.MarshalException
373 * if object is null or if any SAXException is thrown during
376 public void marshal(final org.xml.sax.ContentHandler handler)
377 throws java.io.IOException,
378 org.exolab.castor.xml.MarshalException,
379 org.exolab.castor.xml.ValidationException
381 Marshaller.marshal(this, handler);
386 public void removeAllMapListFrom()
388 this._mapListFromList.clear();
393 public void removeAllMapListTo()
395 this._mapListToList.clear();
399 * Method removeMapListFrom.
401 * @param vMapListFrom
402 * @return true if the object was removed from the collection.
404 public boolean removeMapListFrom(
405 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
407 boolean removed = _mapListFromList.remove(vMapListFrom);
412 * Method removeMapListFromAt.
415 * @return the element removed from the collection
417 public jalview.schemabinding.version2.MapListFrom removeMapListFromAt(
420 java.lang.Object obj = this._mapListFromList.remove(index);
421 return (jalview.schemabinding.version2.MapListFrom) obj;
425 * Method removeMapListTo.
428 * @return true if the object was removed from the collection.
430 public boolean removeMapListTo(
431 final jalview.schemabinding.version2.MapListTo vMapListTo)
433 boolean removed = _mapListToList.remove(vMapListTo);
438 * Method removeMapListToAt.
441 * @return the element removed from the collection
443 public jalview.schemabinding.version2.MapListTo removeMapListToAt(
446 java.lang.Object obj = this._mapListToList.remove(index);
447 return (jalview.schemabinding.version2.MapListTo) obj;
451 * Sets the value of field 'mapFromUnit'. The field 'mapFromUnit' has the
452 * following description: number of dictionary symbol widths involved in each
453 * mapped position on this sequence (for example, 3 for a dna sequence exon
454 * region that is being mapped to a protein sequence). This is optional, since
455 * the unit can be usually be inferred from the dictionary type of each
456 * sequence involved in the mapping.
459 * the value of field 'mapFromUnit'.
461 public void setMapFromUnit(final long mapFromUnit)
463 this._mapFromUnit = mapFromUnit;
464 this._has_mapFromUnit = true;
471 * @param vMapListFrom
472 * @throws java.lang.IndexOutOfBoundsException
473 * if the index given is outside the bounds of the collection
475 public void setMapListFrom(final int index,
476 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
477 throws java.lang.IndexOutOfBoundsException
479 // check bounds for index
480 if (index < 0 || index >= this._mapListFromList.size())
482 throw new IndexOutOfBoundsException("setMapListFrom: Index value '"
483 + index + "' not in range [0.."
484 + (this._mapListFromList.size() - 1) + "]");
487 this._mapListFromList.set(index, vMapListFrom);
493 * @param vMapListFromArray
495 public void setMapListFrom(
496 final jalview.schemabinding.version2.MapListFrom[] vMapListFromArray)
499 _mapListFromList.clear();
501 for (int i = 0; i < vMapListFromArray.length; i++)
503 this._mapListFromList.add(vMapListFromArray[i]);
512 * @throws java.lang.IndexOutOfBoundsException
513 * if the index given is outside the bounds of the collection
515 public void setMapListTo(final int index,
516 final jalview.schemabinding.version2.MapListTo vMapListTo)
517 throws java.lang.IndexOutOfBoundsException
519 // check bounds for index
520 if (index < 0 || index >= this._mapListToList.size())
522 throw new IndexOutOfBoundsException("setMapListTo: Index value '"
523 + index + "' not in range [0.."
524 + (this._mapListToList.size() - 1) + "]");
527 this._mapListToList.set(index, vMapListTo);
533 * @param vMapListToArray
535 public void setMapListTo(
536 final jalview.schemabinding.version2.MapListTo[] vMapListToArray)
539 _mapListToList.clear();
541 for (int i = 0; i < vMapListToArray.length; i++)
543 this._mapListToList.add(vMapListToArray[i]);
548 * Sets the value of field 'mapToUnit'. The field 'mapToUnit' has the
549 * following description: number of dictionary symbol widths involved in each
550 * mapped position on this sequence (for example, 3 for a dna sequence exon
551 * region that is being mapped to a protein sequence). This is optional, since
552 * the unit can be usually be inferred from the dictionary type of each
553 * sequence involved in the mapping.
556 * the value of field 'mapToUnit'.
558 public void setMapToUnit(final long mapToUnit)
560 this._mapToUnit = mapToUnit;
561 this._has_mapToUnit = true;
568 * @throws org.exolab.castor.xml.MarshalException
569 * if object is null or if any SAXException is thrown during
571 * @throws org.exolab.castor.xml.ValidationException
572 * if this object is an invalid instance according to the schema
573 * @return the unmarshaled jalview.schemabinding.version2.MapListType
575 public static jalview.schemabinding.version2.MapListType unmarshal(
576 final java.io.Reader reader)
577 throws org.exolab.castor.xml.MarshalException,
578 org.exolab.castor.xml.ValidationException
580 return (jalview.schemabinding.version2.MapListType) Unmarshaller
581 .unmarshal(jalview.schemabinding.version2.MapListType.class,
588 * @throws org.exolab.castor.xml.ValidationException
589 * if this object is an invalid instance according to the schema
591 public void validate() throws org.exolab.castor.xml.ValidationException
593 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
594 validator.validate(this);