apply gpl development license
[jalview.git] / src / jalview / schemabinding / version2 / PdbentryItem.java
index 6f64036..02818a0 100755 (executable)
@@ -1,22 +1,23 @@
 /*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)\r
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * \r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * \r
+ * This program 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 General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
  */\r
-\r
 package jalview.schemabinding.version2;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.Serializable;\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
-\r
 /**\r
  * Class PdbentryItem.\r
  * \r
@@ -30,7 +31,7 @@ public class PdbentryItem implements java.io.Serializable {
     //--------------------------/\r
 \r
     /**\r
-     * Field _propertyList\r
+     * Field _propertyList.\r
      */\r
     private java.util.Vector _propertyList;\r
 \r
@@ -41,8 +42,8 @@ public class PdbentryItem implements java.io.Serializable {
 \r
     public PdbentryItem() {\r
         super();\r
-        _propertyList = new Vector();\r
-    } //-- jalview.schemabinding.version2.PdbentryItem()\r
+        this._propertyList = new java.util.Vector();\r
+    }\r
 \r
 \r
       //-----------/\r
@@ -50,148 +51,153 @@ public class PdbentryItem implements java.io.Serializable {
     //-----------/\r
 \r
     /**\r
-     * Method addProperty\r
-     * \r
      * \r
      * \r
      * @param vProperty\r
+     * @throws java.lang.IndexOutOfBoundsException if the index\r
+     * given is outside the bounds of the collection\r
      */\r
-    public void addProperty(jalview.schemabinding.version2.Property vProperty)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        _propertyList.addElement(vProperty);\r
-    } //-- void addProperty(jalview.schemabinding.version2.Property) \r
+    public void addProperty(\r
+            final jalview.schemabinding.version2.Property vProperty)\r
+    throws java.lang.IndexOutOfBoundsException {\r
+        this._propertyList.addElement(vProperty);\r
+    }\r
 \r
     /**\r
-     * Method addProperty\r
-     * \r
      * \r
      * \r
      * @param index\r
      * @param vProperty\r
+     * @throws java.lang.IndexOutOfBoundsException if the index\r
+     * given is outside the bounds of the collection\r
      */\r
-    public void addProperty(int index, jalview.schemabinding.version2.Property vProperty)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        _propertyList.insertElementAt(vProperty, index);\r
-    } //-- void addProperty(int, jalview.schemabinding.version2.Property) \r
+    public void addProperty(\r
+            final int index,\r
+            final jalview.schemabinding.version2.Property vProperty)\r
+    throws java.lang.IndexOutOfBoundsException {\r
+        this._propertyList.add(index, vProperty);\r
+    }\r
 \r
     /**\r
-     * Method enumerateProperty\r
-     * \r
+     * Method enumerateProperty.\r
      * \r
-     * \r
-     * @return Enumeration\r
+     * @return an Enumeration over all\r
+     * jalview.schemabinding.version2.Property elements\r
      */\r
-    public java.util.Enumeration enumerateProperty()\r
-    {\r
-        return _propertyList.elements();\r
-    } //-- java.util.Enumeration enumerateProperty() \r
+    public java.util.Enumeration enumerateProperty(\r
+    ) {\r
+        return this._propertyList.elements();\r
+    }\r
 \r
     /**\r
-     * Method getProperty\r
-     * \r
-     * \r
+     * Method getProperty.\r
      * \r
      * @param index\r
-     * @return Property\r
+     * @throws java.lang.IndexOutOfBoundsException if the index\r
+     * given is outside the bounds of the collection\r
+     * @return the value of the\r
+     * jalview.schemabinding.version2.Property at the given index\r
      */\r
-    public jalview.schemabinding.version2.Property getProperty(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        //-- check bounds for index\r
-        if ((index < 0) || (index > _propertyList.size())) {\r
-            throw new IndexOutOfBoundsException();\r
+    public jalview.schemabinding.version2.Property getProperty(\r
+            final int index)\r
+    throws java.lang.IndexOutOfBoundsException {\r
+        // check bounds for index\r
+        if (index < 0 || index >= this._propertyList.size()) {\r
+            throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
         }\r
         \r
-        return (jalview.schemabinding.version2.Property) _propertyList.elementAt(index);\r
-    } //-- jalview.schemabinding.version2.Property getProperty(int) \r
+        return (jalview.schemabinding.version2.Property) _propertyList.get(index);\r
+    }\r
 \r
     /**\r
-     * Method getProperty\r
-     * \r
-     * \r
+     * Method getProperty.Returns the contents of the collection in\r
+     * an Array.  <p>Note:  Just in case the collection contents\r
+     * are changing in another thread, we pass a 0-length Array of\r
+     * the 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 Property\r
+     * @return this collection as an Array\r
      */\r
-    public jalview.schemabinding.version2.Property[] getProperty()\r
-    {\r
-        int size = _propertyList.size();\r
-        jalview.schemabinding.version2.Property[] mArray = new jalview.schemabinding.version2.Property[size];\r
-        for (int index = 0; index < size; index++) {\r
-            mArray[index] = (jalview.schemabinding.version2.Property) _propertyList.elementAt(index);\r
-        }\r
-        return mArray;\r
-    } //-- jalview.schemabinding.version2.Property[] getProperty() \r
+    public jalview.schemabinding.version2.Property[] getProperty(\r
+    ) {\r
+        jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0];\r
+        return (jalview.schemabinding.version2.Property[]) this._propertyList.toArray(array);\r
+    }\r
 \r
     /**\r
-     * Method getPropertyCount\r
-     * \r
+     * Method getPropertyCount.\r
      * \r
-     * \r
-     * @return int\r
+     * @return the size of this collection\r
      */\r
-    public int getPropertyCount()\r
-    {\r
-        return _propertyList.size();\r
-    } //-- int getPropertyCount() \r
+    public int getPropertyCount(\r
+    ) {\r
+        return this._propertyList.size();\r
+    }\r
 \r
     /**\r
-     * Method removeAllProperty\r
-     * \r
      */\r
-    public void removeAllProperty()\r
-    {\r
-        _propertyList.removeAllElements();\r
-    } //-- void removeAllProperty() \r
+    public void removeAllProperty(\r
+    ) {\r
+        this._propertyList.clear();\r
+    }\r
 \r
     /**\r
-     * Method removeProperty\r
-     * \r
+     * Method removeProperty.\r
      * \r
+     * @param vProperty\r
+     * @return true if the object was removed from the collection.\r
+     */\r
+    public boolean removeProperty(\r
+            final jalview.schemabinding.version2.Property vProperty) {\r
+        boolean removed = _propertyList.remove(vProperty);\r
+        return removed;\r
+    }\r
+\r
+    /**\r
+     * Method removePropertyAt.\r
      * \r
      * @param index\r
-     * @return Property\r
+     * @return the element removed from the collection\r
      */\r
-    public jalview.schemabinding.version2.Property removeProperty(int index)\r
-    {\r
-        java.lang.Object obj = _propertyList.elementAt(index);\r
-        _propertyList.removeElementAt(index);\r
+    public jalview.schemabinding.version2.Property removePropertyAt(\r
+            final int index) {\r
+        java.lang.Object obj = this._propertyList.remove(index);\r
         return (jalview.schemabinding.version2.Property) obj;\r
-    } //-- jalview.schemabinding.version2.Property removeProperty(int) \r
+    }\r
 \r
     /**\r
-     * Method setProperty\r
-     * \r
      * \r
      * \r
      * @param index\r
      * @param vProperty\r
+     * @throws java.lang.IndexOutOfBoundsException if the index\r
+     * given is outside the bounds of the collection\r
      */\r
-    public void setProperty(int index, jalview.schemabinding.version2.Property vProperty)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        //-- check bounds for index\r
-        if ((index < 0) || (index > _propertyList.size())) {\r
-            throw new IndexOutOfBoundsException();\r
+    public void setProperty(\r
+            final int index,\r
+            final jalview.schemabinding.version2.Property vProperty)\r
+    throws java.lang.IndexOutOfBoundsException {\r
+        // check bounds for index\r
+        if (index < 0 || index >= this._propertyList.size()) {\r
+            throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
         }\r
-        _propertyList.setElementAt(vProperty, index);\r
-    } //-- void setProperty(int, jalview.schemabinding.version2.Property) \r
+        \r
+        this._propertyList.set(index, vProperty);\r
+    }\r
 \r
     /**\r
-     * Method setProperty\r
-     * \r
      * \r
      * \r
-     * @param propertyArray\r
+     * @param vPropertyArray\r
      */\r
-    public void setProperty(jalview.schemabinding.version2.Property[] propertyArray)\r
-    {\r
+    public void setProperty(\r
+            final jalview.schemabinding.version2.Property[] vPropertyArray) {\r
         //-- copy array\r
-        _propertyList.removeAllElements();\r
-        for (int i = 0; i < propertyArray.length; i++) {\r
-            _propertyList.addElement(propertyArray[i]);\r
+        _propertyList.clear();\r
+        \r
+        for (int i = 0; i < vPropertyArray.length; i++) {\r
+                this._propertyList.add(vPropertyArray[i]);\r
         }\r
-    } //-- void setProperty(jalview.schemabinding.version2.Property) \r
+    }\r
 \r
 }\r