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