merge from 2_4_Release branch
[jalview.git] / src / jalview / schemabinding / version2 / StructureState.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.schemabinding.version2;
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 StructureState.
30  * 
31  * @version $Revision$ $Date$
32  */
33 public class StructureState implements java.io.Serializable
34 {
35
36   // --------------------------/
37   // - Class/Member Variables -/
38   // --------------------------/
39
40   /**
41    * internal content storage
42    */
43   private java.lang.String _content = "";
44
45   /**
46    * Field _visible.
47    */
48   private boolean _visible;
49
50   /**
51    * keeps track of state for field: _visible
52    */
53   private boolean _has_visible;
54
55   /**
56    * Field _xpos.
57    */
58   private int _xpos;
59
60   /**
61    * keeps track of state for field: _xpos
62    */
63   private boolean _has_xpos;
64
65   /**
66    * Field _ypos.
67    */
68   private int _ypos;
69
70   /**
71    * keeps track of state for field: _ypos
72    */
73   private boolean _has_ypos;
74
75   /**
76    * Field _width.
77    */
78   private int _width;
79
80   /**
81    * keeps track of state for field: _width
82    */
83   private boolean _has_width;
84
85   /**
86    * Field _height.
87    */
88   private int _height;
89
90   /**
91    * keeps track of state for field: _height
92    */
93   private boolean _has_height;
94
95   // ----------------/
96   // - Constructors -/
97   // ----------------/
98
99   public StructureState()
100   {
101     super();
102     setContent("");
103   }
104
105   // -----------/
106   // - Methods -/
107   // -----------/
108
109   /**
110    */
111   public void deleteHeight()
112   {
113     this._has_height = false;
114   }
115
116   /**
117    */
118   public void deleteVisible()
119   {
120     this._has_visible = false;
121   }
122
123   /**
124    */
125   public void deleteWidth()
126   {
127     this._has_width = false;
128   }
129
130   /**
131    */
132   public void deleteXpos()
133   {
134     this._has_xpos = false;
135   }
136
137   /**
138    */
139   public void deleteYpos()
140   {
141     this._has_ypos = false;
142   }
143
144   /**
145    * Returns the value of field 'content'. The field 'content' has the following
146    * description: internal content storage
147    * 
148    * @return the value of field 'Content'.
149    */
150   public java.lang.String getContent()
151   {
152     return this._content;
153   }
154
155   /**
156    * Returns the value of field 'height'.
157    * 
158    * @return the value of field 'Height'.
159    */
160   public int getHeight()
161   {
162     return this._height;
163   }
164
165   /**
166    * Returns the value of field 'visible'.
167    * 
168    * @return the value of field 'Visible'.
169    */
170   public boolean getVisible()
171   {
172     return this._visible;
173   }
174
175   /**
176    * Returns the value of field 'width'.
177    * 
178    * @return the value of field 'Width'.
179    */
180   public int getWidth()
181   {
182     return this._width;
183   }
184
185   /**
186    * Returns the value of field 'xpos'.
187    * 
188    * @return the value of field 'Xpos'.
189    */
190   public int getXpos()
191   {
192     return this._xpos;
193   }
194
195   /**
196    * Returns the value of field 'ypos'.
197    * 
198    * @return the value of field 'Ypos'.
199    */
200   public int getYpos()
201   {
202     return this._ypos;
203   }
204
205   /**
206    * Method hasHeight.
207    * 
208    * @return true if at least one Height has been added
209    */
210   public boolean hasHeight()
211   {
212     return this._has_height;
213   }
214
215   /**
216    * Method hasVisible.
217    * 
218    * @return true if at least one Visible has been added
219    */
220   public boolean hasVisible()
221   {
222     return this._has_visible;
223   }
224
225   /**
226    * Method hasWidth.
227    * 
228    * @return true if at least one Width has been added
229    */
230   public boolean hasWidth()
231   {
232     return this._has_width;
233   }
234
235   /**
236    * Method hasXpos.
237    * 
238    * @return true if at least one Xpos has been added
239    */
240   public boolean hasXpos()
241   {
242     return this._has_xpos;
243   }
244
245   /**
246    * Method hasYpos.
247    * 
248    * @return true if at least one Ypos has been added
249    */
250   public boolean hasYpos()
251   {
252     return this._has_ypos;
253   }
254
255   /**
256    * Method isValid.
257    * 
258    * @return true if this object is valid according to the schema
259    */
260   public boolean isValid()
261   {
262     try
263     {
264       validate();
265     } catch (org.exolab.castor.xml.ValidationException vex)
266     {
267       return false;
268     }
269     return true;
270   }
271
272   /**
273    * Returns the value of field 'visible'.
274    * 
275    * @return the value of field 'Visible'.
276    */
277   public boolean isVisible()
278   {
279     return this._visible;
280   }
281
282   /**
283    * 
284    * 
285    * @param out
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
291    *                 schema
292    */
293   public void marshal(final java.io.Writer out)
294           throws org.exolab.castor.xml.MarshalException,
295           org.exolab.castor.xml.ValidationException
296   {
297     Marshaller.marshal(this, out);
298   }
299
300   /**
301    * 
302    * 
303    * @param handler
304    * @throws java.io.IOException
305    *                 if an IOException occurs during marshaling
306    * @throws org.exolab.castor.xml.ValidationException
307    *                 if this object is an invalid instance according to the
308    *                 schema
309    * @throws org.exolab.castor.xml.MarshalException
310    *                 if object is null or if any SAXException is thrown during
311    *                 marshaling
312    */
313   public void marshal(final org.xml.sax.ContentHandler handler)
314           throws java.io.IOException,
315           org.exolab.castor.xml.MarshalException,
316           org.exolab.castor.xml.ValidationException
317   {
318     Marshaller.marshal(this, handler);
319   }
320
321   /**
322    * Sets the value of field 'content'. The field 'content' has the following
323    * description: internal content storage
324    * 
325    * @param content
326    *                the value of field 'content'.
327    */
328   public void setContent(final java.lang.String content)
329   {
330     this._content = content;
331   }
332
333   /**
334    * Sets the value of field 'height'.
335    * 
336    * @param height
337    *                the value of field 'height'.
338    */
339   public void setHeight(final int height)
340   {
341     this._height = height;
342     this._has_height = true;
343   }
344
345   /**
346    * Sets the value of field 'visible'.
347    * 
348    * @param visible
349    *                the value of field 'visible'.
350    */
351   public void setVisible(final boolean visible)
352   {
353     this._visible = visible;
354     this._has_visible = true;
355   }
356
357   /**
358    * Sets the value of field 'width'.
359    * 
360    * @param width
361    *                the value of field 'width'.
362    */
363   public void setWidth(final int width)
364   {
365     this._width = width;
366     this._has_width = true;
367   }
368
369   /**
370    * Sets the value of field 'xpos'.
371    * 
372    * @param xpos
373    *                the value of field 'xpos'.
374    */
375   public void setXpos(final int xpos)
376   {
377     this._xpos = xpos;
378     this._has_xpos = true;
379   }
380
381   /**
382    * Sets the value of field 'ypos'.
383    * 
384    * @param ypos
385    *                the value of field 'ypos'.
386    */
387   public void setYpos(final int ypos)
388   {
389     this._ypos = ypos;
390     this._has_ypos = true;
391   }
392
393   /**
394    * Method unmarshal.
395    * 
396    * @param reader
397    * @throws org.exolab.castor.xml.MarshalException
398    *                 if object is null or if any SAXException is thrown during
399    *                 marshaling
400    * @throws org.exolab.castor.xml.ValidationException
401    *                 if this object is an invalid instance according to the
402    *                 schema
403    * @return the unmarshaled jalview.schemabinding.version2.StructureState
404    */
405   public static jalview.schemabinding.version2.StructureState unmarshal(
406           final java.io.Reader reader)
407           throws org.exolab.castor.xml.MarshalException,
408           org.exolab.castor.xml.ValidationException
409   {
410     return (jalview.schemabinding.version2.StructureState) Unmarshaller
411             .unmarshal(jalview.schemabinding.version2.StructureState.class,
412                     reader);
413   }
414
415   /**
416    * 
417    * 
418    * @throws org.exolab.castor.xml.ValidationException
419    *                 if this object is an invalid instance according to the
420    *                 schema
421    */
422   public void validate() throws org.exolab.castor.xml.ValidationException
423   {
424     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
425     validator.validate(this);
426   }
427
428 }