--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class CompoundMatcher.
+ *
+ * @version $Revision$ $Date$
+ */
+public class CompoundMatcher implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * If true, matchers are AND-ed, if false they are OR-ed
+ */
+ private boolean _and;
+
+ /**
+ * keeps track of state for field: _and
+ */
+ private boolean _has_and;
+
+ /**
+ * Field _matcherSetList.
+ */
+ private java.util.Vector _matcherSetList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public CompoundMatcher()
+ {
+ super();
+ this._matcherSetList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vMatcherSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMatcherSet(final jalview.binding.MatcherSet vMatcherSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check for the maximum size
+ if (this._matcherSetList.size() >= 2)
+ {
+ throw new IndexOutOfBoundsException(
+ "addMatcherSet has a maximum of 2");
+ }
+
+ this._matcherSetList.addElement(vMatcherSet);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMatcherSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMatcherSet(final int index,
+ final jalview.binding.MatcherSet vMatcherSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check for the maximum size
+ if (this._matcherSetList.size() >= 2)
+ {
+ throw new IndexOutOfBoundsException(
+ "addMatcherSet has a maximum of 2");
+ }
+
+ this._matcherSetList.add(index, vMatcherSet);
+ }
+
+ /**
+ */
+ public void deleteAnd()
+ {
+ this._has_and = false;
+ }
+
+ /**
+ * Method enumerateMatcherSet.
+ *
+ * @return an Enumeration over all jalview.binding.MatcherSet elements
+ */
+ public java.util.Enumeration enumerateMatcherSet()
+ {
+ return this._matcherSetList.elements();
+ }
+
+ /**
+ * Returns the value of field 'and'. The field 'and' has the following
+ * description: If true, matchers are AND-ed, if false they are OR-ed
+ *
+ * @return the value of field 'And'.
+ */
+ public boolean getAnd()
+ {
+ return this._and;
+ }
+
+ /**
+ * Method getMatcherSet.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.MatcherSet at the given index
+ */
+ public jalview.binding.MatcherSet getMatcherSet(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._matcherSetList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "getMatcherSet: Index value '" + index + "' not in range [0.."
+ + (this._matcherSetList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.MatcherSet) _matcherSetList.get(index);
+ }
+
+ /**
+ * Method getMatcherSet.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.MatcherSet[] getMatcherSet()
+ {
+ jalview.binding.MatcherSet[] array = new jalview.binding.MatcherSet[0];
+ return (jalview.binding.MatcherSet[]) this._matcherSetList
+ .toArray(array);
+ }
+
+ /**
+ * Method getMatcherSetCount.
+ *
+ * @return the size of this collection
+ */
+ public int getMatcherSetCount()
+ {
+ return this._matcherSetList.size();
+ }
+
+ /**
+ * Method hasAnd.
+ *
+ * @return true if at least one And has been added
+ */
+ public boolean hasAnd()
+ {
+ return this._has_and;
+ }
+
+ /**
+ * Returns the value of field 'and'. The field 'and' has the following
+ * description: If true, matchers are AND-ed, if false they are OR-ed
+ *
+ * @return the value of field 'And'.
+ */
+ public boolean isAnd()
+ {
+ return this._and;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllMatcherSet()
+ {
+ this._matcherSetList.clear();
+ }
+
+ /**
+ * Method removeMatcherSet.
+ *
+ * @param vMatcherSet
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeMatcherSet(
+ final jalview.binding.MatcherSet vMatcherSet)
+ {
+ boolean removed = _matcherSetList.remove(vMatcherSet);
+ return removed;
+ }
+
+ /**
+ * Method removeMatcherSetAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.MatcherSet removeMatcherSetAt(final int index)
+ {
+ java.lang.Object obj = this._matcherSetList.remove(index);
+ return (jalview.binding.MatcherSet) obj;
+ }
+
+ /**
+ * Sets the value of field 'and'. The field 'and' has the following
+ * description: If true, matchers are AND-ed, if false they are OR-ed
+ *
+ * @param and
+ * the value of field 'and'.
+ */
+ public void setAnd(final boolean and)
+ {
+ this._and = and;
+ this._has_and = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMatcherSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setMatcherSet(final int index,
+ final jalview.binding.MatcherSet vMatcherSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._matcherSetList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "setMatcherSet: Index value '" + index + "' not in range [0.."
+ + (this._matcherSetList.size() - 1) + "]");
+ }
+
+ this._matcherSetList.set(index, vMatcherSet);
+ }
+
+ /**
+ *
+ *
+ * @param vMatcherSetArray
+ */
+ public void setMatcherSet(
+ final jalview.binding.MatcherSet[] vMatcherSetArray)
+ {
+ // -- copy array
+ _matcherSetList.clear();
+
+ for (int i = 0; i < vMatcherSetArray.length; i++)
+ {
+ this._matcherSetList.add(vMatcherSetArray[i]);
+ }
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.CompoundMatcher
+ */
+ public static jalview.binding.CompoundMatcher unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.CompoundMatcher) Unmarshaller
+ .unmarshal(jalview.binding.CompoundMatcher.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
+
+}