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