2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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/>.
18 package jalview.schemabinding.version2;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
30 * @version $Revision$ $Date$
32 public class AlcodonFrame implements java.io.Serializable
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
42 private java.util.Vector _alcodonList;
45 * Field _alcodMapList.
47 private java.util.Vector _alcodMapList;
56 this._alcodonList = new java.util.Vector();
57 this._alcodMapList = new java.util.Vector();
68 * @throws java.lang.IndexOutOfBoundsException
69 * if the index given is outside the bounds of the collection
71 public void addAlcodMap(
72 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
73 throws java.lang.IndexOutOfBoundsException
75 this._alcodMapList.addElement(vAlcodMap);
83 * @throws java.lang.IndexOutOfBoundsException
84 * if the index given is outside the bounds of the collection
86 public void addAlcodMap(final int index,
87 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
88 throws java.lang.IndexOutOfBoundsException
90 this._alcodMapList.add(index, vAlcodMap);
97 * @throws java.lang.IndexOutOfBoundsException
98 * if the index given is outside the bounds of the collection
100 public void addAlcodon(
101 final jalview.schemabinding.version2.Alcodon vAlcodon)
102 throws java.lang.IndexOutOfBoundsException
104 this._alcodonList.addElement(vAlcodon);
112 * @throws java.lang.IndexOutOfBoundsException
113 * if the index given is outside the bounds of the collection
115 public void addAlcodon(final int index,
116 final jalview.schemabinding.version2.Alcodon vAlcodon)
117 throws java.lang.IndexOutOfBoundsException
119 this._alcodonList.add(index, vAlcodon);
123 * Method enumerateAlcodMap.
125 * @return an Enumeration over all jalview.schemabinding.version2.AlcodMap
128 public java.util.Enumeration enumerateAlcodMap()
130 return this._alcodMapList.elements();
134 * Method enumerateAlcodon.
136 * @return an Enumeration over all jalview.schemabinding.version2.Alcodon
139 public java.util.Enumeration enumerateAlcodon()
141 return this._alcodonList.elements();
145 * Method getAlcodMap.
148 * @throws java.lang.IndexOutOfBoundsException
149 * if the index given is outside the bounds of the collection
150 * @return the value of the jalview.schemabinding.version2.AlcodMap at the
153 public jalview.schemabinding.version2.AlcodMap getAlcodMap(final int index)
154 throws java.lang.IndexOutOfBoundsException
156 // check bounds for index
157 if (index < 0 || index >= this._alcodMapList.size())
159 throw new IndexOutOfBoundsException("getAlcodMap: Index value '"
160 + index + "' not in range [0.."
161 + (this._alcodMapList.size() - 1) + "]");
164 return (jalview.schemabinding.version2.AlcodMap) _alcodMapList
169 * Method getAlcodMap.Returns the contents of the collection in an Array.
171 * Note: Just in case the collection contents are changing in another thread,
172 * we pass a 0-length Array of the correct type into the API call. This way we
173 * <i>know</i> that the Array returned is of exactly the correct length.
175 * @return this collection as an Array
177 public jalview.schemabinding.version2.AlcodMap[] getAlcodMap()
179 jalview.schemabinding.version2.AlcodMap[] array = new jalview.schemabinding.version2.AlcodMap[0];
180 return (jalview.schemabinding.version2.AlcodMap[]) this._alcodMapList
185 * Method getAlcodMapCount.
187 * @return the size of this collection
189 public int getAlcodMapCount()
191 return this._alcodMapList.size();
198 * @throws java.lang.IndexOutOfBoundsException
199 * if the index given is outside the bounds of the collection
200 * @return the value of the jalview.schemabinding.version2.Alcodon at the
203 public jalview.schemabinding.version2.Alcodon getAlcodon(final int index)
204 throws java.lang.IndexOutOfBoundsException
206 // check bounds for index
207 if (index < 0 || index >= this._alcodonList.size())
209 throw new IndexOutOfBoundsException("getAlcodon: Index value '"
210 + index + "' not in range [0.."
211 + (this._alcodonList.size() - 1) + "]");
214 return (jalview.schemabinding.version2.Alcodon) _alcodonList.get(index);
218 * Method getAlcodon.Returns the contents of the collection in an Array.
220 * Note: Just in case the collection contents are changing in another thread,
221 * we pass a 0-length Array of the correct type into the API call. This way we
222 * <i>know</i> that the Array returned is of exactly the correct length.
224 * @return this collection as an Array
226 public jalview.schemabinding.version2.Alcodon[] getAlcodon()
228 jalview.schemabinding.version2.Alcodon[] array = new jalview.schemabinding.version2.Alcodon[0];
229 return (jalview.schemabinding.version2.Alcodon[]) this._alcodonList
234 * Method getAlcodonCount.
236 * @return the size of this collection
238 public int getAlcodonCount()
240 return this._alcodonList.size();
246 * @return true if this object is valid according to the schema
248 public boolean isValid()
253 } catch (org.exolab.castor.xml.ValidationException vex)
264 * @throws org.exolab.castor.xml.MarshalException
265 * if object is null or if any SAXException is thrown during
267 * @throws org.exolab.castor.xml.ValidationException
268 * if this object is an invalid instance according to the schema
270 public void marshal(final java.io.Writer out)
271 throws org.exolab.castor.xml.MarshalException,
272 org.exolab.castor.xml.ValidationException
274 Marshaller.marshal(this, out);
281 * @throws java.io.IOException
282 * if an IOException occurs during marshaling
283 * @throws org.exolab.castor.xml.ValidationException
284 * if this object is an invalid instance according to the schema
285 * @throws org.exolab.castor.xml.MarshalException
286 * if object is null or if any SAXException is thrown during
289 public void marshal(final org.xml.sax.ContentHandler handler)
290 throws java.io.IOException,
291 org.exolab.castor.xml.MarshalException,
292 org.exolab.castor.xml.ValidationException
294 Marshaller.marshal(this, handler);
298 * Method removeAlcodMap.
301 * @return true if the object was removed from the collection.
303 public boolean removeAlcodMap(
304 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
306 boolean removed = _alcodMapList.remove(vAlcodMap);
311 * Method removeAlcodMapAt.
314 * @return the element removed from the collection
316 public jalview.schemabinding.version2.AlcodMap removeAlcodMapAt(
319 java.lang.Object obj = this._alcodMapList.remove(index);
320 return (jalview.schemabinding.version2.AlcodMap) obj;
324 * Method removeAlcodon.
327 * @return true if the object was removed from the collection.
329 public boolean removeAlcodon(
330 final jalview.schemabinding.version2.Alcodon vAlcodon)
332 boolean removed = _alcodonList.remove(vAlcodon);
337 * Method removeAlcodonAt.
340 * @return the element removed from the collection
342 public jalview.schemabinding.version2.Alcodon removeAlcodonAt(
345 java.lang.Object obj = this._alcodonList.remove(index);
346 return (jalview.schemabinding.version2.Alcodon) obj;
351 public void removeAllAlcodMap()
353 this._alcodMapList.clear();
358 public void removeAllAlcodon()
360 this._alcodonList.clear();
368 * @throws java.lang.IndexOutOfBoundsException
369 * if the index given is outside the bounds of the collection
371 public void setAlcodMap(final int index,
372 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
373 throws java.lang.IndexOutOfBoundsException
375 // check bounds for index
376 if (index < 0 || index >= this._alcodMapList.size())
378 throw new IndexOutOfBoundsException("setAlcodMap: Index value '"
379 + index + "' not in range [0.."
380 + (this._alcodMapList.size() - 1) + "]");
383 this._alcodMapList.set(index, vAlcodMap);
389 * @param vAlcodMapArray
391 public void setAlcodMap(
392 final jalview.schemabinding.version2.AlcodMap[] vAlcodMapArray)
395 _alcodMapList.clear();
397 for (int i = 0; i < vAlcodMapArray.length; i++)
399 this._alcodMapList.add(vAlcodMapArray[i]);
408 * @throws java.lang.IndexOutOfBoundsException
409 * if the index given is outside the bounds of the collection
411 public void setAlcodon(final int index,
412 final jalview.schemabinding.version2.Alcodon vAlcodon)
413 throws java.lang.IndexOutOfBoundsException
415 // check bounds for index
416 if (index < 0 || index >= this._alcodonList.size())
418 throw new IndexOutOfBoundsException("setAlcodon: Index value '"
419 + index + "' not in range [0.."
420 + (this._alcodonList.size() - 1) + "]");
423 this._alcodonList.set(index, vAlcodon);
429 * @param vAlcodonArray
431 public void setAlcodon(
432 final jalview.schemabinding.version2.Alcodon[] vAlcodonArray)
435 _alcodonList.clear();
437 for (int i = 0; i < vAlcodonArray.length; i++)
439 this._alcodonList.add(vAlcodonArray[i]);
447 * @throws org.exolab.castor.xml.MarshalException
448 * if object is null or if any SAXException is thrown during
450 * @throws org.exolab.castor.xml.ValidationException
451 * if this object is an invalid instance according to the schema
452 * @return the unmarshaled jalview.schemabinding.version2.AlcodonFrame
454 public static jalview.schemabinding.version2.AlcodonFrame unmarshal(
455 final java.io.Reader reader)
456 throws org.exolab.castor.xml.MarshalException,
457 org.exolab.castor.xml.ValidationException
459 return (jalview.schemabinding.version2.AlcodonFrame) Unmarshaller
460 .unmarshal(jalview.schemabinding.version2.AlcodonFrame.class,
467 * @throws org.exolab.castor.xml.ValidationException
468 * if this object is an invalid instance according to the schema
470 public void validate() throws org.exolab.castor.xml.ValidationException
472 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
473 validator.validate(this);