X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbinding%2FPdbentryItem.java;h=5eb9c69fd355f81a0e97976ad7eb46ff4fa29b7d;hb=ab43013b7e357b84b4abade0dba949668dfb2a0e;hp=316ace7c56e41c3798c1d132af0779795fbc182c;hpb=a45774ee31d9f35d4eff46d54d7deab719afb092;p=jalview.git diff --git a/src/jalview/binding/PdbentryItem.java b/src/jalview/binding/PdbentryItem.java index 316ace7..5eb9c69 100644 --- a/src/jalview/binding/PdbentryItem.java +++ b/src/jalview/binding/PdbentryItem.java @@ -1,209 +1,215 @@ -/******************************************************************************* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1) + * 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. - * + * 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 . - *******************************************************************************/ -/* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ - package jalview.binding; +import jalview.util.MessageManager; + /** * 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); +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(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ + "getProperty", + Integer.valueOf(index).toString(), + Integer.valueOf((this._propertyList.size() - 1)).toString() + })); } - /** - * Method enumerateProperty. - * - * @return an Enumeration over all jalview.binding.Property - * elements + return (jalview.binding.Property) _propertyList.get(index); + } + + /** + * 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 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 java.util.Enumeration enumerateProperty( - ) { - return this._propertyList.elements(); + 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() + })); } - /** - * 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.

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("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]); - } + 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]); } + } }