/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
/**\r
- * Specify an ordered set of positions and/or regions on the\r
- * principle\r
- * dimension of some associated vamsas object Keeping to jaxb-1.0\r
- * specification for the moment - this choice should\r
- * become a substitution group when we use jaxb-2.0 capable\r
- * bindings\r
- * \r
+ * Specify an ordered set of positions and/or regions on the principle dimension\r
+ * of some associated vamsas object Keeping to jaxb-1.0 specification for the\r
+ * moment - this choice should become a substitution group when we use jaxb-2.0\r
+ * capable bindings\r
+ * \r
* \r
* @version $Revision$ $Date$\r
*/\r
-public abstract class RangeType extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Internal choice value storage\r
- */\r
- private java.lang.Object _choiceValue;\r
-\r
- /**\r
- * a position within the associated object's coordinate system\r
- * \r
- */\r
- private java.util.Vector _posList;\r
-\r
- /**\r
- * a region from start to end, with flag for inclusivity of\r
- * terminii \r
- */\r
- private java.util.Vector _segList;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public RangeType() {\r
- super();\r
- this._posList = new java.util.Vector();\r
- this._segList = new java.util.Vector();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\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(\r
- final uk.ac.vamsas.objects.core.Pos vPos)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._posList.addElement(vPos);\r
- }\r
-\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(\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
- * \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(\r
- final uk.ac.vamsas.objects.core.Seg vSeg)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._segList.addElement(vSeg);\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 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
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.Pos elements\r
- */\r
- public java.util.Enumeration enumeratePos(\r
- ) {\r
- return this._posList.elements();\r
- }\r
-\r
- /**\r
- * Method enumerateSeg.\r
- * \r
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.Seg elements\r
- */\r
- public java.util.Enumeration enumerateSeg(\r
- ) {\r
- return this._segList.elements();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public abstract class RangeType extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Internal choice value storage\r
+ */\r
+ private java.lang.Object _choiceValue;\r
+\r
+ /**\r
+ * a position within the associated object's coordinate system\r
+ * \r
+ */\r
+ private java.util.Vector _posList;\r
+\r
+ /**\r
+ * a region from start to end, with flag for inclusivity of terminii\r
+ */\r
+ private java.util.Vector _segList;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public RangeType() {\r
+ super();\r
+ this._posList = new java.util.Vector();\r
+ this._segList = new java.util.Vector();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vPos\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addPos(final uk.ac.vamsas.objects.core.Pos vPos)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._posList.addElement(vPos);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vPos\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addPos(final int index, final uk.ac.vamsas.objects.core.Pos vPos)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._posList.add(index, vPos);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vSeg\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addSeg(final uk.ac.vamsas.objects.core.Seg vSeg)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._segList.addElement(vSeg);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vSeg\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addSeg(final int index, 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
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Pos elements\r
+ */\r
+ public java.util.Enumeration enumeratePos() {\r
+ return this._posList.elements();\r
+ }\r
+\r
+ /**\r
+ * Method enumerateSeg.\r
+ * \r
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Seg elements\r
+ */\r
+ public java.util.Enumeration enumerateSeg() {\r
+ return this._segList.elements();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\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)\r
+ return false;\r
+ if (this._choiceValue != temp._choiceValue) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._choiceValue);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._choiceValue);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._choiceValue);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._choiceValue);\r
+ }\r
+ ;\r
return false;\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
- 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
- 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
- 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
+ if (!thcycle) {\r
+ if (!this._choiceValue.equals(temp._choiceValue)) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._choiceValue);\r
+ org.castor.util.CycleBreaker\r
+ .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
- }\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 the value of field 'ChoiceValue'.\r
- */\r
- public java.lang.Object getChoiceValue(\r
- ) {\r
- return this._choiceValue;\r
- }\r
-\r
- /**\r
- * Method getPos.\r
- * \r
- * @param index\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.get(index);\r
- }\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 this collection as an Array\r
- */\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 getPosAsReference.Returns a reference to '_posList'.\r
- * No type checking is performed on any modifications to the\r
- * Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getPosAsReference(\r
- ) {\r
- return this._posList;\r
- }\r
-\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
- * @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.get(index);\r
- }\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 this collection as an Array\r
- */\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 getSegAsReference.Returns a reference to '_segList'.\r
- * No type checking is performed on any modifications to the\r
- * Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getSegAsReference(\r
- ) {\r
- return this._segList;\r
- }\r
-\r
- /**\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 true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ if (this._posList != null) {\r
+ if (temp._posList == null)\r
+ return false;\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) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._posList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList);\r
+ }\r
+ ;\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
- return true;\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllPos(\r
- ) {\r
- this._posList.clear();\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllSeg(\r
- ) {\r
- this._segList.clear();\r
- }\r
-\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 the element removed from the collection\r
- */\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
- }\r
-\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 the element removed from the collection\r
- */\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
- }\r
-\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(\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
- \r
- this._posList.set(index, vPos);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vPosArray\r
- */\r
- public void setPos(\r
- final uk.ac.vamsas.objects.core.Pos[] vPosArray) {\r
- //-- copy array\r
- _posList.clear();\r
- \r
- for (int i = 0; i < vPosArray.length; i++) {\r
- this._posList.add(vPosArray[i]);\r
- }\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
- * 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(\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
- \r
- this._segList.set(index, vSeg);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vSegArray\r
- */\r
- public void setSeg(\r
- final uk.ac.vamsas.objects.core.Seg[] vSegArray) {\r
- //-- copy array\r
- _segList.clear();\r
- \r
- for (int i = 0; i < vSegArray.length; i++) {\r
- this._segList.add(vSegArray[i]);\r
+ } else if (temp._posList != null)\r
+ return false;\r
+ if (this._segList != null) {\r
+ if (temp._segList == null)\r
+ return false;\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) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._segList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList);\r
+ }\r
+ ;\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
- }\r
-\r
- /**\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
- )\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
- }\r
+ } else if (temp._segList != null)\r
+ return false;\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'choiceValue'. The field 'choiceValue' has the\r
+ * following description: Internal choice value storage\r
+ * \r
+ * @return the value of field 'ChoiceValue'.\r
+ */\r
+ public java.lang.Object getChoiceValue() {\r
+ return this._choiceValue;\r
+ }\r
+\r
+ /**\r
+ * Method getPos.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Pos at the given index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Pos getPos(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\r
+ + "' not in range [0.." + (this._posList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.Pos) _posList.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getPos.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.Pos[] getPos() {\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 getPosAsReference.Returns a reference to '_posList'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getPosAsReference() {\r
+ return this._posList;\r
+ }\r
+\r
+ /**\r
+ * Method getPosCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getPosCount() {\r
+ return this._posList.size();\r
+ }\r
+\r
+ /**\r
+ * Method getSeg.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Seg at the given index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Seg getSeg(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\r
+ + "' not in range [0.." + (this._segList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.Seg) _segList.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getSeg.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.Seg[] getSeg() {\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 getSegAsReference.Returns a reference to '_segList'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getSegAsReference() {\r
+ return this._segList;\r
+ }\r
+\r
+ /**\r
+ * Method getSegCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getSegCount() {\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 Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\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 true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllPos() {\r
+ this._posList.clear();\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllSeg() {\r
+ this._segList.clear();\r
+ }\r
+\r
+ /**\r
+ * Method removePos.\r
+ * \r
+ * @param vPos\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removePos(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 the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.Pos removePosAt(final int index) {\r
+ java.lang.Object obj = this._posList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.Pos) obj;\r
+ }\r
+\r
+ /**\r
+ * Method removeSeg.\r
+ * \r
+ * @param vSeg\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeSeg(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 the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.Seg removeSegAt(final int index) {\r
+ java.lang.Object obj = this._segList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.Seg) obj;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vPos\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setPos(final int index, 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\r
+ + "' not in range [0.." + (this._posList.size() - 1) + "]");\r
+ }\r
+\r
+ this._posList.set(index, vPos);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vPosArray\r
+ */\r
+ public void setPos(final uk.ac.vamsas.objects.core.Pos[] vPosArray) {\r
+ // -- copy array\r
+ _posList.clear();\r
+\r
+ for (int i = 0; i < vPosArray.length; i++) {\r
+ this._posList.add(vPosArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_posList' by copying the given Vector. All elements will\r
+ * be checked for type safety.\r
+ * \r
+ * @param vPosList\r
+ * the Vector to copy.\r
+ */\r
+ public void setPos(final java.util.Vector vPosList) {\r
+ // copy vector\r
+ this._posList.clear();\r
+\r
+ this._posList.addAll(vPosList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_posList' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param posVector\r
+ * the Vector to set.\r
+ */\r
+ public void setPosAsReference(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\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setSeg(final int index, 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\r
+ + "' not in range [0.." + (this._segList.size() - 1) + "]");\r
+ }\r
+\r
+ this._segList.set(index, vSeg);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vSegArray\r
+ */\r
+ public void setSeg(final uk.ac.vamsas.objects.core.Seg[] vSegArray) {\r
+ // -- copy array\r
+ _segList.clear();\r
+\r
+ for (int i = 0; i < vSegArray.length; i++) {\r
+ this._segList.add(vSegArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_segList' by copying the given Vector. All elements will\r
+ * be checked for type safety.\r
+ * \r
+ * @param vSegList\r
+ * the Vector to copy.\r
+ */\r
+ public void setSeg(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 Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param segVector\r
+ * the Vector to set.\r
+ */\r
+ public void setSegAsReference(final java.util.Vector segVector) {\r
+ this._segList = segVector;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r