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 CompoundMatcher.
20 * @version $Revision$ $Date$
22 public class CompoundMatcher implements java.io.Serializable
25 // --------------------------/
26 // - Class/Member Variables -/
27 // --------------------------/
30 * If true, matchers are AND-ed, if false they are OR-ed
35 * keeps track of state for field: _and
37 private boolean _has_and;
40 * Field _matcherSetList.
42 private java.util.Vector _matcherSetList;
48 public CompoundMatcher()
51 this._matcherSetList = new java.util.Vector();
62 * @throws java.lang.IndexOutOfBoundsException
63 * if the index given is outside the bounds of the collection
65 public void addMatcherSet(final jalview.binding.MatcherSet vMatcherSet)
66 throws java.lang.IndexOutOfBoundsException
68 // check for the maximum size
69 if (this._matcherSetList.size() >= 2)
71 throw new IndexOutOfBoundsException(
72 "addMatcherSet has a maximum of 2");
75 this._matcherSetList.addElement(vMatcherSet);
83 * @throws java.lang.IndexOutOfBoundsException
84 * if the index given is outside the bounds of the collection
86 public void addMatcherSet(final int index,
87 final jalview.binding.MatcherSet vMatcherSet)
88 throws java.lang.IndexOutOfBoundsException
90 // check for the maximum size
91 if (this._matcherSetList.size() >= 2)
93 throw new IndexOutOfBoundsException(
94 "addMatcherSet has a maximum of 2");
97 this._matcherSetList.add(index, vMatcherSet);
102 public void deleteAnd()
104 this._has_and = false;
108 * Method enumerateMatcherSet.
110 * @return an Enumeration over all jalview.binding.MatcherSet elements
112 public java.util.Enumeration enumerateMatcherSet()
114 return this._matcherSetList.elements();
118 * Returns the value of field 'and'. The field 'and' has the following
119 * description: If true, matchers are AND-ed, if false they are OR-ed
121 * @return the value of field 'And'.
123 public boolean getAnd()
129 * Method getMatcherSet.
132 * @throws java.lang.IndexOutOfBoundsException
133 * if the index given is outside the bounds of the collection
134 * @return the value of the jalview.binding.MatcherSet at the given index
136 public jalview.binding.MatcherSet getMatcherSet(final int index)
137 throws java.lang.IndexOutOfBoundsException
139 // check bounds for index
140 if (index < 0 || index >= this._matcherSetList.size())
142 throw new IndexOutOfBoundsException(
143 "getMatcherSet: Index value '" + index + "' not in range [0.."
144 + (this._matcherSetList.size() - 1) + "]");
147 return (jalview.binding.MatcherSet) _matcherSetList.get(index);
151 * Method getMatcherSet.Returns the contents of the collection in an Array.
153 * Note: Just in case the collection contents are changing in another thread,
154 * we pass a 0-length Array of the correct type into the API call. This way we
155 * <i>know</i> that the Array returned is of exactly the correct length.
157 * @return this collection as an Array
159 public jalview.binding.MatcherSet[] getMatcherSet()
161 jalview.binding.MatcherSet[] array = new jalview.binding.MatcherSet[0];
162 return (jalview.binding.MatcherSet[]) this._matcherSetList
167 * Method getMatcherSetCount.
169 * @return the size of this collection
171 public int getMatcherSetCount()
173 return this._matcherSetList.size();
179 * @return true if at least one And has been added
181 public boolean hasAnd()
183 return this._has_and;
187 * Returns the value of field 'and'. The field 'and' has the following
188 * description: If true, matchers are AND-ed, if false they are OR-ed
190 * @return the value of field 'And'.
192 public boolean isAnd()
200 * @return true if this object is valid according to the schema
202 public boolean isValid()
207 } catch (org.exolab.castor.xml.ValidationException vex)
218 * @throws org.exolab.castor.xml.MarshalException
219 * if object is null or if any SAXException is thrown during
221 * @throws org.exolab.castor.xml.ValidationException
222 * if this object is an invalid instance according to the schema
224 public void marshal(final java.io.Writer out)
225 throws org.exolab.castor.xml.MarshalException,
226 org.exolab.castor.xml.ValidationException
228 Marshaller.marshal(this, out);
235 * @throws java.io.IOException
236 * if an IOException occurs during marshaling
237 * @throws org.exolab.castor.xml.ValidationException
238 * if this object is an invalid instance according to the schema
239 * @throws org.exolab.castor.xml.MarshalException
240 * if object is null or if any SAXException is thrown during
243 public void marshal(final org.xml.sax.ContentHandler handler)
244 throws java.io.IOException,
245 org.exolab.castor.xml.MarshalException,
246 org.exolab.castor.xml.ValidationException
248 Marshaller.marshal(this, handler);
253 public void removeAllMatcherSet()
255 this._matcherSetList.clear();
259 * Method removeMatcherSet.
262 * @return true if the object was removed from the collection.
264 public boolean removeMatcherSet(
265 final jalview.binding.MatcherSet vMatcherSet)
267 boolean removed = _matcherSetList.remove(vMatcherSet);
272 * Method removeMatcherSetAt.
275 * @return the element removed from the collection
277 public jalview.binding.MatcherSet removeMatcherSetAt(final int index)
279 java.lang.Object obj = this._matcherSetList.remove(index);
280 return (jalview.binding.MatcherSet) obj;
284 * Sets the value of field 'and'. The field 'and' has the following
285 * description: If true, matchers are AND-ed, if false they are OR-ed
288 * the value of field 'and'.
290 public void setAnd(final boolean and)
293 this._has_and = true;
301 * @throws java.lang.IndexOutOfBoundsException
302 * if the index given is outside the bounds of the collection
304 public void setMatcherSet(final int index,
305 final jalview.binding.MatcherSet vMatcherSet)
306 throws java.lang.IndexOutOfBoundsException
308 // check bounds for index
309 if (index < 0 || index >= this._matcherSetList.size())
311 throw new IndexOutOfBoundsException(
312 "setMatcherSet: Index value '" + index + "' not in range [0.."
313 + (this._matcherSetList.size() - 1) + "]");
316 this._matcherSetList.set(index, vMatcherSet);
322 * @param vMatcherSetArray
324 public void setMatcherSet(
325 final jalview.binding.MatcherSet[] vMatcherSetArray)
328 _matcherSetList.clear();
330 for (int i = 0; i < vMatcherSetArray.length; i++)
332 this._matcherSetList.add(vMatcherSetArray[i]);
340 * @throws org.exolab.castor.xml.MarshalException
341 * if object is null or if any SAXException is thrown during
343 * @throws org.exolab.castor.xml.ValidationException
344 * if this object is an invalid instance according to the schema
345 * @return the unmarshaled jalview.binding.CompoundMatcher
347 public static jalview.binding.CompoundMatcher unmarshal(
348 final java.io.Reader reader)
349 throws org.exolab.castor.xml.MarshalException,
350 org.exolab.castor.xml.ValidationException
352 return (jalview.binding.CompoundMatcher) Unmarshaller
353 .unmarshal(jalview.binding.CompoundMatcher.class, reader);
359 * @throws org.exolab.castor.xml.ValidationException
360 * if this object is an invalid instance according to the schema
362 public void validate() throws org.exolab.castor.xml.ValidationException
364 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
365 validator.validate(this);