1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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. If not, see <http://www.gnu.org/licenses/>.
17 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import org.exolab.castor.xml.Marshaller;
32 import org.exolab.castor.xml.Unmarshaller;
35 * developed after mapRangeType from
36 * http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes
38 * This effectively represents a java.util.MapList object
41 * @version $Revision$ $Date$
43 public class MapListType implements java.io.Serializable {
46 //--------------------------/
47 //- Class/Member Variables -/
48 //--------------------------/
51 * number of dictionary symbol widths involved in each
52 * mapped position on this sequence (for example, 3 for a dna
54 * region that is being mapped to a protein sequence). This is
56 * since the unit can be usually be inferred from the
58 * each sequence involved in the mapping.
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
69 * mapped position on this sequence (for example, 3 for a dna
71 * region that is being mapped to a protein sequence). This is
73 * since the unit can be usually be inferred from the
75 * each sequence involved in the mapping.
77 private long _mapToUnit;
80 * keeps track of state for field: _mapToUnit
82 private boolean _has_mapToUnit;
85 * a region from start to end inclusive
87 private java.util.Vector _mapListFromList;
90 * a region from start to end inclusive
92 private java.util.Vector _mapListToList;
99 public MapListType() {
101 this._mapListFromList = new java.util.Vector();
102 this._mapListToList = new java.util.Vector();
113 * @param vMapListFrom
114 * @throws java.lang.IndexOutOfBoundsException if the index
115 * given is outside the bounds of the collection
117 public void addMapListFrom(
118 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
119 throws java.lang.IndexOutOfBoundsException {
120 this._mapListFromList.addElement(vMapListFrom);
127 * @param vMapListFrom
128 * @throws java.lang.IndexOutOfBoundsException if the index
129 * given is outside the bounds of the collection
131 public void addMapListFrom(
133 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
134 throws java.lang.IndexOutOfBoundsException {
135 this._mapListFromList.add(index, vMapListFrom);
142 * @throws java.lang.IndexOutOfBoundsException if the index
143 * given is outside the bounds of the collection
145 public void addMapListTo(
146 final jalview.schemabinding.version2.MapListTo vMapListTo)
147 throws java.lang.IndexOutOfBoundsException {
148 this._mapListToList.addElement(vMapListTo);
156 * @throws java.lang.IndexOutOfBoundsException if the index
157 * given is outside the bounds of the collection
159 public void addMapListTo(
161 final jalview.schemabinding.version2.MapListTo vMapListTo)
162 throws java.lang.IndexOutOfBoundsException {
163 this._mapListToList.add(index, vMapListTo);
168 public void deleteMapFromUnit(
170 this._has_mapFromUnit= false;
175 public void deleteMapToUnit(
177 this._has_mapToUnit= false;
181 * Method enumerateMapListFrom.
183 * @return an Enumeration over all
184 * jalview.schemabinding.version2.MapListFrom elements
186 public java.util.Enumeration enumerateMapListFrom(
188 return this._mapListFromList.elements();
192 * Method enumerateMapListTo.
194 * @return an Enumeration over all
195 * jalview.schemabinding.version2.MapListTo elements
197 public java.util.Enumeration enumerateMapListTo(
199 return this._mapListToList.elements();
203 * Returns the value of field 'mapFromUnit'. The field
204 * 'mapFromUnit' has the following description: number of
205 * dictionary symbol widths involved in each
206 * mapped position on this sequence (for example, 3 for a dna
208 * region that is being mapped to a protein sequence). This is
210 * since the unit can be usually be inferred from the
212 * each sequence involved in the mapping.
214 * @return the value of field 'MapFromUnit'.
216 public long getMapFromUnit(
218 return this._mapFromUnit;
222 * Method getMapListFrom.
225 * @throws java.lang.IndexOutOfBoundsException if the index
226 * given is outside the bounds of the collection
227 * @return the value of the
228 * jalview.schemabinding.version2.MapListFrom at the given index
230 public jalview.schemabinding.version2.MapListFrom getMapListFrom(
232 throws java.lang.IndexOutOfBoundsException {
233 // check bounds for index
234 if (index < 0 || index >= this._mapListFromList.size()) {
235 throw new IndexOutOfBoundsException("getMapListFrom: Index value '" + index + "' not in range [0.." + (this._mapListFromList.size() - 1) + "]");
238 return (jalview.schemabinding.version2.MapListFrom) _mapListFromList.get(index);
242 * Method getMapListFrom.Returns the contents of the collection
243 * in an Array. <p>Note: Just in case the collection contents
244 * are changing in another thread, we pass a 0-length Array of
245 * the correct type into the API call. This way we <i>know</i>
246 * that the Array returned is of exactly the correct length.
248 * @return this collection as an Array
250 public jalview.schemabinding.version2.MapListFrom[] getMapListFrom(
252 jalview.schemabinding.version2.MapListFrom[] array = new jalview.schemabinding.version2.MapListFrom[0];
253 return (jalview.schemabinding.version2.MapListFrom[]) this._mapListFromList.toArray(array);
257 * Method getMapListFromCount.
259 * @return the size of this collection
261 public int getMapListFromCount(
263 return this._mapListFromList.size();
267 * Method getMapListTo.
270 * @throws java.lang.IndexOutOfBoundsException if the index
271 * given is outside the bounds of the collection
272 * @return the value of the
273 * jalview.schemabinding.version2.MapListTo at the given index
275 public jalview.schemabinding.version2.MapListTo getMapListTo(
277 throws java.lang.IndexOutOfBoundsException {
278 // check bounds for index
279 if (index < 0 || index >= this._mapListToList.size()) {
280 throw new IndexOutOfBoundsException("getMapListTo: Index value '" + index + "' not in range [0.." + (this._mapListToList.size() - 1) + "]");
283 return (jalview.schemabinding.version2.MapListTo) _mapListToList.get(index);
287 * Method getMapListTo.Returns the contents of the collection
288 * in an Array. <p>Note: Just in case the collection contents
289 * are changing in another thread, we pass a 0-length Array of
290 * the correct type into the API call. This way we <i>know</i>
291 * that the Array returned is of exactly the correct length.
293 * @return this collection as an Array
295 public jalview.schemabinding.version2.MapListTo[] getMapListTo(
297 jalview.schemabinding.version2.MapListTo[] array = new jalview.schemabinding.version2.MapListTo[0];
298 return (jalview.schemabinding.version2.MapListTo[]) this._mapListToList.toArray(array);
302 * Method getMapListToCount.
304 * @return the size of this collection
306 public int getMapListToCount(
308 return this._mapListToList.size();
312 * Returns the value of field 'mapToUnit'. The field
313 * 'mapToUnit' has the following description: number of
314 * dictionary symbol widths involved in each
315 * mapped position on this sequence (for example, 3 for a dna
317 * region that is being mapped to a protein sequence). This is
319 * since the unit can be usually be inferred from the
321 * each 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(
359 } catch (org.exolab.castor.xml.ValidationException vex) {
369 * @throws org.exolab.castor.xml.MarshalException if object is
370 * null or if any SAXException is thrown during marshaling
371 * @throws org.exolab.castor.xml.ValidationException if this
372 * object is an invalid instance according to the schema
375 final java.io.Writer out)
376 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
377 Marshaller.marshal(this, out);
384 * @throws java.io.IOException if an IOException occurs during
386 * @throws org.exolab.castor.xml.ValidationException if this
387 * object is an invalid instance according to the schema
388 * @throws org.exolab.castor.xml.MarshalException if object is
389 * null or if any SAXException is thrown during marshaling
392 final org.xml.sax.ContentHandler handler)
393 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
394 Marshaller.marshal(this, handler);
399 public void removeAllMapListFrom(
401 this._mapListFromList.clear();
406 public void removeAllMapListTo(
408 this._mapListToList.clear();
412 * Method removeMapListFrom.
414 * @param vMapListFrom
415 * @return true if the object was removed from the collection.
417 public boolean removeMapListFrom(
418 final jalview.schemabinding.version2.MapListFrom vMapListFrom) {
419 boolean removed = _mapListFromList.remove(vMapListFrom);
424 * Method removeMapListFromAt.
427 * @return the element removed from the collection
429 public jalview.schemabinding.version2.MapListFrom removeMapListFromAt(
431 java.lang.Object obj = this._mapListFromList.remove(index);
432 return (jalview.schemabinding.version2.MapListFrom) obj;
436 * Method removeMapListTo.
439 * @return true if the object was removed from the collection.
441 public boolean removeMapListTo(
442 final jalview.schemabinding.version2.MapListTo vMapListTo) {
443 boolean removed = _mapListToList.remove(vMapListTo);
448 * Method removeMapListToAt.
451 * @return the element removed from the collection
453 public jalview.schemabinding.version2.MapListTo removeMapListToAt(
455 java.lang.Object obj = this._mapListToList.remove(index);
456 return (jalview.schemabinding.version2.MapListTo) obj;
460 * Sets the value of field 'mapFromUnit'. The field
461 * 'mapFromUnit' has the following description: number of
462 * dictionary symbol widths involved in each
463 * mapped position on this sequence (for example, 3 for a dna
465 * region that is being mapped to a protein sequence). This is
467 * since the unit can be usually be inferred from the
469 * each sequence involved in the mapping.
471 * @param mapFromUnit the value of field 'mapFromUnit'.
473 public void setMapFromUnit(
474 final long mapFromUnit) {
475 this._mapFromUnit = mapFromUnit;
476 this._has_mapFromUnit = true;
483 * @param vMapListFrom
484 * @throws java.lang.IndexOutOfBoundsException if the index
485 * given is outside the bounds of the collection
487 public void setMapListFrom(
489 final jalview.schemabinding.version2.MapListFrom vMapListFrom)
490 throws java.lang.IndexOutOfBoundsException {
491 // check bounds for index
492 if (index < 0 || index >= this._mapListFromList.size()) {
493 throw new IndexOutOfBoundsException("setMapListFrom: Index value '" + index + "' not in range [0.." + (this._mapListFromList.size() - 1) + "]");
496 this._mapListFromList.set(index, vMapListFrom);
502 * @param vMapListFromArray
504 public void setMapListFrom(
505 final jalview.schemabinding.version2.MapListFrom[] vMapListFromArray) {
507 _mapListFromList.clear();
509 for (int i = 0; i < vMapListFromArray.length; i++) {
510 this._mapListFromList.add(vMapListFromArray[i]);
519 * @throws java.lang.IndexOutOfBoundsException if the index
520 * given is outside the bounds of the collection
522 public void setMapListTo(
524 final jalview.schemabinding.version2.MapListTo vMapListTo)
525 throws java.lang.IndexOutOfBoundsException {
526 // check bounds for index
527 if (index < 0 || index >= this._mapListToList.size()) {
528 throw new IndexOutOfBoundsException("setMapListTo: Index value '" + index + "' not in range [0.." + (this._mapListToList.size() - 1) + "]");
531 this._mapListToList.set(index, vMapListTo);
537 * @param vMapListToArray
539 public void setMapListTo(
540 final jalview.schemabinding.version2.MapListTo[] vMapListToArray) {
542 _mapListToList.clear();
544 for (int i = 0; i < vMapListToArray.length; i++) {
545 this._mapListToList.add(vMapListToArray[i]);
550 * Sets the value of field 'mapToUnit'. The field 'mapToUnit'
551 * has the following description: number of dictionary symbol
552 * widths involved in each
553 * mapped position on this sequence (for example, 3 for a dna
555 * region that is being mapped to a protein sequence). This is
557 * since the unit can be usually be inferred from the
559 * each sequence involved in the mapping.
561 * @param mapToUnit the value of field 'mapToUnit'.
563 public void setMapToUnit(
564 final long mapToUnit) {
565 this._mapToUnit = mapToUnit;
566 this._has_mapToUnit = true;
573 * @throws org.exolab.castor.xml.MarshalException if object is
574 * null or if any SAXException is thrown during marshaling
575 * @throws org.exolab.castor.xml.ValidationException if this
576 * object is an invalid instance according to the schema
577 * @return the unmarshaled
578 * jalview.schemabinding.version2.MapListType
580 public static jalview.schemabinding.version2.MapListType unmarshal(
581 final java.io.Reader reader)
582 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
583 return (jalview.schemabinding.version2.MapListType) Unmarshaller.unmarshal(jalview.schemabinding.version2.MapListType.class, reader);
589 * @throws org.exolab.castor.xml.ValidationException if this
590 * object is an invalid instance according to the schema
592 public void validate(
594 throws org.exolab.castor.xml.ValidationException {
595 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
596 validator.validate(this);