X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fbinding%2FPdbentryItem.java;h=2e8d77df49be3997f2a2ec2df5e51e04ec1006d5;hb=fe72160257543fca39f7959fc1347665e95764a2;hp=d797520bd5dfdee23b5feec5d1c2cba42732c261;hpb=55e2e9b22b133db8b9ff0979b0338a33081fc8fd;p=jalview.git
diff --git a/src/jalview/binding/PdbentryItem.java b/src/jalview/binding/PdbentryItem.java
old mode 100755
new mode 100644
index d797520..2e8d77d
--- a/src/jalview/binding/PdbentryItem.java
+++ b/src/jalview/binding/PdbentryItem.java
@@ -1,197 +1,215 @@
-/*
- * This class was automatically generated with
- * Castor 0.9.6, using an XML
- * Schema.
- * $Id$
- */
-
-package jalview.binding;
-
- //---------------------------------/
- //- Imported classes and packages -/
-//---------------------------------/
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.Vector;
-import org.exolab.castor.xml.Marshaller;
-import org.exolab.castor.xml.Unmarshaller;
-
-/**
- * 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();
- _propertyList = new Vector();
- } //-- jalview.binding.PdbentryItem()
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Method addProperty
- *
- *
- *
- * @param vProperty
- */
- public void addProperty(jalview.binding.Property vProperty)
- throws java.lang.IndexOutOfBoundsException
- {
- _propertyList.addElement(vProperty);
- } //-- void addProperty(jalview.binding.Property)
-
- /**
- * Method addProperty
- *
- *
- *
- * @param index
- * @param vProperty
- */
- public void addProperty(int index, jalview.binding.Property vProperty)
- throws java.lang.IndexOutOfBoundsException
- {
- _propertyList.insertElementAt(vProperty, index);
- } //-- void addProperty(int, jalview.binding.Property)
-
- /**
- * Method enumerateProperty
- *
- *
- *
- * @return Enumeration
- */
- public java.util.Enumeration enumerateProperty()
- {
- return _propertyList.elements();
- } //-- java.util.Enumeration enumerateProperty()
-
- /**
- * Method getProperty
- *
- *
- *
- * @param index
- * @return Property
- */
- public jalview.binding.Property getProperty(int index)
- throws java.lang.IndexOutOfBoundsException
- {
- //-- check bounds for index
- if ((index < 0) || (index > _propertyList.size())) {
- throw new IndexOutOfBoundsException();
- }
-
- return (jalview.binding.Property) _propertyList.elementAt(index);
- } //-- jalview.binding.Property getProperty(int)
-
- /**
- * Method getProperty
- *
- *
- *
- * @return Property
- */
- public jalview.binding.Property[] getProperty()
- {
- int size = _propertyList.size();
- jalview.binding.Property[] mArray = new jalview.binding.Property[size];
- for (int index = 0; index < size; index++) {
- mArray[index] = (jalview.binding.Property) _propertyList.elementAt(index);
- }
- return mArray;
- } //-- jalview.binding.Property[] getProperty()
-
- /**
- * Method getPropertyCount
- *
- *
- *
- * @return int
- */
- public int getPropertyCount()
- {
- return _propertyList.size();
- } //-- int getPropertyCount()
-
- /**
- * Method removeAllProperty
- *
- */
- public void removeAllProperty()
- {
- _propertyList.removeAllElements();
- } //-- void removeAllProperty()
-
- /**
- * Method removeProperty
- *
- *
- *
- * @param index
- * @return Property
- */
- public jalview.binding.Property removeProperty(int index)
- {
- java.lang.Object obj = _propertyList.elementAt(index);
- _propertyList.removeElementAt(index);
- return (jalview.binding.Property) obj;
- } //-- jalview.binding.Property removeProperty(int)
-
- /**
- * Method setProperty
- *
- *
- *
- * @param index
- * @param vProperty
- */
- public void setProperty(int index, jalview.binding.Property vProperty)
- throws java.lang.IndexOutOfBoundsException
- {
- //-- check bounds for index
- if ((index < 0) || (index > _propertyList.size())) {
- throw new IndexOutOfBoundsException();
- }
- _propertyList.setElementAt(vProperty, index);
- } //-- void setProperty(int, jalview.binding.Property)
-
- /**
- * Method setProperty
- *
- *
- *
- * @param propertyArray
- */
- public void setProperty(jalview.binding.Property[] propertyArray)
- {
- //-- copy array
- _propertyList.removeAllElements();
- for (int i = 0; i < propertyArray.length; i++) {
- _propertyList.addElement(propertyArray[i]);
- }
- } //-- void setProperty(jalview.binding.Property)
-
-}
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ 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
+ * 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 + * know 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(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ + "setProperty", + Integer.valueOf(index).toString(), + Integer.valueOf((this._propertyList.size() - 1)).toString() + })); + } + + 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]); + } + } + +}