/* * This class was automatically generated with * Castor 1.1, using an XML * Schema. * $Id$ */ package jalview.schemabinding.version2; //---------------------------------/ //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; /** * Class FeatureMatcher. * * @version $Revision$ $Date$ */ public class FeatureMatcher implements java.io.Serializable { // --------------------------/ // - Class/Member Variables -/ // --------------------------/ /** * Field _by. */ private jalview.schemabinding.version2.types.FeatureMatcherByType _by; /** * name of feature attribute to filter on, or attribute and sub-attribute */ private java.util.Vector _attributeNameList; /** * Field _condition. */ private java.lang.String _condition; /** * Field _value. */ private java.lang.String _value; // ----------------/ // - Constructors -/ // ----------------/ public FeatureMatcher() { super(); this._attributeNameList = new java.util.Vector(); } // -----------/ // - Methods -/ // -----------/ /** * * * @param vAttributeName * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection */ public void addAttributeName(final java.lang.String vAttributeName) throws java.lang.IndexOutOfBoundsException { // check for the maximum size if (this._attributeNameList.size() >= 2) { throw new IndexOutOfBoundsException( "addAttributeName has a maximum of 2"); } this._attributeNameList.addElement(vAttributeName); } /** * * * @param index * @param vAttributeName * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection */ public void addAttributeName(final int index, final java.lang.String vAttributeName) throws java.lang.IndexOutOfBoundsException { // check for the maximum size if (this._attributeNameList.size() >= 2) { throw new IndexOutOfBoundsException( "addAttributeName has a maximum of 2"); } this._attributeNameList.add(index, vAttributeName); } /** * Method enumerateAttributeName. * * @return an Enumeration over all java.lang.String elements */ public java.util.Enumeration enumerateAttributeName() { return this._attributeNameList.elements(); } /** * Method getAttributeName. * * @param index * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection * @return the value of the java.lang.String at the given index */ public java.lang.String getAttributeName(final int index) throws java.lang.IndexOutOfBoundsException { // check bounds for index if (index < 0 || index >= this._attributeNameList.size()) { throw new IndexOutOfBoundsException("getAttributeName: Index value '" + index + "' not in range [0.." + (this._attributeNameList.size() - 1) + "]"); } return (java.lang.String) _attributeNameList.get(index); } /** * Method getAttributeName.Returns the contents of the collection in an Array. *

* 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 * know that the Array returned is of exactly the correct length. * * @return this collection as an Array */ public java.lang.String[] getAttributeName() { java.lang.String[] array = new java.lang.String[0]; return (java.lang.String[]) this._attributeNameList.toArray(array); } /** * Method getAttributeNameCount. * * @return the size of this collection */ public int getAttributeNameCount() { return this._attributeNameList.size(); } /** * Returns the value of field 'by'. * * @return the value of field 'By'. */ public jalview.schemabinding.version2.types.FeatureMatcherByType getBy() { return this._by; } /** * Returns the value of field 'condition'. * * @return the value of field 'Condition'. */ public java.lang.String getCondition() { return this._condition; } /** * Returns the value of field 'value'. * * @return the value of field 'Value'. */ public java.lang.String getValue() { return this._value; } /** * 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 removeAllAttributeName() { this._attributeNameList.clear(); } /** * Method removeAttributeName. * * @param vAttributeName * @return true if the object was removed from the collection. */ public boolean removeAttributeName(final java.lang.String vAttributeName) { boolean removed = _attributeNameList.remove(vAttributeName); return removed; } /** * Method removeAttributeNameAt. * * @param index * @return the element removed from the collection */ public java.lang.String removeAttributeNameAt(final int index) { java.lang.Object obj = this._attributeNameList.remove(index); return (java.lang.String) obj; } /** * * * @param index * @param vAttributeName * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection */ public void setAttributeName(final int index, final java.lang.String vAttributeName) throws java.lang.IndexOutOfBoundsException { // check bounds for index if (index < 0 || index >= this._attributeNameList.size()) { throw new IndexOutOfBoundsException("setAttributeName: Index value '" + index + "' not in range [0.." + (this._attributeNameList.size() - 1) + "]"); } this._attributeNameList.set(index, vAttributeName); } /** * * * @param vAttributeNameArray */ public void setAttributeName(final java.lang.String[] vAttributeNameArray) { // -- copy array _attributeNameList.clear(); for (int i = 0; i < vAttributeNameArray.length; i++) { this._attributeNameList.add(vAttributeNameArray[i]); } } /** * Sets the value of field 'by'. * * @param by * the value of field 'by'. */ public void setBy( final jalview.schemabinding.version2.types.FeatureMatcherByType by) { this._by = by; } /** * Sets the value of field 'condition'. * * @param condition * the value of field 'condition'. */ public void setCondition(final java.lang.String condition) { this._condition = condition; } /** * Sets the value of field 'value'. * * @param value * the value of field 'value'. */ public void setValue(final java.lang.String value) { this._value = value; } /** * 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.schemabinding.version2.FeatureMatcher */ public static jalview.schemabinding.version2.FeatureMatcher unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (jalview.schemabinding.version2.FeatureMatcher) Unmarshaller .unmarshal(jalview.schemabinding.version2.FeatureMatcher.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); } }