acac8d7781dac12bfac4f7cda875eff223b63053
[jalview.git] / src / jalview / binding / Feature.java
1 /*
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
4  * 
5  * This file is part of Jalview.
6  * 
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.
10  *  
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.
15  * 
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  */
18 package jalview.binding;
19
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
23
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
26
27 /**
28  * Class Feature.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class Feature implements java.io.Serializable
33 {
34
35   // --------------------------/
36   // - Class/Member Variables -/
37   // --------------------------/
38
39   /**
40    * Field _begin.
41    */
42   private int _begin;
43
44   /**
45    * keeps track of state for field: _begin
46    */
47   private boolean _has_begin;
48
49   /**
50    * Field _end.
51    */
52   private int _end;
53
54   /**
55    * keeps track of state for field: _end
56    */
57   private boolean _has_end;
58
59   /**
60    * Field _type.
61    */
62   private java.lang.String _type;
63
64   /**
65    * Field _description.
66    */
67   private java.lang.String _description;
68
69   /**
70    * Field _status.
71    */
72   private java.lang.String _status;
73
74   // ----------------/
75   // - Constructors -/
76   // ----------------/
77
78   public Feature()
79   {
80     super();
81   }
82
83   // -----------/
84   // - Methods -/
85   // -----------/
86
87   /**
88      */
89   public void deleteBegin()
90   {
91     this._has_begin = false;
92   }
93
94   /**
95      */
96   public void deleteEnd()
97   {
98     this._has_end = false;
99   }
100
101   /**
102    * Returns the value of field 'begin'.
103    * 
104    * @return the value of field 'Begin'.
105    */
106   public int getBegin()
107   {
108     return this._begin;
109   }
110
111   /**
112    * Returns the value of field 'description'.
113    * 
114    * @return the value of field 'Description'.
115    */
116   public java.lang.String getDescription()
117   {
118     return this._description;
119   }
120
121   /**
122    * Returns the value of field 'end'.
123    * 
124    * @return the value of field 'End'.
125    */
126   public int getEnd()
127   {
128     return this._end;
129   }
130
131   /**
132    * Returns the value of field 'status'.
133    * 
134    * @return the value of field 'Status'.
135    */
136   public java.lang.String getStatus()
137   {
138     return this._status;
139   }
140
141   /**
142    * Returns the value of field 'type'.
143    * 
144    * @return the value of field 'Type'.
145    */
146   public java.lang.String getType()
147   {
148     return this._type;
149   }
150
151   /**
152    * Method hasBegin.
153    * 
154    * @return true if at least one Begin has been added
155    */
156   public boolean hasBegin()
157   {
158     return this._has_begin;
159   }
160
161   /**
162    * Method hasEnd.
163    * 
164    * @return true if at least one End has been added
165    */
166   public boolean hasEnd()
167   {
168     return this._has_end;
169   }
170
171   /**
172    * Method isValid.
173    * 
174    * @return true if this object is valid according to the schema
175    */
176   public boolean isValid()
177   {
178     try
179     {
180       validate();
181     } catch (org.exolab.castor.xml.ValidationException vex)
182     {
183       return false;
184     }
185     return true;
186   }
187
188   /**
189    * 
190    * 
191    * @param out
192    * @throws org.exolab.castor.xml.MarshalException
193    *           if object is null or if any SAXException is thrown during
194    *           marshaling
195    * @throws org.exolab.castor.xml.ValidationException
196    *           if this object is an invalid instance according to the schema
197    */
198   public void marshal(final java.io.Writer out)
199           throws org.exolab.castor.xml.MarshalException,
200           org.exolab.castor.xml.ValidationException
201   {
202     Marshaller.marshal(this, out);
203   }
204
205   /**
206    * 
207    * 
208    * @param handler
209    * @throws java.io.IOException
210    *           if an IOException occurs during marshaling
211    * @throws org.exolab.castor.xml.ValidationException
212    *           if this object is an invalid instance according to the schema
213    * @throws org.exolab.castor.xml.MarshalException
214    *           if object is null or if any SAXException is thrown during
215    *           marshaling
216    */
217   public void marshal(final org.xml.sax.ContentHandler handler)
218           throws java.io.IOException,
219           org.exolab.castor.xml.MarshalException,
220           org.exolab.castor.xml.ValidationException
221   {
222     Marshaller.marshal(this, handler);
223   }
224
225   /**
226    * Sets the value of field 'begin'.
227    * 
228    * @param begin
229    *          the value of field 'begin'.
230    */
231   public void setBegin(final int begin)
232   {
233     this._begin = begin;
234     this._has_begin = true;
235   }
236
237   /**
238    * Sets the value of field 'description'.
239    * 
240    * @param description
241    *          the value of field 'description'.
242    */
243   public void setDescription(final java.lang.String description)
244   {
245     this._description = description;
246   }
247
248   /**
249    * Sets the value of field 'end'.
250    * 
251    * @param end
252    *          the value of field 'end'.
253    */
254   public void setEnd(final int end)
255   {
256     this._end = end;
257     this._has_end = true;
258   }
259
260   /**
261    * Sets the value of field 'status'.
262    * 
263    * @param status
264    *          the value of field 'status'.
265    */
266   public void setStatus(final java.lang.String status)
267   {
268     this._status = status;
269   }
270
271   /**
272    * Sets the value of field 'type'.
273    * 
274    * @param type
275    *          the value of field 'type'.
276    */
277   public void setType(final java.lang.String type)
278   {
279     this._type = type;
280   }
281
282   /**
283    * Method unmarshal.
284    * 
285    * @param reader
286    * @throws org.exolab.castor.xml.MarshalException
287    *           if object is null or if any SAXException is thrown during
288    *           marshaling
289    * @throws org.exolab.castor.xml.ValidationException
290    *           if this object is an invalid instance according to the schema
291    * @return the unmarshaled jalview.binding.Feature
292    */
293   public static jalview.binding.Feature unmarshal(
294           final java.io.Reader reader)
295           throws org.exolab.castor.xml.MarshalException,
296           org.exolab.castor.xml.ValidationException
297   {
298     return (jalview.binding.Feature) Unmarshaller.unmarshal(
299             jalview.binding.Feature.class, reader);
300   }
301
302   /**
303    * 
304    * 
305    * @throws org.exolab.castor.xml.ValidationException
306    *           if this object is an invalid instance according to the schema
307    */
308   public void validate() throws org.exolab.castor.xml.ValidationException
309   {
310     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
311     validator.validate(this);
312   }
313
314 }