357deb284994ae103d6d34f9d88141e459132c75
[vamsas.git] / src / uk / ac / vamsas / objects / core / Score.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  * Ordered set of optionally named float values for the\r
19  *  whole annotation \r
20  * \r
21  * @version $Revision$ $Date$\r
22  */\r
23 public class Score 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 float _content;\r
36 \r
37     /**\r
38      * keeps track of state for field: _content\r
39      */\r
40     private boolean _has_content;\r
41 \r
42     /**\r
43      * Field _name.\r
44      */\r
45     private java.lang.String _name = "score";\r
46 \r
47 \r
48       //----------------/\r
49      //- Constructors -/\r
50     //----------------/\r
51 \r
52     public Score() {\r
53         super();\r
54         setName("score");\r
55     }\r
56 \r
57 \r
58       //-----------/\r
59      //- Methods -/\r
60     //-----------/\r
61 \r
62     /**\r
63      */\r
64     public void deleteContent(\r
65     ) {\r
66         this._has_content= false;\r
67     }\r
68 \r
69     /**\r
70      * Overrides the java.lang.Object.equals method.\r
71      * \r
72      * @param obj\r
73      * @return true if the objects are equal.\r
74      */\r
75     public boolean equals(\r
76             final java.lang.Object obj) {\r
77         if ( this == obj )\r
78             return true;\r
79         \r
80         if (super.equals(obj)==false)\r
81             return false;\r
82         \r
83         if (obj instanceof Score) {\r
84         \r
85             Score temp = (Score)obj;\r
86             boolean thcycle;\r
87             boolean tmcycle;\r
88             if (this._content != temp._content)\r
89                 return false;\r
90             if (this._has_content != temp._has_content)\r
91                 return false;\r
92             if (this._name != null) {\r
93                 if (temp._name == null) return false;\r
94                 if (this._name != temp._name) {\r
95                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);\r
96                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
97                     if (thcycle!=tmcycle) {\r
98                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };\r
99                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };\r
100                         return false;\r
101                     }\r
102                     if (!thcycle) {\r
103                         if (!this._name.equals(temp._name)) {\r
104                             org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
105                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
106                             return false;\r
107                         }\r
108                         org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
109                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
110                     }\r
111                 }\r
112             } else if (temp._name != null)\r
113                 return false;\r
114             return true;\r
115         }\r
116         return false;\r
117     }\r
118 \r
119     /**\r
120      * Returns the value of field 'content'. The field 'content'\r
121      * has the following description: internal content storage\r
122      * \r
123      * @return the value of field 'Content'.\r
124      */\r
125     public float getContent(\r
126     ) {\r
127         return this._content;\r
128     }\r
129 \r
130     /**\r
131      * Returns the value of field 'name'.\r
132      * \r
133      * @return the value of field 'Name'.\r
134      */\r
135     public java.lang.String getName(\r
136     ) {\r
137         return this._name;\r
138     }\r
139 \r
140     /**\r
141      * Method hasContent.\r
142      * \r
143      * @return true if at least one Content has been added\r
144      */\r
145     public boolean hasContent(\r
146     ) {\r
147         return this._has_content;\r
148     }\r
149 \r
150     /**\r
151      * Overrides the java.lang.Object.hashCode method.\r
152      * <p>\r
153      * The following steps came from <b>Effective Java Programming\r
154      * Language Guide</b> by Joshua Bloch, Chapter 3\r
155      * \r
156      * @return a hash code value for the object.\r
157      */\r
158     public int hashCode(\r
159     ) {\r
160         int result = super.hashCode();\r
161         \r
162         long tmp;\r
163         result = 37 * result + java.lang.Float.floatToIntBits(_content);\r
164         if (_name != null\r
165             && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
166            result = 37 * result + _name.hashCode();\r
167            org.castor.util.CycleBreaker.releaseCycleHandle(_name);\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 float content) {\r
228         this._content = content;\r
229         this._has_content = true;\r
230     }\r
231 \r
232     /**\r
233      * Sets the value of field 'name'.\r
234      * \r
235      * @param name the value of field 'name'.\r
236      */\r
237     public void setName(\r
238             final java.lang.String name) {\r
239         this._name = name;\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.Score\r
251      */\r
252     public static uk.ac.vamsas.objects.core.Score 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.Score) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Score.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