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.schemabinding.version2;
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(
62 final jalview.schemabinding.version2.Property vProperty)
63 throws java.lang.IndexOutOfBoundsException
65 this._propertyList.addElement(vProperty);
73 * @throws java.lang.IndexOutOfBoundsException
74 * if the index given is outside the bounds of the collection
76 public void addProperty(final int index,
77 final jalview.schemabinding.version2.Property vProperty)
78 throws java.lang.IndexOutOfBoundsException
80 this._propertyList.add(index, vProperty);
84 * Method enumerateProperty.
86 * @return an Enumeration over all jalview.schemabinding.version2.Property
89 public java.util.Enumeration enumerateProperty()
91 return this._propertyList.elements();
98 * @throws java.lang.IndexOutOfBoundsException
99 * if the index given is outside the bounds of the collection
100 * @return the value of the jalview.schemabinding.version2.Property at the
103 public jalview.schemabinding.version2.Property getProperty(final int index)
104 throws java.lang.IndexOutOfBoundsException
106 // check bounds for index
107 if (index < 0 || index >= this._propertyList.size())
109 throw new IndexOutOfBoundsException("getProperty: Index value '"
110 + index + "' not in range [0.."
111 + (this._propertyList.size() - 1) + "]");
114 return (jalview.schemabinding.version2.Property) _propertyList
119 * Method getProperty.Returns the contents of the collection in an Array.
121 * Note: Just in case the collection contents are changing in another thread,
122 * we pass a 0-length Array of the correct type into the API call. This way we
123 * <i>know</i> that the Array returned is of exactly the correct length.
125 * @return this collection as an Array
127 public jalview.schemabinding.version2.Property[] getProperty()
129 jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0];
130 return (jalview.schemabinding.version2.Property[]) this._propertyList
135 * Method getPropertyCount.
137 * @return the size of this collection
139 public int getPropertyCount()
141 return this._propertyList.size();
146 public void removeAllProperty()
148 this._propertyList.clear();
152 * Method removeProperty.
155 * @return true if the object was removed from the collection.
157 public boolean removeProperty(
158 final jalview.schemabinding.version2.Property vProperty)
160 boolean removed = _propertyList.remove(vProperty);
165 * Method removePropertyAt.
168 * @return the element removed from the collection
170 public jalview.schemabinding.version2.Property removePropertyAt(
173 java.lang.Object obj = this._propertyList.remove(index);
174 return (jalview.schemabinding.version2.Property) obj;
182 * @throws java.lang.IndexOutOfBoundsException
183 * if the index given is outside the bounds of the collection
185 public void setProperty(final int index,
186 final jalview.schemabinding.version2.Property vProperty)
187 throws java.lang.IndexOutOfBoundsException
189 // check bounds for index
190 if (index < 0 || index >= this._propertyList.size())
192 throw new IndexOutOfBoundsException("setProperty: Index value '"
193 + index + "' not in range [0.."
194 + (this._propertyList.size() - 1) + "]");
197 this._propertyList.set(index, vProperty);
203 * @param vPropertyArray
205 public void setProperty(
206 final jalview.schemabinding.version2.Property[] vPropertyArray)
209 _propertyList.clear();
211 for (int i = 0; i < vPropertyArray.length; i++)
213 this._propertyList.add(vPropertyArray[i]);