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