7581cae5d0b3a82219fc9938f41ddd8e7004af35
[jalview.git] / src / jalview / binding / UserColours.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3  * Copyright (C) 2014 The Jalview Authors
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
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.binding;
22
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
26
27 import org.exolab.castor.xml.Marshaller;
28 import org.exolab.castor.xml.Unmarshaller;
29
30 /**
31  * Class UserColours.
32  * 
33  * @version $Revision$ $Date$
34  */
35 public class UserColours implements java.io.Serializable
36 {
37
38   // --------------------------/
39   // - Class/Member Variables -/
40   // --------------------------/
41
42   /**
43    * Field _id.
44    */
45   private java.lang.String _id;
46
47   /**
48    * Field _userColourScheme.
49    */
50   private jalview.binding.UserColourScheme _userColourScheme;
51
52   // ----------------/
53   // - Constructors -/
54   // ----------------/
55
56   public UserColours()
57   {
58     super();
59   }
60
61   // -----------/
62   // - Methods -/
63   // -----------/
64
65   /**
66    * Returns the value of field 'id'.
67    * 
68    * @return the value of field 'Id'.
69    */
70   public java.lang.String getId()
71   {
72     return this._id;
73   }
74
75   /**
76    * Returns the value of field 'userColourScheme'.
77    * 
78    * @return the value of field 'UserColourScheme'.
79    */
80   public jalview.binding.UserColourScheme getUserColourScheme()
81   {
82     return this._userColourScheme;
83   }
84
85   /**
86    * Method isValid.
87    * 
88    * @return true if this object is valid according to the schema
89    */
90   public boolean isValid()
91   {
92     try
93     {
94       validate();
95     } catch (org.exolab.castor.xml.ValidationException vex)
96     {
97       return false;
98     }
99     return true;
100   }
101
102   /**
103    * 
104    * 
105    * @param out
106    * @throws org.exolab.castor.xml.MarshalException
107    *           if object is null or if any SAXException is thrown during
108    *           marshaling
109    * @throws org.exolab.castor.xml.ValidationException
110    *           if this object is an invalid instance according to the schema
111    */
112   public void marshal(final java.io.Writer out)
113           throws org.exolab.castor.xml.MarshalException,
114           org.exolab.castor.xml.ValidationException
115   {
116     Marshaller.marshal(this, out);
117   }
118
119   /**
120    * 
121    * 
122    * @param handler
123    * @throws java.io.IOException
124    *           if an IOException occurs during marshaling
125    * @throws org.exolab.castor.xml.ValidationException
126    *           if this object is an invalid instance according to the schema
127    * @throws org.exolab.castor.xml.MarshalException
128    *           if object is null or if any SAXException is thrown during
129    *           marshaling
130    */
131   public void marshal(final org.xml.sax.ContentHandler handler)
132           throws java.io.IOException,
133           org.exolab.castor.xml.MarshalException,
134           org.exolab.castor.xml.ValidationException
135   {
136     Marshaller.marshal(this, handler);
137   }
138
139   /**
140    * Sets the value of field 'id'.
141    * 
142    * @param id
143    *          the value of field 'id'.
144    */
145   public void setId(final java.lang.String id)
146   {
147     this._id = id;
148   }
149
150   /**
151    * Sets the value of field 'userColourScheme'.
152    * 
153    * @param userColourScheme
154    *          the value of field 'userColourScheme'
155    */
156   public void setUserColourScheme(
157           final jalview.binding.UserColourScheme userColourScheme)
158   {
159     this._userColourScheme = userColourScheme;
160   }
161
162   /**
163    * Method unmarshal.
164    * 
165    * @param reader
166    * @throws org.exolab.castor.xml.MarshalException
167    *           if object is null or if any SAXException is thrown during
168    *           marshaling
169    * @throws org.exolab.castor.xml.ValidationException
170    *           if this object is an invalid instance according to the schema
171    * @return the unmarshaled jalview.binding.UserColours
172    */
173   public static jalview.binding.UserColours unmarshal(
174           final java.io.Reader reader)
175           throws org.exolab.castor.xml.MarshalException,
176           org.exolab.castor.xml.ValidationException
177   {
178     return (jalview.binding.UserColours) Unmarshaller.unmarshal(
179             jalview.binding.UserColours.class, reader);
180   }
181
182   /**
183    * 
184    * 
185    * @throws org.exolab.castor.xml.ValidationException
186    *           if this object is an invalid instance according to the schema
187    */
188   public void validate() throws org.exolab.castor.xml.ValidationException
189   {
190     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
191     validator.validate(this);
192   }
193
194 }