8448198457ffb2cf7581d849bd74e25db52e206a
[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             if (this._content != temp._content)\r
87                 return false;\r
88             if (this._has_content != temp._has_content)\r
89                 return false;\r
90             if (this._name != null) {\r
91                 if (temp._name == null) return false;\r
92                 else if (!(this._name.equals(temp._name))) \r
93                     return false;\r
94             }\r
95             else if (temp._name != null)\r
96                 return false;\r
97             return true;\r
98         }\r
99         return false;\r
100     }\r
101 \r
102     /**\r
103      * Returns the value of field 'content'. The field 'content'\r
104      * has the following description: internal content storage\r
105      * \r
106      * @return the value of field 'Content'.\r
107      */\r
108     public float getContent(\r
109     ) {\r
110         return this._content;\r
111     }\r
112 \r
113     /**\r
114      * Returns the value of field 'name'.\r
115      * \r
116      * @return the value of field 'Name'.\r
117      */\r
118     public java.lang.String getName(\r
119     ) {\r
120         return this._name;\r
121     }\r
122 \r
123     /**\r
124      * Method hasContent.\r
125      * \r
126      * @return true if at least one Content has been added\r
127      */\r
128     public boolean hasContent(\r
129     ) {\r
130         return this._has_content;\r
131     }\r
132 \r
133     /**\r
134      * Overrides the java.lang.Object.hashCode method.\r
135      * <p>\r
136      * The following steps came from <b>Effective Java Programming\r
137      * Language Guide</b> by Joshua Bloch, Chapter 3\r
138      * \r
139      * @return a hash code value for the object.\r
140      */\r
141     public int hashCode(\r
142     ) {\r
143         int result = super.hashCode();\r
144         \r
145         long tmp;\r
146         result = 37 * result + java.lang.Float.floatToIntBits(_content);\r
147         if (_name != null) {\r
148            result = 37 * result + _name.hashCode();\r
149         }\r
150         \r
151         return result;\r
152     }\r
153 \r
154     /**\r
155      * Method isValid.\r
156      * \r
157      * @return true if this object is valid according to the schema\r
158      */\r
159     public boolean isValid(\r
160     ) {\r
161         try {\r
162             validate();\r
163         } catch (org.exolab.castor.xml.ValidationException vex) {\r
164             return false;\r
165         }\r
166         return true;\r
167     }\r
168 \r
169     /**\r
170      * \r
171      * \r
172      * @param out\r
173      * @throws org.exolab.castor.xml.MarshalException if object is\r
174      * null or if any SAXException is thrown during marshaling\r
175      * @throws org.exolab.castor.xml.ValidationException if this\r
176      * object is an invalid instance according to the schema\r
177      */\r
178     public void marshal(\r
179             final java.io.Writer out)\r
180     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
181         Marshaller.marshal(this, out);\r
182     }\r
183 \r
184     /**\r
185      * \r
186      * \r
187      * @param handler\r
188      * @throws java.io.IOException if an IOException occurs during\r
189      * marshaling\r
190      * @throws org.exolab.castor.xml.ValidationException if this\r
191      * object is an invalid instance according to the schema\r
192      * @throws org.exolab.castor.xml.MarshalException if object is\r
193      * null or if any SAXException is thrown during marshaling\r
194      */\r
195     public void marshal(\r
196             final org.xml.sax.ContentHandler handler)\r
197     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
198         Marshaller.marshal(this, handler);\r
199     }\r
200 \r
201     /**\r
202      * Sets the value of field 'content'. The field 'content' has\r
203      * the following description: internal content storage\r
204      * \r
205      * @param content the value of field 'content'.\r
206      */\r
207     public void setContent(\r
208             final float content) {\r
209         this._content = content;\r
210         this._has_content = true;\r
211     }\r
212 \r
213     /**\r
214      * Sets the value of field 'name'.\r
215      * \r
216      * @param name the value of field 'name'.\r
217      */\r
218     public void setName(\r
219             final java.lang.String name) {\r
220         this._name = name;\r
221     }\r
222 \r
223     /**\r
224      * Method unmarshal.\r
225      * \r
226      * @param reader\r
227      * @throws org.exolab.castor.xml.MarshalException if object is\r
228      * null or if any SAXException is thrown during marshaling\r
229      * @throws org.exolab.castor.xml.ValidationException if this\r
230      * object is an invalid instance according to the schema\r
231      * @return the unmarshaled uk.ac.vamsas.objects.core.Score\r
232      */\r
233     public static uk.ac.vamsas.objects.core.Score unmarshal(\r
234             final java.io.Reader reader)\r
235     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
236         return (uk.ac.vamsas.objects.core.Score) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Score.class, reader);\r
237     }\r
238 \r
239     /**\r
240      * \r
241      * \r
242      * @throws org.exolab.castor.xml.ValidationException if this\r
243      * object is an invalid instance according to the schema\r
244      */\r
245     public void validate(\r
246     )\r
247     throws org.exolab.castor.xml.ValidationException {\r
248         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
249         validator.validate(this);\r
250     }\r
251 \r
252 }\r