2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
\r
3 * Copyright (C) 2009 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
55 public AlcodonFrame() {
\r
57 this._alcodonList = new java.util.Vector();
\r
58 this._alcodMapList = new java.util.Vector();
\r
70 * @throws java.lang.IndexOutOfBoundsException if the index
\r
71 * given is outside the bounds of the collection
\r
73 public void addAlcodMap(
\r
74 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
\r
75 throws java.lang.IndexOutOfBoundsException {
\r
76 this._alcodMapList.addElement(vAlcodMap);
\r
84 * @throws java.lang.IndexOutOfBoundsException if the index
\r
85 * given is outside the bounds of the collection
\r
87 public void addAlcodMap(
\r
89 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
\r
90 throws java.lang.IndexOutOfBoundsException {
\r
91 this._alcodMapList.add(index, vAlcodMap);
\r
98 * @throws java.lang.IndexOutOfBoundsException if the index
\r
99 * 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
104 this._alcodonList.addElement(vAlcodon);
\r
112 * @throws java.lang.IndexOutOfBoundsException if the index
\r
113 * given is outside the bounds of the collection
\r
115 public void addAlcodon(
\r
117 final jalview.schemabinding.version2.Alcodon vAlcodon)
\r
118 throws java.lang.IndexOutOfBoundsException {
\r
119 this._alcodonList.add(index, vAlcodon);
\r
123 * Method enumerateAlcodMap.
\r
125 * @return an Enumeration over all
\r
126 * jalview.schemabinding.version2.AlcodMap elements
\r
128 public java.util.Enumeration enumerateAlcodMap(
\r
130 return this._alcodMapList.elements();
\r
134 * Method enumerateAlcodon.
\r
136 * @return an Enumeration over all
\r
137 * jalview.schemabinding.version2.Alcodon elements
\r
139 public java.util.Enumeration enumerateAlcodon(
\r
141 return this._alcodonList.elements();
\r
145 * Method getAlcodMap.
\r
148 * @throws java.lang.IndexOutOfBoundsException if the index
\r
149 * given is outside the bounds of the collection
\r
150 * @return the value of the
\r
151 * jalview.schemabinding.version2.AlcodMap at the given index
\r
153 public jalview.schemabinding.version2.AlcodMap getAlcodMap(
\r
155 throws java.lang.IndexOutOfBoundsException {
\r
156 // check bounds for index
\r
157 if (index < 0 || index >= this._alcodMapList.size()) {
\r
158 throw new IndexOutOfBoundsException("getAlcodMap: Index value '" + index + "' not in range [0.." + (this._alcodMapList.size() - 1) + "]");
\r
161 return (jalview.schemabinding.version2.AlcodMap) _alcodMapList.get(index);
\r
165 * Method getAlcodMap.Returns the contents of the collection in
\r
166 * an Array. <p>Note: Just in case the collection contents
\r
167 * are changing in another thread, we pass a 0-length Array of
\r
168 * the correct type into the API call. This way we <i>know</i>
\r
169 * that the Array returned is of exactly the correct length.
\r
171 * @return this collection as an Array
\r
173 public jalview.schemabinding.version2.AlcodMap[] getAlcodMap(
\r
175 jalview.schemabinding.version2.AlcodMap[] array = new jalview.schemabinding.version2.AlcodMap[0];
\r
176 return (jalview.schemabinding.version2.AlcodMap[]) this._alcodMapList.toArray(array);
\r
180 * Method getAlcodMapCount.
\r
182 * @return the size of this collection
\r
184 public int getAlcodMapCount(
\r
186 return this._alcodMapList.size();
\r
190 * Method getAlcodon.
\r
193 * @throws java.lang.IndexOutOfBoundsException if the index
\r
194 * given is outside the bounds of the collection
\r
195 * @return the value of the
\r
196 * jalview.schemabinding.version2.Alcodon at the given index
\r
198 public jalview.schemabinding.version2.Alcodon getAlcodon(
\r
200 throws java.lang.IndexOutOfBoundsException {
\r
201 // check bounds for index
\r
202 if (index < 0 || index >= this._alcodonList.size()) {
\r
203 throw new IndexOutOfBoundsException("getAlcodon: Index value '" + index + "' not in range [0.." + (this._alcodonList.size() - 1) + "]");
\r
206 return (jalview.schemabinding.version2.Alcodon) _alcodonList.get(index);
\r
210 * Method getAlcodon.Returns the contents of the collection in
\r
211 * an Array. <p>Note: Just in case the collection contents
\r
212 * are changing in another thread, we pass a 0-length Array of
\r
213 * the correct type into the API call. This way we <i>know</i>
\r
214 * that the Array returned is of exactly the correct length.
\r
216 * @return this collection as an Array
\r
218 public jalview.schemabinding.version2.Alcodon[] getAlcodon(
\r
220 jalview.schemabinding.version2.Alcodon[] array = new jalview.schemabinding.version2.Alcodon[0];
\r
221 return (jalview.schemabinding.version2.Alcodon[]) this._alcodonList.toArray(array);
\r
225 * Method getAlcodonCount.
\r
227 * @return the size of this collection
\r
229 public int getAlcodonCount(
\r
231 return this._alcodonList.size();
\r
237 * @return true if this object is valid according to the schema
\r
239 public boolean isValid(
\r
243 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
253 * @throws org.exolab.castor.xml.MarshalException if object is
\r
254 * null or if any SAXException is thrown during marshaling
\r
255 * @throws org.exolab.castor.xml.ValidationException if this
\r
256 * object is an invalid instance according to the schema
\r
258 public void marshal(
\r
259 final java.io.Writer out)
\r
260 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
261 Marshaller.marshal(this, out);
\r
268 * @throws java.io.IOException if an IOException occurs during
\r
270 * @throws org.exolab.castor.xml.ValidationException if this
\r
271 * object is an invalid instance according to the schema
\r
272 * @throws org.exolab.castor.xml.MarshalException if object is
\r
273 * null or if any SAXException is thrown during marshaling
\r
275 public void marshal(
\r
276 final org.xml.sax.ContentHandler handler)
\r
277 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
278 Marshaller.marshal(this, handler);
\r
282 * Method removeAlcodMap.
\r
285 * @return true if the object was removed from the collection.
\r
287 public boolean removeAlcodMap(
\r
288 final jalview.schemabinding.version2.AlcodMap vAlcodMap) {
\r
289 boolean removed = _alcodMapList.remove(vAlcodMap);
\r
294 * Method removeAlcodMapAt.
\r
297 * @return the element removed from the collection
\r
299 public jalview.schemabinding.version2.AlcodMap removeAlcodMapAt(
\r
301 java.lang.Object obj = this._alcodMapList.remove(index);
\r
302 return (jalview.schemabinding.version2.AlcodMap) obj;
\r
306 * Method removeAlcodon.
\r
309 * @return true if the object was removed from the collection.
\r
311 public boolean removeAlcodon(
\r
312 final jalview.schemabinding.version2.Alcodon vAlcodon) {
\r
313 boolean removed = _alcodonList.remove(vAlcodon);
\r
318 * Method removeAlcodonAt.
\r
321 * @return the element removed from the collection
\r
323 public jalview.schemabinding.version2.Alcodon removeAlcodonAt(
\r
325 java.lang.Object obj = this._alcodonList.remove(index);
\r
326 return (jalview.schemabinding.version2.Alcodon) obj;
\r
331 public void removeAllAlcodMap(
\r
333 this._alcodMapList.clear();
\r
338 public void removeAllAlcodon(
\r
340 this._alcodonList.clear();
\r
348 * @throws java.lang.IndexOutOfBoundsException if the index
\r
349 * given is outside the bounds of the collection
\r
351 public void setAlcodMap(
\r
353 final jalview.schemabinding.version2.AlcodMap vAlcodMap)
\r
354 throws java.lang.IndexOutOfBoundsException {
\r
355 // check bounds for index
\r
356 if (index < 0 || index >= this._alcodMapList.size()) {
\r
357 throw new IndexOutOfBoundsException("setAlcodMap: Index value '" + index + "' not in range [0.." + (this._alcodMapList.size() - 1) + "]");
\r
360 this._alcodMapList.set(index, vAlcodMap);
\r
366 * @param vAlcodMapArray
\r
368 public void setAlcodMap(
\r
369 final jalview.schemabinding.version2.AlcodMap[] vAlcodMapArray) {
\r
371 _alcodMapList.clear();
\r
373 for (int i = 0; i < vAlcodMapArray.length; i++) {
\r
374 this._alcodMapList.add(vAlcodMapArray[i]);
\r
383 * @throws java.lang.IndexOutOfBoundsException if the index
\r
384 * given is outside the bounds of the collection
\r
386 public void setAlcodon(
\r
388 final jalview.schemabinding.version2.Alcodon vAlcodon)
\r
389 throws java.lang.IndexOutOfBoundsException {
\r
390 // check bounds for index
\r
391 if (index < 0 || index >= this._alcodonList.size()) {
\r
392 throw new IndexOutOfBoundsException("setAlcodon: Index value '" + index + "' not in range [0.." + (this._alcodonList.size() - 1) + "]");
\r
395 this._alcodonList.set(index, vAlcodon);
\r
401 * @param vAlcodonArray
\r
403 public void setAlcodon(
\r
404 final jalview.schemabinding.version2.Alcodon[] vAlcodonArray) {
\r
406 _alcodonList.clear();
\r
408 for (int i = 0; i < vAlcodonArray.length; i++) {
\r
409 this._alcodonList.add(vAlcodonArray[i]);
\r
414 * Method unmarshal.
\r
417 * @throws org.exolab.castor.xml.MarshalException if object is
\r
418 * null or if any SAXException is thrown during marshaling
\r
419 * @throws org.exolab.castor.xml.ValidationException if this
\r
420 * object is an invalid instance according to the schema
\r
421 * @return the unmarshaled
\r
422 * jalview.schemabinding.version2.AlcodonFrame
\r
424 public static jalview.schemabinding.version2.AlcodonFrame unmarshal(
\r
425 final java.io.Reader reader)
\r
426 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
427 return (jalview.schemabinding.version2.AlcodonFrame) Unmarshaller.unmarshal(jalview.schemabinding.version2.AlcodonFrame.class, reader);
\r
433 * @throws org.exolab.castor.xml.ValidationException if this
\r
434 * object is an invalid instance according to the schema
\r
436 public void validate(
\r
438 throws org.exolab.castor.xml.ValidationException {
\r
439 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
440 validator.validate(this);
\r