2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.binding;
23 import jalview.util.MessageManager;
28 * @version $Revision$ $Date$
30 public class PdbentryItem implements java.io.Serializable
33 // --------------------------/
34 // - Class/Member Variables -/
35 // --------------------------/
38 * Field _propertyList.
40 private java.util.Vector _propertyList;
49 this._propertyList = new java.util.Vector();
60 * @throws java.lang.IndexOutOfBoundsException
61 * if the index given is outside the bounds of the collection
63 public void addProperty(final jalview.binding.Property vProperty)
64 throws java.lang.IndexOutOfBoundsException
66 this._propertyList.addElement(vProperty);
74 * @throws java.lang.IndexOutOfBoundsException
75 * if the index given is outside the bounds of the collection
77 public void addProperty(final int index,
78 final jalview.binding.Property vProperty)
79 throws java.lang.IndexOutOfBoundsException
81 this._propertyList.add(index, vProperty);
85 * Method enumerateProperty.
87 * @return an Enumeration over all jalview.binding.Property elements
89 public java.util.Enumeration enumerateProperty()
91 return this._propertyList.elements();
98 * @throws java.lang.IndexOutOfBoundsException
99 * if the index given is outside the bounds of the collection
100 * @return the value of the jalview.binding.Property at the given index
102 public jalview.binding.Property getProperty(final int index)
103 throws java.lang.IndexOutOfBoundsException
105 // check bounds for index
106 if (index < 0 || index >= this._propertyList.size())
108 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
110 Integer.valueOf(index).toString(),
111 Integer.valueOf((this._propertyList.size() - 1)).toString()
115 return (jalview.binding.Property) _propertyList.get(index);
119 * Method getProperty.Returns the contents of the collection in an Array.
121 * Note: Just in case the collection contents are changing in another thread,
122 * we pass a 0-length Array of the correct type into the API call. This way we
123 * <i>know</i> that the Array returned is of exactly the correct length.
125 * @return this collection as an Array
127 public jalview.binding.Property[] getProperty()
129 jalview.binding.Property[] array = new jalview.binding.Property[0];
130 return (jalview.binding.Property[]) this._propertyList.toArray(array);
134 * Method getPropertyCount.
136 * @return the size of this collection
138 public int getPropertyCount()
140 return this._propertyList.size();
145 public void removeAllProperty()
147 this._propertyList.clear();
151 * Method removeProperty.
154 * @return true if the object was removed from the collection.
156 public boolean removeProperty(final jalview.binding.Property vProperty)
158 boolean removed = _propertyList.remove(vProperty);
163 * Method removePropertyAt.
166 * @return the element removed from the collection
168 public jalview.binding.Property removePropertyAt(final int index)
170 java.lang.Object obj = this._propertyList.remove(index);
171 return (jalview.binding.Property) obj;
179 * @throws java.lang.IndexOutOfBoundsException
180 * if the index given is outside the bounds of the collection
182 public void setProperty(final int index,
183 final jalview.binding.Property vProperty)
184 throws java.lang.IndexOutOfBoundsException
186 // check bounds for index
187 if (index < 0 || index >= this._propertyList.size())
189 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
191 Integer.valueOf(index).toString(),
192 Integer.valueOf((this._propertyList.size() - 1)).toString()
196 this._propertyList.set(index, vProperty);
202 * @param vPropertyArray
204 public void setProperty(final jalview.binding.Property[] vPropertyArray)
207 _propertyList.clear();
209 for (int i = 0; i < vPropertyArray.length; i++)
211 this._propertyList.add(vPropertyArray[i]);