1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import org.exolab.castor.xml.Marshaller;
34 import org.exolab.castor.xml.Unmarshaller;
37 * developed after mapRangeType from
38 * http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes
40 * This effectively represents a java.util.MapList object
43 * @version $Revision$ $Date$
45 public class MapListType implements java.io.Serializable
48 // --------------------------/
49 // - Class/Member Variables -/
50 // --------------------------/
53 * number of dictionary symbol widths involved in each mapped position on this
54 * sequence (for example, 3 for a dna sequence exon region that is being
55 * mapped to a protein sequence). This is optional, since the unit can be
56 * usually be inferred from the dictionary type of each sequence involved in
59 private long _mapFromUnit;
62 * keeps track of state for field: _mapFromUnit
64 private boolean _has_mapFromUnit;
67 * number of dictionary symbol widths involved in each mapped position on this
68 * sequence (for example, 3 for a dna sequence exon region that is being
69 * mapped to a protein sequence). This is optional, since the unit can be
70 * usually be inferred from the dictionary type of each sequence involved in
73 private long _mapToUnit;
76 * keeps track of state for field: _mapToUnit
78 private boolean _has_mapToUnit;
81 * a region from start to end inclusive
83 private java.util.Vector _mapListFromList;
86 * a region from start to end inclusive
88 private java.util.Vector _mapListToList;
97 this._mapListFromList = new java.util.Vector();
98 this._mapListToList = new java.util.Vector();
108 * @param vMapListFrom
109 * @throws java.lang.IndexOutOfBoundsException
110 * if the index given is outside the bounds of the collection
112 public void addMapListFrom(
113 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
114 throws java.lang.IndexOutOfBoundsException
116 this._mapListFromList.addElement(vMapListFrom);
123 * @param vMapListFrom
124 * @throws java.lang.IndexOutOfBoundsException
125 * if the index given is outside the bounds of the collection
127 public void addMapListFrom(final int index,
128 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
129 throws java.lang.IndexOutOfBoundsException
131 this._mapListFromList.add(index, vMapListFrom);
138 * @throws java.lang.IndexOutOfBoundsException
139 * if the index given is outside the bounds of the collection
141 public void addMapListTo(
142 final jalview.schemabinding.version2.MapListTo vMapListTo)
143 throws java.lang.IndexOutOfBoundsException
145 this._mapListToList.addElement(vMapListTo);
153 * @throws java.lang.IndexOutOfBoundsException
154 * if the index given is outside the bounds of the collection
156 public void addMapListTo(final int index,
157 final jalview.schemabinding.version2.MapListTo vMapListTo)
158 throws java.lang.IndexOutOfBoundsException
160 this._mapListToList.add(index, vMapListTo);
165 public void deleteMapFromUnit()
167 this._has_mapFromUnit = false;
172 public void deleteMapToUnit()
174 this._has_mapToUnit = false;
178 * Method enumerateMapListFrom.
180 * @return an Enumeration over all jalview.schemabinding.version2.MapListFrom
183 public java.util.Enumeration enumerateMapListFrom()
185 return this._mapListFromList.elements();
189 * Method enumerateMapListTo.
191 * @return an Enumeration over all jalview.schemabinding.version2.MapListTo
194 public java.util.Enumeration enumerateMapListTo()
196 return this._mapListToList.elements();
200 * Returns the value of field 'mapFromUnit'. The field 'mapFromUnit' has the
201 * following description: number of dictionary symbol widths involved in each
202 * mapped position on this sequence (for example, 3 for a dna sequence exon
203 * region that is being mapped to a protein sequence). This is optional, since
204 * the unit can be usually be inferred from the dictionary type of each
205 * sequence involved in the mapping.
207 * @return the value of field 'MapFromUnit'.
209 public long getMapFromUnit()
211 return this._mapFromUnit;
215 * Method getMapListFrom.
218 * @throws java.lang.IndexOutOfBoundsException
219 * if the index given is outside the bounds of the collection
220 * @return the value of the jalview.schemabinding.version2.MapListFrom at the
223 public jalview.schemabinding.version2.MapListFrom getMapListFrom(
224 final int index) throws java.lang.IndexOutOfBoundsException
226 // check bounds for index
227 if (index < 0 || index >= this._mapListFromList.size())
229 throw new IndexOutOfBoundsException("getMapListFrom: Index value '"
230 + index + "' not in range [0.."
231 + (this._mapListFromList.size() - 1) + "]");
234 return (jalview.schemabinding.version2.MapListFrom) _mapListFromList
239 * Method getMapListFrom.Returns the contents of the collection in an Array.
241 * Note: Just in case the collection contents are changing in another thread,
242 * we pass a 0-length Array of the correct type into the API call. This way we
243 * <i>know</i> that the Array returned is of exactly the correct length.
245 * @return this collection as an Array
247 public jalview.schemabinding.version2.MapListFrom[] getMapListFrom()
249 jalview.schemabinding.version2.MapListFrom[] array = new jalview.schemabinding.version2.MapListFrom[0];
250 return (jalview.schemabinding.version2.MapListFrom[]) this._mapListFromList
255 * Method getMapListFromCount.
257 * @return the size of this collection
259 public int getMapListFromCount()
261 return this._mapListFromList.size();
265 * Method getMapListTo.
268 * @throws java.lang.IndexOutOfBoundsException
269 * if the index given is outside the bounds of the collection
270 * @return the value of the jalview.schemabinding.version2.MapListTo at the
273 public jalview.schemabinding.version2.MapListTo getMapListTo(
274 final int index) throws java.lang.IndexOutOfBoundsException
276 // check bounds for index
277 if (index < 0 || index >= this._mapListToList.size())
279 throw new IndexOutOfBoundsException("getMapListTo: Index value '"
280 + index + "' not in range [0.."
281 + (this._mapListToList.size() - 1) + "]");
284 return (jalview.schemabinding.version2.MapListTo) _mapListToList
289 * Method getMapListTo.Returns the contents of the collection in an Array.
291 * Note: Just in case the collection contents are changing in another thread,
292 * we pass a 0-length Array of the correct type into the API call. This way we
293 * <i>know</i> that the Array returned is of exactly the correct length.
295 * @return this collection as an Array
297 public jalview.schemabinding.version2.MapListTo[] getMapListTo()
299 jalview.schemabinding.version2.MapListTo[] array = new jalview.schemabinding.version2.MapListTo[0];
300 return (jalview.schemabinding.version2.MapListTo[]) this._mapListToList
305 * Method getMapListToCount.
307 * @return the size of this collection
309 public int getMapListToCount()
311 return this._mapListToList.size();
315 * Returns the value of field 'mapToUnit'. The field 'mapToUnit' has the
316 * following description: number of dictionary symbol widths involved in each
317 * mapped position on this sequence (for example, 3 for a dna sequence exon
318 * region that is being mapped to a protein sequence). This is optional, since
319 * the unit can be usually be inferred from the dictionary type of each
320 * sequence involved in the mapping.
322 * @return the value of field 'MapToUnit'.
324 public long getMapToUnit()
326 return this._mapToUnit;
330 * Method hasMapFromUnit.
332 * @return true if at least one MapFromUnit has been added
334 public boolean hasMapFromUnit()
336 return this._has_mapFromUnit;
340 * Method hasMapToUnit.
342 * @return true if at least one MapToUnit has been added
344 public boolean hasMapToUnit()
346 return this._has_mapToUnit;
352 * @return true if this object is valid according to the schema
354 public boolean isValid()
359 } catch (org.exolab.castor.xml.ValidationException vex)
370 * @throws org.exolab.castor.xml.MarshalException
371 * if object is null or if any SAXException is thrown during
373 * @throws org.exolab.castor.xml.ValidationException
374 * if this object is an invalid instance according to the schema
376 public void marshal(final java.io.Writer out)
377 throws org.exolab.castor.xml.MarshalException,
378 org.exolab.castor.xml.ValidationException
380 Marshaller.marshal(this, out);
387 * @throws java.io.IOException
388 * if an IOException occurs during marshaling
389 * @throws org.exolab.castor.xml.ValidationException
390 * if this object is an invalid instance according to the schema
391 * @throws org.exolab.castor.xml.MarshalException
392 * if object is null or if any SAXException is thrown during
395 public void marshal(final org.xml.sax.ContentHandler handler)
396 throws java.io.IOException,
397 org.exolab.castor.xml.MarshalException,
398 org.exolab.castor.xml.ValidationException
400 Marshaller.marshal(this, handler);
405 public void removeAllMapListFrom()
407 this._mapListFromList.clear();
412 public void removeAllMapListTo()
414 this._mapListToList.clear();
418 * Method removeMapListFrom.
420 * @param vMapListFrom
421 * @return true if the object was removed from the collection.
423 public boolean removeMapListFrom(
424 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
426 boolean removed = _mapListFromList.remove(vMapListFrom);
431 * Method removeMapListFromAt.
434 * @return the element removed from the collection
436 public jalview.schemabinding.version2.MapListFrom removeMapListFromAt(
439 java.lang.Object obj = this._mapListFromList.remove(index);
440 return (jalview.schemabinding.version2.MapListFrom) obj;
444 * Method removeMapListTo.
447 * @return true if the object was removed from the collection.
449 public boolean removeMapListTo(
450 final jalview.schemabinding.version2.MapListTo vMapListTo)
452 boolean removed = _mapListToList.remove(vMapListTo);
457 * Method removeMapListToAt.
460 * @return the element removed from the collection
462 public jalview.schemabinding.version2.MapListTo removeMapListToAt(
465 java.lang.Object obj = this._mapListToList.remove(index);
466 return (jalview.schemabinding.version2.MapListTo) obj;
470 * Sets the value of field 'mapFromUnit'. The field 'mapFromUnit' has the
471 * following description: number of dictionary symbol widths involved in each
472 * mapped position on this sequence (for example, 3 for a dna sequence exon
473 * region that is being mapped to a protein sequence). This is optional, since
474 * the unit can be usually be inferred from the dictionary type of each
475 * sequence involved in the mapping.
478 * the value of field 'mapFromUnit'.
480 public void setMapFromUnit(final long mapFromUnit)
482 this._mapFromUnit = mapFromUnit;
483 this._has_mapFromUnit = true;
490 * @param vMapListFrom
491 * @throws java.lang.IndexOutOfBoundsException
492 * if the index given is outside the bounds of the collection
494 public void setMapListFrom(final int index,
495 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
496 throws java.lang.IndexOutOfBoundsException
498 // check bounds for index
499 if (index < 0 || index >= this._mapListFromList.size())
501 throw new IndexOutOfBoundsException("setMapListFrom: Index value '"
502 + index + "' not in range [0.."
503 + (this._mapListFromList.size() - 1) + "]");
506 this._mapListFromList.set(index, vMapListFrom);
512 * @param vMapListFromArray
514 public void setMapListFrom(
515 final jalview.schemabinding.version2.MapListFrom[] vMapListFromArray)
518 _mapListFromList.clear();
520 for (int i = 0; i < vMapListFromArray.length; i++)
522 this._mapListFromList.add(vMapListFromArray[i]);
531 * @throws java.lang.IndexOutOfBoundsException
532 * if the index given is outside the bounds of the collection
534 public void setMapListTo(final int index,
535 final jalview.schemabinding.version2.MapListTo vMapListTo)
536 throws java.lang.IndexOutOfBoundsException
538 // check bounds for index
539 if (index < 0 || index >= this._mapListToList.size())
541 throw new IndexOutOfBoundsException("setMapListTo: Index value '"
542 + index + "' not in range [0.."
543 + (this._mapListToList.size() - 1) + "]");
546 this._mapListToList.set(index, vMapListTo);
552 * @param vMapListToArray
554 public void setMapListTo(
555 final jalview.schemabinding.version2.MapListTo[] vMapListToArray)
558 _mapListToList.clear();
560 for (int i = 0; i < vMapListToArray.length; i++)
562 this._mapListToList.add(vMapListToArray[i]);
567 * Sets the value of field 'mapToUnit'. The field 'mapToUnit' has the
568 * following description: number of dictionary symbol widths involved in each
569 * mapped position on this sequence (for example, 3 for a dna sequence exon
570 * region that is being mapped to a protein sequence). This is optional, since
571 * the unit can be usually be inferred from the dictionary type of each
572 * sequence involved in the mapping.
575 * the value of field 'mapToUnit'.
577 public void setMapToUnit(final long mapToUnit)
579 this._mapToUnit = mapToUnit;
580 this._has_mapToUnit = true;
587 * @throws org.exolab.castor.xml.MarshalException
588 * if object is null or if any SAXException is thrown during
590 * @throws org.exolab.castor.xml.ValidationException
591 * if this object is an invalid instance according to the schema
592 * @return the unmarshaled jalview.schemabinding.version2.MapListType
594 public static jalview.schemabinding.version2.MapListType unmarshal(
595 final java.io.Reader reader)
596 throws org.exolab.castor.xml.MarshalException,
597 org.exolab.castor.xml.ValidationException
599 return (jalview.schemabinding.version2.MapListType) Unmarshaller
600 .unmarshal(jalview.schemabinding.version2.MapListType.class,
607 * @throws org.exolab.castor.xml.ValidationException
608 * if this object is an invalid instance according to the schema
610 public void validate() throws org.exolab.castor.xml.ValidationException
612 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
613 validator.validate(this);