licencing and format applied (eclipse)
[jalview.git] / src / jalview / binding / Setting.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 Setting.
30  * 
31  * @version $Revision$ $Date$
32  */
33 public class Setting implements java.io.Serializable
34 {
35
36   // --------------------------/
37   // - Class/Member Variables -/
38   // --------------------------/
39
40   /**
41    * Field _type.
42    */
43   private java.lang.String _type;
44
45   /**
46    * Field _colour.
47    */
48   private int _colour;
49
50   /**
51    * keeps track of state for field: _colour
52    */
53   private boolean _has_colour;
54
55   /**
56    * Field _display.
57    */
58   private boolean _display;
59
60   /**
61    * keeps track of state for field: _display
62    */
63   private boolean _has_display;
64
65   // ----------------/
66   // - Constructors -/
67   // ----------------/
68
69   public Setting()
70   {
71     super();
72   }
73
74   // -----------/
75   // - Methods -/
76   // -----------/
77
78   /**
79    */
80   public void deleteColour()
81   {
82     this._has_colour = false;
83   }
84
85   /**
86    */
87   public void deleteDisplay()
88   {
89     this._has_display = false;
90   }
91
92   /**
93    * Returns the value of field 'colour'.
94    * 
95    * @return the value of field 'Colour'.
96    */
97   public int getColour()
98   {
99     return this._colour;
100   }
101
102   /**
103    * Returns the value of field 'display'.
104    * 
105    * @return the value of field 'Display'.
106    */
107   public boolean getDisplay()
108   {
109     return this._display;
110   }
111
112   /**
113    * Returns the value of field 'type'.
114    * 
115    * @return the value of field 'Type'.
116    */
117   public java.lang.String getType()
118   {
119     return this._type;
120   }
121
122   /**
123    * Method hasColour.
124    * 
125    * @return true if at least one Colour has been added
126    */
127   public boolean hasColour()
128   {
129     return this._has_colour;
130   }
131
132   /**
133    * Method hasDisplay.
134    * 
135    * @return true if at least one Display has been added
136    */
137   public boolean hasDisplay()
138   {
139     return this._has_display;
140   }
141
142   /**
143    * Returns the value of field 'display'.
144    * 
145    * @return the value of field 'Display'.
146    */
147   public boolean isDisplay()
148   {
149     return this._display;
150   }
151
152   /**
153    * Method isValid.
154    * 
155    * @return true if this object is valid according to the schema
156    */
157   public boolean isValid()
158   {
159     try
160     {
161       validate();
162     } catch (org.exolab.castor.xml.ValidationException vex)
163     {
164       return false;
165     }
166     return true;
167   }
168
169   /**
170    * 
171    * 
172    * @param out
173    * @throws org.exolab.castor.xml.MarshalException
174    *                 if object is null or if any SAXException is thrown during
175    *                 marshaling
176    * @throws org.exolab.castor.xml.ValidationException
177    *                 if this object is an invalid instance according to the
178    *                 schema
179    */
180   public void marshal(final java.io.Writer out)
181           throws org.exolab.castor.xml.MarshalException,
182           org.exolab.castor.xml.ValidationException
183   {
184     Marshaller.marshal(this, out);
185   }
186
187   /**
188    * 
189    * 
190    * @param handler
191    * @throws java.io.IOException
192    *                 if an IOException occurs during marshaling
193    * @throws org.exolab.castor.xml.ValidationException
194    *                 if this object is an invalid instance according to the
195    *                 schema
196    * @throws org.exolab.castor.xml.MarshalException
197    *                 if object is null or if any SAXException is thrown during
198    *                 marshaling
199    */
200   public void marshal(final org.xml.sax.ContentHandler handler)
201           throws java.io.IOException,
202           org.exolab.castor.xml.MarshalException,
203           org.exolab.castor.xml.ValidationException
204   {
205     Marshaller.marshal(this, handler);
206   }
207
208   /**
209    * Sets the value of field 'colour'.
210    * 
211    * @param colour
212    *                the value of field 'colour'.
213    */
214   public void setColour(final int colour)
215   {
216     this._colour = colour;
217     this._has_colour = true;
218   }
219
220   /**
221    * Sets the value of field 'display'.
222    * 
223    * @param display
224    *                the value of field 'display'.
225    */
226   public void setDisplay(final boolean display)
227   {
228     this._display = display;
229     this._has_display = true;
230   }
231
232   /**
233    * Sets the value of field 'type'.
234    * 
235    * @param type
236    *                the value of field 'type'.
237    */
238   public void setType(final java.lang.String type)
239   {
240     this._type = type;
241   }
242
243   /**
244    * Method unmarshal.
245    * 
246    * @param reader
247    * @throws org.exolab.castor.xml.MarshalException
248    *                 if object is null or if any SAXException is thrown during
249    *                 marshaling
250    * @throws org.exolab.castor.xml.ValidationException
251    *                 if this object is an invalid instance according to the
252    *                 schema
253    * @return the unmarshaled jalview.binding.Setting
254    */
255   public static jalview.binding.Setting unmarshal(
256           final java.io.Reader reader)
257           throws org.exolab.castor.xml.MarshalException,
258           org.exolab.castor.xml.ValidationException
259   {
260     return (jalview.binding.Setting) Unmarshaller.unmarshal(
261             jalview.binding.Setting.class, reader);
262   }
263
264   /**
265    * 
266    * 
267    * @throws org.exolab.castor.xml.ValidationException
268    *                 if this object is an invalid instance according to the
269    *                 schema
270    */
271   public void validate() throws org.exolab.castor.xml.ValidationException
272   {
273     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
274     validator.validate(this);
275   }
276
277 }