schema changes: provenance-entry-date is now an xmlSchema:dateTime bound directly...
[vamsas.git] / src / uk / ac / vamsas / objects / core / Input.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 Input.\r
19  * \r
20  * @version $Revision$ $Date$\r
21  */\r
22 public class Input 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      * Field _name.\r
33      */\r
34     private java.lang.String _name;\r
35 \r
36     /**\r
37      * Reference Frame for rangeType specfication\r
38      *  \r
39      */\r
40     private java.util.Vector _objRef;\r
41 \r
42 \r
43       //----------------/\r
44      //- Constructors -/\r
45     //----------------/\r
46 \r
47     public Input() {\r
48         super();\r
49         this._objRef = new java.util.Vector();\r
50     }\r
51 \r
52 \r
53       //-----------/\r
54      //- Methods -/\r
55     //-----------/\r
56 \r
57     /**\r
58      * \r
59      * \r
60      * @param vObjRef\r
61      * @throws java.lang.IndexOutOfBoundsException if the index\r
62      * given is outside the bounds of the collection\r
63      */\r
64     public void addObjRef(\r
65             final java.lang.Object vObjRef)\r
66     throws java.lang.IndexOutOfBoundsException {\r
67         this._objRef.addElement(vObjRef);\r
68     }\r
69 \r
70     /**\r
71      * \r
72      * \r
73      * @param index\r
74      * @param vObjRef\r
75      * @throws java.lang.IndexOutOfBoundsException if the index\r
76      * given is outside the bounds of the collection\r
77      */\r
78     public void addObjRef(\r
79             final int index,\r
80             final java.lang.Object vObjRef)\r
81     throws java.lang.IndexOutOfBoundsException {\r
82         this._objRef.add(index, vObjRef);\r
83     }\r
84 \r
85     /**\r
86      * Method enumerateObjRef.\r
87      * \r
88      * @return an Enumeration over all java.lang.Object elements\r
89      */\r
90     public java.util.Enumeration enumerateObjRef(\r
91     ) {\r
92         return this._objRef.elements();\r
93     }\r
94 \r
95     /**\r
96      * Overrides the java.lang.Object.equals method.\r
97      * \r
98      * @param obj\r
99      * @return true if the objects are equal.\r
100      */\r
101     public boolean equals(\r
102             final java.lang.Object obj) {\r
103         if ( this == obj )\r
104             return true;\r
105         \r
106         if (super.equals(obj)==false)\r
107             return false;\r
108         \r
109         if (obj instanceof Input) {\r
110         \r
111             Input temp = (Input)obj;\r
112             if (this._name != null) {\r
113                 if (temp._name == null) return false;\r
114                 else if (!(this._name.equals(temp._name))) \r
115                     return false;\r
116             }\r
117             else if (temp._name != null)\r
118                 return false;\r
119             if (this._objRef != null) {\r
120                 if (temp._objRef == null) return false;\r
121                 else if (!(this._objRef.equals(temp._objRef))) \r
122                     return false;\r
123             }\r
124             else if (temp._objRef != null)\r
125                 return false;\r
126             return true;\r
127         }\r
128         return false;\r
129     }\r
130 \r
131     /**\r
132      * Returns the value of field 'name'.\r
133      * \r
134      * @return the value of field 'Name'.\r
135      */\r
136     public java.lang.String getName(\r
137     ) {\r
138         return this._name;\r
139     }\r
140 \r
141     /**\r
142      * Method getObjRef.\r
143      * \r
144      * @param index\r
145      * @throws java.lang.IndexOutOfBoundsException if the index\r
146      * given is outside the bounds of the collection\r
147      * @return the value of the java.lang.Object at the given index\r
148      */\r
149     public java.lang.Object getObjRef(\r
150             final int index)\r
151     throws java.lang.IndexOutOfBoundsException {\r
152         // check bounds for index\r
153         if (index < 0 || index >= this._objRef.size()) {\r
154             throw new IndexOutOfBoundsException("getObjRef: Index value '" + index + "' not in range [0.." + (this._objRef.size() - 1) + "]");\r
155         }\r
156         \r
157         return _objRef.get(index);\r
158     }\r
159 \r
160     /**\r
161      * Method getObjRef.Returns the contents of the collection in\r
162      * an Array.  <p>Note:  Just in case the collection contents\r
163      * are changing in another thread, we pass a 0-length Array of\r
164      * the correct type into the API call.  This way we <i>know</i>\r
165      * that the Array returned is of exactly the correct length.\r
166      * \r
167      * @return this collection as an Array\r
168      */\r
169     public java.lang.Object[] getObjRef(\r
170     ) {\r
171         java.lang.Object[] array = new java.lang.Object[0];\r
172         return (java.lang.Object[]) this._objRef.toArray(array);\r
173     }\r
174 \r
175     /**\r
176      * Method getObjRefAsReference.Returns a reference to\r
177      * '_objRef'. No type checking is performed on any\r
178      * modifications to the Vector.\r
179      * \r
180      * @return a reference to the Vector backing this class\r
181      */\r
182     public java.util.Vector getObjRefAsReference(\r
183     ) {\r
184         return this._objRef;\r
185     }\r
186 \r
187     /**\r
188      * Method getObjRefCount.\r
189      * \r
190      * @return the size of this collection\r
191      */\r
192     public int getObjRefCount(\r
193     ) {\r
194         return this._objRef.size();\r
195     }\r
196 \r
197     /**\r
198      * Overrides the java.lang.Object.hashCode method.\r
199      * <p>\r
200      * The following steps came from <b>Effective Java Programming\r
201      * Language Guide</b> by Joshua Bloch, Chapter 3\r
202      * \r
203      * @return a hash code value for the object.\r
204      */\r
205     public int hashCode(\r
206     ) {\r
207         int result = super.hashCode();\r
208         \r
209         long tmp;\r
210         if (_name != null) {\r
211            result = 37 * result + _name.hashCode();\r
212         }\r
213         if (_objRef != null) {\r
214            result = 37 * result + _objRef.hashCode();\r
215         }\r
216         \r
217         return result;\r
218     }\r
219 \r
220     /**\r
221      * Method isValid.\r
222      * \r
223      * @return true if this object is valid according to the schema\r
224      */\r
225     public boolean isValid(\r
226     ) {\r
227         try {\r
228             validate();\r
229         } catch (org.exolab.castor.xml.ValidationException vex) {\r
230             return false;\r
231         }\r
232         return true;\r
233     }\r
234 \r
235     /**\r
236      * \r
237      * \r
238      * @param out\r
239      * @throws org.exolab.castor.xml.MarshalException if object is\r
240      * null or if any SAXException is thrown during marshaling\r
241      * @throws org.exolab.castor.xml.ValidationException if this\r
242      * object is an invalid instance according to the schema\r
243      */\r
244     public void marshal(\r
245             final java.io.Writer out)\r
246     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
247         Marshaller.marshal(this, out);\r
248     }\r
249 \r
250     /**\r
251      * \r
252      * \r
253      * @param handler\r
254      * @throws java.io.IOException if an IOException occurs during\r
255      * marshaling\r
256      * @throws org.exolab.castor.xml.ValidationException if this\r
257      * object is an invalid instance according to the schema\r
258      * @throws org.exolab.castor.xml.MarshalException if object is\r
259      * null or if any SAXException is thrown during marshaling\r
260      */\r
261     public void marshal(\r
262             final org.xml.sax.ContentHandler handler)\r
263     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
264         Marshaller.marshal(this, handler);\r
265     }\r
266 \r
267     /**\r
268      */\r
269     public void removeAllObjRef(\r
270     ) {\r
271         this._objRef.clear();\r
272     }\r
273 \r
274     /**\r
275      * Method removeObjRef.\r
276      * \r
277      * @param vObjRef\r
278      * @return true if the object was removed from the collection.\r
279      */\r
280     public boolean removeObjRef(\r
281             final java.lang.Object vObjRef) {\r
282         boolean removed = _objRef.remove(vObjRef);\r
283         return removed;\r
284     }\r
285 \r
286     /**\r
287      * Method removeObjRefAt.\r
288      * \r
289      * @param index\r
290      * @return the element removed from the collection\r
291      */\r
292     public java.lang.Object removeObjRefAt(\r
293             final int index) {\r
294         java.lang.Object obj = this._objRef.remove(index);\r
295         return obj;\r
296     }\r
297 \r
298     /**\r
299      * Sets the value of field 'name'.\r
300      * \r
301      * @param name the value of field 'name'.\r
302      */\r
303     public void setName(\r
304             final java.lang.String name) {\r
305         this._name = name;\r
306     }\r
307 \r
308     /**\r
309      * \r
310      * \r
311      * @param index\r
312      * @param vObjRef\r
313      * @throws java.lang.IndexOutOfBoundsException if the index\r
314      * given is outside the bounds of the collection\r
315      */\r
316     public void setObjRef(\r
317             final int index,\r
318             final java.lang.Object vObjRef)\r
319     throws java.lang.IndexOutOfBoundsException {\r
320         // check bounds for index\r
321         if (index < 0 || index >= this._objRef.size()) {\r
322             throw new IndexOutOfBoundsException("setObjRef: Index value '" + index + "' not in range [0.." + (this._objRef.size() - 1) + "]");\r
323         }\r
324         \r
325         this._objRef.set(index, vObjRef);\r
326     }\r
327 \r
328     /**\r
329      * \r
330      * \r
331      * @param vObjRefArray\r
332      */\r
333     public void setObjRef(\r
334             final java.lang.Object[] vObjRefArray) {\r
335         //-- copy array\r
336         _objRef.clear();\r
337         \r
338         for (int i = 0; i < vObjRefArray.length; i++) {\r
339                 this._objRef.add(vObjRefArray[i]);\r
340         }\r
341     }\r
342 \r
343     /**\r
344      * Sets the value of '_objRef' by copying the given Vector. All\r
345      * elements will be checked for type safety.\r
346      * \r
347      * @param vObjRefList the Vector to copy.\r
348      */\r
349     public void setObjRef(\r
350             final java.util.Vector vObjRefList) {\r
351         // copy vector\r
352         this._objRef.clear();\r
353         \r
354         this._objRef.addAll(vObjRefList);\r
355     }\r
356 \r
357     /**\r
358      * Sets the value of '_objRef' by setting it to the given\r
359      * Vector. No type checking is performed.\r
360      * @deprecated\r
361      * \r
362      * @param objRefVector the Vector to set.\r
363      */\r
364     public void setObjRefAsReference(\r
365             final java.util.Vector objRefVector) {\r
366         this._objRef = objRefVector;\r
367     }\r
368 \r
369     /**\r
370      * Method unmarshal.\r
371      * \r
372      * @param reader\r
373      * @throws org.exolab.castor.xml.MarshalException if object is\r
374      * null or if any SAXException is thrown during marshaling\r
375      * @throws org.exolab.castor.xml.ValidationException if this\r
376      * object is an invalid instance according to the schema\r
377      * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
378      */\r
379     public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
380             final java.io.Reader reader)\r
381     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
382         return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Input.class, reader);\r
383     }\r
384 \r
385     /**\r
386      * \r
387      * \r
388      * @throws org.exolab.castor.xml.ValidationException if this\r
389      * object is an invalid instance according to the schema\r
390      */\r
391     public void validate(\r
392     )\r
393     throws org.exolab.castor.xml.ValidationException {\r
394         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
395         validator.validate(this);\r
396     }\r
397 \r
398 }\r