e9cece2ca74380455552662768cfed9a1e7baaf2
[vamsas.git] / src / uk / ac / vamsas / objects / core / Param.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  * Class Param.\r
19  * \r
20  * @version $Revision$ $Date$\r
21  */\r
22 public class Param extends uk.ac.vamsas.client.Vobject \r
23 implements java.io.Serializable\r
24 {\r
25 \r
26 \r
27       //--------------------------/\r
28      //- Class/Member Variables -/\r
29     //--------------------------/\r
30 \r
31     /**\r
32      * internal content storage\r
33      */\r
34     private java.lang.String _content = "";\r
35 \r
36     /**\r
37      * Field _name.\r
38      */\r
39     private java.lang.String _name;\r
40 \r
41     /**\r
42      * The type specifies how the property will be parsed.\r
43      *  Empty property strings are allowed, and can be used to\r
44      * prototype the\r
45      *  input to a document. TODO: specify allowed types \r
46      */\r
47     private java.lang.String _type;\r
48 \r
49 \r
50       //----------------/\r
51      //- Constructors -/\r
52     //----------------/\r
53 \r
54     public Param() {\r
55         super();\r
56         setContent("");\r
57     }\r
58 \r
59 \r
60       //-----------/\r
61      //- Methods -/\r
62     //-----------/\r
63 \r
64     /**\r
65      * Overrides the java.lang.Object.equals method.\r
66      * \r
67      * @param obj\r
68      * @return true if the objects are equal.\r
69      */\r
70     public boolean equals(\r
71             final java.lang.Object obj) {\r
72         if ( this == obj )\r
73             return true;\r
74         \r
75         if (super.equals(obj)==false)\r
76             return false;\r
77         \r
78         if (obj instanceof Param) {\r
79         \r
80             Param temp = (Param)obj;\r
81             boolean thcycle;\r
82             boolean tmcycle;\r
83             if (this._content != null) {\r
84                 if (temp._content == null) return false;\r
85                 if (this._content != temp._content) {\r
86                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);\r
87                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
88                     if (thcycle!=tmcycle) {\r
89                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };\r
90                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };\r
91                         return false;\r
92                     }\r
93                     if (!thcycle) {\r
94                         if (!this._content.equals(temp._content)) {\r
95                             org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
96                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
97                             return false;\r
98                         }\r
99                         org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
100                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
101                     }\r
102                 }\r
103             } else if (temp._content != null)\r
104                 return false;\r
105             if (this._name != null) {\r
106                 if (temp._name == null) return false;\r
107                 if (this._name != temp._name) {\r
108                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);\r
109                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
110                     if (thcycle!=tmcycle) {\r
111                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };\r
112                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };\r
113                         return false;\r
114                     }\r
115                     if (!thcycle) {\r
116                         if (!this._name.equals(temp._name)) {\r
117                             org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
118                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
119                             return false;\r
120                         }\r
121                         org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
122                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
123                     }\r
124                 }\r
125             } else if (temp._name != null)\r
126                 return false;\r
127             if (this._type != null) {\r
128                 if (temp._type == null) return false;\r
129                 if (this._type != temp._type) {\r
130                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._type);\r
131                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._type);\r
132                     if (thcycle!=tmcycle) {\r
133                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._type); };\r
134                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._type); };\r
135                         return false;\r
136                     }\r
137                     if (!thcycle) {\r
138                         if (!this._type.equals(temp._type)) {\r
139                             org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
140                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
141                             return false;\r
142                         }\r
143                         org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
144                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
145                     }\r
146                 }\r
147             } else if (temp._type != null)\r
148                 return false;\r
149             return true;\r
150         }\r
151         return false;\r
152     }\r
153 \r
154     /**\r
155      * Returns the value of field 'content'. The field 'content'\r
156      * has the following description: internal content storage\r
157      * \r
158      * @return the value of field 'Content'.\r
159      */\r
160     public java.lang.String getContent(\r
161     ) {\r
162         return this._content;\r
163     }\r
164 \r
165     /**\r
166      * Returns the value of field 'name'.\r
167      * \r
168      * @return the value of field 'Name'.\r
169      */\r
170     public java.lang.String getName(\r
171     ) {\r
172         return this._name;\r
173     }\r
174 \r
175     /**\r
176      * Returns the value of field 'type'. The field 'type' has the\r
177      * following description: The type specifies how the property\r
178      * will be parsed.\r
179      *  Empty property strings are allowed, and can be used to\r
180      * prototype the\r
181      *  input to a document. TODO: specify allowed types \r
182      * \r
183      * @return the value of field 'Type'.\r
184      */\r
185     public java.lang.String getType(\r
186     ) {\r
187         return this._type;\r
188     }\r
189 \r
190     /**\r
191      * Overrides the java.lang.Object.hashCode method.\r
192      * <p>\r
193      * The following steps came from <b>Effective Java Programming\r
194      * Language Guide</b> by Joshua Bloch, Chapter 3\r
195      * \r
196      * @return a hash code value for the object.\r
197      */\r
198     public int hashCode(\r
199     ) {\r
200         int result = super.hashCode();\r
201         \r
202         long tmp;\r
203         if (_content != null\r
204             && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
205            result = 37 * result + _content.hashCode();\r
206            org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
207         }\r
208         if (_name != null\r
209             && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
210            result = 37 * result + _name.hashCode();\r
211            org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
212         }\r
213         if (_type != null\r
214             && !org.castor.util.CycleBreaker.startingToCycle(_type)) {\r
215            result = 37 * result + _type.hashCode();\r
216            org.castor.util.CycleBreaker.releaseCycleHandle(_type);\r
217         }\r
218         \r
219         return result;\r
220     }\r
221 \r
222     /**\r
223      * Method isValid.\r
224      * \r
225      * @return true if this object is valid according to the schema\r
226      */\r
227     public boolean isValid(\r
228     ) {\r
229         try {\r
230             validate();\r
231         } catch (org.exolab.castor.xml.ValidationException vex) {\r
232             return false;\r
233         }\r
234         return true;\r
235     }\r
236 \r
237     /**\r
238      * \r
239      * \r
240      * @param out\r
241      * @throws org.exolab.castor.xml.MarshalException if object is\r
242      * null or if any SAXException is thrown during marshaling\r
243      * @throws org.exolab.castor.xml.ValidationException if this\r
244      * object is an invalid instance according to the schema\r
245      */\r
246     public void marshal(\r
247             final java.io.Writer out)\r
248     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
249         Marshaller.marshal(this, out);\r
250     }\r
251 \r
252     /**\r
253      * \r
254      * \r
255      * @param handler\r
256      * @throws java.io.IOException if an IOException occurs during\r
257      * marshaling\r
258      * @throws org.exolab.castor.xml.ValidationException if this\r
259      * object is an invalid instance according to the schema\r
260      * @throws org.exolab.castor.xml.MarshalException if object is\r
261      * null or if any SAXException is thrown during marshaling\r
262      */\r
263     public void marshal(\r
264             final org.xml.sax.ContentHandler handler)\r
265     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
266         Marshaller.marshal(this, handler);\r
267     }\r
268 \r
269     /**\r
270      * Sets the value of field 'content'. The field 'content' has\r
271      * the following description: internal content storage\r
272      * \r
273      * @param content the value of field 'content'.\r
274      */\r
275     public void setContent(\r
276             final java.lang.String content) {\r
277         this._content = content;\r
278     }\r
279 \r
280     /**\r
281      * Sets the value of field 'name'.\r
282      * \r
283      * @param name the value of field 'name'.\r
284      */\r
285     public void setName(\r
286             final java.lang.String name) {\r
287         this._name = name;\r
288     }\r
289 \r
290     /**\r
291      * Sets the value of field 'type'. The field 'type' has the\r
292      * following description: The type specifies how the property\r
293      * will be parsed.\r
294      *  Empty property strings are allowed, and can be used to\r
295      * prototype the\r
296      *  input to a document. TODO: specify allowed types \r
297      * \r
298      * @param type the value of field 'type'.\r
299      */\r
300     public void setType(\r
301             final java.lang.String type) {\r
302         this._type = type;\r
303     }\r
304 \r
305     /**\r
306      * Method unmarshal.\r
307      * \r
308      * @param reader\r
309      * @throws org.exolab.castor.xml.MarshalException if object is\r
310      * null or if any SAXException is thrown during marshaling\r
311      * @throws org.exolab.castor.xml.ValidationException if this\r
312      * object is an invalid instance according to the schema\r
313      * @return the unmarshaled uk.ac.vamsas.objects.core.Param\r
314      */\r
315     public static uk.ac.vamsas.objects.core.Param unmarshal(\r
316             final java.io.Reader reader)\r
317     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
318         return (uk.ac.vamsas.objects.core.Param) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Param.class, reader);\r
319     }\r
320 \r
321     /**\r
322      * \r
323      * \r
324      * @throws org.exolab.castor.xml.ValidationException if this\r
325      * object is an invalid instance according to the schema\r
326      */\r
327     public void validate(\r
328     )\r
329     throws org.exolab.castor.xml.ValidationException {\r
330         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
331         validator.validate(this);\r
332     }\r
333 \r
334 }\r