2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package uk.ac.vamsas.objects.core;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
20 * @version $Revision$ $Date$
22 public class Provenance extends uk.ac.vamsas.client.Vobject
23 implements java.io.Serializable
27 //--------------------------/
28 //- Class/Member Variables -/
29 //--------------------------/
34 private java.util.Vector _entryList;
43 this._entryList = new java.util.Vector();
55 * @throws java.lang.IndexOutOfBoundsException if the index
56 * given is outside the bounds of the collection
59 final uk.ac.vamsas.objects.core.Entry vEntry)
60 throws java.lang.IndexOutOfBoundsException {
61 this._entryList.addElement(vEntry);
69 * @throws java.lang.IndexOutOfBoundsException if the index
70 * given is outside the bounds of the collection
74 final uk.ac.vamsas.objects.core.Entry vEntry)
75 throws java.lang.IndexOutOfBoundsException {
76 this._entryList.add(index, vEntry);
80 * Method enumerateEntry.
82 * @return an Enumeration over all
83 * uk.ac.vamsas.objects.core.Entry elements
85 public java.util.Enumeration enumerateEntry(
87 return this._entryList.elements();
91 * Overrides the java.lang.Object.equals method.
94 * @return true if the objects are equal.
96 public boolean equals(
97 final java.lang.Object obj) {
101 if (super.equals(obj)==false)
104 if (obj instanceof Provenance) {
106 Provenance temp = (Provenance)obj;
107 if (this._entryList != null) {
108 if (temp._entryList == null) return false;
109 else if (!(this._entryList.equals(temp._entryList)))
112 else if (temp._entryList != null)
123 * @throws java.lang.IndexOutOfBoundsException if the index
124 * given is outside the bounds of the collection
125 * @return the value of the uk.ac.vamsas.objects.core.Entry at
128 public uk.ac.vamsas.objects.core.Entry getEntry(
130 throws java.lang.IndexOutOfBoundsException {
131 // check bounds for index
132 if (index < 0 || index >= this._entryList.size()) {
133 throw new IndexOutOfBoundsException("getEntry: Index value '" + index + "' not in range [0.." + (this._entryList.size() - 1) + "]");
136 return (uk.ac.vamsas.objects.core.Entry) _entryList.get(index);
140 * Method getEntry.Returns the contents of the collection in an
141 * Array. <p>Note: Just in case the collection contents are
142 * changing in another thread, we pass a 0-length Array of the
143 * correct type into the API call. This way we <i>know</i>
144 * that the Array returned is of exactly the correct length.
146 * @return this collection as an Array
148 public uk.ac.vamsas.objects.core.Entry[] getEntry(
150 uk.ac.vamsas.objects.core.Entry[] array = new uk.ac.vamsas.objects.core.Entry[0];
151 return (uk.ac.vamsas.objects.core.Entry[]) this._entryList.toArray(array);
155 * Method getEntryAsReference.Returns a reference to
156 * '_entryList'. No type checking is performed on any
157 * modifications to the Vector.
159 * @return a reference to the Vector backing this class
161 public java.util.Vector getEntryAsReference(
163 return this._entryList;
167 * Method getEntryCount.
169 * @return the size of this collection
171 public int getEntryCount(
173 return this._entryList.size();
177 * Overrides the java.lang.Object.hashCode method.
179 * The following steps came from <b>Effective Java Programming
180 * Language Guide</b> by Joshua Bloch, Chapter 3
182 * @return a hash code value for the object.
186 int result = super.hashCode();
189 if (_entryList != null) {
190 result = 37 * result + _entryList.hashCode();
199 * @return true if this object is valid according to the schema
201 public boolean isValid(
205 } catch (org.exolab.castor.xml.ValidationException vex) {
215 * @throws org.exolab.castor.xml.MarshalException if object is
216 * null or if any SAXException is thrown during marshaling
217 * @throws org.exolab.castor.xml.ValidationException if this
218 * object is an invalid instance according to the schema
221 final java.io.Writer out)
222 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
223 Marshaller.marshal(this, out);
230 * @throws java.io.IOException if an IOException occurs during
232 * @throws org.exolab.castor.xml.ValidationException if this
233 * object is an invalid instance according to the schema
234 * @throws org.exolab.castor.xml.MarshalException if object is
235 * null or if any SAXException is thrown during marshaling
238 final org.xml.sax.ContentHandler handler)
239 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
240 Marshaller.marshal(this, handler);
245 public void removeAllEntry(
247 this._entryList.clear();
251 * Method removeEntry.
254 * @return true if the object was removed from the collection.
256 public boolean removeEntry(
257 final uk.ac.vamsas.objects.core.Entry vEntry) {
258 boolean removed = _entryList.remove(vEntry);
263 * Method removeEntryAt.
266 * @return the element removed from the collection
268 public uk.ac.vamsas.objects.core.Entry removeEntryAt(
270 java.lang.Object obj = this._entryList.remove(index);
271 return (uk.ac.vamsas.objects.core.Entry) obj;
279 * @throws java.lang.IndexOutOfBoundsException if the index
280 * given is outside the bounds of the collection
282 public void setEntry(
284 final uk.ac.vamsas.objects.core.Entry vEntry)
285 throws java.lang.IndexOutOfBoundsException {
286 // check bounds for index
287 if (index < 0 || index >= this._entryList.size()) {
288 throw new IndexOutOfBoundsException("setEntry: Index value '" + index + "' not in range [0.." + (this._entryList.size() - 1) + "]");
291 this._entryList.set(index, vEntry);
299 public void setEntry(
300 final uk.ac.vamsas.objects.core.Entry[] vEntryArray) {
304 for (int i = 0; i < vEntryArray.length; i++) {
305 this._entryList.add(vEntryArray[i]);
310 * Sets the value of '_entryList' by copying the given Vector.
311 * All elements will be checked for type safety.
313 * @param vEntryList the Vector to copy.
315 public void setEntry(
316 final java.util.Vector vEntryList) {
318 this._entryList.clear();
320 this._entryList.addAll(vEntryList);
324 * Sets the value of '_entryList' by setting it to the given
325 * Vector. No type checking is performed.
328 * @param entryVector the Vector to set.
330 public void setEntryAsReference(
331 final java.util.Vector entryVector) {
332 this._entryList = entryVector;
339 * @throws org.exolab.castor.xml.MarshalException if object is
340 * null or if any SAXException is thrown during marshaling
341 * @throws org.exolab.castor.xml.ValidationException if this
342 * object is an invalid instance according to the schema
343 * @return the unmarshaled uk.ac.vamsas.objects.core.Provenance
345 public static uk.ac.vamsas.objects.core.Provenance unmarshal(
346 final java.io.Reader reader)
347 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
348 return (uk.ac.vamsas.objects.core.Provenance) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Provenance.class, reader);
354 * @throws org.exolab.castor.xml.ValidationException if this
355 * object is an invalid instance according to the schema
357 public void validate(
359 throws org.exolab.castor.xml.ValidationException {
360 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
361 validator.validate(this);