merge from 2_4_Release branch
[jalview.git] / src / jalview / binding / SequenceType.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package jalview.binding;
20
21 // ---------------------------------/
22 // - Imported classes and packages -/
23 // ---------------------------------/
24
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
27
28 /**
29  * Class SequenceType.
30  * 
31  * @version $Revision$ $Date$
32  */
33 public class SequenceType implements java.io.Serializable
34 {
35
36   // --------------------------/
37   // - Class/Member Variables -/
38   // --------------------------/
39
40   /**
41    * Field _id.
42    */
43   private java.lang.String _id;
44
45   /**
46    * Field _sequence.
47    */
48   private java.lang.String _sequence;
49
50   /**
51    * Field _name.
52    */
53   private java.lang.String _name;
54
55   // ----------------/
56   // - Constructors -/
57   // ----------------/
58
59   public SequenceType()
60   {
61     super();
62   }
63
64   // -----------/
65   // - Methods -/
66   // -----------/
67
68   /**
69    * Returns the value of field 'id'.
70    * 
71    * @return the value of field 'Id'.
72    */
73   public java.lang.String getId()
74   {
75     return this._id;
76   }
77
78   /**
79    * Returns the value of field 'name'.
80    * 
81    * @return the value of field 'Name'.
82    */
83   public java.lang.String getName()
84   {
85     return this._name;
86   }
87
88   /**
89    * Returns the value of field 'sequence'.
90    * 
91    * @return the value of field 'Sequence'.
92    */
93   public java.lang.String getSequence()
94   {
95     return this._sequence;
96   }
97
98   /**
99    * Method isValid.
100    * 
101    * @return true if this object is valid according to the schema
102    */
103   public boolean isValid()
104   {
105     try
106     {
107       validate();
108     } catch (org.exolab.castor.xml.ValidationException vex)
109     {
110       return false;
111     }
112     return true;
113   }
114
115   /**
116    * 
117    * 
118    * @param out
119    * @throws org.exolab.castor.xml.MarshalException
120    *                 if object is null or if any SAXException is thrown during
121    *                 marshaling
122    * @throws org.exolab.castor.xml.ValidationException
123    *                 if this object is an invalid instance according to the
124    *                 schema
125    */
126   public void marshal(final java.io.Writer out)
127           throws org.exolab.castor.xml.MarshalException,
128           org.exolab.castor.xml.ValidationException
129   {
130     Marshaller.marshal(this, out);
131   }
132
133   /**
134    * 
135    * 
136    * @param handler
137    * @throws java.io.IOException
138    *                 if an IOException occurs during marshaling
139    * @throws org.exolab.castor.xml.ValidationException
140    *                 if this object is an invalid instance according to the
141    *                 schema
142    * @throws org.exolab.castor.xml.MarshalException
143    *                 if object is null or if any SAXException is thrown during
144    *                 marshaling
145    */
146   public void marshal(final org.xml.sax.ContentHandler handler)
147           throws java.io.IOException,
148           org.exolab.castor.xml.MarshalException,
149           org.exolab.castor.xml.ValidationException
150   {
151     Marshaller.marshal(this, handler);
152   }
153
154   /**
155    * Sets the value of field 'id'.
156    * 
157    * @param id
158    *                the value of field 'id'.
159    */
160   public void setId(final java.lang.String id)
161   {
162     this._id = id;
163   }
164
165   /**
166    * Sets the value of field 'name'.
167    * 
168    * @param name
169    *                the value of field 'name'.
170    */
171   public void setName(final java.lang.String name)
172   {
173     this._name = name;
174   }
175
176   /**
177    * Sets the value of field 'sequence'.
178    * 
179    * @param sequence
180    *                the value of field 'sequence'.
181    */
182   public void setSequence(final java.lang.String sequence)
183   {
184     this._sequence = sequence;
185   }
186
187   /**
188    * Method unmarshal.
189    * 
190    * @param reader
191    * @throws org.exolab.castor.xml.MarshalException
192    *                 if object is null or if any SAXException is thrown during
193    *                 marshaling
194    * @throws org.exolab.castor.xml.ValidationException
195    *                 if this object is an invalid instance according to the
196    *                 schema
197    * @return the unmarshaled jalview.binding.SequenceType
198    */
199   public static jalview.binding.SequenceType unmarshal(
200           final java.io.Reader reader)
201           throws org.exolab.castor.xml.MarshalException,
202           org.exolab.castor.xml.ValidationException
203   {
204     return (jalview.binding.SequenceType) Unmarshaller.unmarshal(
205             jalview.binding.SequenceType.class, reader);
206   }
207
208   /**
209    * 
210    * 
211    * @throws org.exolab.castor.xml.ValidationException
212    *                 if this object is an invalid instance according to the
213    *                 schema
214    */
215   public void validate() throws org.exolab.castor.xml.ValidationException
216   {
217     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
218     validator.validate(this);
219   }
220
221 }