c3906878c28190ff29c40360dd4245d70ef39f33
[vamsas.git] / src / uk / ac / vamsas / objects / core / MapRangeType.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 MapRangeType.\r
19  * \r
20  * @version $Revision$ $Date$\r
21  */\r
22 public class MapRangeType extends uk.ac.vamsas.objects.core.RangeType \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      * number of dictionary symbol widths involved in each\r
33      *  mapped position on this sequence (for example, 3 for a dna\r
34      * sequence exon\r
35      *  region that is being mapped to a protein sequence). This is\r
36      * optional,\r
37      *  since the unit can be usually be inferred from the\r
38      * dictionary type of\r
39      *  each sequence involved in the mapping. \r
40      */\r
41     private long _unit;\r
42 \r
43     /**\r
44      * keeps track of state for field: _unit\r
45      */\r
46     private boolean _has_unit;\r
47 \r
48 \r
49       //----------------/\r
50      //- Constructors -/\r
51     //----------------/\r
52 \r
53     public MapRangeType() {\r
54         super();\r
55     }\r
56 \r
57 \r
58       //-----------/\r
59      //- Methods -/\r
60     //-----------/\r
61 \r
62     /**\r
63      */\r
64     public void deleteUnit(\r
65     ) {\r
66         this._has_unit= 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 MapRangeType) {\r
84         \r
85             MapRangeType temp = (MapRangeType)obj;\r
86             boolean thcycle;\r
87             boolean tmcycle;\r
88             if (this._unit != temp._unit)\r
89                 return false;\r
90             if (this._has_unit != temp._has_unit)\r
91                 return false;\r
92             return true;\r
93         }\r
94         return false;\r
95     }\r
96 \r
97     /**\r
98      * Returns the value of field 'unit'. The field 'unit' has the\r
99      * following description: number of dictionary symbol widths\r
100      * involved in each\r
101      *  mapped position on this sequence (for example, 3 for a dna\r
102      * sequence exon\r
103      *  region that is being mapped to a protein sequence). This is\r
104      * optional,\r
105      *  since the unit can be usually be inferred from the\r
106      * dictionary type of\r
107      *  each sequence involved in the mapping. \r
108      * \r
109      * @return the value of field 'Unit'.\r
110      */\r
111     public long getUnit(\r
112     ) {\r
113         return this._unit;\r
114     }\r
115 \r
116     /**\r
117      * Method hasUnit.\r
118      * \r
119      * @return true if at least one Unit has been added\r
120      */\r
121     public boolean hasUnit(\r
122     ) {\r
123         return this._has_unit;\r
124     }\r
125 \r
126     /**\r
127      * Overrides the java.lang.Object.hashCode method.\r
128      * <p>\r
129      * The following steps came from <b>Effective Java Programming\r
130      * Language Guide</b> by Joshua Bloch, Chapter 3\r
131      * \r
132      * @return a hash code value for the object.\r
133      */\r
134     public int hashCode(\r
135     ) {\r
136         int result = super.hashCode();\r
137         \r
138         long tmp;\r
139         result = 37 * result + (int)(_unit^(_unit>>>32));\r
140         \r
141         return result;\r
142     }\r
143 \r
144     /**\r
145      * Method isValid.\r
146      * \r
147      * @return true if this object is valid according to the schema\r
148      */\r
149     public boolean isValid(\r
150     ) {\r
151         try {\r
152             validate();\r
153         } catch (org.exolab.castor.xml.ValidationException vex) {\r
154             return false;\r
155         }\r
156         return true;\r
157     }\r
158 \r
159     /**\r
160      * \r
161      * \r
162      * @param out\r
163      * @throws org.exolab.castor.xml.MarshalException if object is\r
164      * null or if any SAXException is thrown during marshaling\r
165      * @throws org.exolab.castor.xml.ValidationException if this\r
166      * object is an invalid instance according to the schema\r
167      */\r
168     public void marshal(\r
169             final java.io.Writer out)\r
170     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
171         Marshaller.marshal(this, out);\r
172     }\r
173 \r
174     /**\r
175      * \r
176      * \r
177      * @param handler\r
178      * @throws java.io.IOException if an IOException occurs during\r
179      * marshaling\r
180      * @throws org.exolab.castor.xml.ValidationException if this\r
181      * object is an invalid instance according to the schema\r
182      * @throws org.exolab.castor.xml.MarshalException if object is\r
183      * null or if any SAXException is thrown during marshaling\r
184      */\r
185     public void marshal(\r
186             final org.xml.sax.ContentHandler handler)\r
187     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
188         Marshaller.marshal(this, handler);\r
189     }\r
190 \r
191     /**\r
192      * Sets the value of field 'unit'. The field 'unit' has the\r
193      * following description: number of dictionary symbol widths\r
194      * involved in each\r
195      *  mapped position on this sequence (for example, 3 for a dna\r
196      * sequence exon\r
197      *  region that is being mapped to a protein sequence). This is\r
198      * optional,\r
199      *  since the unit can be usually be inferred from the\r
200      * dictionary type of\r
201      *  each sequence involved in the mapping. \r
202      * \r
203      * @param unit the value of field 'unit'.\r
204      */\r
205     public void setUnit(\r
206             final long unit) {\r
207         this._unit = unit;\r
208         this._has_unit = true;\r
209     }\r
210 \r
211     /**\r
212      * Method unmarshal.\r
213      * \r
214      * @param reader\r
215      * @throws org.exolab.castor.xml.MarshalException if object is\r
216      * null or if any SAXException is thrown during marshaling\r
217      * @throws org.exolab.castor.xml.ValidationException if this\r
218      * object is an invalid instance according to the schema\r
219      * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
220      */\r
221     public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
222             final java.io.Reader reader)\r
223     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
224         return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.MapRangeType.class, reader);\r
225     }\r
226 \r
227     /**\r
228      * \r
229      * \r
230      * @throws org.exolab.castor.xml.ValidationException if this\r
231      * object is an invalid instance according to the schema\r
232      */\r
233     public void validate(\r
234     )\r
235     throws org.exolab.castor.xml.ValidationException {\r
236         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
237         validator.validate(this);\r
238     }\r
239 \r
240 }\r