1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $(date) The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
20 *******************************************************************************/
22 * This class was automatically generated with
23 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
28 package jalview.schemabinding.version2;
30 //---------------------------------/
31 //- Imported classes and packages -/
32 //---------------------------------/
34 import org.exolab.castor.xml.Marshaller;
35 import org.exolab.castor.xml.Unmarshaller;
38 * developed after mapRangeType from
39 * http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes
41 * This effectively represents a java.util.MapList object
44 * @version $Revision$ $Date$
46 public class MapListType implements java.io.Serializable
49 // --------------------------/
50 // - Class/Member Variables -/
51 // --------------------------/
54 * number of dictionary symbol widths involved in each mapped position on this
55 * sequence (for example, 3 for a dna sequence exon region that is being
56 * mapped to a protein sequence). This is optional, since the unit can be
57 * usually be inferred from the dictionary type of each sequence involved in
60 private long _mapFromUnit;
63 * keeps track of state for field: _mapFromUnit
65 private boolean _has_mapFromUnit;
68 * number of dictionary symbol widths involved in each mapped position on this
69 * sequence (for example, 3 for a dna sequence exon region that is being
70 * mapped to a protein sequence). This is optional, since the unit can be
71 * usually be inferred from the dictionary type of each sequence involved in
74 private long _mapToUnit;
77 * keeps track of state for field: _mapToUnit
79 private boolean _has_mapToUnit;
82 * a region from start to end inclusive
84 private java.util.Vector _mapListFromList;
87 * a region from start to end inclusive
89 private java.util.Vector _mapListToList;
98 this._mapListFromList = new java.util.Vector();
99 this._mapListToList = new java.util.Vector();
109 * @param vMapListFrom
110 * @throws java.lang.IndexOutOfBoundsException
111 * if the index given is outside the bounds of the collection
113 public void addMapListFrom(
114 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
115 throws java.lang.IndexOutOfBoundsException
117 this._mapListFromList.addElement(vMapListFrom);
124 * @param vMapListFrom
125 * @throws java.lang.IndexOutOfBoundsException
126 * if the index given is outside the bounds of the collection
128 public void addMapListFrom(final int index,
129 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
130 throws java.lang.IndexOutOfBoundsException
132 this._mapListFromList.add(index, vMapListFrom);
139 * @throws java.lang.IndexOutOfBoundsException
140 * if the index given is outside the bounds of the collection
142 public void addMapListTo(
143 final jalview.schemabinding.version2.MapListTo vMapListTo)
144 throws java.lang.IndexOutOfBoundsException
146 this._mapListToList.addElement(vMapListTo);
154 * @throws java.lang.IndexOutOfBoundsException
155 * if the index given is outside the bounds of the collection
157 public void addMapListTo(final int index,
158 final jalview.schemabinding.version2.MapListTo vMapListTo)
159 throws java.lang.IndexOutOfBoundsException
161 this._mapListToList.add(index, vMapListTo);
166 public void deleteMapFromUnit()
168 this._has_mapFromUnit = false;
173 public void deleteMapToUnit()
175 this._has_mapToUnit = false;
179 * Method enumerateMapListFrom.
181 * @return an Enumeration over all jalview.schemabinding.version2.MapListFrom
184 public java.util.Enumeration enumerateMapListFrom()
186 return this._mapListFromList.elements();
190 * Method enumerateMapListTo.
192 * @return an Enumeration over all jalview.schemabinding.version2.MapListTo
195 public java.util.Enumeration enumerateMapListTo()
197 return this._mapListToList.elements();
201 * Returns the value of field 'mapFromUnit'. The field 'mapFromUnit' has the
202 * following description: number of dictionary symbol widths involved in each
203 * mapped position on this sequence (for example, 3 for a dna sequence exon
204 * region that is being mapped to a protein sequence). This is optional, since
205 * the unit can be usually be inferred from the dictionary type of each
206 * sequence involved in the mapping.
208 * @return the value of field 'MapFromUnit'.
210 public long getMapFromUnit()
212 return this._mapFromUnit;
216 * Method getMapListFrom.
219 * @throws java.lang.IndexOutOfBoundsException
220 * if the index given is outside the bounds of the collection
221 * @return the value of the jalview.schemabinding.version2.MapListFrom at the
224 public jalview.schemabinding.version2.MapListFrom getMapListFrom(
225 final int index) throws java.lang.IndexOutOfBoundsException
227 // check bounds for index
228 if (index < 0 || index >= this._mapListFromList.size())
230 throw new IndexOutOfBoundsException("getMapListFrom: Index value '"
231 + index + "' not in range [0.."
232 + (this._mapListFromList.size() - 1) + "]");
235 return (jalview.schemabinding.version2.MapListFrom) _mapListFromList
240 * Method getMapListFrom.Returns the contents of the collection in an Array.
242 * Note: Just in case the collection contents are changing in another thread,
243 * we pass a 0-length Array of the correct type into the API call. This way we
244 * <i>know</i> that the Array returned is of exactly the correct length.
246 * @return this collection as an Array
248 public jalview.schemabinding.version2.MapListFrom[] getMapListFrom()
250 jalview.schemabinding.version2.MapListFrom[] array = new jalview.schemabinding.version2.MapListFrom[0];
251 return (jalview.schemabinding.version2.MapListFrom[]) this._mapListFromList
256 * Method getMapListFromCount.
258 * @return the size of this collection
260 public int getMapListFromCount()
262 return this._mapListFromList.size();
266 * Method getMapListTo.
269 * @throws java.lang.IndexOutOfBoundsException
270 * if the index given is outside the bounds of the collection
271 * @return the value of the jalview.schemabinding.version2.MapListTo at the
274 public jalview.schemabinding.version2.MapListTo getMapListTo(
275 final int index) throws java.lang.IndexOutOfBoundsException
277 // check bounds for index
278 if (index < 0 || index >= this._mapListToList.size())
280 throw new IndexOutOfBoundsException("getMapListTo: Index value '"
281 + index + "' not in range [0.."
282 + (this._mapListToList.size() - 1) + "]");
285 return (jalview.schemabinding.version2.MapListTo) _mapListToList
290 * Method getMapListTo.Returns the contents of the collection in an Array.
292 * Note: Just in case the collection contents are changing in another thread,
293 * we pass a 0-length Array of the correct type into the API call. This way we
294 * <i>know</i> that the Array returned is of exactly the correct length.
296 * @return this collection as an Array
298 public jalview.schemabinding.version2.MapListTo[] getMapListTo()
300 jalview.schemabinding.version2.MapListTo[] array = new jalview.schemabinding.version2.MapListTo[0];
301 return (jalview.schemabinding.version2.MapListTo[]) this._mapListToList
306 * Method getMapListToCount.
308 * @return the size of this collection
310 public int getMapListToCount()
312 return this._mapListToList.size();
316 * Returns the value of field 'mapToUnit'. The field 'mapToUnit' has the
317 * following description: number of dictionary symbol widths involved in each
318 * mapped position on this sequence (for example, 3 for a dna sequence exon
319 * region that is being mapped to a protein sequence). This is optional, since
320 * the unit can be usually be inferred from the dictionary type of each
321 * sequence involved in the mapping.
323 * @return the value of field 'MapToUnit'.
325 public long getMapToUnit()
327 return this._mapToUnit;
331 * Method hasMapFromUnit.
333 * @return true if at least one MapFromUnit has been added
335 public boolean hasMapFromUnit()
337 return this._has_mapFromUnit;
341 * Method hasMapToUnit.
343 * @return true if at least one MapToUnit has been added
345 public boolean hasMapToUnit()
347 return this._has_mapToUnit;
353 * @return true if this object is valid according to the schema
355 public boolean isValid()
360 } catch (org.exolab.castor.xml.ValidationException vex)
371 * @throws org.exolab.castor.xml.MarshalException
372 * if object is null or if any SAXException is thrown during
374 * @throws org.exolab.castor.xml.ValidationException
375 * if this object is an invalid instance according to the schema
377 public void marshal(final java.io.Writer out)
378 throws org.exolab.castor.xml.MarshalException,
379 org.exolab.castor.xml.ValidationException
381 Marshaller.marshal(this, out);
388 * @throws java.io.IOException
389 * if an IOException occurs during marshaling
390 * @throws org.exolab.castor.xml.ValidationException
391 * if this object is an invalid instance according to the schema
392 * @throws org.exolab.castor.xml.MarshalException
393 * if object is null or if any SAXException is thrown during
396 public void marshal(final org.xml.sax.ContentHandler handler)
397 throws java.io.IOException,
398 org.exolab.castor.xml.MarshalException,
399 org.exolab.castor.xml.ValidationException
401 Marshaller.marshal(this, handler);
406 public void removeAllMapListFrom()
408 this._mapListFromList.clear();
413 public void removeAllMapListTo()
415 this._mapListToList.clear();
419 * Method removeMapListFrom.
421 * @param vMapListFrom
422 * @return true if the object was removed from the collection.
424 public boolean removeMapListFrom(
425 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
427 boolean removed = _mapListFromList.remove(vMapListFrom);
432 * Method removeMapListFromAt.
435 * @return the element removed from the collection
437 public jalview.schemabinding.version2.MapListFrom removeMapListFromAt(
440 java.lang.Object obj = this._mapListFromList.remove(index);
441 return (jalview.schemabinding.version2.MapListFrom) obj;
445 * Method removeMapListTo.
448 * @return true if the object was removed from the collection.
450 public boolean removeMapListTo(
451 final jalview.schemabinding.version2.MapListTo vMapListTo)
453 boolean removed = _mapListToList.remove(vMapListTo);
458 * Method removeMapListToAt.
461 * @return the element removed from the collection
463 public jalview.schemabinding.version2.MapListTo removeMapListToAt(
466 java.lang.Object obj = this._mapListToList.remove(index);
467 return (jalview.schemabinding.version2.MapListTo) obj;
471 * Sets the value of field 'mapFromUnit'. The field 'mapFromUnit' has the
472 * following description: number of dictionary symbol widths involved in each
473 * mapped position on this sequence (for example, 3 for a dna sequence exon
474 * region that is being mapped to a protein sequence). This is optional, since
475 * the unit can be usually be inferred from the dictionary type of each
476 * sequence involved in the mapping.
479 * the value of field 'mapFromUnit'.
481 public void setMapFromUnit(final long mapFromUnit)
483 this._mapFromUnit = mapFromUnit;
484 this._has_mapFromUnit = true;
491 * @param vMapListFrom
492 * @throws java.lang.IndexOutOfBoundsException
493 * if the index given is outside the bounds of the collection
495 public void setMapListFrom(final int index,
496 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
497 throws java.lang.IndexOutOfBoundsException
499 // check bounds for index
500 if (index < 0 || index >= this._mapListFromList.size())
502 throw new IndexOutOfBoundsException("setMapListFrom: Index value '"
503 + index + "' not in range [0.."
504 + (this._mapListFromList.size() - 1) + "]");
507 this._mapListFromList.set(index, vMapListFrom);
513 * @param vMapListFromArray
515 public void setMapListFrom(
516 final jalview.schemabinding.version2.MapListFrom[] vMapListFromArray)
519 _mapListFromList.clear();
521 for (int i = 0; i < vMapListFromArray.length; i++)
523 this._mapListFromList.add(vMapListFromArray[i]);
532 * @throws java.lang.IndexOutOfBoundsException
533 * if the index given is outside the bounds of the collection
535 public void setMapListTo(final int index,
536 final jalview.schemabinding.version2.MapListTo vMapListTo)
537 throws java.lang.IndexOutOfBoundsException
539 // check bounds for index
540 if (index < 0 || index >= this._mapListToList.size())
542 throw new IndexOutOfBoundsException("setMapListTo: Index value '"
543 + index + "' not in range [0.."
544 + (this._mapListToList.size() - 1) + "]");
547 this._mapListToList.set(index, vMapListTo);
553 * @param vMapListToArray
555 public void setMapListTo(
556 final jalview.schemabinding.version2.MapListTo[] vMapListToArray)
559 _mapListToList.clear();
561 for (int i = 0; i < vMapListToArray.length; i++)
563 this._mapListToList.add(vMapListToArray[i]);
568 * Sets the value of field 'mapToUnit'. The field 'mapToUnit' has the
569 * following description: number of dictionary symbol widths involved in each
570 * mapped position on this sequence (for example, 3 for a dna sequence exon
571 * region that is being mapped to a protein sequence). This is optional, since
572 * the unit can be usually be inferred from the dictionary type of each
573 * sequence involved in the mapping.
576 * the value of field 'mapToUnit'.
578 public void setMapToUnit(final long mapToUnit)
580 this._mapToUnit = mapToUnit;
581 this._has_mapToUnit = true;
588 * @throws org.exolab.castor.xml.MarshalException
589 * if object is null or if any SAXException is thrown during
591 * @throws org.exolab.castor.xml.ValidationException
592 * if this object is an invalid instance according to the schema
593 * @return the unmarshaled jalview.schemabinding.version2.MapListType
595 public static jalview.schemabinding.version2.MapListType unmarshal(
596 final java.io.Reader reader)
597 throws org.exolab.castor.xml.MarshalException,
598 org.exolab.castor.xml.ValidationException
600 return (jalview.schemabinding.version2.MapListType) Unmarshaller
601 .unmarshal(jalview.schemabinding.version2.MapListType.class,
608 * @throws org.exolab.castor.xml.ValidationException
609 * if this object is an invalid instance according to the schema
611 public void validate() throws org.exolab.castor.xml.ValidationException
613 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
614 validator.validate(this);