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