2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
8 package uk.ac.vamsas.objects.core;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import java.util.Enumeration;
19 import java.util.Vector;
20 import org.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.Marshaller;
22 import org.exolab.castor.xml.Unmarshaller;
23 import org.exolab.castor.xml.ValidationException;
24 import org.xml.sax.ContentHandler;
27 * Class ApplicationData.
29 * @version $Revision$ $Date$
31 public class ApplicationData extends uk.ac.vamsas.objects.core.AppData
32 implements java.io.Serializable
36 //--------------------------/
37 //- Class/Member Variables -/
38 //--------------------------/
41 * Version string describing the application specific
42 * data storage version used
44 private java.lang.String _version;
47 * Canonical name of application
49 private java.lang.String _name;
54 private java.util.Vector _userList;
59 private uk.ac.vamsas.objects.core.Common _common;
64 private java.util.Vector _instanceList;
71 public ApplicationData()
74 _userList = new Vector();
75 _instanceList = new Vector();
76 } //-- uk.ac.vamsas.objects.core.ApplicationData()
90 public void addInstance(uk.ac.vamsas.objects.core.Instance vInstance)
91 throws java.lang.IndexOutOfBoundsException
93 _instanceList.addElement(vInstance);
94 } //-- void addInstance(uk.ac.vamsas.objects.core.Instance)
104 public void addInstance(int index, uk.ac.vamsas.objects.core.Instance vInstance)
105 throws java.lang.IndexOutOfBoundsException
107 _instanceList.insertElementAt(vInstance, index);
108 } //-- void addInstance(int, uk.ac.vamsas.objects.core.Instance)
117 public void addUser(uk.ac.vamsas.objects.core.User vUser)
118 throws java.lang.IndexOutOfBoundsException
120 _userList.addElement(vUser);
121 } //-- void addUser(uk.ac.vamsas.objects.core.User)
131 public void addUser(int index, uk.ac.vamsas.objects.core.User vUser)
132 throws java.lang.IndexOutOfBoundsException
134 _userList.insertElementAt(vUser, index);
135 } //-- void addUser(int, uk.ac.vamsas.objects.core.User)
138 * Method enumerateInstance
142 * @return Enumeration
144 public java.util.Enumeration enumerateInstance()
146 return _instanceList.elements();
147 } //-- java.util.Enumeration enumerateInstance()
150 * Method enumerateUser
154 * @return Enumeration
156 public java.util.Enumeration enumerateUser()
158 return _userList.elements();
159 } //-- java.util.Enumeration enumerateUser()
162 * Note: hashCode() has not been overriden
167 public boolean equals(java.lang.Object obj)
172 if (super.equals(obj)==false)
175 if (obj instanceof ApplicationData) {
177 ApplicationData temp = (ApplicationData)obj;
178 if (this._version != null) {
179 if (temp._version == null) return false;
180 else if (!(this._version.equals(temp._version)))
183 else if (temp._version != null)
185 if (this._name != null) {
186 if (temp._name == null) return false;
187 else if (!(this._name.equals(temp._name)))
190 else if (temp._name != null)
192 if (this._userList != null) {
193 if (temp._userList == null) return false;
194 else if (!(this._userList.equals(temp._userList)))
197 else if (temp._userList != null)
199 if (this._common != null) {
200 if (temp._common == null) return false;
201 else if (!(this._common.equals(temp._common)))
204 else if (temp._common != null)
206 if (this._instanceList != null) {
207 if (temp._instanceList == null) return false;
208 else if (!(this._instanceList.equals(temp._instanceList)))
211 else if (temp._instanceList != null)
216 } //-- boolean equals(java.lang.Object)
219 * Returns the value of field 'common'.
222 * @return the value of field 'common'.
224 public uk.ac.vamsas.objects.core.Common getCommon()
227 } //-- uk.ac.vamsas.objects.core.Common getCommon()
237 public uk.ac.vamsas.objects.core.Instance getInstance(int index)
238 throws java.lang.IndexOutOfBoundsException
240 //-- check bounds for index
241 if ((index < 0) || (index > _instanceList.size())) {
242 throw new IndexOutOfBoundsException("getInstance: Index value '"+index+"' not in range [0.."+_instanceList.size()+ "]");
245 return (uk.ac.vamsas.objects.core.Instance) _instanceList.elementAt(index);
246 } //-- uk.ac.vamsas.objects.core.Instance getInstance(int)
255 public uk.ac.vamsas.objects.core.Instance[] getInstance()
257 int size = _instanceList.size();
258 uk.ac.vamsas.objects.core.Instance[] mArray = new uk.ac.vamsas.objects.core.Instance[size];
259 for (int index = 0; index < size; index++) {
260 mArray[index] = (uk.ac.vamsas.objects.core.Instance) _instanceList.elementAt(index);
263 } //-- uk.ac.vamsas.objects.core.Instance[] getInstance()
266 * Method getInstanceCount
272 public int getInstanceCount()
274 return _instanceList.size();
275 } //-- int getInstanceCount()
278 * Returns the value of field 'name'. The field 'name' has the
279 * following description: Canonical name of application
282 * @return the value of field 'name'.
284 public java.lang.String getName()
287 } //-- java.lang.String getName()
297 public uk.ac.vamsas.objects.core.User getUser(int index)
298 throws java.lang.IndexOutOfBoundsException
300 //-- check bounds for index
301 if ((index < 0) || (index > _userList.size())) {
302 throw new IndexOutOfBoundsException("getUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
305 return (uk.ac.vamsas.objects.core.User) _userList.elementAt(index);
306 } //-- uk.ac.vamsas.objects.core.User getUser(int)
315 public uk.ac.vamsas.objects.core.User[] getUser()
317 int size = _userList.size();
318 uk.ac.vamsas.objects.core.User[] mArray = new uk.ac.vamsas.objects.core.User[size];
319 for (int index = 0; index < size; index++) {
320 mArray[index] = (uk.ac.vamsas.objects.core.User) _userList.elementAt(index);
323 } //-- uk.ac.vamsas.objects.core.User[] getUser()
326 * Method getUserCount
332 public int getUserCount()
334 return _userList.size();
335 } //-- int getUserCount()
338 * Returns the value of field 'version'. The field 'version'
339 * has the following description: Version string describing the
340 * application specific
341 * data storage version used
344 * @return the value of field 'version'.
346 public java.lang.String getVersion()
348 return this._version;
349 } //-- java.lang.String getVersion()
358 public boolean isValid()
363 catch (org.exolab.castor.xml.ValidationException vex) {
367 } //-- boolean isValid()
376 public void marshal(java.io.Writer out)
377 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
380 Marshaller.marshal(this, out);
381 } //-- void marshal(java.io.Writer)
390 public void marshal(org.xml.sax.ContentHandler handler)
391 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
394 Marshaller.marshal(this, handler);
395 } //-- void marshal(org.xml.sax.ContentHandler)
398 * Method removeAllInstance
401 public void removeAllInstance()
403 _instanceList.removeAllElements();
404 } //-- void removeAllInstance()
407 * Method removeAllUser
410 public void removeAllUser()
412 _userList.removeAllElements();
413 } //-- void removeAllUser()
416 * Method removeInstance
423 public uk.ac.vamsas.objects.core.Instance removeInstance(int index)
425 java.lang.Object obj = _instanceList.elementAt(index);
426 _instanceList.removeElementAt(index);
427 return (uk.ac.vamsas.objects.core.Instance) obj;
428 } //-- uk.ac.vamsas.objects.core.Instance removeInstance(int)
438 public uk.ac.vamsas.objects.core.User removeUser(int index)
440 java.lang.Object obj = _userList.elementAt(index);
441 _userList.removeElementAt(index);
442 return (uk.ac.vamsas.objects.core.User) obj;
443 } //-- uk.ac.vamsas.objects.core.User removeUser(int)
446 * Sets the value of field 'common'.
448 * @param common the value of field 'common'.
450 public void setCommon(uk.ac.vamsas.objects.core.Common common)
452 this._common = common;
453 } //-- void setCommon(uk.ac.vamsas.objects.core.Common)
463 public void setInstance(int index, uk.ac.vamsas.objects.core.Instance vInstance)
464 throws java.lang.IndexOutOfBoundsException
466 //-- check bounds for index
467 if ((index < 0) || (index > _instanceList.size())) {
468 throw new IndexOutOfBoundsException("setInstance: Index value '"+index+"' not in range [0.."+_instanceList.size()+ "]");
470 _instanceList.setElementAt(vInstance, index);
471 } //-- void setInstance(int, uk.ac.vamsas.objects.core.Instance)
478 * @param instanceArray
480 public void setInstance(uk.ac.vamsas.objects.core.Instance[] instanceArray)
483 _instanceList.removeAllElements();
484 for (int i = 0; i < instanceArray.length; i++) {
485 _instanceList.addElement(instanceArray[i]);
487 } //-- void setInstance(uk.ac.vamsas.objects.core.Instance)
490 * Sets the value of field 'name'. The field 'name' has the
491 * following description: Canonical name of application
493 * @param name the value of field 'name'.
495 public void setName(java.lang.String name)
498 } //-- void setName(java.lang.String)
508 public void setUser(int index, uk.ac.vamsas.objects.core.User vUser)
509 throws java.lang.IndexOutOfBoundsException
511 //-- check bounds for index
512 if ((index < 0) || (index > _userList.size())) {
513 throw new IndexOutOfBoundsException("setUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
515 _userList.setElementAt(vUser, index);
516 } //-- void setUser(int, uk.ac.vamsas.objects.core.User)
525 public void setUser(uk.ac.vamsas.objects.core.User[] userArray)
528 _userList.removeAllElements();
529 for (int i = 0; i < userArray.length; i++) {
530 _userList.addElement(userArray[i]);
532 } //-- void setUser(uk.ac.vamsas.objects.core.User)
535 * Sets the value of field 'version'. The field 'version' has
536 * the following description: Version string describing the
537 * application specific
538 * data storage version used
540 * @param version the value of field 'version'.
542 public void setVersion(java.lang.String version)
544 this._version = version;
545 } //-- void setVersion(java.lang.String)
555 public static uk.ac.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)
556 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
558 return (uk.ac.vamsas.objects.core.ApplicationData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.ApplicationData.class, reader);
559 } //-- uk.ac.vamsas.objects.core.AppData unmarshal(java.io.Reader)
565 public void validate()
566 throws org.exolab.castor.xml.ValidationException
568 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
569 validator.validate(this);
570 } //-- void validate()