2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
\r
8 package uk.ac.vamsas.objects.core;
\r
10 //---------------------------------/
\r
11 //- Imported classes and packages -/
\r
12 //---------------------------------/
\r
14 import org.exolab.castor.xml.Marshaller;
\r
15 import org.exolab.castor.xml.Unmarshaller;
\r
20 * @version $Revision$ $Date$
\r
22 public class Input extends uk.ac.vamsas.objects.core.RangeType
\r
23 implements java.io.Serializable
\r
27 //--------------------------/
\r
28 //- Class/Member Variables -/
\r
29 //--------------------------/
\r
34 private java.lang.String _name;
\r
37 * Reference Frame for rangeType specfication
\r
40 private java.util.Vector _objRef;
\r
49 this._objRef = new java.util.Vector();
\r
61 * @throws java.lang.IndexOutOfBoundsException if the index
\r
62 * given is outside the bounds of the collection
\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
75 * @throws java.lang.IndexOutOfBoundsException if the index
\r
76 * given is outside the bounds of the collection
\r
78 public void addObjRef(
\r
80 final java.lang.Object vObjRef)
\r
81 throws java.lang.IndexOutOfBoundsException {
\r
82 this._objRef.add(index, vObjRef);
\r
86 * Method enumerateObjRef.
\r
88 * @return an Enumeration over all java.lang.Object elements
\r
90 public java.util.Enumeration enumerateObjRef(
\r
92 return this._objRef.elements();
\r
96 * Overrides the java.lang.Object.equals method.
\r
99 * @return true if the objects are equal.
\r
101 public boolean equals(
\r
102 final java.lang.Object obj) {
\r
106 if (super.equals(obj)==false)
\r
109 if (obj instanceof Input) {
\r
111 Input temp = (Input)obj;
\r
114 if (this._name != null) {
\r
115 if (temp._name == null) return false;
\r
116 if (this._name != temp._name) {
\r
117 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);
\r
118 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);
\r
119 if (thcycle!=tmcycle) {
\r
120 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };
\r
121 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };
\r
125 if (!this._name.equals(temp._name)) {
\r
126 org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
\r
127 org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
\r
130 org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
\r
131 org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
\r
134 } else if (temp._name != null)
\r
136 if (this._objRef != null) {
\r
137 if (temp._objRef == null) return false;
\r
138 if (this._objRef != temp._objRef) {
\r
139 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._objRef);
\r
140 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._objRef);
\r
141 if (thcycle!=tmcycle) {
\r
142 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._objRef); };
\r
143 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._objRef); };
\r
147 if (!this._objRef.equals(temp._objRef)) {
\r
148 org.castor.util.CycleBreaker.releaseCycleHandle(this._objRef);
\r
149 org.castor.util.CycleBreaker.releaseCycleHandle(temp._objRef);
\r
152 org.castor.util.CycleBreaker.releaseCycleHandle(this._objRef);
\r
153 org.castor.util.CycleBreaker.releaseCycleHandle(temp._objRef);
\r
156 } else if (temp._objRef != null)
\r
164 * Returns the value of field 'name'.
\r
166 * @return the value of field 'Name'.
\r
168 public java.lang.String getName(
\r
174 * Method getObjRef.
\r
177 * @throws java.lang.IndexOutOfBoundsException if the index
\r
178 * given is outside the bounds of the collection
\r
179 * @return the value of the java.lang.Object at the given index
\r
181 public java.lang.Object getObjRef(
\r
183 throws java.lang.IndexOutOfBoundsException {
\r
184 // check bounds for index
\r
185 if (index < 0 || index >= this._objRef.size()) {
\r
186 throw new IndexOutOfBoundsException("getObjRef: Index value '" + index + "' not in range [0.." + (this._objRef.size() - 1) + "]");
\r
189 return _objRef.get(index);
\r
193 * Method getObjRef.Returns the contents of the collection in
\r
194 * an Array. <p>Note: Just in case the collection contents
\r
195 * are changing in another thread, we pass a 0-length Array of
\r
196 * the correct type into the API call. This way we <i>know</i>
\r
197 * that the Array returned is of exactly the correct length.
\r
199 * @return this collection as an Array
\r
201 public java.lang.Object[] getObjRef(
\r
203 java.lang.Object[] array = new java.lang.Object[0];
\r
204 return (java.lang.Object[]) this._objRef.toArray(array);
\r
208 * Method getObjRefAsReference.Returns a reference to
\r
209 * '_objRef'. No type checking is performed on any
\r
210 * modifications to the Vector.
\r
212 * @return a reference to the Vector backing this class
\r
214 public java.util.Vector getObjRefAsReference(
\r
216 return this._objRef;
\r
220 * Method getObjRefCount.
\r
222 * @return the size of this collection
\r
224 public int getObjRefCount(
\r
226 return this._objRef.size();
\r
230 * Overrides the java.lang.Object.hashCode method.
\r
232 * The following steps came from <b>Effective Java Programming
\r
233 * Language Guide</b> by Joshua Bloch, Chapter 3
\r
235 * @return a hash code value for the object.
\r
237 public int hashCode(
\r
239 int result = super.hashCode();
\r
243 && !org.castor.util.CycleBreaker.startingToCycle(_name)) {
\r
244 result = 37 * result + _name.hashCode();
\r
245 org.castor.util.CycleBreaker.releaseCycleHandle(_name);
\r
247 if (_objRef != null
\r
248 && !org.castor.util.CycleBreaker.startingToCycle(_objRef)) {
\r
249 result = 37 * result + _objRef.hashCode();
\r
250 org.castor.util.CycleBreaker.releaseCycleHandle(_objRef);
\r
259 * @return true if this object is valid according to the schema
\r
261 public boolean isValid(
\r
265 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
275 * @throws org.exolab.castor.xml.MarshalException if object is
\r
276 * null or if any SAXException is thrown during marshaling
\r
277 * @throws org.exolab.castor.xml.ValidationException if this
\r
278 * object is an invalid instance according to the schema
\r
280 public void marshal(
\r
281 final java.io.Writer out)
\r
282 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
283 Marshaller.marshal(this, out);
\r
290 * @throws java.io.IOException if an IOException occurs during
\r
292 * @throws org.exolab.castor.xml.ValidationException if this
\r
293 * object is an invalid instance according to the schema
\r
294 * @throws org.exolab.castor.xml.MarshalException if object is
\r
295 * null or if any SAXException is thrown during marshaling
\r
297 public void marshal(
\r
298 final org.xml.sax.ContentHandler handler)
\r
299 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
300 Marshaller.marshal(this, handler);
\r
305 public void removeAllObjRef(
\r
307 this._objRef.clear();
\r
311 * Method removeObjRef.
\r
314 * @return true if the object was removed from the collection.
\r
316 public boolean removeObjRef(
\r
317 final java.lang.Object vObjRef) {
\r
318 boolean removed = _objRef.remove(vObjRef);
\r
323 * Method removeObjRefAt.
\r
326 * @return the element removed from the collection
\r
328 public java.lang.Object removeObjRefAt(
\r
330 java.lang.Object obj = this._objRef.remove(index);
\r
335 * Sets the value of field 'name'.
\r
337 * @param name the value of field 'name'.
\r
339 public void setName(
\r
340 final java.lang.String name) {
\r
349 * @throws java.lang.IndexOutOfBoundsException if the index
\r
350 * given is outside the bounds of the collection
\r
352 public void setObjRef(
\r
354 final java.lang.Object vObjRef)
\r
355 throws java.lang.IndexOutOfBoundsException {
\r
356 // check bounds for index
\r
357 if (index < 0 || index >= this._objRef.size()) {
\r
358 throw new IndexOutOfBoundsException("setObjRef: Index value '" + index + "' not in range [0.." + (this._objRef.size() - 1) + "]");
\r
361 this._objRef.set(index, vObjRef);
\r
367 * @param vObjRefArray
\r
369 public void setObjRef(
\r
370 final java.lang.Object[] vObjRefArray) {
\r
374 for (int i = 0; i < vObjRefArray.length; i++) {
\r
375 this._objRef.add(vObjRefArray[i]);
\r
380 * Sets the value of '_objRef' by copying the given Vector. All
\r
381 * elements will be checked for type safety.
\r
383 * @param vObjRefList the Vector to copy.
\r
385 public void setObjRef(
\r
386 final java.util.Vector vObjRefList) {
\r
388 this._objRef.clear();
\r
390 this._objRef.addAll(vObjRefList);
\r
394 * Sets the value of '_objRef' by setting it to the given
\r
395 * Vector. No type checking is performed.
\r
398 * @param objRefVector the Vector to set.
\r
400 public void setObjRefAsReference(
\r
401 final java.util.Vector objRefVector) {
\r
402 this._objRef = objRefVector;
\r
406 * Method unmarshal.
\r
409 * @throws org.exolab.castor.xml.MarshalException if object is
\r
410 * null or if any SAXException is thrown during marshaling
\r
411 * @throws org.exolab.castor.xml.ValidationException if this
\r
412 * object is an invalid instance according to the schema
\r
413 * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType
\r
415 public static uk.ac.vamsas.objects.core.RangeType unmarshal(
\r
416 final java.io.Reader reader)
\r
417 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
418 return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Input.class, reader);
\r
424 * @throws org.exolab.castor.xml.ValidationException if this
\r
425 * object is an invalid instance according to the schema
\r
427 public void validate(
\r
429 throws org.exolab.castor.xml.ValidationException {
\r
430 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
431 validator.validate(this);
\r