2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3 * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.binding;
24 * @version $Revision$ $Date$
26 public class PdbentryItem implements java.io.Serializable {
29 //--------------------------/
30 //- Class/Member Variables -/
31 //--------------------------/
34 * Field _propertyList.
36 private java.util.Vector _propertyList;
43 public PdbentryItem() {
45 this._propertyList = new java.util.Vector();
57 * @throws java.lang.IndexOutOfBoundsException if the index
58 * given is outside the bounds of the collection
60 public void addProperty(
61 final jalview.binding.Property vProperty)
62 throws java.lang.IndexOutOfBoundsException {
63 this._propertyList.addElement(vProperty);
71 * @throws java.lang.IndexOutOfBoundsException if the index
72 * given is outside the bounds of the collection
74 public void addProperty(
76 final jalview.binding.Property vProperty)
77 throws java.lang.IndexOutOfBoundsException {
78 this._propertyList.add(index, vProperty);
82 * Method enumerateProperty.
84 * @return an Enumeration over all jalview.binding.Property
87 public java.util.Enumeration enumerateProperty(
89 return this._propertyList.elements();
96 * @throws java.lang.IndexOutOfBoundsException if the index
97 * given is outside the bounds of the collection
98 * @return the value of the jalview.binding.Property at the
101 public jalview.binding.Property getProperty(
103 throws java.lang.IndexOutOfBoundsException {
104 // check bounds for index
105 if (index < 0 || index >= this._propertyList.size()) {
106 throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
109 return (jalview.binding.Property) _propertyList.get(index);
113 * Method getProperty.Returns the contents of the collection in
114 * an Array. <p>Note: Just in case the collection contents
115 * are changing in another thread, we pass a 0-length Array of
116 * the correct type into the API call. This way we <i>know</i>
117 * that the Array returned is of exactly the correct length.
119 * @return this collection as an Array
121 public jalview.binding.Property[] getProperty(
123 jalview.binding.Property[] array = new jalview.binding.Property[0];
124 return (jalview.binding.Property[]) this._propertyList.toArray(array);
128 * Method getPropertyCount.
130 * @return the size of this collection
132 public int getPropertyCount(
134 return this._propertyList.size();
139 public void removeAllProperty(
141 this._propertyList.clear();
145 * Method removeProperty.
148 * @return true if the object was removed from the collection.
150 public boolean removeProperty(
151 final jalview.binding.Property vProperty) {
152 boolean removed = _propertyList.remove(vProperty);
157 * Method removePropertyAt.
160 * @return the element removed from the collection
162 public jalview.binding.Property removePropertyAt(
164 java.lang.Object obj = this._propertyList.remove(index);
165 return (jalview.binding.Property) obj;
173 * @throws java.lang.IndexOutOfBoundsException if the index
174 * given is outside the bounds of the collection
176 public void setProperty(
178 final jalview.binding.Property vProperty)
179 throws java.lang.IndexOutOfBoundsException {
180 // check bounds for index
181 if (index < 0 || index >= this._propertyList.size()) {
182 throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
185 this._propertyList.set(index, vProperty);
191 * @param vPropertyArray
193 public void setProperty(
194 final jalview.binding.Property[] vPropertyArray) {
196 _propertyList.clear();
198 for (int i = 0; i < vPropertyArray.length; i++) {
199 this._propertyList.add(vPropertyArray[i]);