2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 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;
26 * @version $Revision$ $Date$
28 public class PdbentryItem implements java.io.Serializable
31 // --------------------------/
32 // - Class/Member Variables -/
33 // --------------------------/
36 * Field _propertyList.
38 private java.util.Vector _propertyList;
47 this._propertyList = new java.util.Vector();
58 * @throws java.lang.IndexOutOfBoundsException
59 * if the index given is outside the bounds of the collection
61 public void addProperty(final jalview.binding.Property vProperty)
62 throws java.lang.IndexOutOfBoundsException
64 this._propertyList.addElement(vProperty);
72 * @throws java.lang.IndexOutOfBoundsException
73 * if the index given is outside the bounds of the collection
75 public void addProperty(final int index,
76 final jalview.binding.Property vProperty)
77 throws java.lang.IndexOutOfBoundsException
79 this._propertyList.add(index, vProperty);
83 * Method enumerateProperty.
85 * @return an Enumeration over all jalview.binding.Property elements
87 public java.util.Enumeration enumerateProperty()
89 return this._propertyList.elements();
96 * @throws java.lang.IndexOutOfBoundsException
97 * if the index given is outside the bounds of the collection
98 * @return the value of the jalview.binding.Property at the given index
100 public jalview.binding.Property getProperty(final int index)
101 throws java.lang.IndexOutOfBoundsException
103 // check bounds for index
104 if (index < 0 || index >= this._propertyList.size())
106 throw new IndexOutOfBoundsException("getProperty: Index value '"
107 + index + "' not in range [0.."
108 + (this._propertyList.size() - 1) + "]");
111 return (jalview.binding.Property) _propertyList.get(index);
115 * Method getProperty.Returns the contents of the collection in an Array.
117 * Note: Just in case the collection contents are changing in another thread,
118 * we pass a 0-length Array of the correct type into the API call. This way we
119 * <i>know</i> that the Array returned is of exactly the correct length.
121 * @return this collection as an Array
123 public jalview.binding.Property[] getProperty()
125 jalview.binding.Property[] array = new jalview.binding.Property[0];
126 return (jalview.binding.Property[]) this._propertyList.toArray(array);
130 * Method getPropertyCount.
132 * @return the size of this collection
134 public int getPropertyCount()
136 return this._propertyList.size();
141 public void removeAllProperty()
143 this._propertyList.clear();
147 * Method removeProperty.
150 * @return true if the object was removed from the collection.
152 public boolean removeProperty(final jalview.binding.Property vProperty)
154 boolean removed = _propertyList.remove(vProperty);
159 * Method removePropertyAt.
162 * @return the element removed from the collection
164 public jalview.binding.Property removePropertyAt(final int index)
166 java.lang.Object obj = this._propertyList.remove(index);
167 return (jalview.binding.Property) obj;
175 * @throws java.lang.IndexOutOfBoundsException
176 * if the index given is outside the bounds of the collection
178 public void setProperty(final int index,
179 final jalview.binding.Property vProperty)
180 throws java.lang.IndexOutOfBoundsException
182 // check bounds for index
183 if (index < 0 || index >= this._propertyList.size())
185 throw new IndexOutOfBoundsException("setProperty: Index value '"
186 + index + "' not in range [0.."
187 + (this._propertyList.size() - 1) + "]");
190 this._propertyList.set(index, vProperty);
196 * @param vPropertyArray
198 public void setProperty(final jalview.binding.Property[] vPropertyArray)
201 _propertyList.clear();
203 for (int i = 0; i < vPropertyArray.length; i++)
205 this._propertyList.add(vPropertyArray[i]);