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 NodeType extends uk.ac.vamsas.client.Vobject
\r
23 implements java.io.Serializable
\r
27 //--------------------------/
\r
28 //- Class/Member Variables -/
\r
29 //--------------------------/
\r
32 * Primary Key for vamsas object referencing
\r
34 private java.lang.String _id;
\r
37 * Field _modifiable.
\r
39 private java.lang.String _modifiable;
\r
42 * Short name for this node
\r
44 private java.lang.String _name;
\r
47 * Descriptive text for this node
\r
49 private java.lang.String _description;
\r
52 * Direct associations between this node and any vamsas objects
\r
54 private java.util.Vector _vrefList;
\r
57 * Field _propertyList.
\r
59 private java.util.Vector _propertyList;
\r
68 this._vrefList = new java.util.Vector();
\r
69 this._propertyList = new java.util.Vector();
\r
81 * @throws java.lang.IndexOutOfBoundsException if the index
\r
82 * given is outside the bounds of the collection
\r
84 public void addProperty(
\r
85 final uk.ac.vamsas.objects.core.Property vProperty)
\r
86 throws java.lang.IndexOutOfBoundsException {
\r
87 this._propertyList.addElement(vProperty);
\r
95 * @throws java.lang.IndexOutOfBoundsException if the index
\r
96 * given is outside the bounds of the collection
\r
98 public void addProperty(
\r
100 final uk.ac.vamsas.objects.core.Property vProperty)
\r
101 throws java.lang.IndexOutOfBoundsException {
\r
102 this._propertyList.add(index, vProperty);
\r
109 * @throws java.lang.IndexOutOfBoundsException if the index
\r
110 * given is outside the bounds of the collection
\r
112 public void addVref(
\r
113 final uk.ac.vamsas.objects.core.Vref vVref)
\r
114 throws java.lang.IndexOutOfBoundsException {
\r
115 this._vrefList.addElement(vVref);
\r
123 * @throws java.lang.IndexOutOfBoundsException if the index
\r
124 * given is outside the bounds of the collection
\r
126 public void addVref(
\r
128 final uk.ac.vamsas.objects.core.Vref vVref)
\r
129 throws java.lang.IndexOutOfBoundsException {
\r
130 this._vrefList.add(index, vVref);
\r
134 * Method enumerateProperty.
\r
136 * @return an Enumeration over all
\r
137 * uk.ac.vamsas.objects.core.Property elements
\r
139 public java.util.Enumeration enumerateProperty(
\r
141 return this._propertyList.elements();
\r
145 * Method enumerateVref.
\r
147 * @return an Enumeration over all
\r
148 * uk.ac.vamsas.objects.core.Vref elements
\r
150 public java.util.Enumeration enumerateVref(
\r
152 return this._vrefList.elements();
\r
156 * Overrides the java.lang.Object.equals method.
\r
159 * @return true if the objects are equal.
\r
161 public boolean equals(
\r
162 final java.lang.Object obj) {
\r
166 if (super.equals(obj)==false)
\r
169 if (obj instanceof NodeType) {
\r
171 NodeType temp = (NodeType)obj;
\r
172 if (this._id != null) {
\r
173 if (temp._id == null) return false;
\r
174 else if (!(this._id.equals(temp._id)))
\r
177 else if (temp._id != null)
\r
179 if (this._modifiable != null) {
\r
180 if (temp._modifiable == null) return false;
\r
181 else if (!(this._modifiable.equals(temp._modifiable)))
\r
184 else if (temp._modifiable != null)
\r
186 if (this._name != null) {
\r
187 if (temp._name == null) return false;
\r
188 else if (!(this._name.equals(temp._name)))
\r
191 else if (temp._name != null)
\r
193 if (this._description != null) {
\r
194 if (temp._description == null) return false;
\r
195 else if (!(this._description.equals(temp._description)))
\r
198 else if (temp._description != null)
\r
200 if (this._vrefList != null) {
\r
201 if (temp._vrefList == null) return false;
\r
202 else if (!(this._vrefList.equals(temp._vrefList)))
\r
205 else if (temp._vrefList != null)
\r
207 if (this._propertyList != null) {
\r
208 if (temp._propertyList == null) return false;
\r
209 else if (!(this._propertyList.equals(temp._propertyList)))
\r
212 else if (temp._propertyList != null)
\r
220 * Returns the value of field 'description'. The field
\r
221 * 'description' has the following description: Descriptive
\r
222 * text for this node
\r
224 * @return the value of field 'Description'.
\r
226 public java.lang.String getDescription(
\r
228 return this._description;
\r
232 * Returns the value of field 'id'. The field 'id' has the
\r
233 * following description: Primary Key for vamsas object
\r
236 * @return the value of field 'Id'.
\r
238 public java.lang.String getId(
\r
244 * Returns the value of field 'modifiable'.
\r
246 * @return the value of field 'Modifiable'.
\r
248 public java.lang.String getModifiable(
\r
250 return this._modifiable;
\r
254 * Returns the value of field 'name'. The field 'name' has the
\r
255 * following description: Short name for this node
\r
257 * @return the value of field 'Name'.
\r
259 public java.lang.String getName(
\r
265 * Method getProperty.
\r
268 * @throws java.lang.IndexOutOfBoundsException if the index
\r
269 * given is outside the bounds of the collection
\r
270 * @return the value of the uk.ac.vamsas.objects.core.Property
\r
271 * at the given index
\r
273 public uk.ac.vamsas.objects.core.Property getProperty(
\r
275 throws java.lang.IndexOutOfBoundsException {
\r
276 // check bounds for index
\r
277 if (index < 0 || index >= this._propertyList.size()) {
\r
278 throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
\r
281 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
\r
285 * Method getProperty.Returns the contents of the collection in
\r
286 * an Array. <p>Note: Just in case the collection contents
\r
287 * are changing in another thread, we pass a 0-length Array of
\r
288 * the correct type into the API call. This way we <i>know</i>
\r
289 * that the Array returned is of exactly the correct length.
\r
291 * @return this collection as an Array
\r
293 public uk.ac.vamsas.objects.core.Property[] getProperty(
\r
295 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
\r
296 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
\r
300 * Method getPropertyAsReference.Returns a reference to
\r
301 * '_propertyList'. No type checking is performed on any
\r
302 * modifications to the Vector.
\r
304 * @return a reference to the Vector backing this class
\r
306 public java.util.Vector getPropertyAsReference(
\r
308 return this._propertyList;
\r
312 * Method getPropertyCount.
\r
314 * @return the size of this collection
\r
316 public int getPropertyCount(
\r
318 return this._propertyList.size();
\r
325 * @throws java.lang.IndexOutOfBoundsException if the index
\r
326 * given is outside the bounds of the collection
\r
327 * @return the value of the uk.ac.vamsas.objects.core.Vref at
\r
330 public uk.ac.vamsas.objects.core.Vref getVref(
\r
332 throws java.lang.IndexOutOfBoundsException {
\r
333 // check bounds for index
\r
334 if (index < 0 || index >= this._vrefList.size()) {
\r
335 throw new IndexOutOfBoundsException("getVref: Index value '" + index + "' not in range [0.." + (this._vrefList.size() - 1) + "]");
\r
338 return (uk.ac.vamsas.objects.core.Vref) _vrefList.get(index);
\r
342 * Method getVref.Returns the contents of the collection in an
\r
343 * Array. <p>Note: Just in case the collection contents are
\r
344 * changing in another thread, we pass a 0-length Array of the
\r
345 * correct type into the API call. This way we <i>know</i>
\r
346 * that the Array returned is of exactly the correct length.
\r
348 * @return this collection as an Array
\r
350 public uk.ac.vamsas.objects.core.Vref[] getVref(
\r
352 uk.ac.vamsas.objects.core.Vref[] array = new uk.ac.vamsas.objects.core.Vref[0];
\r
353 return (uk.ac.vamsas.objects.core.Vref[]) this._vrefList.toArray(array);
\r
357 * Method getVrefAsReference.Returns a reference to
\r
358 * '_vrefList'. No type checking is performed on any
\r
359 * modifications to the Vector.
\r
361 * @return a reference to the Vector backing this class
\r
363 public java.util.Vector getVrefAsReference(
\r
365 return this._vrefList;
\r
369 * Method getVrefCount.
\r
371 * @return the size of this collection
\r
373 public int getVrefCount(
\r
375 return this._vrefList.size();
\r
379 * Overrides the java.lang.Object.hashCode method.
\r
381 * The following steps came from <b>Effective Java Programming
\r
382 * Language Guide</b> by Joshua Bloch, Chapter 3
\r
384 * @return a hash code value for the object.
\r
386 public int hashCode(
\r
388 int result = super.hashCode();
\r
392 result = 37 * result + _id.hashCode();
\r
394 if (_modifiable != null) {
\r
395 result = 37 * result + _modifiable.hashCode();
\r
397 if (_name != null) {
\r
398 result = 37 * result + _name.hashCode();
\r
400 if (_description != null) {
\r
401 result = 37 * result + _description.hashCode();
\r
403 if (_vrefList != null) {
\r
404 result = 37 * result + _vrefList.hashCode();
\r
406 if (_propertyList != null) {
\r
407 result = 37 * result + _propertyList.hashCode();
\r
416 * @return true if this object is valid according to the schema
\r
418 public boolean isValid(
\r
422 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
432 * @throws org.exolab.castor.xml.MarshalException if object is
\r
433 * null or if any SAXException is thrown during marshaling
\r
434 * @throws org.exolab.castor.xml.ValidationException if this
\r
435 * object is an invalid instance according to the schema
\r
437 public void marshal(
\r
438 final java.io.Writer out)
\r
439 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
440 Marshaller.marshal(this, out);
\r
447 * @throws java.io.IOException if an IOException occurs during
\r
449 * @throws org.exolab.castor.xml.ValidationException if this
\r
450 * object is an invalid instance according to the schema
\r
451 * @throws org.exolab.castor.xml.MarshalException if object is
\r
452 * null or if any SAXException is thrown during marshaling
\r
454 public void marshal(
\r
455 final org.xml.sax.ContentHandler handler)
\r
456 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
457 Marshaller.marshal(this, handler);
\r
462 public void removeAllProperty(
\r
464 this._propertyList.clear();
\r
469 public void removeAllVref(
\r
471 this._vrefList.clear();
\r
475 * Method removeProperty.
\r
478 * @return true if the object was removed from the collection.
\r
480 public boolean removeProperty(
\r
481 final uk.ac.vamsas.objects.core.Property vProperty) {
\r
482 boolean removed = _propertyList.remove(vProperty);
\r
487 * Method removePropertyAt.
\r
490 * @return the element removed from the collection
\r
492 public uk.ac.vamsas.objects.core.Property removePropertyAt(
\r
494 java.lang.Object obj = this._propertyList.remove(index);
\r
495 return (uk.ac.vamsas.objects.core.Property) obj;
\r
499 * Method removeVref.
\r
502 * @return true if the object was removed from the collection.
\r
504 public boolean removeVref(
\r
505 final uk.ac.vamsas.objects.core.Vref vVref) {
\r
506 boolean removed = _vrefList.remove(vVref);
\r
511 * Method removeVrefAt.
\r
514 * @return the element removed from the collection
\r
516 public uk.ac.vamsas.objects.core.Vref removeVrefAt(
\r
518 java.lang.Object obj = this._vrefList.remove(index);
\r
519 return (uk.ac.vamsas.objects.core.Vref) obj;
\r
523 * Sets the value of field 'description'. The field
\r
524 * 'description' has the following description: Descriptive
\r
525 * text for this node
\r
527 * @param description the value of field 'description'.
\r
529 public void setDescription(
\r
530 final java.lang.String description) {
\r
531 this._description = description;
\r
535 * Sets the value of field 'id'. The field 'id' has the
\r
536 * following description: Primary Key for vamsas object
\r
539 * @param id the value of field 'id'.
\r
542 final java.lang.String id) {
\r
547 * Sets the value of field 'modifiable'.
\r
549 * @param modifiable the value of field 'modifiable'.
\r
551 public void setModifiable(
\r
552 final java.lang.String modifiable) {
\r
553 this._modifiable = modifiable;
\r
557 * Sets the value of field 'name'. The field 'name' has the
\r
558 * following description: Short name for this node
\r
560 * @param name the value of field 'name'.
\r
562 public void setName(
\r
563 final java.lang.String name) {
\r
572 * @throws java.lang.IndexOutOfBoundsException if the index
\r
573 * given is outside the bounds of the collection
\r
575 public void setProperty(
\r
577 final uk.ac.vamsas.objects.core.Property vProperty)
\r
578 throws java.lang.IndexOutOfBoundsException {
\r
579 // check bounds for index
\r
580 if (index < 0 || index >= this._propertyList.size()) {
\r
581 throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
\r
584 this._propertyList.set(index, vProperty);
\r
590 * @param vPropertyArray
\r
592 public void setProperty(
\r
593 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
\r
595 _propertyList.clear();
\r
597 for (int i = 0; i < vPropertyArray.length; i++) {
\r
598 this._propertyList.add(vPropertyArray[i]);
\r
603 * Sets the value of '_propertyList' by copying the given
\r
604 * Vector. All elements will be checked for type safety.
\r
606 * @param vPropertyList the Vector to copy.
\r
608 public void setProperty(
\r
609 final java.util.Vector vPropertyList) {
\r
611 this._propertyList.clear();
\r
613 this._propertyList.addAll(vPropertyList);
\r
617 * Sets the value of '_propertyList' by setting it to the given
\r
618 * Vector. No type checking is performed.
\r
621 * @param propertyVector the Vector to set.
\r
623 public void setPropertyAsReference(
\r
624 final java.util.Vector propertyVector) {
\r
625 this._propertyList = propertyVector;
\r
633 * @throws java.lang.IndexOutOfBoundsException if the index
\r
634 * given is outside the bounds of the collection
\r
636 public void setVref(
\r
638 final uk.ac.vamsas.objects.core.Vref vVref)
\r
639 throws java.lang.IndexOutOfBoundsException {
\r
640 // check bounds for index
\r
641 if (index < 0 || index >= this._vrefList.size()) {
\r
642 throw new IndexOutOfBoundsException("setVref: Index value '" + index + "' not in range [0.." + (this._vrefList.size() - 1) + "]");
\r
645 this._vrefList.set(index, vVref);
\r
651 * @param vVrefArray
\r
653 public void setVref(
\r
654 final uk.ac.vamsas.objects.core.Vref[] vVrefArray) {
\r
658 for (int i = 0; i < vVrefArray.length; i++) {
\r
659 this._vrefList.add(vVrefArray[i]);
\r
664 * Sets the value of '_vrefList' by copying the given Vector.
\r
665 * All elements will be checked for type safety.
\r
667 * @param vVrefList the Vector to copy.
\r
669 public void setVref(
\r
670 final java.util.Vector vVrefList) {
\r
672 this._vrefList.clear();
\r
674 this._vrefList.addAll(vVrefList);
\r
678 * Sets the value of '_vrefList' by setting it to the given
\r
679 * Vector. No type checking is performed.
\r
682 * @param vrefVector the Vector to set.
\r
684 public void setVrefAsReference(
\r
685 final java.util.Vector vrefVector) {
\r
686 this._vrefList = vrefVector;
\r
690 * Method unmarshal.
\r
693 * @throws org.exolab.castor.xml.MarshalException if object is
\r
694 * null or if any SAXException is thrown during marshaling
\r
695 * @throws org.exolab.castor.xml.ValidationException if this
\r
696 * object is an invalid instance according to the schema
\r
697 * @return the unmarshaled uk.ac.vamsas.objects.core.NodeType
\r
699 public static uk.ac.vamsas.objects.core.NodeType unmarshal(
\r
700 final java.io.Reader reader)
\r
701 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
702 return (uk.ac.vamsas.objects.core.NodeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.NodeType.class, reader);
\r
708 * @throws org.exolab.castor.xml.ValidationException if this
\r
709 * object is an invalid instance according to the schema
\r
711 public void validate(
\r
713 throws org.exolab.castor.xml.ValidationException {
\r
714 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
715 validator.validate(this);
\r