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
\r
55 private java.util.Vector _vrefList;
\r
58 * Field _propertyList.
\r
60 private java.util.Vector _propertyList;
\r
69 this._vrefList = new java.util.Vector();
\r
70 this._propertyList = new java.util.Vector();
\r
82 * @throws java.lang.IndexOutOfBoundsException if the index
\r
83 * given is outside the bounds of the collection
\r
85 public void addProperty(
\r
86 final uk.ac.vamsas.objects.core.Property vProperty)
\r
87 throws java.lang.IndexOutOfBoundsException {
\r
88 this._propertyList.addElement(vProperty);
\r
96 * @throws java.lang.IndexOutOfBoundsException if the index
\r
97 * given is outside the bounds of the collection
\r
99 public void addProperty(
\r
101 final uk.ac.vamsas.objects.core.Property vProperty)
\r
102 throws java.lang.IndexOutOfBoundsException {
\r
103 this._propertyList.add(index, vProperty);
\r
110 * @throws java.lang.IndexOutOfBoundsException if the index
\r
111 * given is outside the bounds of the collection
\r
113 public void addVref(
\r
114 final uk.ac.vamsas.objects.core.Vref vVref)
\r
115 throws java.lang.IndexOutOfBoundsException {
\r
116 this._vrefList.addElement(vVref);
\r
124 * @throws java.lang.IndexOutOfBoundsException if the index
\r
125 * given is outside the bounds of the collection
\r
127 public void addVref(
\r
129 final uk.ac.vamsas.objects.core.Vref vVref)
\r
130 throws java.lang.IndexOutOfBoundsException {
\r
131 this._vrefList.add(index, vVref);
\r
135 * Method enumerateProperty.
\r
137 * @return an Enumeration over all
\r
138 * uk.ac.vamsas.objects.core.Property elements
\r
140 public java.util.Enumeration enumerateProperty(
\r
142 return this._propertyList.elements();
\r
146 * Method enumerateVref.
\r
148 * @return an Enumeration over all
\r
149 * uk.ac.vamsas.objects.core.Vref elements
\r
151 public java.util.Enumeration enumerateVref(
\r
153 return this._vrefList.elements();
\r
157 * Overrides the java.lang.Object.equals method.
\r
160 * @return true if the objects are equal.
\r
162 public boolean equals(
\r
163 final java.lang.Object obj) {
\r
167 if (super.equals(obj)==false)
\r
170 if (obj instanceof NodeType) {
\r
172 NodeType temp = (NodeType)obj;
\r
175 if (this._id != null) {
\r
176 if (temp._id == null) return false;
\r
177 if (this._id != temp._id) {
\r
178 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
\r
179 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
\r
180 if (thcycle!=tmcycle) {
\r
181 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
\r
182 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
\r
186 if (!this._id.equals(temp._id)) {
\r
187 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
\r
188 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
\r
191 org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
\r
192 org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
\r
195 } else if (temp._id != null)
\r
197 if (this._modifiable != null) {
\r
198 if (temp._modifiable == null) return false;
\r
199 if (this._modifiable != temp._modifiable) {
\r
200 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._modifiable);
\r
201 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._modifiable);
\r
202 if (thcycle!=tmcycle) {
\r
203 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable); };
\r
204 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable); };
\r
208 if (!this._modifiable.equals(temp._modifiable)) {
\r
209 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
\r
210 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
\r
213 org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
\r
214 org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
\r
217 } else if (temp._modifiable != null)
\r
219 if (this._name != null) {
\r
220 if (temp._name == null) return false;
\r
221 if (this._name != temp._name) {
\r
222 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);
\r
223 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);
\r
224 if (thcycle!=tmcycle) {
\r
225 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };
\r
226 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };
\r
230 if (!this._name.equals(temp._name)) {
\r
231 org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
\r
232 org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
\r
235 org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
\r
236 org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
\r
239 } else if (temp._name != null)
\r
241 if (this._description != null) {
\r
242 if (temp._description == null) return false;
\r
243 if (this._description != temp._description) {
\r
244 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._description);
\r
245 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._description);
\r
246 if (thcycle!=tmcycle) {
\r
247 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._description); };
\r
248 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._description); };
\r
252 if (!this._description.equals(temp._description)) {
\r
253 org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
\r
254 org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
\r
257 org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
\r
258 org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
\r
261 } else if (temp._description != null)
\r
263 if (this._vrefList != null) {
\r
264 if (temp._vrefList == null) return false;
\r
265 if (this._vrefList != temp._vrefList) {
\r
266 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._vrefList);
\r
267 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._vrefList);
\r
268 if (thcycle!=tmcycle) {
\r
269 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._vrefList); };
\r
270 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._vrefList); };
\r
274 if (!this._vrefList.equals(temp._vrefList)) {
\r
275 org.castor.util.CycleBreaker.releaseCycleHandle(this._vrefList);
\r
276 org.castor.util.CycleBreaker.releaseCycleHandle(temp._vrefList);
\r
279 org.castor.util.CycleBreaker.releaseCycleHandle(this._vrefList);
\r
280 org.castor.util.CycleBreaker.releaseCycleHandle(temp._vrefList);
\r
283 } else if (temp._vrefList != null)
\r
285 if (this._propertyList != null) {
\r
286 if (temp._propertyList == null) return false;
\r
287 if (this._propertyList != temp._propertyList) {
\r
288 thcycle=org.castor.util.CycleBreaker.startingToCycle(this._propertyList);
\r
289 tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._propertyList);
\r
290 if (thcycle!=tmcycle) {
\r
291 if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList); };
\r
292 if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList); };
\r
296 if (!this._propertyList.equals(temp._propertyList)) {
\r
297 org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
\r
298 org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
\r
301 org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
\r
302 org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
\r
305 } else if (temp._propertyList != null)
\r
313 * Returns the value of field 'description'. The field
\r
314 * 'description' has the following description: Descriptive
\r
315 * text for this node
\r
317 * @return the value of field 'Description'.
\r
319 public java.lang.String getDescription(
\r
321 return this._description;
\r
325 * Returns the value of field 'id'. The field 'id' has the
\r
326 * following description: Primary Key for vamsas object
\r
329 * @return the value of field 'Id'.
\r
331 public java.lang.String getId(
\r
337 * Returns the value of field 'modifiable'.
\r
339 * @return the value of field 'Modifiable'.
\r
341 public java.lang.String getModifiable(
\r
343 return this._modifiable;
\r
347 * Returns the value of field 'name'. The field 'name' has the
\r
348 * following description: Short name for this node
\r
350 * @return the value of field 'Name'.
\r
352 public java.lang.String getName(
\r
358 * Method getProperty.
\r
361 * @throws java.lang.IndexOutOfBoundsException if the index
\r
362 * given is outside the bounds of the collection
\r
363 * @return the value of the uk.ac.vamsas.objects.core.Property
\r
364 * at the given index
\r
366 public uk.ac.vamsas.objects.core.Property getProperty(
\r
368 throws java.lang.IndexOutOfBoundsException {
\r
369 // check bounds for index
\r
370 if (index < 0 || index >= this._propertyList.size()) {
\r
371 throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
\r
374 return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
\r
378 * Method getProperty.Returns the contents of the collection in
\r
379 * an Array. <p>Note: Just in case the collection contents
\r
380 * are changing in another thread, we pass a 0-length Array of
\r
381 * the correct type into the API call. This way we <i>know</i>
\r
382 * that the Array returned is of exactly the correct length.
\r
384 * @return this collection as an Array
\r
386 public uk.ac.vamsas.objects.core.Property[] getProperty(
\r
388 uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
\r
389 return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
\r
393 * Method getPropertyAsReference.Returns a reference to
\r
394 * '_propertyList'. No type checking is performed on any
\r
395 * modifications to the Vector.
\r
397 * @return a reference to the Vector backing this class
\r
399 public java.util.Vector getPropertyAsReference(
\r
401 return this._propertyList;
\r
405 * Method getPropertyCount.
\r
407 * @return the size of this collection
\r
409 public int getPropertyCount(
\r
411 return this._propertyList.size();
\r
418 * @throws java.lang.IndexOutOfBoundsException if the index
\r
419 * given is outside the bounds of the collection
\r
420 * @return the value of the uk.ac.vamsas.objects.core.Vref at
\r
423 public uk.ac.vamsas.objects.core.Vref getVref(
\r
425 throws java.lang.IndexOutOfBoundsException {
\r
426 // check bounds for index
\r
427 if (index < 0 || index >= this._vrefList.size()) {
\r
428 throw new IndexOutOfBoundsException("getVref: Index value '" + index + "' not in range [0.." + (this._vrefList.size() - 1) + "]");
\r
431 return (uk.ac.vamsas.objects.core.Vref) _vrefList.get(index);
\r
435 * Method getVref.Returns the contents of the collection in an
\r
436 * Array. <p>Note: Just in case the collection contents are
\r
437 * changing in another thread, we pass a 0-length Array of the
\r
438 * correct type into the API call. This way we <i>know</i>
\r
439 * that the Array returned is of exactly the correct length.
\r
441 * @return this collection as an Array
\r
443 public uk.ac.vamsas.objects.core.Vref[] getVref(
\r
445 uk.ac.vamsas.objects.core.Vref[] array = new uk.ac.vamsas.objects.core.Vref[0];
\r
446 return (uk.ac.vamsas.objects.core.Vref[]) this._vrefList.toArray(array);
\r
450 * Method getVrefAsReference.Returns a reference to
\r
451 * '_vrefList'. No type checking is performed on any
\r
452 * modifications to the Vector.
\r
454 * @return a reference to the Vector backing this class
\r
456 public java.util.Vector getVrefAsReference(
\r
458 return this._vrefList;
\r
462 * Method getVrefCount.
\r
464 * @return the size of this collection
\r
466 public int getVrefCount(
\r
468 return this._vrefList.size();
\r
472 * Overrides the java.lang.Object.hashCode method.
\r
474 * The following steps came from <b>Effective Java Programming
\r
475 * Language Guide</b> by Joshua Bloch, Chapter 3
\r
477 * @return a hash code value for the object.
\r
479 public int hashCode(
\r
481 int result = super.hashCode();
\r
485 && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
\r
486 result = 37 * result + _id.hashCode();
\r
487 org.castor.util.CycleBreaker.releaseCycleHandle(_id);
\r
489 if (_modifiable != null
\r
490 && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
\r
491 result = 37 * result + _modifiable.hashCode();
\r
492 org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
\r
495 && !org.castor.util.CycleBreaker.startingToCycle(_name)) {
\r
496 result = 37 * result + _name.hashCode();
\r
497 org.castor.util.CycleBreaker.releaseCycleHandle(_name);
\r
499 if (_description != null
\r
500 && !org.castor.util.CycleBreaker.startingToCycle(_description)) {
\r
501 result = 37 * result + _description.hashCode();
\r
502 org.castor.util.CycleBreaker.releaseCycleHandle(_description);
\r
504 if (_vrefList != null
\r
505 && !org.castor.util.CycleBreaker.startingToCycle(_vrefList)) {
\r
506 result = 37 * result + _vrefList.hashCode();
\r
507 org.castor.util.CycleBreaker.releaseCycleHandle(_vrefList);
\r
509 if (_propertyList != null
\r
510 && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
\r
511 result = 37 * result + _propertyList.hashCode();
\r
512 org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
\r
521 * @return true if this object is valid according to the schema
\r
523 public boolean isValid(
\r
527 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
537 * @throws org.exolab.castor.xml.MarshalException if object is
\r
538 * null or if any SAXException is thrown during marshaling
\r
539 * @throws org.exolab.castor.xml.ValidationException if this
\r
540 * object is an invalid instance according to the schema
\r
542 public void marshal(
\r
543 final java.io.Writer out)
\r
544 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
545 Marshaller.marshal(this, out);
\r
552 * @throws java.io.IOException if an IOException occurs during
\r
554 * @throws org.exolab.castor.xml.ValidationException if this
\r
555 * object is an invalid instance according to the schema
\r
556 * @throws org.exolab.castor.xml.MarshalException if object is
\r
557 * null or if any SAXException is thrown during marshaling
\r
559 public void marshal(
\r
560 final org.xml.sax.ContentHandler handler)
\r
561 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
562 Marshaller.marshal(this, handler);
\r
567 public void removeAllProperty(
\r
569 this._propertyList.clear();
\r
574 public void removeAllVref(
\r
576 this._vrefList.clear();
\r
580 * Method removeProperty.
\r
583 * @return true if the object was removed from the collection.
\r
585 public boolean removeProperty(
\r
586 final uk.ac.vamsas.objects.core.Property vProperty) {
\r
587 boolean removed = _propertyList.remove(vProperty);
\r
592 * Method removePropertyAt.
\r
595 * @return the element removed from the collection
\r
597 public uk.ac.vamsas.objects.core.Property removePropertyAt(
\r
599 java.lang.Object obj = this._propertyList.remove(index);
\r
600 return (uk.ac.vamsas.objects.core.Property) obj;
\r
604 * Method removeVref.
\r
607 * @return true if the object was removed from the collection.
\r
609 public boolean removeVref(
\r
610 final uk.ac.vamsas.objects.core.Vref vVref) {
\r
611 boolean removed = _vrefList.remove(vVref);
\r
616 * Method removeVrefAt.
\r
619 * @return the element removed from the collection
\r
621 public uk.ac.vamsas.objects.core.Vref removeVrefAt(
\r
623 java.lang.Object obj = this._vrefList.remove(index);
\r
624 return (uk.ac.vamsas.objects.core.Vref) obj;
\r
628 * Sets the value of field 'description'. The field
\r
629 * 'description' has the following description: Descriptive
\r
630 * text for this node
\r
632 * @param description the value of field 'description'.
\r
634 public void setDescription(
\r
635 final java.lang.String description) {
\r
636 this._description = description;
\r
640 * Sets the value of field 'id'. The field 'id' has the
\r
641 * following description: Primary Key for vamsas object
\r
644 * @param id the value of field 'id'.
\r
647 final java.lang.String id) {
\r
652 * Sets the value of field 'modifiable'.
\r
654 * @param modifiable the value of field 'modifiable'.
\r
656 public void setModifiable(
\r
657 final java.lang.String modifiable) {
\r
658 this._modifiable = modifiable;
\r
662 * Sets the value of field 'name'. The field 'name' has the
\r
663 * following description: Short name for this node
\r
665 * @param name the value of field 'name'.
\r
667 public void setName(
\r
668 final java.lang.String name) {
\r
677 * @throws java.lang.IndexOutOfBoundsException if the index
\r
678 * given is outside the bounds of the collection
\r
680 public void setProperty(
\r
682 final uk.ac.vamsas.objects.core.Property vProperty)
\r
683 throws java.lang.IndexOutOfBoundsException {
\r
684 // check bounds for index
\r
685 if (index < 0 || index >= this._propertyList.size()) {
\r
686 throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
\r
689 this._propertyList.set(index, vProperty);
\r
695 * @param vPropertyArray
\r
697 public void setProperty(
\r
698 final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
\r
700 _propertyList.clear();
\r
702 for (int i = 0; i < vPropertyArray.length; i++) {
\r
703 this._propertyList.add(vPropertyArray[i]);
\r
708 * Sets the value of '_propertyList' by copying the given
\r
709 * Vector. All elements will be checked for type safety.
\r
711 * @param vPropertyList the Vector to copy.
\r
713 public void setProperty(
\r
714 final java.util.Vector vPropertyList) {
\r
716 this._propertyList.clear();
\r
718 this._propertyList.addAll(vPropertyList);
\r
722 * Sets the value of '_propertyList' by setting it to the given
\r
723 * Vector. No type checking is performed.
\r
726 * @param propertyVector the Vector to set.
\r
728 public void setPropertyAsReference(
\r
729 final java.util.Vector propertyVector) {
\r
730 this._propertyList = propertyVector;
\r
738 * @throws java.lang.IndexOutOfBoundsException if the index
\r
739 * given is outside the bounds of the collection
\r
741 public void setVref(
\r
743 final uk.ac.vamsas.objects.core.Vref vVref)
\r
744 throws java.lang.IndexOutOfBoundsException {
\r
745 // check bounds for index
\r
746 if (index < 0 || index >= this._vrefList.size()) {
\r
747 throw new IndexOutOfBoundsException("setVref: Index value '" + index + "' not in range [0.." + (this._vrefList.size() - 1) + "]");
\r
750 this._vrefList.set(index, vVref);
\r
756 * @param vVrefArray
\r
758 public void setVref(
\r
759 final uk.ac.vamsas.objects.core.Vref[] vVrefArray) {
\r
763 for (int i = 0; i < vVrefArray.length; i++) {
\r
764 this._vrefList.add(vVrefArray[i]);
\r
769 * Sets the value of '_vrefList' by copying the given Vector.
\r
770 * All elements will be checked for type safety.
\r
772 * @param vVrefList the Vector to copy.
\r
774 public void setVref(
\r
775 final java.util.Vector vVrefList) {
\r
777 this._vrefList.clear();
\r
779 this._vrefList.addAll(vVrefList);
\r
783 * Sets the value of '_vrefList' by setting it to the given
\r
784 * Vector. No type checking is performed.
\r
787 * @param vrefVector the Vector to set.
\r
789 public void setVrefAsReference(
\r
790 final java.util.Vector vrefVector) {
\r
791 this._vrefList = vrefVector;
\r
795 * Method unmarshal.
\r
798 * @throws org.exolab.castor.xml.MarshalException if object is
\r
799 * null or if any SAXException is thrown during marshaling
\r
800 * @throws org.exolab.castor.xml.ValidationException if this
\r
801 * object is an invalid instance according to the schema
\r
802 * @return the unmarshaled uk.ac.vamsas.objects.core.NodeType
\r
804 public static uk.ac.vamsas.objects.core.NodeType unmarshal(
\r
805 final java.io.Reader reader)
\r
806 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
807 return (uk.ac.vamsas.objects.core.NodeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.NodeType.class, reader);
\r
813 * @throws org.exolab.castor.xml.ValidationException if this
\r
814 * object is an invalid instance according to the schema
\r
816 public void validate(
\r
818 throws org.exolab.castor.xml.ValidationException {
\r
819 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
820 validator.validate(this);
\r