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
112 if (this._name != null) {
\r
113 if (temp._name == null) return false;
\r
114 else if (!(this._name.equals(temp._name)))
\r
117 else if (temp._name != null)
\r
119 if (this._objRef != null) {
\r
120 if (temp._objRef == null) return false;
\r
121 else if (!(this._objRef.equals(temp._objRef)))
\r
124 else if (temp._objRef != null)
\r
132 * Returns the value of field 'name'.
\r
134 * @return the value of field 'Name'.
\r
136 public java.lang.String getName(
\r
142 * Method getObjRef.
\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
149 public java.lang.Object getObjRef(
\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
157 return _objRef.get(index);
\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
167 * @return this collection as an Array
\r
169 public java.lang.Object[] getObjRef(
\r
171 java.lang.Object[] array = new java.lang.Object[0];
\r
172 return (java.lang.Object[]) this._objRef.toArray(array);
\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
180 * @return a reference to the Vector backing this class
\r
182 public java.util.Vector getObjRefAsReference(
\r
184 return this._objRef;
\r
188 * Method getObjRefCount.
\r
190 * @return the size of this collection
\r
192 public int getObjRefCount(
\r
194 return this._objRef.size();
\r
198 * Overrides the java.lang.Object.hashCode method.
\r
200 * The following steps came from <b>Effective Java Programming
\r
201 * Language Guide</b> by Joshua Bloch, Chapter 3
\r
203 * @return a hash code value for the object.
\r
205 public int hashCode(
\r
207 int result = super.hashCode();
\r
210 if (_name != null) {
\r
211 result = 37 * result + _name.hashCode();
\r
213 if (_objRef != null) {
\r
214 result = 37 * result + _objRef.hashCode();
\r
223 * @return true if this object is valid according to the schema
\r
225 public boolean isValid(
\r
229 } catch (org.exolab.castor.xml.ValidationException vex) {
\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
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
254 * @throws java.io.IOException if an IOException occurs during
\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
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
269 public void removeAllObjRef(
\r
271 this._objRef.clear();
\r
275 * Method removeObjRef.
\r
278 * @return true if the object was removed from the collection.
\r
280 public boolean removeObjRef(
\r
281 final java.lang.Object vObjRef) {
\r
282 boolean removed = _objRef.remove(vObjRef);
\r
287 * Method removeObjRefAt.
\r
290 * @return the element removed from the collection
\r
292 public java.lang.Object removeObjRefAt(
\r
294 java.lang.Object obj = this._objRef.remove(index);
\r
299 * Sets the value of field 'name'.
\r
301 * @param name the value of field 'name'.
\r
303 public void setName(
\r
304 final java.lang.String name) {
\r
313 * @throws java.lang.IndexOutOfBoundsException if the index
\r
314 * given is outside the bounds of the collection
\r
316 public void setObjRef(
\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
325 this._objRef.set(index, vObjRef);
\r
331 * @param vObjRefArray
\r
333 public void setObjRef(
\r
334 final java.lang.Object[] vObjRefArray) {
\r
338 for (int i = 0; i < vObjRefArray.length; i++) {
\r
339 this._objRef.add(vObjRefArray[i]);
\r
344 * Sets the value of '_objRef' by copying the given Vector. All
\r
345 * elements will be checked for type safety.
\r
347 * @param vObjRefList the Vector to copy.
\r
349 public void setObjRef(
\r
350 final java.util.Vector vObjRefList) {
\r
352 this._objRef.clear();
\r
354 this._objRef.addAll(vObjRefList);
\r
358 * Sets the value of '_objRef' by setting it to the given
\r
359 * Vector. No type checking is performed.
\r
362 * @param objRefVector the Vector to set.
\r
364 public void setObjRefAsReference(
\r
365 final java.util.Vector objRefVector) {
\r
366 this._objRef = objRefVector;
\r
370 * Method unmarshal.
\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
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
388 * @throws org.exolab.castor.xml.ValidationException if this
\r
389 * object is an invalid instance according to the schema
\r
391 public void validate(
\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