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. If not, see <http://www.gnu.org/licenses/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.schemabinding.version2;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
31 * @version $Revision$ $Date$
33 public class AlcodonFrame implements java.io.Serializable
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
43 private java.util.Vector _alcodonList;
46 * Field _alcodMapList.
48 private java.util.Vector _alcodMapList;
57 this._alcodonList = new java.util.Vector();
58 this._alcodMapList = new java.util.Vector();
69 * @throws java.lang.IndexOutOfBoundsException
70 * if the index given is outside the bounds of the collection
72 public void addAlcodMap(
73 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
74 throws java.lang.IndexOutOfBoundsException
76 this._alcodMapList.addElement(vAlcodMap);
84 * @throws java.lang.IndexOutOfBoundsException
85 * if the index given is outside the bounds of the collection
87 public void addAlcodMap(final int index,
88 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
89 throws java.lang.IndexOutOfBoundsException
91 this._alcodMapList.add(index, vAlcodMap);
98 * @throws java.lang.IndexOutOfBoundsException
99 * if the index given is outside the bounds of the collection
101 public void addAlcodon(
102 final jalview.schemabinding.version2.Alcodon vAlcodon)
103 throws java.lang.IndexOutOfBoundsException
105 this._alcodonList.addElement(vAlcodon);
113 * @throws java.lang.IndexOutOfBoundsException
114 * if the index given is outside the bounds of the collection
116 public void addAlcodon(final int index,
117 final jalview.schemabinding.version2.Alcodon vAlcodon)
118 throws java.lang.IndexOutOfBoundsException
120 this._alcodonList.add(index, vAlcodon);
124 * Method enumerateAlcodMap.
126 * @return an Enumeration over all jalview.schemabinding.version2.AlcodMap
129 public java.util.Enumeration enumerateAlcodMap()
131 return this._alcodMapList.elements();
135 * Method enumerateAlcodon.
137 * @return an Enumeration over all jalview.schemabinding.version2.Alcodon
140 public java.util.Enumeration enumerateAlcodon()
142 return this._alcodonList.elements();
146 * Method getAlcodMap.
149 * @throws java.lang.IndexOutOfBoundsException
150 * if the index given is outside the bounds of the collection
151 * @return the value of the jalview.schemabinding.version2.AlcodMap at the
154 public jalview.schemabinding.version2.AlcodMap getAlcodMap(final int index)
155 throws java.lang.IndexOutOfBoundsException
157 // check bounds for index
158 if (index < 0 || index >= this._alcodMapList.size())
160 throw new IndexOutOfBoundsException("getAlcodMap: Index value '"
161 + index + "' not in range [0.."
162 + (this._alcodMapList.size() - 1) + "]");
165 return (jalview.schemabinding.version2.AlcodMap) _alcodMapList
170 * Method getAlcodMap.Returns the contents of the collection in an Array.
172 * Note: Just in case the collection contents are changing in another thread,
173 * we pass a 0-length Array of the correct type into the API call. This way we
174 * <i>know</i> that the Array returned is of exactly the correct length.
176 * @return this collection as an Array
178 public jalview.schemabinding.version2.AlcodMap[] getAlcodMap()
180 jalview.schemabinding.version2.AlcodMap[] array = new jalview.schemabinding.version2.AlcodMap[0];
181 return (jalview.schemabinding.version2.AlcodMap[]) this._alcodMapList
186 * Method getAlcodMapCount.
188 * @return the size of this collection
190 public int getAlcodMapCount()
192 return this._alcodMapList.size();
199 * @throws java.lang.IndexOutOfBoundsException
200 * if the index given is outside the bounds of the collection
201 * @return the value of the jalview.schemabinding.version2.Alcodon at the
204 public jalview.schemabinding.version2.Alcodon getAlcodon(final int index)
205 throws java.lang.IndexOutOfBoundsException
207 // check bounds for index
208 if (index < 0 || index >= this._alcodonList.size())
210 throw new IndexOutOfBoundsException("getAlcodon: Index value '"
211 + index + "' not in range [0.."
212 + (this._alcodonList.size() - 1) + "]");
215 return (jalview.schemabinding.version2.Alcodon) _alcodonList.get(index);
219 * Method getAlcodon.Returns the contents of the collection in an Array.
221 * Note: Just in case the collection contents are changing in another thread,
222 * we pass a 0-length Array of the correct type into the API call. This way we
223 * <i>know</i> that the Array returned is of exactly the correct length.
225 * @return this collection as an Array
227 public jalview.schemabinding.version2.Alcodon[] getAlcodon()
229 jalview.schemabinding.version2.Alcodon[] array = new jalview.schemabinding.version2.Alcodon[0];
230 return (jalview.schemabinding.version2.Alcodon[]) this._alcodonList
235 * Method getAlcodonCount.
237 * @return the size of this collection
239 public int getAlcodonCount()
241 return this._alcodonList.size();
247 * @return true if this object is valid according to the schema
249 public boolean isValid()
254 } catch (org.exolab.castor.xml.ValidationException vex)
265 * @throws org.exolab.castor.xml.MarshalException
266 * if object is null or if any SAXException is thrown during
268 * @throws org.exolab.castor.xml.ValidationException
269 * if this object is an invalid instance according to the schema
271 public void marshal(final java.io.Writer out)
272 throws org.exolab.castor.xml.MarshalException,
273 org.exolab.castor.xml.ValidationException
275 Marshaller.marshal(this, out);
282 * @throws java.io.IOException
283 * if an IOException occurs during marshaling
284 * @throws org.exolab.castor.xml.ValidationException
285 * if this object is an invalid instance according to the schema
286 * @throws org.exolab.castor.xml.MarshalException
287 * if object is null or if any SAXException is thrown during
290 public void marshal(final org.xml.sax.ContentHandler handler)
291 throws java.io.IOException,
292 org.exolab.castor.xml.MarshalException,
293 org.exolab.castor.xml.ValidationException
295 Marshaller.marshal(this, handler);
299 * Method removeAlcodMap.
302 * @return true if the object was removed from the collection.
304 public boolean removeAlcodMap(
305 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
307 boolean removed = _alcodMapList.remove(vAlcodMap);
312 * Method removeAlcodMapAt.
315 * @return the element removed from the collection
317 public jalview.schemabinding.version2.AlcodMap removeAlcodMapAt(
320 java.lang.Object obj = this._alcodMapList.remove(index);
321 return (jalview.schemabinding.version2.AlcodMap) obj;
325 * Method removeAlcodon.
328 * @return true if the object was removed from the collection.
330 public boolean removeAlcodon(
331 final jalview.schemabinding.version2.Alcodon vAlcodon)
333 boolean removed = _alcodonList.remove(vAlcodon);
338 * Method removeAlcodonAt.
341 * @return the element removed from the collection
343 public jalview.schemabinding.version2.Alcodon removeAlcodonAt(
346 java.lang.Object obj = this._alcodonList.remove(index);
347 return (jalview.schemabinding.version2.Alcodon) obj;
352 public void removeAllAlcodMap()
354 this._alcodMapList.clear();
359 public void removeAllAlcodon()
361 this._alcodonList.clear();
369 * @throws java.lang.IndexOutOfBoundsException
370 * if the index given is outside the bounds of the collection
372 public void setAlcodMap(final int index,
373 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
374 throws java.lang.IndexOutOfBoundsException
376 // check bounds for index
377 if (index < 0 || index >= this._alcodMapList.size())
379 throw new IndexOutOfBoundsException("setAlcodMap: Index value '"
380 + index + "' not in range [0.."
381 + (this._alcodMapList.size() - 1) + "]");
384 this._alcodMapList.set(index, vAlcodMap);
390 * @param vAlcodMapArray
392 public void setAlcodMap(
393 final jalview.schemabinding.version2.AlcodMap[] vAlcodMapArray)
396 _alcodMapList.clear();
398 for (int i = 0; i < vAlcodMapArray.length; i++)
400 this._alcodMapList.add(vAlcodMapArray[i]);
409 * @throws java.lang.IndexOutOfBoundsException
410 * if the index given is outside the bounds of the collection
412 public void setAlcodon(final int index,
413 final jalview.schemabinding.version2.Alcodon vAlcodon)
414 throws java.lang.IndexOutOfBoundsException
416 // check bounds for index
417 if (index < 0 || index >= this._alcodonList.size())
419 throw new IndexOutOfBoundsException("setAlcodon: Index value '"
420 + index + "' not in range [0.."
421 + (this._alcodonList.size() - 1) + "]");
424 this._alcodonList.set(index, vAlcodon);
430 * @param vAlcodonArray
432 public void setAlcodon(
433 final jalview.schemabinding.version2.Alcodon[] vAlcodonArray)
436 _alcodonList.clear();
438 for (int i = 0; i < vAlcodonArray.length; i++)
440 this._alcodonList.add(vAlcodonArray[i]);
448 * @throws org.exolab.castor.xml.MarshalException
449 * if object is null or if any SAXException is thrown during
451 * @throws org.exolab.castor.xml.ValidationException
452 * if this object is an invalid instance according to the schema
453 * @return the unmarshaled jalview.schemabinding.version2.AlcodonFrame
455 public static jalview.schemabinding.version2.AlcodonFrame unmarshal(
456 final java.io.Reader reader)
457 throws org.exolab.castor.xml.MarshalException,
458 org.exolab.castor.xml.ValidationException
460 return (jalview.schemabinding.version2.AlcodonFrame) Unmarshaller
461 .unmarshal(jalview.schemabinding.version2.AlcodonFrame.class,
468 * @throws org.exolab.castor.xml.ValidationException
469 * if this object is an invalid instance according to the schema
471 public void validate() throws org.exolab.castor.xml.ValidationException
473 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
474 validator.validate(this);