2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4.0.b2)
\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
38 // ----------------/
\r
39 // - Constructors -/
\r
40 // ----------------/
\r
42 public PdbentryItem()
\r
45 this._propertyList = new java.util.Vector();
\r
56 * @throws java.lang.IndexOutOfBoundsException
\r
57 * if the index given is outside the bounds of the collection
\r
59 public void addProperty(
\r
60 final jalview.schemabinding.version2.Property vProperty)
\r
61 throws java.lang.IndexOutOfBoundsException
\r
63 this._propertyList.addElement(vProperty);
\r
71 * @throws java.lang.IndexOutOfBoundsException
\r
72 * if the index given is outside the bounds of the collection
\r
74 public void addProperty(final int index,
\r
75 final jalview.schemabinding.version2.Property vProperty)
\r
76 throws java.lang.IndexOutOfBoundsException
\r
78 this._propertyList.add(index, vProperty);
\r
82 * Method enumerateProperty.
\r
84 * @return an Enumeration over all jalview.schemabinding.version2.Property
\r
87 public java.util.Enumeration enumerateProperty()
\r
89 return this._propertyList.elements();
\r
93 * Method getProperty.
\r
96 * @throws java.lang.IndexOutOfBoundsException
\r
97 * if the index given is outside the bounds of the collection
\r
98 * @return the value of the jalview.schemabinding.version2.Property at the
\r
101 public jalview.schemabinding.version2.Property getProperty(final int index)
\r
102 throws java.lang.IndexOutOfBoundsException
\r
104 // check bounds for index
\r
105 if (index < 0 || index >= this._propertyList.size())
\r
107 throw new IndexOutOfBoundsException("getProperty: Index value '"
\r
108 + index + "' not in range [0.."
\r
109 + (this._propertyList.size() - 1) + "]");
\r
112 return (jalview.schemabinding.version2.Property) _propertyList
\r
117 * Method getProperty.Returns the contents of the collection in an Array.
\r
119 * Note: Just in case the collection contents are changing in another thread,
\r
120 * we pass a 0-length Array of the correct type into the API call. This way we
\r
121 * <i>know</i> that the Array returned is of exactly the correct length.
\r
123 * @return this collection as an Array
\r
125 public jalview.schemabinding.version2.Property[] getProperty()
\r
127 jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0];
\r
128 return (jalview.schemabinding.version2.Property[]) this._propertyList
\r
133 * Method getPropertyCount.
\r
135 * @return the size of this collection
\r
137 public int getPropertyCount()
\r
139 return this._propertyList.size();
\r
144 public void removeAllProperty()
\r
146 this._propertyList.clear();
\r
150 * Method removeProperty.
\r
153 * @return true if the object was removed from the collection.
\r
155 public boolean removeProperty(
\r
156 final jalview.schemabinding.version2.Property vProperty)
\r
158 boolean removed = _propertyList.remove(vProperty);
\r
163 * Method removePropertyAt.
\r
166 * @return the element removed from the collection
\r
168 public jalview.schemabinding.version2.Property removePropertyAt(
\r
171 java.lang.Object obj = this._propertyList.remove(index);
\r
172 return (jalview.schemabinding.version2.Property) obj;
\r
180 * @throws java.lang.IndexOutOfBoundsException
\r
181 * if the index given is outside the bounds of the collection
\r
183 public void setProperty(final int index,
\r
184 final jalview.schemabinding.version2.Property vProperty)
\r
185 throws java.lang.IndexOutOfBoundsException
\r
187 // check bounds for index
\r
188 if (index < 0 || index >= this._propertyList.size())
\r
190 throw new IndexOutOfBoundsException("setProperty: Index value '"
\r
191 + index + "' not in range [0.."
\r
192 + (this._propertyList.size() - 1) + "]");
\r
195 this._propertyList.set(index, vProperty);
\r
201 * @param vPropertyArray
\r
203 public void setProperty(
\r
204 final jalview.schemabinding.version2.Property[] vPropertyArray)
\r
207 _propertyList.clear();
\r
209 for (int i = 0; i < vPropertyArray.length; i++)
\r
211 this._propertyList.add(vPropertyArray[i]);
\r