X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemabinding%2Fversion2%2FPdbentryItem.java;h=3dbc99c882cf7dc8cc8634b2e1c6e884cc0d8908;hb=49cc4c921eac8fd966dfe4fa4b86d00655ea2f67;hp=6f6403680e9a526dc2aa05266322072254332e31;hpb=48df59aa393e03aa7269b2df662ac1b8d58cbb25;p=jalview.git diff --git a/src/jalview/schemabinding/version2/PdbentryItem.java b/src/jalview/schemabinding/version2/PdbentryItem.java index 6f64036..3dbc99c 100755 --- a/src/jalview/schemabinding/version2/PdbentryItem.java +++ b/src/jalview/schemabinding/version2/PdbentryItem.java @@ -1,22 +1,12 @@ /* * This class was automatically generated with - * Castor 0.9.6, using an XML + * Castor 1.1, using an XML * Schema. * $Id$ */ package jalview.schemabinding.version2; - //---------------------------------/ - //- 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. * @@ -30,7 +20,7 @@ public class PdbentryItem implements java.io.Serializable { //--------------------------/ /** - * Field _propertyList + * Field _propertyList. */ private java.util.Vector _propertyList; @@ -41,8 +31,8 @@ public class PdbentryItem implements java.io.Serializable { public PdbentryItem() { super(); - _propertyList = new Vector(); - } //-- jalview.schemabinding.version2.PdbentryItem() + this._propertyList = new java.util.Vector(); + } //-----------/ @@ -50,148 +40,153 @@ public class PdbentryItem implements java.io.Serializable { //-----------/ /** - * Method addProperty - * * * * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection */ - public void addProperty(jalview.schemabinding.version2.Property vProperty) - throws java.lang.IndexOutOfBoundsException - { - _propertyList.addElement(vProperty); - } //-- void addProperty(jalview.schemabinding.version2.Property) + public void addProperty( + final jalview.schemabinding.version2.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + this._propertyList.addElement(vProperty); + } /** - * Method addProperty - * * * * @param index * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection */ - public void addProperty(int index, jalview.schemabinding.version2.Property vProperty) - throws java.lang.IndexOutOfBoundsException - { - _propertyList.insertElementAt(vProperty, index); - } //-- void addProperty(int, jalview.schemabinding.version2.Property) + public void addProperty( + final int index, + final jalview.schemabinding.version2.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + this._propertyList.add(index, vProperty); + } /** - * Method enumerateProperty - * - * + * Method enumerateProperty. * - * @return Enumeration + * @return an Enumeration over all + * jalview.schemabinding.version2.Property elements */ - public java.util.Enumeration enumerateProperty() - { - return _propertyList.elements(); - } //-- java.util.Enumeration enumerateProperty() + public java.util.Enumeration enumerateProperty( + ) { + return this._propertyList.elements(); + } /** - * Method getProperty - * - * + * Method getProperty. * * @param index - * @return Property + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the + * jalview.schemabinding.version2.Property at the given index */ - public jalview.schemabinding.version2.Property getProperty(int index) - throws java.lang.IndexOutOfBoundsException - { - //-- check bounds for index - if ((index < 0) || (index > _propertyList.size())) { - throw new IndexOutOfBoundsException(); + public jalview.schemabinding.version2.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.schemabinding.version2.Property) _propertyList.elementAt(index); - } //-- jalview.schemabinding.version2.Property getProperty(int) + return (jalview.schemabinding.version2.Property) _propertyList.get(index); + } /** - * Method getProperty - * + * Method getProperty.Returns the contents of the collection in + * an Array.
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 Property + * @return this collection as an Array */ - public jalview.schemabinding.version2.Property[] getProperty() - { - int size = _propertyList.size(); - jalview.schemabinding.version2.Property[] mArray = new jalview.schemabinding.version2.Property[size]; - for (int index = 0; index < size; index++) { - mArray[index] = (jalview.schemabinding.version2.Property) _propertyList.elementAt(index); - } - return mArray; - } //-- jalview.schemabinding.version2.Property[] getProperty() + public jalview.schemabinding.version2.Property[] getProperty( + ) { + jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0]; + return (jalview.schemabinding.version2.Property[]) this._propertyList.toArray(array); + } /** - * Method getPropertyCount - * + * Method getPropertyCount. * - * - * @return int + * @return the size of this collection */ - public int getPropertyCount() - { - return _propertyList.size(); - } //-- int getPropertyCount() + public int getPropertyCount( + ) { + return this._propertyList.size(); + } /** - * Method removeAllProperty - * */ - public void removeAllProperty() - { - _propertyList.removeAllElements(); - } //-- void removeAllProperty() + public void removeAllProperty( + ) { + this._propertyList.clear(); + } /** - * Method removeProperty - * + * Method removeProperty. * + * @param vProperty + * @return true if the object was removed from the collection. + */ + public boolean removeProperty( + final jalview.schemabinding.version2.Property vProperty) { + boolean removed = _propertyList.remove(vProperty); + return removed; + } + + /** + * Method removePropertyAt. * * @param index - * @return Property + * @return the element removed from the collection */ - public jalview.schemabinding.version2.Property removeProperty(int index) - { - java.lang.Object obj = _propertyList.elementAt(index); - _propertyList.removeElementAt(index); + public jalview.schemabinding.version2.Property removePropertyAt( + final int index) { + java.lang.Object obj = this._propertyList.remove(index); return (jalview.schemabinding.version2.Property) obj; - } //-- jalview.schemabinding.version2.Property removeProperty(int) + } /** - * Method setProperty - * * * * @param index * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection */ - public void setProperty(int index, jalview.schemabinding.version2.Property vProperty) - throws java.lang.IndexOutOfBoundsException - { - //-- check bounds for index - if ((index < 0) || (index > _propertyList.size())) { - throw new IndexOutOfBoundsException(); + public void setProperty( + final int index, + final jalview.schemabinding.version2.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) + "]"); } - _propertyList.setElementAt(vProperty, index); - } //-- void setProperty(int, jalview.schemabinding.version2.Property) + + this._propertyList.set(index, vProperty); + } /** - * Method setProperty * * - * - * @param propertyArray + * @param vPropertyArray */ - public void setProperty(jalview.schemabinding.version2.Property[] propertyArray) - { + public void setProperty( + final jalview.schemabinding.version2.Property[] vPropertyArray) { //-- copy array - _propertyList.removeAllElements(); - for (int i = 0; i < propertyArray.length; i++) { - _propertyList.addElement(propertyArray[i]); + _propertyList.clear(); + + for (int i = 0; i < vPropertyArray.length; i++) { + this._propertyList.add(vPropertyArray[i]); } - } //-- void setProperty(jalview.schemabinding.version2.Property) + } }