2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.binding;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
18 * Class FeatureMatcher.
20 * @version $Revision$ $Date$
22 public class FeatureMatcher implements java.io.Serializable
25 // --------------------------/
26 // - Class/Member Variables -/
27 // --------------------------/
32 private jalview.binding.types.FeatureMatcherByType _by;
35 * name of feature attribute to filter on, or attribute and sub-attribute
37 private java.util.Vector _attributeNameList;
42 private java.lang.String _condition;
47 private java.lang.String _value;
53 public FeatureMatcher()
56 this._attributeNameList = new java.util.Vector();
66 * @param vAttributeName
67 * @throws java.lang.IndexOutOfBoundsException
68 * if the index given is outside the bounds of the collection
70 public void addAttributeName(final java.lang.String vAttributeName)
71 throws java.lang.IndexOutOfBoundsException
73 // check for the maximum size
74 if (this._attributeNameList.size() >= 2)
76 throw new IndexOutOfBoundsException(
77 "addAttributeName has a maximum of 2");
80 this._attributeNameList.addElement(vAttributeName);
87 * @param vAttributeName
88 * @throws java.lang.IndexOutOfBoundsException
89 * if the index given is outside the bounds of the collection
91 public void addAttributeName(final int index,
92 final java.lang.String vAttributeName)
93 throws java.lang.IndexOutOfBoundsException
95 // check for the maximum size
96 if (this._attributeNameList.size() >= 2)
98 throw new IndexOutOfBoundsException(
99 "addAttributeName has a maximum of 2");
102 this._attributeNameList.add(index, vAttributeName);
106 * Method enumerateAttributeName.
108 * @return an Enumeration over all java.lang.String elements
110 public java.util.Enumeration enumerateAttributeName()
112 return this._attributeNameList.elements();
116 * Method getAttributeName.
119 * @throws java.lang.IndexOutOfBoundsException
120 * if the index given is outside the bounds of the collection
121 * @return the value of the java.lang.String at the given index
123 public java.lang.String getAttributeName(final int index)
124 throws java.lang.IndexOutOfBoundsException
126 // check bounds for index
127 if (index < 0 || index >= this._attributeNameList.size())
129 throw new IndexOutOfBoundsException("getAttributeName: Index value '"
130 + index + "' not in range [0.."
131 + (this._attributeNameList.size() - 1) + "]");
134 return (java.lang.String) _attributeNameList.get(index);
138 * Method getAttributeName.Returns the contents of the collection in an Array.
140 * Note: Just in case the collection contents are changing in another thread,
141 * we pass a 0-length Array of the correct type into the API call. This way we
142 * <i>know</i> that the Array returned is of exactly the correct length.
144 * @return this collection as an Array
146 public java.lang.String[] getAttributeName()
148 java.lang.String[] array = new java.lang.String[0];
149 return (java.lang.String[]) this._attributeNameList.toArray(array);
153 * Method getAttributeNameCount.
155 * @return the size of this collection
157 public int getAttributeNameCount()
159 return this._attributeNameList.size();
163 * Returns the value of field 'by'.
165 * @return the value of field 'By'.
167 public jalview.binding.types.FeatureMatcherByType getBy()
173 * Returns the value of field 'condition'.
175 * @return the value of field 'Condition'.
177 public java.lang.String getCondition()
179 return this._condition;
183 * Returns the value of field 'value'.
185 * @return the value of field 'Value'.
187 public java.lang.String getValue()
195 * @return true if this object is valid according to the schema
197 public boolean isValid()
202 } catch (org.exolab.castor.xml.ValidationException vex)
213 * @throws org.exolab.castor.xml.MarshalException
214 * if object is null or if any SAXException is thrown during
216 * @throws org.exolab.castor.xml.ValidationException
217 * if this object is an invalid instance according to the schema
219 public void marshal(final java.io.Writer out)
220 throws org.exolab.castor.xml.MarshalException,
221 org.exolab.castor.xml.ValidationException
223 Marshaller.marshal(this, out);
230 * @throws java.io.IOException
231 * if an IOException occurs during marshaling
232 * @throws org.exolab.castor.xml.ValidationException
233 * if this object is an invalid instance according to the schema
234 * @throws org.exolab.castor.xml.MarshalException
235 * if object is null or if any SAXException is thrown during
238 public void marshal(final org.xml.sax.ContentHandler handler)
239 throws java.io.IOException,
240 org.exolab.castor.xml.MarshalException,
241 org.exolab.castor.xml.ValidationException
243 Marshaller.marshal(this, handler);
248 public void removeAllAttributeName()
250 this._attributeNameList.clear();
254 * Method removeAttributeName.
256 * @param vAttributeName
257 * @return true if the object was removed from the collection.
259 public boolean removeAttributeName(final java.lang.String vAttributeName)
261 boolean removed = _attributeNameList.remove(vAttributeName);
266 * Method removeAttributeNameAt.
269 * @return the element removed from the collection
271 public java.lang.String removeAttributeNameAt(final int index)
273 java.lang.Object obj = this._attributeNameList.remove(index);
274 return (java.lang.String) obj;
281 * @param vAttributeName
282 * @throws java.lang.IndexOutOfBoundsException
283 * if the index given is outside the bounds of the collection
285 public void setAttributeName(final int index,
286 final java.lang.String vAttributeName)
287 throws java.lang.IndexOutOfBoundsException
289 // check bounds for index
290 if (index < 0 || index >= this._attributeNameList.size())
292 throw new IndexOutOfBoundsException("setAttributeName: Index value '"
293 + index + "' not in range [0.."
294 + (this._attributeNameList.size() - 1) + "]");
297 this._attributeNameList.set(index, vAttributeName);
303 * @param vAttributeNameArray
305 public void setAttributeName(final java.lang.String[] vAttributeNameArray)
308 _attributeNameList.clear();
310 for (int i = 0; i < vAttributeNameArray.length; i++)
312 this._attributeNameList.add(vAttributeNameArray[i]);
317 * Sets the value of field 'by'.
320 * the value of field 'by'.
322 public void setBy(final jalview.binding.types.FeatureMatcherByType by)
328 * Sets the value of field 'condition'.
331 * the value of field 'condition'.
333 public void setCondition(final java.lang.String condition)
335 this._condition = condition;
339 * Sets the value of field 'value'.
342 * the value of field 'value'.
344 public void setValue(final java.lang.String value)
353 * @throws org.exolab.castor.xml.MarshalException
354 * if object is null or if any SAXException is thrown during
356 * @throws org.exolab.castor.xml.ValidationException
357 * if this object is an invalid instance according to the schema
358 * @return the unmarshaled jalview.binding.FeatureMatcher
360 public static jalview.binding.FeatureMatcher unmarshal(
361 final java.io.Reader reader)
362 throws org.exolab.castor.xml.MarshalException,
363 org.exolab.castor.xml.ValidationException
365 return (jalview.binding.FeatureMatcher) Unmarshaller
366 .unmarshal(jalview.binding.FeatureMatcher.class, reader);
372 * @throws org.exolab.castor.xml.ValidationException
373 * if this object is an invalid instance according to the schema
375 public void validate() throws org.exolab.castor.xml.ValidationException
377 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
378 validator.validate(this);