5174b808cb9101d28d353138fb5242fa8a407705
[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             boolean thcycle;\r
118             boolean tmcycle;\r
119             if (this._start != temp._start)\r
120                 return false;\r
121             if (this._has_start != temp._has_start)\r
122                 return false;\r
123             if (this._end != temp._end)\r
124                 return false;\r
125             if (this._has_end != temp._has_end)\r
126                 return false;\r
127             if (this._inclusive != temp._inclusive)\r
128                 return false;\r
129             if (this._has_inclusive != temp._has_inclusive)\r
130                 return false;\r
131             return true;\r
132         }\r
133         return false;\r
134     }\r
135 \r
136     /**\r
137      * Returns the value of field 'end'.\r
138      * \r
139      * @return the value of field 'End'.\r
140      */\r
141     public int getEnd(\r
142     ) {\r
143         return this._end;\r
144     }\r
145 \r
146     /**\r
147      * Returns the value of field 'inclusive'. The field\r
148      * 'inclusive' has the following description: when false, a\r
149      * consecutive range like 'start=1, end=2'\r
150      *  means the region lying after position 1 and before position\r
151      * 2\r
152      *  \r
153      * \r
154      * @return the value of field 'Inclusive'.\r
155      */\r
156     public boolean getInclusive(\r
157     ) {\r
158         return this._inclusive;\r
159     }\r
160 \r
161     /**\r
162      * Returns the value of field 'start'.\r
163      * \r
164      * @return the value of field 'Start'.\r
165      */\r
166     public int getStart(\r
167     ) {\r
168         return this._start;\r
169     }\r
170 \r
171     /**\r
172      * Method hasEnd.\r
173      * \r
174      * @return true if at least one End has been added\r
175      */\r
176     public boolean hasEnd(\r
177     ) {\r
178         return this._has_end;\r
179     }\r
180 \r
181     /**\r
182      * Method hasInclusive.\r
183      * \r
184      * @return true if at least one Inclusive has been added\r
185      */\r
186     public boolean hasInclusive(\r
187     ) {\r
188         return this._has_inclusive;\r
189     }\r
190 \r
191     /**\r
192      * Method hasStart.\r
193      * \r
194      * @return true if at least one Start has been added\r
195      */\r
196     public boolean hasStart(\r
197     ) {\r
198         return this._has_start;\r
199     }\r
200 \r
201     /**\r
202      * Overrides the java.lang.Object.hashCode method.\r
203      * <p>\r
204      * The following steps came from <b>Effective Java Programming\r
205      * Language Guide</b> by Joshua Bloch, Chapter 3\r
206      * \r
207      * @return a hash code value for the object.\r
208      */\r
209     public int hashCode(\r
210     ) {\r
211         int result = super.hashCode();\r
212         \r
213         long tmp;\r
214         result = 37 * result + _start;\r
215         result = 37 * result + _end;\r
216         result = 37 * result + (_inclusive?0:1);\r
217         \r
218         return result;\r
219     }\r
220 \r
221     /**\r
222      * Returns the value of field 'inclusive'. The field\r
223      * 'inclusive' has the following description: when false, a\r
224      * consecutive range like 'start=1, end=2'\r
225      *  means the region lying after position 1 and before position\r
226      * 2\r
227      *  \r
228      * \r
229      * @return the value of field 'Inclusive'.\r
230      */\r
231     public boolean isInclusive(\r
232     ) {\r
233         return this._inclusive;\r
234     }\r
235 \r
236     /**\r
237      * Method isValid.\r
238      * \r
239      * @return true if this object is valid according to the schema\r
240      */\r
241     public boolean isValid(\r
242     ) {\r
243         try {\r
244             validate();\r
245         } catch (org.exolab.castor.xml.ValidationException vex) {\r
246             return false;\r
247         }\r
248         return true;\r
249     }\r
250 \r
251     /**\r
252      * \r
253      * \r
254      * @param out\r
255      * @throws org.exolab.castor.xml.MarshalException if object is\r
256      * null or if any SAXException is thrown during marshaling\r
257      * @throws org.exolab.castor.xml.ValidationException if this\r
258      * object is an invalid instance according to the schema\r
259      */\r
260     public void marshal(\r
261             final java.io.Writer out)\r
262     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
263         Marshaller.marshal(this, out);\r
264     }\r
265 \r
266     /**\r
267      * \r
268      * \r
269      * @param handler\r
270      * @throws java.io.IOException if an IOException occurs during\r
271      * marshaling\r
272      * @throws org.exolab.castor.xml.ValidationException if this\r
273      * object is an invalid instance according to the schema\r
274      * @throws org.exolab.castor.xml.MarshalException if object is\r
275      * null or if any SAXException is thrown during marshaling\r
276      */\r
277     public void marshal(\r
278             final org.xml.sax.ContentHandler handler)\r
279     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
280         Marshaller.marshal(this, handler);\r
281     }\r
282 \r
283     /**\r
284      * Sets the value of field 'end'.\r
285      * \r
286      * @param end the value of field 'end'.\r
287      */\r
288     public void setEnd(\r
289             final int end) {\r
290         this._end = end;\r
291         this._has_end = true;\r
292     }\r
293 \r
294     /**\r
295      * Sets the value of field 'inclusive'. The field 'inclusive'\r
296      * has the following description: when false, a consecutive\r
297      * range like 'start=1, end=2'\r
298      *  means the region lying after position 1 and before position\r
299      * 2\r
300      *  \r
301      * \r
302      * @param inclusive the value of field 'inclusive'.\r
303      */\r
304     public void setInclusive(\r
305             final boolean inclusive) {\r
306         this._inclusive = inclusive;\r
307         this._has_inclusive = true;\r
308     }\r
309 \r
310     /**\r
311      * Sets the value of field 'start'.\r
312      * \r
313      * @param start the value of field 'start'.\r
314      */\r
315     public void setStart(\r
316             final int start) {\r
317         this._start = start;\r
318         this._has_start = true;\r
319     }\r
320 \r
321     /**\r
322      * Method unmarshal.\r
323      * \r
324      * @param reader\r
325      * @throws org.exolab.castor.xml.MarshalException if object is\r
326      * null or if any SAXException is thrown during marshaling\r
327      * @throws org.exolab.castor.xml.ValidationException if this\r
328      * object is an invalid instance according to the schema\r
329      * @return the unmarshaled uk.ac.vamsas.objects.core.Seg\r
330      */\r
331     public static uk.ac.vamsas.objects.core.Seg unmarshal(\r
332             final java.io.Reader reader)\r
333     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
334         return (uk.ac.vamsas.objects.core.Seg) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Seg.class, reader);\r
335     }\r
336 \r
337     /**\r
338      * \r
339      * \r
340      * @throws org.exolab.castor.xml.ValidationException if this\r
341      * object is an invalid instance according to the schema\r
342      */\r
343     public void validate(\r
344     )\r
345     throws org.exolab.castor.xml.ValidationException {\r
346         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
347         validator.validate(this);\r
348     }\r
349 \r
350 }\r