JAL-1503 update version in GPL header
[jalview.git] / src / jalview / binding / PdbentryItem.java
old mode 100755 (executable)
new mode 100644 (file)
index d797520..41edda3
-/*\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
- */\r
-\r
-package jalview.binding;\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
- * @version $Revision$ $Date$\r
- */\r
-public class PdbentryItem implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
-    //--------------------------/\r
-\r
-    /**\r
-     * Field _propertyList\r
-     */\r
-    private java.util.Vector _propertyList;\r
-\r
-\r
-      //----------------/\r
-     //- Constructors -/\r
-    //----------------/\r
-\r
-    public PdbentryItem() {\r
-        super();\r
-        _propertyList = new Vector();\r
-    } //-- jalview.binding.PdbentryItem()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method addProperty\r
-     * \r
-     * \r
-     * \r
-     * @param vProperty\r
-     */\r
-    public void addProperty(jalview.binding.Property vProperty)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        _propertyList.addElement(vProperty);\r
-    } //-- void addProperty(jalview.binding.Property) \r
-\r
-    /**\r
-     * Method addProperty\r
-     * \r
-     * \r
-     * \r
-     * @param index\r
-     * @param vProperty\r
-     */\r
-    public void addProperty(int index, jalview.binding.Property vProperty)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        _propertyList.insertElementAt(vProperty, index);\r
-    } //-- void addProperty(int, jalview.binding.Property) \r
-\r
-    /**\r
-     * Method enumerateProperty\r
-     * \r
-     * \r
-     * \r
-     * @return Enumeration\r
-     */\r
-    public java.util.Enumeration enumerateProperty()\r
-    {\r
-        return _propertyList.elements();\r
-    } //-- java.util.Enumeration enumerateProperty() \r
-\r
-    /**\r
-     * Method getProperty\r
-     * \r
-     * \r
-     * \r
-     * @param index\r
-     * @return Property\r
-     */\r
-    public jalview.binding.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
-        }\r
-        \r
-        return (jalview.binding.Property) _propertyList.elementAt(index);\r
-    } //-- jalview.binding.Property getProperty(int) \r
-\r
-    /**\r
-     * Method getProperty\r
-     * \r
-     * \r
-     * \r
-     * @return Property\r
-     */\r
-    public jalview.binding.Property[] getProperty()\r
-    {\r
-        int size = _propertyList.size();\r
-        jalview.binding.Property[] mArray = new jalview.binding.Property[size];\r
-        for (int index = 0; index < size; index++) {\r
-            mArray[index] = (jalview.binding.Property) _propertyList.elementAt(index);\r
-        }\r
-        return mArray;\r
-    } //-- jalview.binding.Property[] getProperty() \r
-\r
-    /**\r
-     * Method getPropertyCount\r
-     * \r
-     * \r
-     * \r
-     * @return int\r
-     */\r
-    public int getPropertyCount()\r
-    {\r
-        return _propertyList.size();\r
-    } //-- int getPropertyCount() \r
-\r
-    /**\r
-     * Method removeAllProperty\r
-     * \r
-     */\r
-    public void removeAllProperty()\r
-    {\r
-        _propertyList.removeAllElements();\r
-    } //-- void removeAllProperty() \r
-\r
-    /**\r
-     * Method removeProperty\r
-     * \r
-     * \r
-     * \r
-     * @param index\r
-     * @return Property\r
-     */\r
-    public jalview.binding.Property removeProperty(int index)\r
-    {\r
-        java.lang.Object obj = _propertyList.elementAt(index);\r
-        _propertyList.removeElementAt(index);\r
-        return (jalview.binding.Property) obj;\r
-    } //-- jalview.binding.Property removeProperty(int) \r
-\r
-    /**\r
-     * Method setProperty\r
-     * \r
-     * \r
-     * \r
-     * @param index\r
-     * @param vProperty\r
-     */\r
-    public void setProperty(int index, jalview.binding.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
-        }\r
-        _propertyList.setElementAt(vProperty, index);\r
-    } //-- void setProperty(int, jalview.binding.Property) \r
-\r
-    /**\r
-     * Method setProperty\r
-     * \r
-     * \r
-     * \r
-     * @param propertyArray\r
-     */\r
-    public void setProperty(jalview.binding.Property[] propertyArray)\r
-    {\r
-        //-- copy array\r
-        _propertyList.removeAllElements();\r
-        for (int i = 0; i < propertyArray.length; i++) {\r
-            _propertyList.addElement(propertyArray[i]);\r
-        }\r
-    } //-- void setProperty(jalview.binding.Property) \r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
+ * Copyright (C) 2014 The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.binding;
+
+/**
+ * Class PdbentryItem.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class PdbentryItem implements java.io.Serializable
+{
+
+  // --------------------------/
+  // - Class/Member Variables -/
+  // --------------------------/
+
+  /**
+   * Field _propertyList.
+   */
+  private java.util.Vector _propertyList;
+
+  // ----------------/
+  // - Constructors -/
+  // ----------------/
+
+  public PdbentryItem()
+  {
+    super();
+    this._propertyList = new java.util.Vector();
+  }
+
+  // -----------/
+  // - Methods -/
+  // -----------/
+
+  /**
+   * 
+   * 
+   * @param vProperty
+   * @throws java.lang.IndexOutOfBoundsException
+   *           if the index given is outside the bounds of the collection
+   */
+  public void addProperty(final jalview.binding.Property vProperty)
+          throws java.lang.IndexOutOfBoundsException
+  {
+    this._propertyList.addElement(vProperty);
+  }
+
+  /**
+   * 
+   * 
+   * @param index
+   * @param vProperty
+   * @throws java.lang.IndexOutOfBoundsException
+   *           if the index given is outside the bounds of the collection
+   */
+  public void addProperty(final int index,
+          final jalview.binding.Property vProperty)
+          throws java.lang.IndexOutOfBoundsException
+  {
+    this._propertyList.add(index, vProperty);
+  }
+
+  /**
+   * Method enumerateProperty.
+   * 
+   * @return an Enumeration over all jalview.binding.Property elements
+   */
+  public java.util.Enumeration enumerateProperty()
+  {
+    return this._propertyList.elements();
+  }
+
+  /**
+   * Method getProperty.
+   * 
+   * @param index
+   * @throws java.lang.IndexOutOfBoundsException
+   *           if the index given is outside the bounds of the collection
+   * @return the value of the jalview.binding.Property at the given index
+   */
+  public jalview.binding.Property getProperty(final int index)
+          throws java.lang.IndexOutOfBoundsException
+  {
+    // check bounds for index
+    if (index < 0 || index >= this._propertyList.size())
+    {
+      throw new IndexOutOfBoundsException("getProperty: Index value '"
+              + index + "' not in range [0.."
+              + (this._propertyList.size() - 1) + "]");
+    }
+
+    return (jalview.binding.Property) _propertyList.get(index);
+  }
+
+  /**
+   * Method getProperty.Returns the contents of the collection in an Array.
+   * <p>
+   * Note: Just in case the collection contents are changing in another thread,
+   * we pass a 0-length Array of the correct type into the API call. This way we
+   * <i>know</i> that the Array returned is of exactly the correct length.
+   * 
+   * @return this collection as an Array
+   */
+  public jalview.binding.Property[] getProperty()
+  {
+    jalview.binding.Property[] array = new jalview.binding.Property[0];
+    return (jalview.binding.Property[]) this._propertyList.toArray(array);
+  }
+
+  /**
+   * Method getPropertyCount.
+   * 
+   * @return the size of this collection
+   */
+  public int getPropertyCount()
+  {
+    return this._propertyList.size();
+  }
+
+  /**
+     */
+  public void removeAllProperty()
+  {
+    this._propertyList.clear();
+  }
+
+  /**
+   * Method removeProperty.
+   * 
+   * @param vProperty
+   * @return true if the object was removed from the collection.
+   */
+  public boolean removeProperty(final jalview.binding.Property vProperty)
+  {
+    boolean removed = _propertyList.remove(vProperty);
+    return removed;
+  }
+
+  /**
+   * Method removePropertyAt.
+   * 
+   * @param index
+   * @return the element removed from the collection
+   */
+  public jalview.binding.Property removePropertyAt(final int index)
+  {
+    java.lang.Object obj = this._propertyList.remove(index);
+    return (jalview.binding.Property) obj;
+  }
+
+  /**
+   * 
+   * 
+   * @param index
+   * @param vProperty
+   * @throws java.lang.IndexOutOfBoundsException
+   *           if the index given is outside the bounds of the collection
+   */
+  public void setProperty(final int index,
+          final jalview.binding.Property vProperty)
+          throws java.lang.IndexOutOfBoundsException
+  {
+    // check bounds for index
+    if (index < 0 || index >= this._propertyList.size())
+    {
+      throw new IndexOutOfBoundsException("setProperty: Index value '"
+              + index + "' not in range [0.."
+              + (this._propertyList.size() - 1) + "]");
+    }
+
+    this._propertyList.set(index, vProperty);
+  }
+
+  /**
+   * 
+   * 
+   * @param vPropertyArray
+   */
+  public void setProperty(final jalview.binding.Property[] vPropertyArray)
+  {
+    // -- copy array
+    _propertyList.clear();
+
+    for (int i = 0; i < vPropertyArray.length; i++)
+    {
+      this._propertyList.add(vPropertyArray[i]);
+    }
+  }
+
+}