2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.schemabinding.version2;
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(
66 final jalview.schemabinding.version2.MatcherSet vMatcherSet)
67 throws java.lang.IndexOutOfBoundsException
69 // check for the maximum size
70 if (this._matcherSetList.size() >= 2)
72 throw new IndexOutOfBoundsException(
73 "addMatcherSet has a maximum of 2");
76 this._matcherSetList.addElement(vMatcherSet);
84 * @throws java.lang.IndexOutOfBoundsException
85 * if the index given is outside the bounds of the collection
87 public void addMatcherSet(final int index,
88 final jalview.schemabinding.version2.MatcherSet vMatcherSet)
89 throws java.lang.IndexOutOfBoundsException
91 // check for the maximum size
92 if (this._matcherSetList.size() >= 2)
94 throw new IndexOutOfBoundsException(
95 "addMatcherSet has a maximum of 2");
98 this._matcherSetList.add(index, vMatcherSet);
103 public void deleteAnd()
105 this._has_and = false;
109 * Method enumerateMatcherSet.
111 * @return an Enumeration over all jalview.schemabinding.version2.MatcherSet
114 public java.util.Enumeration enumerateMatcherSet()
116 return this._matcherSetList.elements();
120 * Returns the value of field 'and'. The field 'and' has the following
121 * description: If true, matchers are AND-ed, if false they are OR-ed
123 * @return the value of field 'And'.
125 public boolean getAnd()
131 * Method getMatcherSet.
134 * @throws java.lang.IndexOutOfBoundsException
135 * if the index given is outside the bounds of the collection
136 * @return the value of the jalview.schemabinding.version2.MatcherSet at the
139 public jalview.schemabinding.version2.MatcherSet getMatcherSet(
140 final int index) throws java.lang.IndexOutOfBoundsException
142 // check bounds for index
143 if (index < 0 || index >= this._matcherSetList.size())
145 throw new IndexOutOfBoundsException(
146 "getMatcherSet: Index value '" + index + "' not in range [0.."
147 + (this._matcherSetList.size() - 1) + "]");
150 return (jalview.schemabinding.version2.MatcherSet) _matcherSetList
155 * Method getMatcherSet.Returns the contents of the collection in an Array.
157 * Note: Just in case the collection contents are changing in another thread,
158 * we pass a 0-length Array of the correct type into the API call. This way we
159 * <i>know</i> that the Array returned is of exactly the correct length.
161 * @return this collection as an Array
163 public jalview.schemabinding.version2.MatcherSet[] getMatcherSet()
165 jalview.schemabinding.version2.MatcherSet[] array = new jalview.schemabinding.version2.MatcherSet[0];
166 return (jalview.schemabinding.version2.MatcherSet[]) this._matcherSetList
171 * Method getMatcherSetCount.
173 * @return the size of this collection
175 public int getMatcherSetCount()
177 return this._matcherSetList.size();
183 * @return true if at least one And has been added
185 public boolean hasAnd()
187 return this._has_and;
191 * Returns the value of field 'and'. The field 'and' has the following
192 * description: If true, matchers are AND-ed, if false they are OR-ed
194 * @return the value of field 'And'.
196 public boolean isAnd()
204 * @return true if this object is valid according to the schema
206 public boolean isValid()
211 } catch (org.exolab.castor.xml.ValidationException vex)
222 * @throws org.exolab.castor.xml.MarshalException
223 * if object is null or if any SAXException is thrown during
225 * @throws org.exolab.castor.xml.ValidationException
226 * if this object is an invalid instance according to the schema
228 public void marshal(final java.io.Writer out)
229 throws org.exolab.castor.xml.MarshalException,
230 org.exolab.castor.xml.ValidationException
232 Marshaller.marshal(this, out);
239 * @throws java.io.IOException
240 * if an IOException occurs during marshaling
241 * @throws org.exolab.castor.xml.ValidationException
242 * if this object is an invalid instance according to the schema
243 * @throws org.exolab.castor.xml.MarshalException
244 * if object is null or if any SAXException is thrown during
247 public void marshal(final org.xml.sax.ContentHandler handler)
248 throws java.io.IOException,
249 org.exolab.castor.xml.MarshalException,
250 org.exolab.castor.xml.ValidationException
252 Marshaller.marshal(this, handler);
257 public void removeAllMatcherSet()
259 this._matcherSetList.clear();
263 * Method removeMatcherSet.
266 * @return true if the object was removed from the collection.
268 public boolean removeMatcherSet(
269 final jalview.schemabinding.version2.MatcherSet vMatcherSet)
271 boolean removed = _matcherSetList.remove(vMatcherSet);
276 * Method removeMatcherSetAt.
279 * @return the element removed from the collection
281 public jalview.schemabinding.version2.MatcherSet removeMatcherSetAt(
284 java.lang.Object obj = this._matcherSetList.remove(index);
285 return (jalview.schemabinding.version2.MatcherSet) obj;
289 * Sets the value of field 'and'. The field 'and' has the following
290 * description: If true, matchers are AND-ed, if false they are OR-ed
293 * the value of field 'and'.
295 public void setAnd(final boolean and)
298 this._has_and = true;
306 * @throws java.lang.IndexOutOfBoundsException
307 * if the index given is outside the bounds of the collection
309 public void setMatcherSet(final int index,
310 final jalview.schemabinding.version2.MatcherSet vMatcherSet)
311 throws java.lang.IndexOutOfBoundsException
313 // check bounds for index
314 if (index < 0 || index >= this._matcherSetList.size())
316 throw new IndexOutOfBoundsException(
317 "setMatcherSet: Index value '" + index + "' not in range [0.."
318 + (this._matcherSetList.size() - 1) + "]");
321 this._matcherSetList.set(index, vMatcherSet);
327 * @param vMatcherSetArray
329 public void setMatcherSet(
330 final jalview.schemabinding.version2.MatcherSet[] vMatcherSetArray)
333 _matcherSetList.clear();
335 for (int i = 0; i < vMatcherSetArray.length; i++)
337 this._matcherSetList.add(vMatcherSetArray[i]);
345 * @throws org.exolab.castor.xml.MarshalException
346 * if object is null or if any SAXException is thrown during
348 * @throws org.exolab.castor.xml.ValidationException
349 * if this object is an invalid instance according to the schema
350 * @return the unmarshaled jalview.schemabinding.version2.CompoundMatcher
352 public static jalview.schemabinding.version2.CompoundMatcher unmarshal(
353 final java.io.Reader reader)
354 throws org.exolab.castor.xml.MarshalException,
355 org.exolab.castor.xml.ValidationException
357 return (jalview.schemabinding.version2.CompoundMatcher) Unmarshaller
358 .unmarshal(jalview.schemabinding.version2.CompoundMatcher.class,
365 * @throws org.exolab.castor.xml.ValidationException
366 * if this object is an invalid instance according to the schema
368 public void validate() throws org.exolab.castor.xml.ValidationException
370 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
371 validator.validate(this);