2813c569ed0b60030ec2e9bed35f4494deeba42c
[vamsas.git] / src / uk / ac / vamsas / objects / core / Newick.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package uk.ac.vamsas.objects.core;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class Newick.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class Newick extends uk.ac.vamsas.client.Vobject 
23 implements java.io.Serializable
24 {
25
26
27       //--------------------------/
28      //- Class/Member Variables -/
29     //--------------------------/
30
31     /**
32      * internal content storage
33      */
34     private java.lang.String _content = "";
35
36     /**
37      * Field _title.
38      */
39     private java.lang.String _title;
40
41     /**
42      * Primary Key for vamsas object referencing
43      *  
44      */
45     private java.lang.String _id;
46
47     /**
48      * Field _modifiable.
49      */
50     private java.lang.String _modifiable;
51
52
53       //----------------/
54      //- Constructors -/
55     //----------------/
56
57     public Newick() {
58         super();
59         setContent("");
60     }
61
62
63       //-----------/
64      //- Methods -/
65     //-----------/
66
67     /**
68      * Overrides the java.lang.Object.equals method.
69      * 
70      * @param obj
71      * @return true if the objects are equal.
72      */
73     public boolean equals(
74             final java.lang.Object obj) {
75         if ( this == obj )
76             return true;
77         
78         if (super.equals(obj)==false)
79             return false;
80         
81         if (obj instanceof Newick) {
82         
83             Newick temp = (Newick)obj;
84             boolean thcycle;
85             boolean tmcycle;
86             if (this._content != null) {
87                 if (temp._content == null) return false;
88                 if (this._content != temp._content) {
89                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);
90                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);
91                     if (thcycle!=tmcycle) {
92                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };
93                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };
94                         return false;
95                     }
96                     if (!thcycle) {
97                         if (!this._content.equals(temp._content)) {
98                             org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
99                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
100                             return false;
101                         }
102                         org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
103                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
104                     }
105                 }
106             } else if (temp._content != null)
107                 return false;
108             if (this._title != null) {
109                 if (temp._title == null) return false;
110                 if (this._title != temp._title) {
111                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._title);
112                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._title);
113                     if (thcycle!=tmcycle) {
114                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._title); };
115                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._title); };
116                         return false;
117                     }
118                     if (!thcycle) {
119                         if (!this._title.equals(temp._title)) {
120                             org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
121                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
122                             return false;
123                         }
124                         org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
125                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
126                     }
127                 }
128             } else if (temp._title != null)
129                 return false;
130             if (this._id != null) {
131                 if (temp._id == null) return false;
132                 if (this._id != temp._id) {
133                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
134                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
135                     if (thcycle!=tmcycle) {
136                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
137                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
138                         return false;
139                     }
140                     if (!thcycle) {
141                         if (!this._id.equals(temp._id)) {
142                             org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
143                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
144                             return false;
145                         }
146                         org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
147                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
148                     }
149                 }
150             } else if (temp._id != null)
151                 return false;
152             if (this._modifiable != null) {
153                 if (temp._modifiable == null) return false;
154                 if (this._modifiable != temp._modifiable) {
155                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._modifiable);
156                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._modifiable);
157                     if (thcycle!=tmcycle) {
158                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable); };
159                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable); };
160                         return false;
161                     }
162                     if (!thcycle) {
163                         if (!this._modifiable.equals(temp._modifiable)) {
164                             org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
165                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
166                             return false;
167                         }
168                         org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
169                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
170                     }
171                 }
172             } else if (temp._modifiable != null)
173                 return false;
174             return true;
175         }
176         return false;
177     }
178
179     /**
180      * Returns the value of field 'content'. The field 'content'
181      * has the following description: internal content storage
182      * 
183      * @return the value of field 'Content'.
184      */
185     public java.lang.String getContent(
186     ) {
187         return this._content;
188     }
189
190     /**
191      * Returns the value of field 'id'. The field 'id' has the
192      * following description: Primary Key for vamsas object
193      * referencing
194      *  
195      * 
196      * @return the value of field 'Id'.
197      */
198     public java.lang.String getId(
199     ) {
200         return this._id;
201     }
202
203     /**
204      * Returns the value of field 'modifiable'.
205      * 
206      * @return the value of field 'Modifiable'.
207      */
208     public java.lang.String getModifiable(
209     ) {
210         return this._modifiable;
211     }
212
213     /**
214      * Returns the value of field 'title'.
215      * 
216      * @return the value of field 'Title'.
217      */
218     public java.lang.String getTitle(
219     ) {
220         return this._title;
221     }
222
223     /**
224      * Overrides the java.lang.Object.hashCode method.
225      * <p>
226      * The following steps came from <b>Effective Java Programming
227      * Language Guide</b> by Joshua Bloch, Chapter 3
228      * 
229      * @return a hash code value for the object.
230      */
231     public int hashCode(
232     ) {
233         int result = super.hashCode();
234         
235         long tmp;
236         if (_content != null
237             && !org.castor.util.CycleBreaker.startingToCycle(_content)) {
238            result = 37 * result + _content.hashCode();
239            org.castor.util.CycleBreaker.releaseCycleHandle(_content);
240         }
241         if (_title != null
242             && !org.castor.util.CycleBreaker.startingToCycle(_title)) {
243            result = 37 * result + _title.hashCode();
244            org.castor.util.CycleBreaker.releaseCycleHandle(_title);
245         }
246         if (_id != null
247             && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
248            result = 37 * result + _id.hashCode();
249            org.castor.util.CycleBreaker.releaseCycleHandle(_id);
250         }
251         if (_modifiable != null
252             && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
253            result = 37 * result + _modifiable.hashCode();
254            org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
255         }
256         
257         return result;
258     }
259
260     /**
261      * Method isValid.
262      * 
263      * @return true if this object is valid according to the schema
264      */
265     public boolean isValid(
266     ) {
267         try {
268             validate();
269         } catch (org.exolab.castor.xml.ValidationException vex) {
270             return false;
271         }
272         return true;
273     }
274
275     /**
276      * 
277      * 
278      * @param out
279      * @throws org.exolab.castor.xml.MarshalException if object is
280      * null or if any SAXException is thrown during marshaling
281      * @throws org.exolab.castor.xml.ValidationException if this
282      * object is an invalid instance according to the schema
283      */
284     public void marshal(
285             final java.io.Writer out)
286     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
287         Marshaller.marshal(this, out);
288     }
289
290     /**
291      * 
292      * 
293      * @param handler
294      * @throws java.io.IOException if an IOException occurs during
295      * marshaling
296      * @throws org.exolab.castor.xml.ValidationException if this
297      * object is an invalid instance according to the schema
298      * @throws org.exolab.castor.xml.MarshalException if object is
299      * null or if any SAXException is thrown during marshaling
300      */
301     public void marshal(
302             final org.xml.sax.ContentHandler handler)
303     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
304         Marshaller.marshal(this, handler);
305     }
306
307     /**
308      * Sets the value of field 'content'. The field 'content' has
309      * the following description: internal content storage
310      * 
311      * @param content the value of field 'content'.
312      */
313     public void setContent(
314             final java.lang.String content) {
315         this._content = content;
316     }
317
318     /**
319      * Sets the value of field 'id'. The field 'id' has the
320      * following description: Primary Key for vamsas object
321      * referencing
322      *  
323      * 
324      * @param id the value of field 'id'.
325      */
326     public void setId(
327             final java.lang.String id) {
328         this._id = id;
329     }
330
331     /**
332      * Sets the value of field 'modifiable'.
333      * 
334      * @param modifiable the value of field 'modifiable'.
335      */
336     public void setModifiable(
337             final java.lang.String modifiable) {
338         this._modifiable = modifiable;
339     }
340
341     /**
342      * Sets the value of field 'title'.
343      * 
344      * @param title the value of field 'title'.
345      */
346     public void setTitle(
347             final java.lang.String title) {
348         this._title = title;
349     }
350
351     /**
352      * Method unmarshal.
353      * 
354      * @param reader
355      * @throws org.exolab.castor.xml.MarshalException if object is
356      * null or if any SAXException is thrown during marshaling
357      * @throws org.exolab.castor.xml.ValidationException if this
358      * object is an invalid instance according to the schema
359      * @return the unmarshaled uk.ac.vamsas.objects.core.Newick
360      */
361     public static uk.ac.vamsas.objects.core.Newick unmarshal(
362             final java.io.Reader reader)
363     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
364         return (uk.ac.vamsas.objects.core.Newick) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Newick.class, reader);
365     }
366
367     /**
368      * 
369      * 
370      * @throws org.exolab.castor.xml.ValidationException if this
371      * object is an invalid instance according to the schema
372      */
373     public void validate(
374     )
375     throws org.exolab.castor.xml.ValidationException {
376         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
377         validator.validate(this);
378     }
379
380 }