applied LGPLv3 and source code formatting.
[vamsas.git] / src / uk / ac / vamsas / objects / core / Local.java
1 /*\r
2  * This file is part of the Vamsas Client version 0.1. \r
3  * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
4  *  Andrew Waterhouse and Dominik Lindner.\r
5  * \r
6  * Earlier versions have also been incorporated into Jalview version 2.4 \r
7  * since 2008, and TOPALi version 2 since 2007.\r
8  * \r
9  * The Vamsas Client is free software: you can redistribute it and/or modify\r
10  * it under the terms of the GNU Lesser General Public License as published by\r
11  * the Free Software Foundation, either version 3 of the License, or\r
12  * (at your option) any later version.\r
13  *  \r
14  * The Vamsas Client is distributed in the hope that it will be useful,\r
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  * GNU Lesser General Public License for more details.\r
18  * \r
19  * You should have received a copy of the GNU Lesser General Public License\r
20  * along with the Vamsas Client.  If not, see <http://www.gnu.org/licenses/>.\r
21  */\r
22 package uk.ac.vamsas.objects.core;\r
23 \r
24 //---------------------------------/\r
25 //- Imported classes and packages -/\r
26 //---------------------------------/\r
27 \r
28 import org.exolab.castor.xml.Marshaller;\r
29 import org.exolab.castor.xml.Unmarshaller;\r
30 \r
31 /**\r
32  * \r
33  * \r
34  * @version $Revision$ $Date$\r
35  */\r
36 public class Local extends MapRangeType implements java.io.Serializable {\r
37 \r
38   // ----------------/\r
39   // - Constructors -/\r
40   // ----------------/\r
41 \r
42   public Local() {\r
43     super();\r
44   }\r
45 \r
46   // -----------/\r
47   // - Methods -/\r
48   // -----------/\r
49 \r
50   /**\r
51    * Overrides the java.lang.Object.equals method.\r
52    * \r
53    * @param obj\r
54    * @return true if the objects are equal.\r
55    */\r
56   public boolean equals(final java.lang.Object obj) {\r
57     if (this == obj)\r
58       return true;\r
59 \r
60     if (super.equals(obj) == false)\r
61       return false;\r
62 \r
63     if (obj instanceof Local) {\r
64 \r
65       return true;\r
66     }\r
67     return false;\r
68   }\r
69 \r
70   /**\r
71    * Overrides the java.lang.Object.hashCode method.\r
72    * <p>\r
73    * The following steps came from <b>Effective Java Programming Language\r
74    * Guide</b> by Joshua Bloch, Chapter 3\r
75    * \r
76    * @return a hash code value for the object.\r
77    */\r
78   public int hashCode() {\r
79     int result = super.hashCode();\r
80 \r
81     long tmp;\r
82 \r
83     return result;\r
84   }\r
85 \r
86   /**\r
87    * Method isValid.\r
88    * \r
89    * @return true if this object is valid according to the schema\r
90    */\r
91   public boolean isValid() {\r
92     try {\r
93       validate();\r
94     } catch (org.exolab.castor.xml.ValidationException vex) {\r
95       return false;\r
96     }\r
97     return true;\r
98   }\r
99 \r
100   /**\r
101    * \r
102    * \r
103    * @param out\r
104    * @throws org.exolab.castor.xml.MarshalException\r
105    *           if object is null or if any SAXException is thrown during\r
106    *           marshaling\r
107    * @throws org.exolab.castor.xml.ValidationException\r
108    *           if this object is an invalid instance according to the schema\r
109    */\r
110   public void marshal(final java.io.Writer out)\r
111       throws org.exolab.castor.xml.MarshalException,\r
112       org.exolab.castor.xml.ValidationException {\r
113     Marshaller.marshal(this, out);\r
114   }\r
115 \r
116   /**\r
117    * \r
118    * \r
119    * @param handler\r
120    * @throws java.io.IOException\r
121    *           if an IOException occurs during marshaling\r
122    * @throws org.exolab.castor.xml.ValidationException\r
123    *           if this object is an invalid instance according to the schema\r
124    * @throws org.exolab.castor.xml.MarshalException\r
125    *           if object is null or if any SAXException is thrown during\r
126    *           marshaling\r
127    */\r
128   public void marshal(final org.xml.sax.ContentHandler handler)\r
129       throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
130       org.exolab.castor.xml.ValidationException {\r
131     Marshaller.marshal(this, handler);\r
132   }\r
133 \r
134   /**\r
135    * Method unmarshal.\r
136    * \r
137    * @param reader\r
138    * @throws org.exolab.castor.xml.MarshalException\r
139    *           if object is null or if any SAXException is thrown during\r
140    *           marshaling\r
141    * @throws org.exolab.castor.xml.ValidationException\r
142    *           if this object is an invalid instance according to the schema\r
143    * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
144    */\r
145   public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
146       final java.io.Reader reader)\r
147       throws org.exolab.castor.xml.MarshalException,\r
148       org.exolab.castor.xml.ValidationException {\r
149     return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(\r
150         uk.ac.vamsas.objects.core.Local.class, reader);\r
151   }\r
152 \r
153   /**\r
154    * \r
155    * \r
156    * @throws org.exolab.castor.xml.ValidationException\r
157    *           if this object is an invalid instance according to the schema\r
158    */\r
159   public void validate() throws org.exolab.castor.xml.ValidationException {\r
160     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
161     validator.validate(this);\r
162   }\r
163 \r
164 }\r