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