2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
\r
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
\r
5 * This file is part of Jalview.
\r
7 * Jalview is free software: you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
\r
11 * Jalview is distributed in the hope that it will be useful, but
\r
12 * WITHOUT ANY WARRANTY; without even the implied warranty
\r
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
\r
14 * PURPOSE. See the GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
\r
18 package jalview.schemabinding.version2;
\r
21 * Class PdbentryItem.
\r
23 * @version $Revision$ $Date$
\r
25 public class PdbentryItem implements java.io.Serializable
\r
28 // --------------------------/
\r
29 // - Class/Member Variables -/
\r
30 // --------------------------/
\r
33 * Field _propertyList.
\r
35 private java.util.Vector _propertyList;
\r
37 // ----------------/
\r
38 // - Constructors -/
\r
39 // ----------------/
\r
41 public PdbentryItem()
\r
44 this._propertyList = new java.util.Vector();
\r
55 * @throws java.lang.IndexOutOfBoundsException
\r
56 * if the index given is outside the bounds of the collection
\r
58 public void addProperty(
\r
59 final jalview.schemabinding.version2.Property vProperty)
\r
60 throws java.lang.IndexOutOfBoundsException
\r
62 this._propertyList.addElement(vProperty);
\r
70 * @throws java.lang.IndexOutOfBoundsException
\r
71 * if the index given is outside the bounds of the collection
\r
73 public void addProperty(final int index,
\r
74 final jalview.schemabinding.version2.Property vProperty)
\r
75 throws java.lang.IndexOutOfBoundsException
\r
77 this._propertyList.add(index, vProperty);
\r
81 * Method enumerateProperty.
\r
83 * @return an Enumeration over all jalview.schemabinding.version2.Property
\r
86 public java.util.Enumeration enumerateProperty()
\r
88 return this._propertyList.elements();
\r
92 * Method getProperty.
\r
95 * @throws java.lang.IndexOutOfBoundsException
\r
96 * if the index given is outside the bounds of the collection
\r
97 * @return the value of the jalview.schemabinding.version2.Property at the
\r
100 public jalview.schemabinding.version2.Property getProperty(final int index)
\r
101 throws java.lang.IndexOutOfBoundsException
\r
103 // check bounds for index
\r
104 if (index < 0 || index >= this._propertyList.size())
\r
106 throw new IndexOutOfBoundsException("getProperty: Index value '"
\r
107 + index + "' not in range [0.."
\r
108 + (this._propertyList.size() - 1) + "]");
\r
111 return (jalview.schemabinding.version2.Property) _propertyList
\r
116 * Method getProperty.Returns the contents of the collection in an Array.
\r
118 * Note: Just in case the collection contents are changing in another thread,
\r
119 * we pass a 0-length Array of the correct type into the API call. This way we
\r
120 * <i>know</i> that the Array returned is of exactly the correct length.
\r
122 * @return this collection as an Array
\r
124 public jalview.schemabinding.version2.Property[] getProperty()
\r
126 jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0];
\r
127 return (jalview.schemabinding.version2.Property[]) this._propertyList
\r
132 * Method getPropertyCount.
\r
134 * @return the size of this collection
\r
136 public int getPropertyCount()
\r
138 return this._propertyList.size();
\r
143 public void removeAllProperty()
\r
145 this._propertyList.clear();
\r
149 * Method removeProperty.
\r
152 * @return true if the object was removed from the collection.
\r
154 public boolean removeProperty(
\r
155 final jalview.schemabinding.version2.Property vProperty)
\r
157 boolean removed = _propertyList.remove(vProperty);
\r
162 * Method removePropertyAt.
\r
165 * @return the element removed from the collection
\r
167 public jalview.schemabinding.version2.Property removePropertyAt(
\r
170 java.lang.Object obj = this._propertyList.remove(index);
\r
171 return (jalview.schemabinding.version2.Property) obj;
\r
179 * @throws java.lang.IndexOutOfBoundsException
\r
180 * if the index given is outside the bounds of the collection
\r
182 public void setProperty(final int index,
\r
183 final jalview.schemabinding.version2.Property vProperty)
\r
184 throws java.lang.IndexOutOfBoundsException
\r
186 // check bounds for index
\r
187 if (index < 0 || index >= this._propertyList.size())
\r
189 throw new IndexOutOfBoundsException("setProperty: Index value '"
\r
190 + index + "' not in range [0.."
\r
191 + (this._propertyList.size() - 1) + "]");
\r
194 this._propertyList.set(index, vProperty);
\r
200 * @param vPropertyArray
\r
202 public void setProperty(
\r
203 final jalview.schemabinding.version2.Property[] vPropertyArray)
\r
206 _propertyList.clear();
\r
208 for (int i = 0; i < vPropertyArray.length; i++)
\r
210 this._propertyList.add(vPropertyArray[i]);
\r