rebult for castor-1.1(vamsas version)
[vamsas.git] / src / uk / ac / vamsas / objects / core / Glyph.java
1 /*\r
2  * This class was automatically generated with \r
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
4  * Schema.\r
5  * $Id$\r
6  */\r
7 \r
8 package uk.ac.vamsas.objects.core;\r
9 \r
10   //---------------------------------/\r
11  //- Imported classes and packages -/\r
12 //---------------------------------/\r
13 \r
14 import org.exolab.castor.xml.Marshaller;\r
15 import org.exolab.castor.xml.Unmarshaller;\r
16 \r
17 /**\r
18  * Discrete symbol - possibly graphically represented\r
19  *  \r
20  * \r
21  * @version $Revision$ $Date$\r
22  */\r
23 public class Glyph extends uk.ac.vamsas.client.Vobject \r
24 implements java.io.Serializable\r
25 {\r
26 \r
27 \r
28       //--------------------------/\r
29      //- Class/Member Variables -/\r
30     //--------------------------/\r
31 \r
32     /**\r
33      * internal content storage\r
34      */\r
35     private java.lang.String _content = "";\r
36 \r
37     /**\r
38      * specifies the symbol dictionary for this\r
39      *  glyph - eg utf8 (the default), aasecstr_3 or\r
40      *  kd_hydrophobicity - the content is not validated so\r
41      *  applications must ensure they gracefully deal with\r
42      *  invalid entries here \r
43      */\r
44     private java.lang.String _dict = "utf8";\r
45 \r
46 \r
47       //----------------/\r
48      //- Constructors -/\r
49     //----------------/\r
50 \r
51     public Glyph() {\r
52         super();\r
53         setContent("");\r
54         setDict("utf8");\r
55     }\r
56 \r
57 \r
58       //-----------/\r
59      //- Methods -/\r
60     //-----------/\r
61 \r
62     /**\r
63      * Overrides the java.lang.Object.equals method.\r
64      * \r
65      * @param obj\r
66      * @return true if the objects are equal.\r
67      */\r
68     public boolean equals(\r
69             final java.lang.Object obj) {\r
70         if ( this == obj )\r
71             return true;\r
72         \r
73         if (super.equals(obj)==false)\r
74             return false;\r
75         \r
76         if (obj instanceof Glyph) {\r
77         \r
78             Glyph temp = (Glyph)obj;\r
79             if (this._content != null) {\r
80                 if (temp._content == null) return false;\r
81                 else if (!(this._content.equals(temp._content))) \r
82                     return false;\r
83             }\r
84             else if (temp._content != null)\r
85                 return false;\r
86             if (this._dict != null) {\r
87                 if (temp._dict == null) return false;\r
88                 else if (!(this._dict.equals(temp._dict))) \r
89                     return false;\r
90             }\r
91             else if (temp._dict != null)\r
92                 return false;\r
93             return true;\r
94         }\r
95         return false;\r
96     }\r
97 \r
98     /**\r
99      * Returns the value of field 'content'. The field 'content'\r
100      * has the following description: internal content storage\r
101      * \r
102      * @return the value of field 'Content'.\r
103      */\r
104     public java.lang.String getContent(\r
105     ) {\r
106         return this._content;\r
107     }\r
108 \r
109     /**\r
110      * Returns the value of field 'dict'. The field 'dict' has the\r
111      * following description: specifies the symbol dictionary for\r
112      * this\r
113      *  glyph - eg utf8 (the default), aasecstr_3 or\r
114      *  kd_hydrophobicity - the content is not validated so\r
115      *  applications must ensure they gracefully deal with\r
116      *  invalid entries here \r
117      * \r
118      * @return the value of field 'Dict'.\r
119      */\r
120     public java.lang.String getDict(\r
121     ) {\r
122         return this._dict;\r
123     }\r
124 \r
125     /**\r
126      * Overrides the java.lang.Object.hashCode method.\r
127      * <p>\r
128      * The following steps came from <b>Effective Java Programming\r
129      * Language Guide</b> by Joshua Bloch, Chapter 3\r
130      * \r
131      * @return a hash code value for the object.\r
132      */\r
133     public int hashCode(\r
134     ) {\r
135         int result = super.hashCode();\r
136         \r
137         long tmp;\r
138         if (_content != null) {\r
139            result = 37 * result + _content.hashCode();\r
140         }\r
141         if (_dict != null) {\r
142            result = 37 * result + _dict.hashCode();\r
143         }\r
144         \r
145         return result;\r
146     }\r
147 \r
148     /**\r
149      * Method isValid.\r
150      * \r
151      * @return true if this object is valid according to the schema\r
152      */\r
153     public boolean isValid(\r
154     ) {\r
155         try {\r
156             validate();\r
157         } catch (org.exolab.castor.xml.ValidationException vex) {\r
158             return false;\r
159         }\r
160         return true;\r
161     }\r
162 \r
163     /**\r
164      * \r
165      * \r
166      * @param out\r
167      * @throws org.exolab.castor.xml.MarshalException if object is\r
168      * null or if any SAXException is thrown during marshaling\r
169      * @throws org.exolab.castor.xml.ValidationException if this\r
170      * object is an invalid instance according to the schema\r
171      */\r
172     public void marshal(\r
173             final java.io.Writer out)\r
174     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
175         Marshaller.marshal(this, out);\r
176     }\r
177 \r
178     /**\r
179      * \r
180      * \r
181      * @param handler\r
182      * @throws java.io.IOException if an IOException occurs during\r
183      * marshaling\r
184      * @throws org.exolab.castor.xml.ValidationException if this\r
185      * object is an invalid instance according to the schema\r
186      * @throws org.exolab.castor.xml.MarshalException if object is\r
187      * null or if any SAXException is thrown during marshaling\r
188      */\r
189     public void marshal(\r
190             final org.xml.sax.ContentHandler handler)\r
191     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
192         Marshaller.marshal(this, handler);\r
193     }\r
194 \r
195     /**\r
196      * Sets the value of field 'content'. The field 'content' has\r
197      * the following description: internal content storage\r
198      * \r
199      * @param content the value of field 'content'.\r
200      */\r
201     public void setContent(\r
202             final java.lang.String content) {\r
203         this._content = content;\r
204     }\r
205 \r
206     /**\r
207      * Sets the value of field 'dict'. The field 'dict' has the\r
208      * following description: specifies the symbol dictionary for\r
209      * this\r
210      *  glyph - eg utf8 (the default), aasecstr_3 or\r
211      *  kd_hydrophobicity - the content is not validated so\r
212      *  applications must ensure they gracefully deal with\r
213      *  invalid entries here \r
214      * \r
215      * @param dict the value of field 'dict'.\r
216      */\r
217     public void setDict(\r
218             final java.lang.String dict) {\r
219         this._dict = dict;\r
220     }\r
221 \r
222     /**\r
223      * Method unmarshal.\r
224      * \r
225      * @param reader\r
226      * @throws org.exolab.castor.xml.MarshalException if object is\r
227      * null or if any SAXException is thrown during marshaling\r
228      * @throws org.exolab.castor.xml.ValidationException if this\r
229      * object is an invalid instance according to the schema\r
230      * @return the unmarshaled uk.ac.vamsas.objects.core.Glyph\r
231      */\r
232     public static uk.ac.vamsas.objects.core.Glyph unmarshal(\r
233             final java.io.Reader reader)\r
234     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
235         return (uk.ac.vamsas.objects.core.Glyph) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Glyph.class, reader);\r
236     }\r
237 \r
238     /**\r
239      * \r
240      * \r
241      * @throws org.exolab.castor.xml.ValidationException if this\r
242      * object is an invalid instance according to the schema\r
243      */\r
244     public void validate(\r
245     )\r
246     throws org.exolab.castor.xml.ValidationException {\r
247         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
248         validator.validate(this);\r
249     }\r
250 \r
251 }\r