2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
\r
3 * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.schemabinding.version2;
\r
21 // ---------------------------------/
\r
22 // - Imported classes and packages -/
\r
23 // ---------------------------------/
\r
25 import org.exolab.castor.xml.Marshaller;
\r
26 import org.exolab.castor.xml.Unmarshaller;
\r
29 * Class AlcodonFrame.
\r
31 * @version $Revision$ $Date$
\r
33 public class AlcodonFrame implements java.io.Serializable
\r
36 // --------------------------/
\r
37 // - Class/Member Variables -/
\r
38 // --------------------------/
\r
41 * Field _alcodonList.
\r
43 private java.util.Vector _alcodonList;
\r
46 * Field _alcodMapList.
\r
48 private java.util.Vector _alcodMapList;
\r
50 // ----------------/
\r
51 // - Constructors -/
\r
52 // ----------------/
\r
54 public AlcodonFrame()
\r
57 this._alcodonList = new java.util.Vector();
\r
58 this._alcodMapList = new java.util.Vector();
\r
69 * @throws java.lang.IndexOutOfBoundsException
\r
70 * if the index given is outside the bounds of the collection
\r
72 public void addAlcodMap(
\r
73 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
\r
74 throws java.lang.IndexOutOfBoundsException
\r
76 this._alcodMapList.addElement(vAlcodMap);
\r
84 * @throws java.lang.IndexOutOfBoundsException
\r
85 * if the index given is outside the bounds of the collection
\r
87 public void addAlcodMap(final int index,
\r
88 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
\r
89 throws java.lang.IndexOutOfBoundsException
\r
91 this._alcodMapList.add(index, vAlcodMap);
\r
98 * @throws java.lang.IndexOutOfBoundsException
\r
99 * if the index given is outside the bounds of the collection
\r
101 public void addAlcodon(
\r
102 final jalview.schemabinding.version2.Alcodon vAlcodon)
\r
103 throws java.lang.IndexOutOfBoundsException
\r
105 this._alcodonList.addElement(vAlcodon);
\r
113 * @throws java.lang.IndexOutOfBoundsException
\r
114 * if the index given is outside the bounds of the collection
\r
116 public void addAlcodon(final int index,
\r
117 final jalview.schemabinding.version2.Alcodon vAlcodon)
\r
118 throws java.lang.IndexOutOfBoundsException
\r
120 this._alcodonList.add(index, vAlcodon);
\r
124 * Method enumerateAlcodMap.
\r
126 * @return an Enumeration over all jalview.schemabinding.version2.AlcodMap
\r
129 public java.util.Enumeration enumerateAlcodMap()
\r
131 return this._alcodMapList.elements();
\r
135 * Method enumerateAlcodon.
\r
137 * @return an Enumeration over all jalview.schemabinding.version2.Alcodon
\r
140 public java.util.Enumeration enumerateAlcodon()
\r
142 return this._alcodonList.elements();
\r
146 * Method getAlcodMap.
\r
149 * @throws java.lang.IndexOutOfBoundsException
\r
150 * if the index given is outside the bounds of the collection
\r
151 * @return the value of the jalview.schemabinding.version2.AlcodMap at the
\r
154 public jalview.schemabinding.version2.AlcodMap getAlcodMap(final int index)
\r
155 throws java.lang.IndexOutOfBoundsException
\r
157 // check bounds for index
\r
158 if (index < 0 || index >= this._alcodMapList.size())
\r
160 throw new IndexOutOfBoundsException("getAlcodMap: Index value '"
\r
161 + index + "' not in range [0.."
\r
162 + (this._alcodMapList.size() - 1) + "]");
\r
165 return (jalview.schemabinding.version2.AlcodMap) _alcodMapList
\r
170 * Method getAlcodMap.Returns the contents of the collection in an Array.
\r
172 * Note: Just in case the collection contents are changing in another thread,
\r
173 * we pass a 0-length Array of the correct type into the API call. This way we
\r
174 * <i>know</i> that the Array returned is of exactly the correct length.
\r
176 * @return this collection as an Array
\r
178 public jalview.schemabinding.version2.AlcodMap[] getAlcodMap()
\r
180 jalview.schemabinding.version2.AlcodMap[] array = new jalview.schemabinding.version2.AlcodMap[0];
\r
181 return (jalview.schemabinding.version2.AlcodMap[]) this._alcodMapList
\r
186 * Method getAlcodMapCount.
\r
188 * @return the size of this collection
\r
190 public int getAlcodMapCount()
\r
192 return this._alcodMapList.size();
\r
196 * Method getAlcodon.
\r
199 * @throws java.lang.IndexOutOfBoundsException
\r
200 * if the index given is outside the bounds of the collection
\r
201 * @return the value of the jalview.schemabinding.version2.Alcodon at the
\r
204 public jalview.schemabinding.version2.Alcodon getAlcodon(final int index)
\r
205 throws java.lang.IndexOutOfBoundsException
\r
207 // check bounds for index
\r
208 if (index < 0 || index >= this._alcodonList.size())
\r
210 throw new IndexOutOfBoundsException("getAlcodon: Index value '"
\r
211 + index + "' not in range [0.."
\r
212 + (this._alcodonList.size() - 1) + "]");
\r
215 return (jalview.schemabinding.version2.Alcodon) _alcodonList.get(index);
\r
219 * Method getAlcodon.Returns the contents of the collection in an Array.
\r
221 * Note: Just in case the collection contents are changing in another thread,
\r
222 * we pass a 0-length Array of the correct type into the API call. This way we
\r
223 * <i>know</i> that the Array returned is of exactly the correct length.
\r
225 * @return this collection as an Array
\r
227 public jalview.schemabinding.version2.Alcodon[] getAlcodon()
\r
229 jalview.schemabinding.version2.Alcodon[] array = new jalview.schemabinding.version2.Alcodon[0];
\r
230 return (jalview.schemabinding.version2.Alcodon[]) this._alcodonList
\r
235 * Method getAlcodonCount.
\r
237 * @return the size of this collection
\r
239 public int getAlcodonCount()
\r
241 return this._alcodonList.size();
\r
247 * @return true if this object is valid according to the schema
\r
249 public boolean isValid()
\r
254 } catch (org.exolab.castor.xml.ValidationException vex)
\r
265 * @throws org.exolab.castor.xml.MarshalException
\r
266 * if object is null or if any SAXException is thrown during
\r
268 * @throws org.exolab.castor.xml.ValidationException
\r
269 * if this object is an invalid instance according to the
\r
272 public void marshal(final java.io.Writer out)
\r
273 throws org.exolab.castor.xml.MarshalException,
\r
274 org.exolab.castor.xml.ValidationException
\r
276 Marshaller.marshal(this, out);
\r
283 * @throws java.io.IOException
\r
284 * if an IOException occurs during marshaling
\r
285 * @throws org.exolab.castor.xml.ValidationException
\r
286 * if this object is an invalid instance according to the
\r
288 * @throws org.exolab.castor.xml.MarshalException
\r
289 * if object is null or if any SAXException is thrown during
\r
292 public void marshal(final org.xml.sax.ContentHandler handler)
\r
293 throws java.io.IOException,
\r
294 org.exolab.castor.xml.MarshalException,
\r
295 org.exolab.castor.xml.ValidationException
\r
297 Marshaller.marshal(this, handler);
\r
301 * Method removeAlcodMap.
\r
304 * @return true if the object was removed from the collection.
\r
306 public boolean removeAlcodMap(
\r
307 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
\r
309 boolean removed = _alcodMapList.remove(vAlcodMap);
\r
314 * Method removeAlcodMapAt.
\r
317 * @return the element removed from the collection
\r
319 public jalview.schemabinding.version2.AlcodMap removeAlcodMapAt(
\r
322 java.lang.Object obj = this._alcodMapList.remove(index);
\r
323 return (jalview.schemabinding.version2.AlcodMap) obj;
\r
327 * Method removeAlcodon.
\r
330 * @return true if the object was removed from the collection.
\r
332 public boolean removeAlcodon(
\r
333 final jalview.schemabinding.version2.Alcodon vAlcodon)
\r
335 boolean removed = _alcodonList.remove(vAlcodon);
\r
340 * Method removeAlcodonAt.
\r
343 * @return the element removed from the collection
\r
345 public jalview.schemabinding.version2.Alcodon removeAlcodonAt(
\r
348 java.lang.Object obj = this._alcodonList.remove(index);
\r
349 return (jalview.schemabinding.version2.Alcodon) obj;
\r
354 public void removeAllAlcodMap()
\r
356 this._alcodMapList.clear();
\r
361 public void removeAllAlcodon()
\r
363 this._alcodonList.clear();
\r
371 * @throws java.lang.IndexOutOfBoundsException
\r
372 * if the index given is outside the bounds of the collection
\r
374 public void setAlcodMap(final int index,
\r
375 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
\r
376 throws java.lang.IndexOutOfBoundsException
\r
378 // check bounds for index
\r
379 if (index < 0 || index >= this._alcodMapList.size())
\r
381 throw new IndexOutOfBoundsException("setAlcodMap: Index value '"
\r
382 + index + "' not in range [0.."
\r
383 + (this._alcodMapList.size() - 1) + "]");
\r
386 this._alcodMapList.set(index, vAlcodMap);
\r
392 * @param vAlcodMapArray
\r
394 public void setAlcodMap(
\r
395 final jalview.schemabinding.version2.AlcodMap[] vAlcodMapArray)
\r
398 _alcodMapList.clear();
\r
400 for (int i = 0; i < vAlcodMapArray.length; i++)
\r
402 this._alcodMapList.add(vAlcodMapArray[i]);
\r
411 * @throws java.lang.IndexOutOfBoundsException
\r
412 * if the index given is outside the bounds of the collection
\r
414 public void setAlcodon(final int index,
\r
415 final jalview.schemabinding.version2.Alcodon vAlcodon)
\r
416 throws java.lang.IndexOutOfBoundsException
\r
418 // check bounds for index
\r
419 if (index < 0 || index >= this._alcodonList.size())
\r
421 throw new IndexOutOfBoundsException("setAlcodon: Index value '"
\r
422 + index + "' not in range [0.."
\r
423 + (this._alcodonList.size() - 1) + "]");
\r
426 this._alcodonList.set(index, vAlcodon);
\r
432 * @param vAlcodonArray
\r
434 public void setAlcodon(
\r
435 final jalview.schemabinding.version2.Alcodon[] vAlcodonArray)
\r
438 _alcodonList.clear();
\r
440 for (int i = 0; i < vAlcodonArray.length; i++)
\r
442 this._alcodonList.add(vAlcodonArray[i]);
\r
447 * Method unmarshal.
\r
450 * @throws org.exolab.castor.xml.MarshalException
\r
451 * if object is null or if any SAXException is thrown during
\r
453 * @throws org.exolab.castor.xml.ValidationException
\r
454 * if this object is an invalid instance according to the
\r
456 * @return the unmarshaled jalview.schemabinding.version2.AlcodonFrame
\r
458 public static jalview.schemabinding.version2.AlcodonFrame unmarshal(
\r
459 final java.io.Reader reader)
\r
460 throws org.exolab.castor.xml.MarshalException,
\r
461 org.exolab.castor.xml.ValidationException
\r
463 return (jalview.schemabinding.version2.AlcodonFrame) Unmarshaller
\r
464 .unmarshal(jalview.schemabinding.version2.AlcodonFrame.class,
\r
471 * @throws org.exolab.castor.xml.ValidationException
\r
472 * if this object is an invalid instance according to the
\r
475 public void validate() throws org.exolab.castor.xml.ValidationException
\r
477 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
478 validator.validate(this);
\r