2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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;
23 import jalview.util.MessageManager;
28 * @version $Revision$ $Date$
30 public class PdbentryItem implements java.io.Serializable
33 // --------------------------/
34 // - Class/Member Variables -/
35 // --------------------------/
38 * Field _propertyList.
40 private java.util.Vector _propertyList;
49 this._propertyList = new java.util.Vector();
60 * @throws java.lang.IndexOutOfBoundsException
61 * if the index given is outside the bounds of the collection
63 public void addProperty(
64 final jalview.schemabinding.version2.Property vProperty)
65 throws java.lang.IndexOutOfBoundsException
67 this._propertyList.addElement(vProperty);
75 * @throws java.lang.IndexOutOfBoundsException
76 * if the index given is outside the bounds of the collection
78 public void addProperty(final int index,
79 final jalview.schemabinding.version2.Property vProperty)
80 throws java.lang.IndexOutOfBoundsException
82 this._propertyList.add(index, vProperty);
86 * Method enumerateProperty.
88 * @return an Enumeration over all jalview.schemabinding.version2.Property
91 public java.util.Enumeration enumerateProperty()
93 return this._propertyList.elements();
100 * @throws java.lang.IndexOutOfBoundsException
101 * if the index given is outside the bounds of the collection
102 * @return the value of the jalview.schemabinding.version2.Property at the
105 public jalview.schemabinding.version2.Property getProperty(final int index)
106 throws java.lang.IndexOutOfBoundsException
108 // check bounds for index
109 if (index < 0 || index >= this._propertyList.size())
111 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
113 Integer.valueOf(index).toString(),
114 Integer.valueOf((this._propertyList.size() - 1)).toString()
118 return (jalview.schemabinding.version2.Property) _propertyList
123 * Method getProperty.Returns the contents of the collection in an Array.
125 * Note: Just in case the collection contents are changing in another thread,
126 * we pass a 0-length Array of the correct type into the API call. This way we
127 * <i>know</i> that the Array returned is of exactly the correct length.
129 * @return this collection as an Array
131 public jalview.schemabinding.version2.Property[] getProperty()
133 jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0];
134 return (jalview.schemabinding.version2.Property[]) this._propertyList
139 * Method getPropertyCount.
141 * @return the size of this collection
143 public int getPropertyCount()
145 return this._propertyList.size();
150 public void removeAllProperty()
152 this._propertyList.clear();
156 * Method removeProperty.
159 * @return true if the object was removed from the collection.
161 public boolean removeProperty(
162 final jalview.schemabinding.version2.Property vProperty)
164 boolean removed = _propertyList.remove(vProperty);
169 * Method removePropertyAt.
172 * @return the element removed from the collection
174 public jalview.schemabinding.version2.Property removePropertyAt(
177 java.lang.Object obj = this._propertyList.remove(index);
178 return (jalview.schemabinding.version2.Property) obj;
186 * @throws java.lang.IndexOutOfBoundsException
187 * if the index given is outside the bounds of the collection
189 public void setProperty(final int index,
190 final jalview.schemabinding.version2.Property vProperty)
191 throws java.lang.IndexOutOfBoundsException
193 // check bounds for index
194 if (index < 0 || index >= this._propertyList.size())
196 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
198 Integer.valueOf(index).toString(),
199 Integer.valueOf((this._propertyList.size() - 1)).toString()
203 this._propertyList.set(index, vProperty);
209 * @param vPropertyArray
211 public void setProperty(
212 final jalview.schemabinding.version2.Property[] vPropertyArray)
215 _propertyList.clear();
217 for (int i = 0; i < vPropertyArray.length; i++)
219 this._propertyList.add(vPropertyArray[i]);