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