2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
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.
21 package jalview.schemabinding.version2;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import org.exolab.castor.xml.Marshaller;
28 import org.exolab.castor.xml.Unmarshaller;
33 * @version $Revision$ $Date$
35 public class AlcodonFrame implements java.io.Serializable
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
45 private java.util.Vector _alcodonList;
48 * Field _alcodMapList.
50 private java.util.Vector _alcodMapList;
59 this._alcodonList = new java.util.Vector();
60 this._alcodMapList = new java.util.Vector();
71 * @throws java.lang.IndexOutOfBoundsException
72 * if the index given is outside the bounds of the collection
74 public void addAlcodMap(
75 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
76 throws java.lang.IndexOutOfBoundsException
78 this._alcodMapList.addElement(vAlcodMap);
86 * @throws java.lang.IndexOutOfBoundsException
87 * if the index given is outside the bounds of the collection
89 public void addAlcodMap(final int index,
90 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
91 throws java.lang.IndexOutOfBoundsException
93 this._alcodMapList.add(index, vAlcodMap);
100 * @throws java.lang.IndexOutOfBoundsException
101 * if the index given is outside the bounds of the collection
103 public void addAlcodon(
104 final jalview.schemabinding.version2.Alcodon vAlcodon)
105 throws java.lang.IndexOutOfBoundsException
107 this._alcodonList.addElement(vAlcodon);
115 * @throws java.lang.IndexOutOfBoundsException
116 * if the index given is outside the bounds of the collection
118 public void addAlcodon(final int index,
119 final jalview.schemabinding.version2.Alcodon vAlcodon)
120 throws java.lang.IndexOutOfBoundsException
122 this._alcodonList.add(index, vAlcodon);
126 * Method enumerateAlcodMap.
128 * @return an Enumeration over all jalview.schemabinding.version2.AlcodMap
131 public java.util.Enumeration enumerateAlcodMap()
133 return this._alcodMapList.elements();
137 * Method enumerateAlcodon.
139 * @return an Enumeration over all jalview.schemabinding.version2.Alcodon
142 public java.util.Enumeration enumerateAlcodon()
144 return this._alcodonList.elements();
148 * Method getAlcodMap.
151 * @throws java.lang.IndexOutOfBoundsException
152 * if the index given is outside the bounds of the collection
153 * @return the value of the jalview.schemabinding.version2.AlcodMap at the
156 public jalview.schemabinding.version2.AlcodMap getAlcodMap(final int index)
157 throws java.lang.IndexOutOfBoundsException
159 // check bounds for index
160 if (index < 0 || index >= this._alcodMapList.size())
162 throw new IndexOutOfBoundsException("getAlcodMap: Index value '"
163 + index + "' not in range [0.."
164 + (this._alcodMapList.size() - 1) + "]");
167 return (jalview.schemabinding.version2.AlcodMap) _alcodMapList
172 * Method getAlcodMap.Returns the contents of the collection in an Array.
174 * Note: Just in case the collection contents are changing in another thread,
175 * we pass a 0-length Array of the correct type into the API call. This way we
176 * <i>know</i> that the Array returned is of exactly the correct length.
178 * @return this collection as an Array
180 public jalview.schemabinding.version2.AlcodMap[] getAlcodMap()
182 jalview.schemabinding.version2.AlcodMap[] array = new jalview.schemabinding.version2.AlcodMap[0];
183 return (jalview.schemabinding.version2.AlcodMap[]) this._alcodMapList
188 * Method getAlcodMapCount.
190 * @return the size of this collection
192 public int getAlcodMapCount()
194 return this._alcodMapList.size();
201 * @throws java.lang.IndexOutOfBoundsException
202 * if the index given is outside the bounds of the collection
203 * @return the value of the jalview.schemabinding.version2.Alcodon at the
206 public jalview.schemabinding.version2.Alcodon getAlcodon(final int index)
207 throws java.lang.IndexOutOfBoundsException
209 // check bounds for index
210 if (index < 0 || index >= this._alcodonList.size())
212 throw new IndexOutOfBoundsException("getAlcodon: Index value '"
213 + index + "' not in range [0.."
214 + (this._alcodonList.size() - 1) + "]");
217 return (jalview.schemabinding.version2.Alcodon) _alcodonList.get(index);
221 * Method getAlcodon.Returns the contents of the collection in an Array.
223 * Note: Just in case the collection contents are changing in another thread,
224 * we pass a 0-length Array of the correct type into the API call. This way we
225 * <i>know</i> that the Array returned is of exactly the correct length.
227 * @return this collection as an Array
229 public jalview.schemabinding.version2.Alcodon[] getAlcodon()
231 jalview.schemabinding.version2.Alcodon[] array = new jalview.schemabinding.version2.Alcodon[0];
232 return (jalview.schemabinding.version2.Alcodon[]) this._alcodonList
237 * Method getAlcodonCount.
239 * @return the size of this collection
241 public int getAlcodonCount()
243 return this._alcodonList.size();
249 * @return true if this object is valid according to the schema
251 public boolean isValid()
256 } catch (org.exolab.castor.xml.ValidationException vex)
267 * @throws org.exolab.castor.xml.MarshalException
268 * if object is null or if any SAXException is thrown during
270 * @throws org.exolab.castor.xml.ValidationException
271 * if this object is an invalid instance according to the schema
273 public void marshal(final java.io.Writer out)
274 throws org.exolab.castor.xml.MarshalException,
275 org.exolab.castor.xml.ValidationException
277 Marshaller.marshal(this, out);
284 * @throws java.io.IOException
285 * if an IOException occurs during marshaling
286 * @throws org.exolab.castor.xml.ValidationException
287 * if this object is an invalid instance according to the schema
288 * @throws org.exolab.castor.xml.MarshalException
289 * if object is null or if any SAXException is thrown during
292 public void marshal(final org.xml.sax.ContentHandler handler)
293 throws java.io.IOException,
294 org.exolab.castor.xml.MarshalException,
295 org.exolab.castor.xml.ValidationException
297 Marshaller.marshal(this, handler);
301 * Method removeAlcodMap.
304 * @return true if the object was removed from the collection.
306 public boolean removeAlcodMap(
307 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
309 boolean removed = _alcodMapList.remove(vAlcodMap);
314 * Method removeAlcodMapAt.
317 * @return the element removed from the collection
319 public jalview.schemabinding.version2.AlcodMap removeAlcodMapAt(
322 java.lang.Object obj = this._alcodMapList.remove(index);
323 return (jalview.schemabinding.version2.AlcodMap) obj;
327 * Method removeAlcodon.
330 * @return true if the object was removed from the collection.
332 public boolean removeAlcodon(
333 final jalview.schemabinding.version2.Alcodon vAlcodon)
335 boolean removed = _alcodonList.remove(vAlcodon);
340 * Method removeAlcodonAt.
343 * @return the element removed from the collection
345 public jalview.schemabinding.version2.Alcodon removeAlcodonAt(
348 java.lang.Object obj = this._alcodonList.remove(index);
349 return (jalview.schemabinding.version2.Alcodon) obj;
354 public void removeAllAlcodMap()
356 this._alcodMapList.clear();
361 public void removeAllAlcodon()
363 this._alcodonList.clear();
371 * @throws java.lang.IndexOutOfBoundsException
372 * if the index given is outside the bounds of the collection
374 public void setAlcodMap(final int index,
375 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
376 throws java.lang.IndexOutOfBoundsException
378 // check bounds for index
379 if (index < 0 || index >= this._alcodMapList.size())
381 throw new IndexOutOfBoundsException("setAlcodMap: Index value '"
382 + index + "' not in range [0.."
383 + (this._alcodMapList.size() - 1) + "]");
386 this._alcodMapList.set(index, vAlcodMap);
392 * @param vAlcodMapArray
394 public void setAlcodMap(
395 final jalview.schemabinding.version2.AlcodMap[] vAlcodMapArray)
398 _alcodMapList.clear();
400 for (int i = 0; i < vAlcodMapArray.length; i++)
402 this._alcodMapList.add(vAlcodMapArray[i]);
411 * @throws java.lang.IndexOutOfBoundsException
412 * if the index given is outside the bounds of the collection
414 public void setAlcodon(final int index,
415 final jalview.schemabinding.version2.Alcodon vAlcodon)
416 throws java.lang.IndexOutOfBoundsException
418 // check bounds for index
419 if (index < 0 || index >= this._alcodonList.size())
421 throw new IndexOutOfBoundsException("setAlcodon: Index value '"
422 + index + "' not in range [0.."
423 + (this._alcodonList.size() - 1) + "]");
426 this._alcodonList.set(index, vAlcodon);
432 * @param vAlcodonArray
434 public void setAlcodon(
435 final jalview.schemabinding.version2.Alcodon[] vAlcodonArray)
438 _alcodonList.clear();
440 for (int i = 0; i < vAlcodonArray.length; i++)
442 this._alcodonList.add(vAlcodonArray[i]);
450 * @throws org.exolab.castor.xml.MarshalException
451 * if object is null or if any SAXException is thrown during
453 * @throws org.exolab.castor.xml.ValidationException
454 * if this object is an invalid instance according to the schema
455 * @return the unmarshaled jalview.schemabinding.version2.AlcodonFrame
457 public static jalview.schemabinding.version2.AlcodonFrame unmarshal(
458 final java.io.Reader reader)
459 throws org.exolab.castor.xml.MarshalException,
460 org.exolab.castor.xml.ValidationException
462 return (jalview.schemabinding.version2.AlcodonFrame) Unmarshaller
463 .unmarshal(jalview.schemabinding.version2.AlcodonFrame.class,
470 * @throws org.exolab.castor.xml.ValidationException
471 * if this object is an invalid instance according to the schema
473 public void validate() throws org.exolab.castor.xml.ValidationException
475 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
476 validator.validate(this);