561589c0f29fbcabbe415b1fac9b5197727d008d
[vamsas.git] / src / uk / ac / vamsas / objects / core / Map.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  * the local mapType maps from the parent\r
19  *  sequence coordinate frame to the reference\r
20  *  frame defined by the dbRef element.\r
21  *  The mapped mapType is the mapped range defined\r
22  *  on the dbRef element's reference frame.\r
23  *  Conventionally, the unit attribute defaults to 1, or\r
24  *  will be inferred from the local sequence's\r
25  *  dictionary type and any dictionary type associated\r
26  *  with the database being mapped to. \r
27  *  However, it may be used to avoid ambiguity.\r
28  *  \r
29  * \r
30  * @version $Revision$ $Date$\r
31  */\r
32 public class Map extends uk.ac.vamsas.objects.core.MapType \r
33 implements java.io.Serializable\r
34 {\r
35 \r
36 \r
37       //--------------------------/\r
38      //- Class/Member Variables -/\r
39     //--------------------------/\r
40 \r
41     /**\r
42      * Field _id.\r
43      */\r
44     private java.lang.String _id;\r
45 \r
46 \r
47       //----------------/\r
48      //- Constructors -/\r
49     //----------------/\r
50 \r
51     public Map() {\r
52         super();\r
53     }\r
54 \r
55 \r
56       //-----------/\r
57      //- Methods -/\r
58     //-----------/\r
59 \r
60     /**\r
61      * Overrides the java.lang.Object.equals method.\r
62      * \r
63      * @param obj\r
64      * @return true if the objects are equal.\r
65      */\r
66     public boolean equals(\r
67             final java.lang.Object obj) {\r
68         if ( this == obj )\r
69             return true;\r
70         \r
71         if (super.equals(obj)==false)\r
72             return false;\r
73         \r
74         if (obj instanceof Map) {\r
75         \r
76             Map temp = (Map)obj;\r
77             boolean thcycle;\r
78             boolean tmcycle;\r
79             if (this._id != null) {\r
80                 if (temp._id == null) return false;\r
81                 if (this._id != temp._id) {\r
82                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);\r
83                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
84                     if (thcycle!=tmcycle) {\r
85                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };\r
86                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };\r
87                         return false;\r
88                     }\r
89                     if (!thcycle) {\r
90                         if (!this._id.equals(temp._id)) {\r
91                             org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
92                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
93                             return false;\r
94                         }\r
95                         org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
96                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
97                     }\r
98                 }\r
99             } else if (temp._id != 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 'id'.\r
108      * \r
109      * @return the value of field 'Id'.\r
110      */\r
111     public java.lang.String getId(\r
112     ) {\r
113         return this._id;\r
114     }\r
115 \r
116     /**\r
117      * Overrides the java.lang.Object.hashCode method.\r
118      * <p>\r
119      * The following steps came from <b>Effective Java Programming\r
120      * Language Guide</b> by Joshua Bloch, Chapter 3\r
121      * \r
122      * @return a hash code value for the object.\r
123      */\r
124     public int hashCode(\r
125     ) {\r
126         int result = super.hashCode();\r
127         \r
128         long tmp;\r
129         if (_id != null\r
130             && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
131            result = 37 * result + _id.hashCode();\r
132            org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
133         }\r
134         \r
135         return result;\r
136     }\r
137 \r
138     /**\r
139      * Method isValid.\r
140      * \r
141      * @return true if this object is valid according to the schema\r
142      */\r
143     public boolean isValid(\r
144     ) {\r
145         try {\r
146             validate();\r
147         } catch (org.exolab.castor.xml.ValidationException vex) {\r
148             return false;\r
149         }\r
150         return true;\r
151     }\r
152 \r
153     /**\r
154      * \r
155      * \r
156      * @param out\r
157      * @throws org.exolab.castor.xml.MarshalException if object is\r
158      * null or if any SAXException is thrown during marshaling\r
159      * @throws org.exolab.castor.xml.ValidationException if this\r
160      * object is an invalid instance according to the schema\r
161      */\r
162     public void marshal(\r
163             final java.io.Writer out)\r
164     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
165         Marshaller.marshal(this, out);\r
166     }\r
167 \r
168     /**\r
169      * \r
170      * \r
171      * @param handler\r
172      * @throws java.io.IOException if an IOException occurs during\r
173      * marshaling\r
174      * @throws org.exolab.castor.xml.ValidationException if this\r
175      * object is an invalid instance according to the schema\r
176      * @throws org.exolab.castor.xml.MarshalException if object is\r
177      * null or if any SAXException is thrown during marshaling\r
178      */\r
179     public void marshal(\r
180             final org.xml.sax.ContentHandler handler)\r
181     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
182         Marshaller.marshal(this, handler);\r
183     }\r
184 \r
185     /**\r
186      * Sets the value of field 'id'.\r
187      * \r
188      * @param id the value of field 'id'.\r
189      */\r
190     public void setId(\r
191             final java.lang.String id) {\r
192         this._id = id;\r
193     }\r
194 \r
195     /**\r
196      * Method unmarshal.\r
197      * \r
198      * @param reader\r
199      * @throws org.exolab.castor.xml.MarshalException if object is\r
200      * null or if any SAXException is thrown during marshaling\r
201      * @throws org.exolab.castor.xml.ValidationException if this\r
202      * object is an invalid instance according to the schema\r
203      * @return the unmarshaled uk.ac.vamsas.objects.core.MapType\r
204      */\r
205     public static uk.ac.vamsas.objects.core.MapType unmarshal(\r
206             final java.io.Reader reader)\r
207     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
208         return (uk.ac.vamsas.objects.core.MapType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Map.class, reader);\r
209     }\r
210 \r
211     /**\r
212      * \r
213      * \r
214      * @throws org.exolab.castor.xml.ValidationException if this\r
215      * object is an invalid instance according to the schema\r
216      */\r
217     public void validate(\r
218     )\r
219     throws org.exolab.castor.xml.ValidationException {\r
220         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
221         validator.validate(this);\r
222     }\r
223 \r
224 }\r