/*\r
* This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
* Schema.\r
* $Id$\r
*/\r
\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-\r
/**\r
* Specify an ordered set of positions and/or regions on the\r
* principle\r
//- Constructors -/\r
//----------------/\r
\r
- public RangeType() \r
- {\r
+ public RangeType() {\r
super();\r
- _posList = new Vector();\r
- _segList = new Vector();\r
- } //-- uk.ac.vamsas.objects.core.RangeType()\r
+ this._posList = new java.util.Vector();\r
+ this._segList = new java.util.Vector();\r
+ }\r
\r
\r
//-----------/\r
//-----------/\r
\r
/**\r
- * Method addPos\r
- * \r
* \r
* \r
* @param vPos\r
+ * @throws java.lang.IndexOutOfBoundsException if the index\r
+ * given is outside the bounds of the collection\r
*/\r
- public void addPos(uk.ac.vamsas.objects.core.Pos vPos)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _posList.addElement(vPos);\r
- } //-- void addPos(uk.ac.vamsas.objects.core.Pos) \r
+ public void addPos(\r
+ final uk.ac.vamsas.objects.core.Pos vPos)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._posList.addElement(vPos);\r
+ }\r
\r
/**\r
- * Method addPos\r
- * \r
* \r
* \r
* @param index\r
* @param vPos\r
+ * @throws java.lang.IndexOutOfBoundsException if the index\r
+ * given is outside the bounds of the collection\r
*/\r
- public void addPos(int index, uk.ac.vamsas.objects.core.Pos vPos)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _posList.insertElementAt(vPos, index);\r
- } //-- void addPos(int, uk.ac.vamsas.objects.core.Pos) \r
+ public void addPos(\r
+ final int index,\r
+ final uk.ac.vamsas.objects.core.Pos vPos)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._posList.add(index, vPos);\r
+ }\r
\r
/**\r
- * Method addSeg\r
- * \r
* \r
* \r
* @param vSeg\r
+ * @throws java.lang.IndexOutOfBoundsException if the index\r
+ * given is outside the bounds of the collection\r
*/\r
- public void addSeg(uk.ac.vamsas.objects.core.Seg vSeg)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _segList.addElement(vSeg);\r
- } //-- void addSeg(uk.ac.vamsas.objects.core.Seg) \r
+ public void addSeg(\r
+ final uk.ac.vamsas.objects.core.Seg vSeg)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._segList.addElement(vSeg);\r
+ }\r
\r
/**\r
- * Method addSeg\r
- * \r
* \r
* \r
* @param index\r
* @param vSeg\r
+ * @throws java.lang.IndexOutOfBoundsException if the index\r
+ * given is outside the bounds of the collection\r
*/\r
- public void addSeg(int index, uk.ac.vamsas.objects.core.Seg vSeg)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- _segList.insertElementAt(vSeg, index);\r
- } //-- void addSeg(int, uk.ac.vamsas.objects.core.Seg) \r
+ public void addSeg(\r
+ final int index,\r
+ final uk.ac.vamsas.objects.core.Seg vSeg)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._segList.add(index, vSeg);\r
+ }\r
\r
/**\r
- * Method enumeratePos\r
- * \r
- * \r
+ * Method enumeratePos.\r
* \r
- * @return Enumeration\r
+ * @return an Enumeration over all\r
+ * uk.ac.vamsas.objects.core.Pos elements\r
*/\r
- public java.util.Enumeration enumeratePos()\r
- {\r
- return _posList.elements();\r
- } //-- java.util.Enumeration enumeratePos() \r
+ public java.util.Enumeration enumeratePos(\r
+ ) {\r
+ return this._posList.elements();\r
+ }\r
\r
/**\r
- * Method enumerateSeg\r
- * \r
- * \r
+ * Method enumerateSeg.\r
* \r
- * @return Enumeration\r
+ * @return an Enumeration over all\r
+ * uk.ac.vamsas.objects.core.Seg elements\r
*/\r
- public java.util.Enumeration enumerateSeg()\r
- {\r
- return _segList.elements();\r
- } //-- java.util.Enumeration enumerateSeg() \r
+ public java.util.Enumeration enumerateSeg(\r
+ ) {\r
+ return this._segList.elements();\r
+ }\r
\r
/**\r
- * Note: hashCode() has not been overriden\r
+ * Overrides the java.lang.Object.equals method.\r
* \r
* @param obj\r
- * @return boolean\r
+ * @return true if the objects are equal.\r
*/\r
- public boolean equals(java.lang.Object obj)\r
- {\r
+ public boolean equals(\r
+ final java.lang.Object obj) {\r
if ( this == obj )\r
return true;\r
\r
if (obj instanceof RangeType) {\r
\r
RangeType temp = (RangeType)obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
if (this._choiceValue != null) {\r
if (temp._choiceValue == null) return false;\r
- else if (!(this._choiceValue.equals(temp._choiceValue))) \r
- return false;\r
- }\r
- else if (temp._choiceValue != null)\r
+ if (this._choiceValue != temp._choiceValue) {\r
+ thcycle=org.castor.util.CycleBreaker.startingToCycle(this._choiceValue);\r
+ tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._choiceValue);\r
+ if (thcycle!=tmcycle) {\r
+ if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue); };\r
+ if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue); };\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._choiceValue.equals(temp._choiceValue)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
+ }\r
+ }\r
+ } else if (temp._choiceValue != null)\r
return false;\r
if (this._posList != null) {\r
if (temp._posList == null) return false;\r
- else if (!(this._posList.equals(temp._posList))) \r
- return false;\r
- }\r
- else if (temp._posList != null)\r
+ if (this._posList != temp._posList) {\r
+ thcycle=org.castor.util.CycleBreaker.startingToCycle(this._posList);\r
+ tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._posList);\r
+ if (thcycle!=tmcycle) {\r
+ if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._posList); };\r
+ if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList); };\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._posList.equals(temp._posList)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._posList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._posList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList);\r
+ }\r
+ }\r
+ } else if (temp._posList != null)\r
return false;\r
if (this._segList != null) {\r
if (temp._segList == null) return false;\r
- else if (!(this._segList.equals(temp._segList))) \r
- return false;\r
- }\r
- else if (temp._segList != null)\r
+ if (this._segList != temp._segList) {\r
+ thcycle=org.castor.util.CycleBreaker.startingToCycle(this._segList);\r
+ tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._segList);\r
+ if (thcycle!=tmcycle) {\r
+ if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._segList); };\r
+ if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList); };\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._segList.equals(temp._segList)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._segList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._segList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList);\r
+ }\r
+ }\r
+ } else if (temp._segList != null)\r
return false;\r
return true;\r
}\r
return false;\r
- } //-- boolean equals(java.lang.Object) \r
+ }\r
\r
/**\r
* Returns the value of field 'choiceValue'. The field\r
* 'choiceValue' has the following description: Internal choice\r
* value storage\r
* \r
- * @return Object\r
- * @return the value of field 'choiceValue'.\r
+ * @return the value of field 'ChoiceValue'.\r
*/\r
- public java.lang.Object getChoiceValue()\r
- {\r
+ public java.lang.Object getChoiceValue(\r
+ ) {\r
return this._choiceValue;\r
- } //-- java.lang.Object getChoiceValue() \r
+ }\r
\r
/**\r
- * Method getPos\r
- * \r
- * \r
+ * Method getPos.\r
* \r
* @param index\r
- * @return Pos\r
- */\r
- public uk.ac.vamsas.objects.core.Pos getPos(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _posList.size())) {\r
- throw new IndexOutOfBoundsException("getPos: Index value '"+index+"' not in range [0.."+_posList.size()+ "]");\r
+ * @throws java.lang.IndexOutOfBoundsException if the index\r
+ * given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Pos at\r
+ * the given index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Pos getPos(\r
+ final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._posList.size()) {\r
+ throw new IndexOutOfBoundsException("getPos: Index value '" + index + "' not in range [0.." + (this._posList.size() - 1) + "]");\r
}\r
\r
- return (uk.ac.vamsas.objects.core.Pos) _posList.elementAt(index);\r
- } //-- uk.ac.vamsas.objects.core.Pos getPos(int) \r
+ return (uk.ac.vamsas.objects.core.Pos) _posList.get(index);\r
+ }\r
\r
/**\r
- * Method getPos\r
- * \r
- * \r
+ * Method getPos.Returns the contents of the collection in an\r
+ * Array. <p>Note: Just in case the collection contents are\r
+ * changing in another thread, we pass a 0-length Array of the\r
+ * correct type into the API call. This way we <i>know</i>\r
+ * that the Array returned is of exactly the correct length.\r
* \r
- * @return Pos\r
+ * @return this collection as an Array\r
*/\r
- public uk.ac.vamsas.objects.core.Pos[] getPos()\r
- {\r
- int size = _posList.size();\r
- uk.ac.vamsas.objects.core.Pos[] mArray = new uk.ac.vamsas.objects.core.Pos[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (uk.ac.vamsas.objects.core.Pos) _posList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- uk.ac.vamsas.objects.core.Pos[] getPos() \r
+ public uk.ac.vamsas.objects.core.Pos[] getPos(\r
+ ) {\r
+ uk.ac.vamsas.objects.core.Pos[] array = new uk.ac.vamsas.objects.core.Pos[0];\r
+ return (uk.ac.vamsas.objects.core.Pos[]) this._posList.toArray(array);\r
+ }\r
\r
/**\r
- * Method getPosCount\r
- * \r
- * \r
+ * Method getPosAsReference.Returns a reference to '_posList'.\r
+ * No type checking is performed on any modifications to the\r
+ * Vector.\r
* \r
- * @return int\r
+ * @return a reference to the Vector backing this class\r
*/\r
- public int getPosCount()\r
- {\r
- return _posList.size();\r
- } //-- int getPosCount() \r
+ public java.util.Vector getPosAsReference(\r
+ ) {\r
+ return this._posList;\r
+ }\r
\r
/**\r
- * Method getSeg\r
- * \r
+ * Method getPosCount.\r
* \r
+ * @return the size of this collection\r
+ */\r
+ public int getPosCount(\r
+ ) {\r
+ return this._posList.size();\r
+ }\r
+\r
+ /**\r
+ * Method getSeg.\r
* \r
* @param index\r
- * @return Seg\r
- */\r
- public uk.ac.vamsas.objects.core.Seg getSeg(int index)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _segList.size())) {\r
- throw new IndexOutOfBoundsException("getSeg: Index value '"+index+"' not in range [0.."+_segList.size()+ "]");\r
+ * @throws java.lang.IndexOutOfBoundsException if the index\r
+ * given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Seg at\r
+ * the given index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Seg getSeg(\r
+ final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._segList.size()) {\r
+ throw new IndexOutOfBoundsException("getSeg: Index value '" + index + "' not in range [0.." + (this._segList.size() - 1) + "]");\r
}\r
\r
- return (uk.ac.vamsas.objects.core.Seg) _segList.elementAt(index);\r
- } //-- uk.ac.vamsas.objects.core.Seg getSeg(int) \r
+ return (uk.ac.vamsas.objects.core.Seg) _segList.get(index);\r
+ }\r
\r
/**\r
- * Method getSeg\r
- * \r
- * \r
+ * Method getSeg.Returns the contents of the collection in an\r
+ * Array. <p>Note: Just in case the collection contents are\r
+ * changing in another thread, we pass a 0-length Array of the\r
+ * correct type into the API call. This way we <i>know</i>\r
+ * that the Array returned is of exactly the correct length.\r
* \r
- * @return Seg\r
+ * @return this collection as an Array\r
*/\r
- public uk.ac.vamsas.objects.core.Seg[] getSeg()\r
- {\r
- int size = _segList.size();\r
- uk.ac.vamsas.objects.core.Seg[] mArray = new uk.ac.vamsas.objects.core.Seg[size];\r
- for (int index = 0; index < size; index++) {\r
- mArray[index] = (uk.ac.vamsas.objects.core.Seg) _segList.elementAt(index);\r
- }\r
- return mArray;\r
- } //-- uk.ac.vamsas.objects.core.Seg[] getSeg() \r
+ public uk.ac.vamsas.objects.core.Seg[] getSeg(\r
+ ) {\r
+ uk.ac.vamsas.objects.core.Seg[] array = new uk.ac.vamsas.objects.core.Seg[0];\r
+ return (uk.ac.vamsas.objects.core.Seg[]) this._segList.toArray(array);\r
+ }\r
\r
/**\r
- * Method getSegCount\r
- * \r
- * \r
+ * Method getSegAsReference.Returns a reference to '_segList'.\r
+ * No type checking is performed on any modifications to the\r
+ * Vector.\r
* \r
- * @return int\r
+ * @return a reference to the Vector backing this class\r
*/\r
- public int getSegCount()\r
- {\r
- return _segList.size();\r
- } //-- int getSegCount() \r
+ public java.util.Vector getSegAsReference(\r
+ ) {\r
+ return this._segList;\r
+ }\r
\r
/**\r
- * Method isValid\r
+ * Method getSegCount.\r
* \r
+ * @return the size of this collection\r
+ */\r
+ public int getSegCount(\r
+ ) {\r
+ return this._segList.size();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming\r
+ * Language Guide</b> by Joshua Bloch, Chapter 3\r
* \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode(\r
+ ) {\r
+ int result = super.hashCode();\r
+ \r
+ long tmp;\r
+ if (_choiceValue != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_choiceValue)) {\r
+ result = 37 * result + _choiceValue.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_choiceValue);\r
+ }\r
+ if (_posList != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_posList)) {\r
+ result = 37 * result + _posList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_posList);\r
+ }\r
+ if (_segList != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_segList)) {\r
+ result = 37 * result + _segList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_segList);\r
+ }\r
+ \r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
* \r
- * @return boolean\r
+ * @return true if this object is valid according to the schema\r
*/\r
- public boolean isValid()\r
- {\r
+ public boolean isValid(\r
+ ) {\r
try {\r
validate();\r
- }\r
- catch (org.exolab.castor.xml.ValidationException vex) {\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
return false;\r
}\r
return true;\r
- } //-- boolean isValid() \r
+ }\r
\r
/**\r
- * Method removeAllPos\r
- * \r
*/\r
- public void removeAllPos()\r
- {\r
- _posList.removeAllElements();\r
- } //-- void removeAllPos() \r
+ public void removeAllPos(\r
+ ) {\r
+ this._posList.clear();\r
+ }\r
\r
/**\r
- * Method removeAllSeg\r
- * \r
*/\r
- public void removeAllSeg()\r
- {\r
- _segList.removeAllElements();\r
- } //-- void removeAllSeg() \r
+ public void removeAllSeg(\r
+ ) {\r
+ this._segList.clear();\r
+ }\r
\r
/**\r
- * Method removePos\r
- * \r
+ * Method removePos.\r
* \r
+ * @param vPos\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removePos(\r
+ final uk.ac.vamsas.objects.core.Pos vPos) {\r
+ boolean removed = _posList.remove(vPos);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removePosAt.\r
* \r
* @param index\r
- * @return Pos\r
+ * @return the element removed from the collection\r
*/\r
- public uk.ac.vamsas.objects.core.Pos removePos(int index)\r
- {\r
- java.lang.Object obj = _posList.elementAt(index);\r
- _posList.removeElementAt(index);\r
+ public uk.ac.vamsas.objects.core.Pos removePosAt(\r
+ final int index) {\r
+ java.lang.Object obj = this._posList.remove(index);\r
return (uk.ac.vamsas.objects.core.Pos) obj;\r
- } //-- uk.ac.vamsas.objects.core.Pos removePos(int) \r
+ }\r
\r
/**\r
- * Method removeSeg\r
- * \r
+ * Method removeSeg.\r
* \r
+ * @param vSeg\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeSeg(\r
+ final uk.ac.vamsas.objects.core.Seg vSeg) {\r
+ boolean removed = _segList.remove(vSeg);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeSegAt.\r
* \r
* @param index\r
- * @return Seg\r
+ * @return the element removed from the collection\r
*/\r
- public uk.ac.vamsas.objects.core.Seg removeSeg(int index)\r
- {\r
- java.lang.Object obj = _segList.elementAt(index);\r
- _segList.removeElementAt(index);\r
+ public uk.ac.vamsas.objects.core.Seg removeSegAt(\r
+ final int index) {\r
+ java.lang.Object obj = this._segList.remove(index);\r
return (uk.ac.vamsas.objects.core.Seg) obj;\r
- } //-- uk.ac.vamsas.objects.core.Seg removeSeg(int) \r
+ }\r
\r
/**\r
- * Method setPos\r
- * \r
* \r
* \r
* @param index\r
* @param vPos\r
+ * @throws java.lang.IndexOutOfBoundsException if the index\r
+ * given is outside the bounds of the collection\r
*/\r
- public void setPos(int index, uk.ac.vamsas.objects.core.Pos vPos)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _posList.size())) {\r
- throw new IndexOutOfBoundsException("setPos: Index value '"+index+"' not in range [0.."+_posList.size()+ "]");\r
+ public void setPos(\r
+ final int index,\r
+ final uk.ac.vamsas.objects.core.Pos vPos)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._posList.size()) {\r
+ throw new IndexOutOfBoundsException("setPos: Index value '" + index + "' not in range [0.." + (this._posList.size() - 1) + "]");\r
}\r
- _posList.setElementAt(vPos, index);\r
- } //-- void setPos(int, uk.ac.vamsas.objects.core.Pos) \r
+ \r
+ this._posList.set(index, vPos);\r
+ }\r
\r
/**\r
- * Method setPos\r
* \r
* \r
- * \r
- * @param posArray\r
+ * @param vPosArray\r
*/\r
- public void setPos(uk.ac.vamsas.objects.core.Pos[] posArray)\r
- {\r
+ public void setPos(\r
+ final uk.ac.vamsas.objects.core.Pos[] vPosArray) {\r
//-- copy array\r
- _posList.removeAllElements();\r
- for (int i = 0; i < posArray.length; i++) {\r
- _posList.addElement(posArray[i]);\r
+ _posList.clear();\r
+ \r
+ for (int i = 0; i < vPosArray.length; i++) {\r
+ this._posList.add(vPosArray[i]);\r
}\r
- } //-- void setPos(uk.ac.vamsas.objects.core.Pos) \r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_posList' by copying the given Vector.\r
+ * All elements will be checked for type safety.\r
+ * \r
+ * @param vPosList the Vector to copy.\r
+ */\r
+ public void setPos(\r
+ final java.util.Vector vPosList) {\r
+ // copy vector\r
+ this._posList.clear();\r
+ \r
+ this._posList.addAll(vPosList);\r
+ }\r
\r
/**\r
- * Method setSeg\r
+ * Sets the value of '_posList' by setting it to the given\r
+ * Vector. No type checking is performed.\r
+ * @deprecated\r
* \r
+ * @param posVector the Vector to set.\r
+ */\r
+ public void setPosAsReference(\r
+ final java.util.Vector posVector) {\r
+ this._posList = posVector;\r
+ }\r
+\r
+ /**\r
* \r
* \r
* @param index\r
* @param vSeg\r
+ * @throws java.lang.IndexOutOfBoundsException if the index\r
+ * given is outside the bounds of the collection\r
*/\r
- public void setSeg(int index, uk.ac.vamsas.objects.core.Seg vSeg)\r
- throws java.lang.IndexOutOfBoundsException\r
- {\r
- //-- check bounds for index\r
- if ((index < 0) || (index > _segList.size())) {\r
- throw new IndexOutOfBoundsException("setSeg: Index value '"+index+"' not in range [0.."+_segList.size()+ "]");\r
+ public void setSeg(\r
+ final int index,\r
+ final uk.ac.vamsas.objects.core.Seg vSeg)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._segList.size()) {\r
+ throw new IndexOutOfBoundsException("setSeg: Index value '" + index + "' not in range [0.." + (this._segList.size() - 1) + "]");\r
}\r
- _segList.setElementAt(vSeg, index);\r
- } //-- void setSeg(int, uk.ac.vamsas.objects.core.Seg) \r
+ \r
+ this._segList.set(index, vSeg);\r
+ }\r
\r
/**\r
- * Method setSeg\r
- * \r
* \r
* \r
- * @param segArray\r
+ * @param vSegArray\r
*/\r
- public void setSeg(uk.ac.vamsas.objects.core.Seg[] segArray)\r
- {\r
+ public void setSeg(\r
+ final uk.ac.vamsas.objects.core.Seg[] vSegArray) {\r
//-- copy array\r
- _segList.removeAllElements();\r
- for (int i = 0; i < segArray.length; i++) {\r
- _segList.addElement(segArray[i]);\r
+ _segList.clear();\r
+ \r
+ for (int i = 0; i < vSegArray.length; i++) {\r
+ this._segList.add(vSegArray[i]);\r
}\r
- } //-- void setSeg(uk.ac.vamsas.objects.core.Seg) \r
+ }\r
\r
/**\r
- * Method validate\r
+ * Sets the value of '_segList' by copying the given Vector.\r
+ * All elements will be checked for type safety.\r
+ * \r
+ * @param vSegList the Vector to copy.\r
+ */\r
+ public void setSeg(\r
+ final java.util.Vector vSegList) {\r
+ // copy vector\r
+ this._segList.clear();\r
+ \r
+ this._segList.addAll(vSegList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_segList' by setting it to the given\r
+ * Vector. No type checking is performed.\r
+ * @deprecated\r
+ * \r
+ * @param segVector the Vector to set.\r
+ */\r
+ public void setSegAsReference(\r
+ final java.util.Vector segVector) {\r
+ this._segList = segVector;\r
+ }\r
+\r
+ /**\r
+ * \r
* \r
+ * @throws org.exolab.castor.xml.ValidationException if this\r
+ * object is an invalid instance according to the schema\r
*/\r
- public void validate()\r
- throws org.exolab.castor.xml.ValidationException\r
- {\r
+ public void validate(\r
+ )\r
+ throws org.exolab.castor.xml.ValidationException {\r
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
validator.validate(this);\r
- } //-- void validate() \r
+ }\r
\r
}\r