2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.binding;
23 * @version $Revision$ $Date$
25 public class PdbentryItem implements java.io.Serializable
28 // --------------------------/
29 // - Class/Member Variables -/
30 // --------------------------/
33 * Field _propertyList.
35 private java.util.Vector _propertyList;
44 this._propertyList = new java.util.Vector();
55 * @throws java.lang.IndexOutOfBoundsException
56 * if the index given is outside the bounds of the collection
58 public void addProperty(final jalview.binding.Property vProperty)
59 throws java.lang.IndexOutOfBoundsException
61 this._propertyList.addElement(vProperty);
69 * @throws java.lang.IndexOutOfBoundsException
70 * if the index given is outside the bounds of the collection
72 public void addProperty(final int index,
73 final jalview.binding.Property vProperty)
74 throws java.lang.IndexOutOfBoundsException
76 this._propertyList.add(index, vProperty);
80 * Method enumerateProperty.
82 * @return an Enumeration over all jalview.binding.Property elements
84 public java.util.Enumeration enumerateProperty()
86 return this._propertyList.elements();
93 * @throws java.lang.IndexOutOfBoundsException
94 * if the index given is outside the bounds of the collection
95 * @return the value of the jalview.binding.Property at the given index
97 public jalview.binding.Property getProperty(final int index)
98 throws java.lang.IndexOutOfBoundsException
100 // check bounds for index
101 if (index < 0 || index >= this._propertyList.size())
103 throw new IndexOutOfBoundsException("getProperty: Index value '"
104 + index + "' not in range [0.."
105 + (this._propertyList.size() - 1) + "]");
108 return (jalview.binding.Property) _propertyList.get(index);
112 * Method getProperty.Returns the contents of the collection in an Array.
114 * Note: Just in case the collection contents are changing in another thread,
115 * we pass a 0-length Array of the correct type into the API call. This way we
116 * <i>know</i> that the Array returned is of exactly the correct length.
118 * @return this collection as an Array
120 public jalview.binding.Property[] getProperty()
122 jalview.binding.Property[] array = new jalview.binding.Property[0];
123 return (jalview.binding.Property[]) this._propertyList.toArray(array);
127 * Method getPropertyCount.
129 * @return the size of this collection
131 public int getPropertyCount()
133 return this._propertyList.size();
138 public void removeAllProperty()
140 this._propertyList.clear();
144 * Method removeProperty.
147 * @return true if the object was removed from the collection.
149 public boolean removeProperty(final jalview.binding.Property vProperty)
151 boolean removed = _propertyList.remove(vProperty);
156 * Method removePropertyAt.
159 * @return the element removed from the collection
161 public jalview.binding.Property removePropertyAt(final int index)
163 java.lang.Object obj = this._propertyList.remove(index);
164 return (jalview.binding.Property) obj;
172 * @throws java.lang.IndexOutOfBoundsException
173 * if the index given is outside the bounds of the collection
175 public void setProperty(final int index,
176 final jalview.binding.Property vProperty)
177 throws java.lang.IndexOutOfBoundsException
179 // check bounds for index
180 if (index < 0 || index >= this._propertyList.size())
182 throw new IndexOutOfBoundsException("setProperty: Index value '"
183 + index + "' not in range [0.."
184 + (this._propertyList.size() - 1) + "]");
187 this._propertyList.set(index, vProperty);
193 * @param vPropertyArray
195 public void setProperty(final jalview.binding.Property[] vPropertyArray)
198 _propertyList.clear();
200 for (int i = 0; i < vPropertyArray.length; i++)
202 this._propertyList.add(vPropertyArray[i]);