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