Jalview 2.6 source licence
[jalview.git] / src / jalview / schemabinding / version2 / UserColourScheme.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)\r
3  * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
4  * \r
5  * This file is part of Jalview.\r
6  * \r
7  * Jalview is free software: you can redistribute it and/or\r
8  * modify it under the terms of the GNU General Public License \r
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
10  * \r
11  * Jalview is distributed in the hope that it will be useful, but \r
12  * WITHOUT ANY WARRANTY; without even the implied warranty \r
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
14  * PURPOSE.  See the GNU General Public License for more details.\r
15  * \r
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
17  */\r
18 package jalview.schemabinding.version2;\r
19 \r
20 //---------------------------------/\r
21 //- Imported classes and packages -/\r
22 //---------------------------------/\r
23 \r
24 import org.exolab.castor.xml.Marshaller;\r
25 import org.exolab.castor.xml.Unmarshaller;\r
26 \r
27 /**\r
28  * Class UserColourScheme.\r
29  * \r
30  * @version $Revision$ $Date$\r
31  */\r
32 public class UserColourScheme extends JalviewUserColours implements\r
33         java.io.Serializable\r
34 {\r
35 \r
36   // ----------------/\r
37   // - Constructors -/\r
38   // ----------------/\r
39 \r
40   public UserColourScheme()\r
41   {\r
42     super();\r
43   }\r
44 \r
45   // -----------/\r
46   // - Methods -/\r
47   // -----------/\r
48 \r
49   /**\r
50    * Method isValid.\r
51    * \r
52    * @return true if this object is valid according to the schema\r
53    */\r
54   public boolean isValid()\r
55   {\r
56     try\r
57     {\r
58       validate();\r
59     } catch (org.exolab.castor.xml.ValidationException vex)\r
60     {\r
61       return false;\r
62     }\r
63     return true;\r
64   }\r
65 \r
66   /**\r
67    * \r
68    * \r
69    * @param out\r
70    * @throws org.exolab.castor.xml.MarshalException\r
71    *           if object is null or if any SAXException is thrown during\r
72    *           marshaling\r
73    * @throws org.exolab.castor.xml.ValidationException\r
74    *           if this object is an invalid instance according to the schema\r
75    */\r
76   public void marshal(final java.io.Writer out)\r
77           throws org.exolab.castor.xml.MarshalException,\r
78           org.exolab.castor.xml.ValidationException\r
79   {\r
80     Marshaller.marshal(this, out);\r
81   }\r
82 \r
83   /**\r
84    * \r
85    * \r
86    * @param handler\r
87    * @throws java.io.IOException\r
88    *           if an IOException occurs during marshaling\r
89    * @throws org.exolab.castor.xml.ValidationException\r
90    *           if this object is an invalid instance according to the schema\r
91    * @throws org.exolab.castor.xml.MarshalException\r
92    *           if object is null or if any SAXException is thrown during\r
93    *           marshaling\r
94    */\r
95   public void marshal(final org.xml.sax.ContentHandler handler)\r
96           throws java.io.IOException,\r
97           org.exolab.castor.xml.MarshalException,\r
98           org.exolab.castor.xml.ValidationException\r
99   {\r
100     Marshaller.marshal(this, handler);\r
101   }\r
102 \r
103   /**\r
104    * Method unmarshal.\r
105    * \r
106    * @param reader\r
107    * @throws org.exolab.castor.xml.MarshalException\r
108    *           if object is null or if any SAXException is thrown during\r
109    *           marshaling\r
110    * @throws org.exolab.castor.xml.ValidationException\r
111    *           if this object is an invalid instance according to the schema\r
112    * @return the unmarshaled jalview.schemabinding.version2.JalviewUserColours\r
113    */\r
114   public static jalview.schemabinding.version2.JalviewUserColours unmarshal(\r
115           final java.io.Reader reader)\r
116           throws org.exolab.castor.xml.MarshalException,\r
117           org.exolab.castor.xml.ValidationException\r
118   {\r
119     return (jalview.schemabinding.version2.JalviewUserColours) Unmarshaller\r
120             .unmarshal(\r
121                     jalview.schemabinding.version2.UserColourScheme.class,\r
122                     reader);\r
123   }\r
124 \r
125   /**\r
126    * \r
127    * \r
128    * @throws org.exolab.castor.xml.ValidationException\r
129    *           if this object is an invalid instance according to the schema\r
130    */\r
131   public void validate() throws org.exolab.castor.xml.ValidationException\r
132   {\r
133     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
134     validator.validate(this);\r
135   }\r
136 \r
137 }\r