rebult for castor-1.1(vamsas version)
[vamsas.git] / src / uk / ac / vamsas / objects / core / Seg.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  * a region from start to end, with flag for inclusivity of\r
19  *  terminii \r
20  * \r
21  * @version $Revision$ $Date$\r
22  */\r
23 public class Seg 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      * Field _start.\r
34      */\r
35     private int _start;\r
36 \r
37     /**\r
38      * keeps track of state for field: _start\r
39      */\r
40     private boolean _has_start;\r
41 \r
42     /**\r
43      * Field _end.\r
44      */\r
45     private int _end;\r
46 \r
47     /**\r
48      * keeps track of state for field: _end\r
49      */\r
50     private boolean _has_end;\r
51 \r
52     /**\r
53      * when false, a consecutive range like 'start=1, end=2'\r
54      *  means the region lying after position 1 and before position\r
55      * 2\r
56      *  \r
57      */\r
58     private boolean _inclusive;\r
59 \r
60     /**\r
61      * keeps track of state for field: _inclusive\r
62      */\r
63     private boolean _has_inclusive;\r
64 \r
65 \r
66       //----------------/\r
67      //- Constructors -/\r
68     //----------------/\r
69 \r
70     public Seg() {\r
71         super();\r
72     }\r
73 \r
74 \r
75       //-----------/\r
76      //- Methods -/\r
77     //-----------/\r
78 \r
79     /**\r
80      */\r
81     public void deleteEnd(\r
82     ) {\r
83         this._has_end= false;\r
84     }\r
85 \r
86     /**\r
87      */\r
88     public void deleteInclusive(\r
89     ) {\r
90         this._has_inclusive= false;\r
91     }\r
92 \r
93     /**\r
94      */\r
95     public void deleteStart(\r
96     ) {\r
97         this._has_start= false;\r
98     }\r
99 \r
100     /**\r
101      * Overrides the java.lang.Object.equals method.\r
102      * \r
103      * @param obj\r
104      * @return true if the objects are equal.\r
105      */\r
106     public boolean equals(\r
107             final java.lang.Object obj) {\r
108         if ( this == obj )\r
109             return true;\r
110         \r
111         if (super.equals(obj)==false)\r
112             return false;\r
113         \r
114         if (obj instanceof Seg) {\r
115         \r
116             Seg temp = (Seg)obj;\r
117             if (this._start != temp._start)\r
118                 return false;\r
119             if (this._has_start != temp._has_start)\r
120                 return false;\r
121             if (this._end != temp._end)\r
122                 return false;\r
123             if (this._has_end != temp._has_end)\r
124                 return false;\r
125             if (this._inclusive != temp._inclusive)\r
126                 return false;\r
127             if (this._has_inclusive != temp._has_inclusive)\r
128                 return false;\r
129             return true;\r
130         }\r
131         return false;\r
132     }\r
133 \r
134     /**\r
135      * Returns the value of field 'end'.\r
136      * \r
137      * @return the value of field 'End'.\r
138      */\r
139     public int getEnd(\r
140     ) {\r
141         return this._end;\r
142     }\r
143 \r
144     /**\r
145      * Returns the value of field 'inclusive'. The field\r
146      * 'inclusive' has the following description: when false, a\r
147      * consecutive range like 'start=1, end=2'\r
148      *  means the region lying after position 1 and before position\r
149      * 2\r
150      *  \r
151      * \r
152      * @return the value of field 'Inclusive'.\r
153      */\r
154     public boolean getInclusive(\r
155     ) {\r
156         return this._inclusive;\r
157     }\r
158 \r
159     /**\r
160      * Returns the value of field 'start'.\r
161      * \r
162      * @return the value of field 'Start'.\r
163      */\r
164     public int getStart(\r
165     ) {\r
166         return this._start;\r
167     }\r
168 \r
169     /**\r
170      * Method hasEnd.\r
171      * \r
172      * @return true if at least one End has been added\r
173      */\r
174     public boolean hasEnd(\r
175     ) {\r
176         return this._has_end;\r
177     }\r
178 \r
179     /**\r
180      * Method hasInclusive.\r
181      * \r
182      * @return true if at least one Inclusive has been added\r
183      */\r
184     public boolean hasInclusive(\r
185     ) {\r
186         return this._has_inclusive;\r
187     }\r
188 \r
189     /**\r
190      * Method hasStart.\r
191      * \r
192      * @return true if at least one Start has been added\r
193      */\r
194     public boolean hasStart(\r
195     ) {\r
196         return this._has_start;\r
197     }\r
198 \r
199     /**\r
200      * Overrides the java.lang.Object.hashCode method.\r
201      * <p>\r
202      * The following steps came from <b>Effective Java Programming\r
203      * Language Guide</b> by Joshua Bloch, Chapter 3\r
204      * \r
205      * @return a hash code value for the object.\r
206      */\r
207     public int hashCode(\r
208     ) {\r
209         int result = super.hashCode();\r
210         \r
211         long tmp;\r
212         result = 37 * result + _start;\r
213         result = 37 * result + _end;\r
214         result = 37 * result + (_inclusive?0:1);\r
215         \r
216         return result;\r
217     }\r
218 \r
219     /**\r
220      * Returns the value of field 'inclusive'. The field\r
221      * 'inclusive' has the following description: when false, a\r
222      * consecutive range like 'start=1, end=2'\r
223      *  means the region lying after position 1 and before position\r
224      * 2\r
225      *  \r
226      * \r
227      * @return the value of field 'Inclusive'.\r
228      */\r
229     public boolean isInclusive(\r
230     ) {\r
231         return this._inclusive;\r
232     }\r
233 \r
234     /**\r
235      * Method isValid.\r
236      * \r
237      * @return true if this object is valid according to the schema\r
238      */\r
239     public boolean isValid(\r
240     ) {\r
241         try {\r
242             validate();\r
243         } catch (org.exolab.castor.xml.ValidationException vex) {\r
244             return false;\r
245         }\r
246         return true;\r
247     }\r
248 \r
249     /**\r
250      * \r
251      * \r
252      * @param out\r
253      * @throws org.exolab.castor.xml.MarshalException if object is\r
254      * null or if any SAXException is thrown during marshaling\r
255      * @throws org.exolab.castor.xml.ValidationException if this\r
256      * object is an invalid instance according to the schema\r
257      */\r
258     public void marshal(\r
259             final java.io.Writer out)\r
260     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
261         Marshaller.marshal(this, out);\r
262     }\r
263 \r
264     /**\r
265      * \r
266      * \r
267      * @param handler\r
268      * @throws java.io.IOException if an IOException occurs during\r
269      * marshaling\r
270      * @throws org.exolab.castor.xml.ValidationException if this\r
271      * object is an invalid instance according to the schema\r
272      * @throws org.exolab.castor.xml.MarshalException if object is\r
273      * null or if any SAXException is thrown during marshaling\r
274      */\r
275     public void marshal(\r
276             final org.xml.sax.ContentHandler handler)\r
277     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
278         Marshaller.marshal(this, handler);\r
279     }\r
280 \r
281     /**\r
282      * Sets the value of field 'end'.\r
283      * \r
284      * @param end the value of field 'end'.\r
285      */\r
286     public void setEnd(\r
287             final int end) {\r
288         this._end = end;\r
289         this._has_end = true;\r
290     }\r
291 \r
292     /**\r
293      * Sets the value of field 'inclusive'. The field 'inclusive'\r
294      * has the following description: when false, a consecutive\r
295      * range like 'start=1, end=2'\r
296      *  means the region lying after position 1 and before position\r
297      * 2\r
298      *  \r
299      * \r
300      * @param inclusive the value of field 'inclusive'.\r
301      */\r
302     public void setInclusive(\r
303             final boolean inclusive) {\r
304         this._inclusive = inclusive;\r
305         this._has_inclusive = true;\r
306     }\r
307 \r
308     /**\r
309      * Sets the value of field 'start'.\r
310      * \r
311      * @param start the value of field 'start'.\r
312      */\r
313     public void setStart(\r
314             final int start) {\r
315         this._start = start;\r
316         this._has_start = true;\r
317     }\r
318 \r
319     /**\r
320      * Method unmarshal.\r
321      * \r
322      * @param reader\r
323      * @throws org.exolab.castor.xml.MarshalException if object is\r
324      * null or if any SAXException is thrown during marshaling\r
325      * @throws org.exolab.castor.xml.ValidationException if this\r
326      * object is an invalid instance according to the schema\r
327      * @return the unmarshaled uk.ac.vamsas.objects.core.Seg\r
328      */\r
329     public static uk.ac.vamsas.objects.core.Seg unmarshal(\r
330             final java.io.Reader reader)\r
331     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
332         return (uk.ac.vamsas.objects.core.Seg) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Seg.class, reader);\r
333     }\r
334 \r
335     /**\r
336      * \r
337      * \r
338      * @throws org.exolab.castor.xml.ValidationException if this\r
339      * object is an invalid instance according to the schema\r
340      */\r
341     public void validate(\r
342     )\r
343     throws org.exolab.castor.xml.ValidationException {\r
344         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
345         validator.validate(this);\r
346     }\r
347 \r
348 }\r