From ab7590e6d0bbb8764d8df5bfcfa55956d80a4ac9 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 14 Dec 2017 11:25:57 +0000 Subject: [PATCH] JAL-2843 schema and code changes to save colour by attribute and filters in user colours XML file --- schemas/JalviewUserColours.xsd | 91 +++- src/jalview/binding/Colour.java | 243 ++++++++++- src/jalview/binding/CompoundMatcher.java | 368 ++++++++++++++++ src/jalview/binding/FeatureMatcher.java | 381 +++++++++++++++++ src/jalview/binding/FeatureMatcherSet.java | 200 +++++++++ src/jalview/binding/Filter.java | 180 ++++++++ src/jalview/binding/JalviewUserColours.java | 161 ++++++- src/jalview/binding/MatchCondition.java | 125 ++++++ src/jalview/binding/MatcherSet.java | 125 ++++++ .../binding/types/ColourNoValueColourType.java | 171 ++++++++ .../binding/types/ColourThreshTypeType.java | 168 ++++++++ .../binding/types/FeatureMatcherByType.java | 168 ++++++++ src/jalview/gui/FeatureSettings.java | 445 ++++++++++++++++---- .../schemabinding/version2/CompoundMatcher.java | 374 ++++++++++++++++ .../schemabinding/version2/FeatureMatcher.java | 383 +++++++++++++++++ .../schemabinding/version2/FeatureMatcherSet.java | 202 +++++++++ src/jalview/schemabinding/version2/Filter.java | 181 ++++++++ .../schemabinding/version2/JalviewUserColours.java | 173 +++++++- .../schemabinding/version2/MatchCondition.java | 126 ++++++ src/jalview/schemabinding/version2/MatcherSet.java | 126 ++++++ .../version2/descriptors/ColourDescriptor.java | 132 +++++- .../descriptors/CompoundMatcherDescriptor.java | 270 ++++++++++++ .../descriptors/FeatureMatcherDescriptor.java | 356 ++++++++++++++++ .../descriptors/FeatureMatcherSetDescriptor.java | 245 +++++++++++ .../version2/descriptors/FilterDescriptor.java | 246 +++++++++++ .../descriptors/JalviewUserColoursDescriptor.java | 70 ++- .../descriptors/MatchConditionDescriptor.java | 148 +++++++ .../version2/descriptors/MatcherSetDescriptor.java | 148 +++++++ .../schemabinding/version2/types/.castor.cdr | 4 + .../version2/types/ColourNoValueColourType.java | 171 ++++++++ .../version2/types/ColourThreshTypeType.java | 168 ++++++++ .../version2/types/FeatureMatcherByType.java | 168 ++++++++ .../ColourNoValueColourTypeDescriptor.java | 150 +++++++ .../ColourThreshTypeTypeDescriptor.java | 150 +++++++ .../FeatureMatcherByTypeDescriptor.java | 150 +++++++ 35 files changed, 6841 insertions(+), 126 deletions(-) create mode 100644 src/jalview/binding/CompoundMatcher.java create mode 100644 src/jalview/binding/FeatureMatcher.java create mode 100644 src/jalview/binding/FeatureMatcherSet.java create mode 100644 src/jalview/binding/Filter.java create mode 100644 src/jalview/binding/MatchCondition.java create mode 100644 src/jalview/binding/MatcherSet.java create mode 100644 src/jalview/binding/types/ColourNoValueColourType.java create mode 100644 src/jalview/binding/types/ColourThreshTypeType.java create mode 100644 src/jalview/binding/types/FeatureMatcherByType.java create mode 100644 src/jalview/schemabinding/version2/CompoundMatcher.java create mode 100644 src/jalview/schemabinding/version2/FeatureMatcher.java create mode 100644 src/jalview/schemabinding/version2/FeatureMatcherSet.java create mode 100644 src/jalview/schemabinding/version2/Filter.java create mode 100644 src/jalview/schemabinding/version2/MatchCondition.java create mode 100644 src/jalview/schemabinding/version2/MatcherSet.java create mode 100644 src/jalview/schemabinding/version2/descriptors/CompoundMatcherDescriptor.java create mode 100644 src/jalview/schemabinding/version2/descriptors/FeatureMatcherDescriptor.java create mode 100644 src/jalview/schemabinding/version2/descriptors/FeatureMatcherSetDescriptor.java create mode 100644 src/jalview/schemabinding/version2/descriptors/FilterDescriptor.java create mode 100644 src/jalview/schemabinding/version2/descriptors/MatchConditionDescriptor.java create mode 100644 src/jalview/schemabinding/version2/descriptors/MatcherSetDescriptor.java create mode 100644 src/jalview/schemabinding/version2/types/.castor.cdr create mode 100644 src/jalview/schemabinding/version2/types/ColourNoValueColourType.java create mode 100644 src/jalview/schemabinding/version2/types/ColourThreshTypeType.java create mode 100644 src/jalview/schemabinding/version2/types/FeatureMatcherByType.java create mode 100644 src/jalview/schemabinding/version2/types/descriptors/ColourNoValueColourTypeDescriptor.java create mode 100644 src/jalview/schemabinding/version2/types/descriptors/ColourThreshTypeTypeDescriptor.java create mode 100644 src/jalview/schemabinding/version2/types/descriptors/FeatureMatcherByTypeDescriptor.java diff --git a/schemas/JalviewUserColours.xsd b/schemas/JalviewUserColours.xsd index bd43e9d..9cc7083 100755 --- a/schemas/JalviewUserColours.xsd +++ b/schemas/JalviewUserColours.xsd @@ -16,8 +16,7 @@ You should have received a copy of the GNU General Public License along with Jalview. If not, see . --> - - + @@ -29,13 +28,40 @@ - + + + + name of feature attribute to colour by, or attribute and sub-attribute + + + + + + Single letter residue code for an alignment colour scheme, or feature type for a feature colour scheme + + - - - loosely specified enumeration: NONE,ABOVE, or BELOW - + + + Colour if no attribute or score value + + + + + + + + + + + + + + + + + @@ -44,7 +70,58 @@ + + + + + + + + + + + + A feature match condition, which may be simple or compound + + + + + + + + + + + If true, matchers are AND-ed, if false they are OR-ed + + + + + + + + + + + + name of feature attribute to filter on, or attribute and sub-attribute + + + + + + + + + + + + + + + + diff --git a/src/jalview/binding/Colour.java b/src/jalview/binding/Colour.java index 25cf9bf..c2dcba9 100644 --- a/src/jalview/binding/Colour.java +++ b/src/jalview/binding/Colour.java @@ -27,7 +27,8 @@ public class Colour implements java.io.Serializable // --------------------------/ /** - * Field _name. + * Single letter residue code for an alignment colour scheme, or feature type + * for a feature colour scheme */ private java.lang.String _name; @@ -42,9 +43,15 @@ public class Colour implements java.io.Serializable private java.lang.String _minRGB; /** - * loosely specified enumeration: NONE,ABOVE, or BELOW + * Colour if no attribute or score value */ - private java.lang.String _threshType; + private jalview.binding.types.ColourNoValueColourType _noValueColour = jalview.binding.types.ColourNoValueColourType + .valueOf("Min"); + + /** + * Field _threshType. + */ + private jalview.binding.types.ColourThreshTypeType _threshType; /** * Field _threshold. @@ -96,6 +103,11 @@ public class Colour implements java.io.Serializable */ private boolean _has_autoScale; + /** + * name of feature attribute to colour by, or attribute and sub-attribute + */ + private java.util.Vector _attributeNameList; + // ----------------/ // - Constructors -/ // ----------------/ @@ -103,6 +115,9 @@ public class Colour implements java.io.Serializable public Colour() { super(); + setNoValueColour( + jalview.binding.types.ColourNoValueColourType.valueOf("Min")); + this._attributeNameList = new java.util.Vector(); } // -----------/ @@ -110,41 +125,140 @@ public class Colour implements java.io.Serializable // -----------/ /** - */ + * + * + * @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); + } + + /** + */ public void deleteAutoScale() { this._has_autoScale = false; } /** - */ + */ public void deleteColourByLabel() { this._has_colourByLabel = false; } /** - */ + */ public void deleteMax() { this._has_max = false; } /** - */ + */ public void deleteMin() { this._has_min = false; } /** - */ + */ public void deleteThreshold() { this._has_threshold = false; } /** + * 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 'autoScale'. * * @return the value of field 'AutoScale'. @@ -195,7 +309,9 @@ public class Colour implements java.io.Serializable } /** - * Returns the value of field 'name'. + * Returns the value of field 'name'. The field 'name' has the following + * description: Single letter residue code for an alignment colour scheme, or + * feature type for a feature colour scheme * * @return the value of field 'Name'. */ @@ -205,6 +321,17 @@ public class Colour implements java.io.Serializable } /** + * Returns the value of field 'noValueColour'. The field 'noValueColour' has + * the following description: Colour if no attribute or score value + * + * @return the value of field 'NoValueColour'. + */ + public jalview.binding.types.ColourNoValueColourType getNoValueColour() + { + return this._noValueColour; + } + + /** * Returns the value of field 'RGB'. * * @return the value of field 'RGB'. @@ -215,12 +342,11 @@ public class Colour implements java.io.Serializable } /** - * Returns the value of field 'threshType'. The field 'threshType' has the - * following description: loosely specified enumeration: NONE,ABOVE, or BELOW + * Returns the value of field 'threshType'. * * @return the value of field 'ThreshType'. */ - public java.lang.String getThreshType() + public jalview.binding.types.ColourThreshTypeType getThreshType() { return this._threshType; } @@ -360,6 +486,76 @@ public class Colour implements java.io.Serializable } /** + */ + 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 'autoScale'. * * @param autoScale @@ -419,7 +615,9 @@ public class Colour implements java.io.Serializable } /** - * Sets the value of field 'name'. + * Sets the value of field 'name'. The field 'name' has the following + * description: Single letter residue code for an alignment colour scheme, or + * feature type for a feature colour scheme * * @param name * the value of field 'name'. @@ -430,6 +628,19 @@ public class Colour implements java.io.Serializable } /** + * Sets the value of field 'noValueColour'. The field 'noValueColour' has the + * following description: Colour if no attribute or score value + * + * @param noValueColour + * the value of field 'noValueColour'. + */ + public void setNoValueColour( + final jalview.binding.types.ColourNoValueColourType noValueColour) + { + this._noValueColour = noValueColour; + } + + /** * Sets the value of field 'RGB'. * * @param RGB @@ -441,13 +652,13 @@ public class Colour implements java.io.Serializable } /** - * Sets the value of field 'threshType'. The field 'threshType' has the - * following description: loosely specified enumeration: NONE,ABOVE, or BELOW + * Sets the value of field 'threshType'. * * @param threshType * the value of field 'threshType'. */ - public void setThreshType(final java.lang.String threshType) + public void setThreshType( + final jalview.binding.types.ColourThreshTypeType threshType) { this._threshType = threshType; } diff --git a/src/jalview/binding/CompoundMatcher.java b/src/jalview/binding/CompoundMatcher.java new file mode 100644 index 0000000..a2d1048 --- /dev/null +++ b/src/jalview/binding/CompoundMatcher.java @@ -0,0 +1,368 @@ +/* + * This class was automatically generated with + * Castor 1.1, 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. + *

+ * 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 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); + } + +} diff --git a/src/jalview/binding/FeatureMatcher.java b/src/jalview/binding/FeatureMatcher.java new file mode 100644 index 0000000..e4e52fb --- /dev/null +++ b/src/jalview/binding/FeatureMatcher.java @@ -0,0 +1,381 @@ +/* + * This class was automatically generated with + * Castor 1.1, 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 FeatureMatcher. + * + * @version $Revision$ $Date$ + */ +public class FeatureMatcher implements java.io.Serializable +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _by. + */ + private jalview.binding.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.binding.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.binding.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.binding.FeatureMatcher + */ + public static jalview.binding.FeatureMatcher unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException + { + return (jalview.binding.FeatureMatcher) Unmarshaller + .unmarshal(jalview.binding.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); + } + +} diff --git a/src/jalview/binding/FeatureMatcherSet.java b/src/jalview/binding/FeatureMatcherSet.java new file mode 100644 index 0000000..7ba5f0e --- /dev/null +++ b/src/jalview/binding/FeatureMatcherSet.java @@ -0,0 +1,200 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * A feature match condition, which may be simple or compound + * + * @version $Revision$ $Date$ + */ +public class FeatureMatcherSet implements java.io.Serializable +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Internal choice value storage + */ + private java.lang.Object _choiceValue; + + /** + * Field _matchCondition. + */ + private jalview.binding.MatchCondition _matchCondition; + + /** + * Field _compoundMatcher. + */ + private jalview.binding.CompoundMatcher _compoundMatcher; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public FeatureMatcherSet() + { + super(); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Returns the value of field 'choiceValue'. The field 'choiceValue' has the + * following description: Internal choice value storage + * + * @return the value of field 'ChoiceValue'. + */ + public java.lang.Object getChoiceValue() + { + return this._choiceValue; + } + + /** + * Returns the value of field 'compoundMatcher'. + * + * @return the value of field 'CompoundMatcher'. + */ + public jalview.binding.CompoundMatcher getCompoundMatcher() + { + return this._compoundMatcher; + } + + /** + * Returns the value of field 'matchCondition'. + * + * @return the value of field 'MatchCondition'. + */ + public jalview.binding.MatchCondition getMatchCondition() + { + return this._matchCondition; + } + + /** + * 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); + } + + /** + * Sets the value of field 'compoundMatcher'. + * + * @param compoundMatcher + * the value of field 'compoundMatcher'. + */ + public void setCompoundMatcher( + final jalview.binding.CompoundMatcher compoundMatcher) + { + this._compoundMatcher = compoundMatcher; + this._choiceValue = compoundMatcher; + } + + /** + * Sets the value of field 'matchCondition'. + * + * @param matchCondition + * the value of field 'matchCondition'. + */ + public void setMatchCondition( + final jalview.binding.MatchCondition matchCondition) + { + this._matchCondition = matchCondition; + this._choiceValue = matchCondition; + } + + /** + * 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.FeatureMatcherSet + */ + public static jalview.binding.FeatureMatcherSet unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException + { + return (jalview.binding.FeatureMatcherSet) Unmarshaller + .unmarshal(jalview.binding.FeatureMatcherSet.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); + } + +} diff --git a/src/jalview/binding/Filter.java b/src/jalview/binding/Filter.java new file mode 100644 index 0000000..687ae91 --- /dev/null +++ b/src/jalview/binding/Filter.java @@ -0,0 +1,180 @@ +/* + * This class was automatically generated with + * Castor 1.1, 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 Filter. + * + * @version $Revision$ $Date$ + */ +public class Filter implements java.io.Serializable +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _featureType. + */ + private java.lang.String _featureType; + + /** + * Field _matcherSet. + */ + private jalview.binding.MatcherSet _matcherSet; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public Filter() + { + super(); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Returns the value of field 'featureType'. + * + * @return the value of field 'FeatureType'. + */ + public java.lang.String getFeatureType() + { + return this._featureType; + } + + /** + * Returns the value of field 'matcherSet'. + * + * @return the value of field 'MatcherSet'. + */ + public jalview.binding.MatcherSet getMatcherSet() + { + return this._matcherSet; + } + + /** + * 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); + } + + /** + * Sets the value of field 'featureType'. + * + * @param featureType + * the value of field 'featureType'. + */ + public void setFeatureType(final java.lang.String featureType) + { + this._featureType = featureType; + } + + /** + * Sets the value of field 'matcherSet'. + * + * @param matcherSet + * the value of field 'matcherSet'. + */ + public void setMatcherSet(final jalview.binding.MatcherSet matcherSet) + { + this._matcherSet = matcherSet; + } + + /** + * 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.Filter + */ + public static jalview.binding.Filter unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException + { + return (jalview.binding.Filter) Unmarshaller + .unmarshal(jalview.binding.Filter.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); + } + +} diff --git a/src/jalview/binding/JalviewUserColours.java b/src/jalview/binding/JalviewUserColours.java index 6709487..67ee5a2 100644 --- a/src/jalview/binding/JalviewUserColours.java +++ b/src/jalview/binding/JalviewUserColours.java @@ -42,6 +42,11 @@ public class JalviewUserColours implements java.io.Serializable */ private java.util.Vector _colourList; + /** + * Field _filterList. + */ + private java.util.Vector _filterList; + // ----------------/ // - Constructors -/ // ----------------/ @@ -50,6 +55,7 @@ public class JalviewUserColours implements java.io.Serializable { super(); this._colourList = new java.util.Vector(); + this._filterList = new java.util.Vector(); } // -----------/ @@ -84,6 +90,33 @@ public class JalviewUserColours implements java.io.Serializable } /** + * + * + * @param vFilter + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addFilter(final Filter vFilter) + throws java.lang.IndexOutOfBoundsException + { + this._filterList.addElement(vFilter); + } + + /** + * + * + * @param index + * @param vFilter + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addFilter(final int index, final Filter vFilter) + throws java.lang.IndexOutOfBoundsException + { + this._filterList.add(index, vFilter); + } + + /** * Method enumerateColour. * * @return an Enumeration over all Colour elements @@ -94,6 +127,16 @@ public class JalviewUserColours implements java.io.Serializable } /** + * Method enumerateFilter. + * + * @return an Enumeration over all Filter elements + */ + public java.util.Enumeration enumerateFilter() + { + return this._filterList.elements(); + } + + /** * Method getColour. * * @param index @@ -141,6 +184,53 @@ public class JalviewUserColours implements java.io.Serializable } /** + * Method getFilter. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + * @return the value of the Filter at the given index + */ + public Filter getFilter(final int index) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._filterList.size()) + { + throw new IndexOutOfBoundsException( + "getFilter: Index value '" + index + "' not in range [0.." + + (this._filterList.size() - 1) + "]"); + } + + return (Filter) _filterList.get(index); + } + + /** + * Method getFilter.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 Filter[] getFilter() + { + Filter[] array = new Filter[0]; + return (Filter[]) this._filterList.toArray(array); + } + + /** + * Method getFilterCount. + * + * @return the size of this collection + */ + public int getFilterCount() + { + return this._filterList.size(); + } + + /** * Returns the value of field 'schemeName'. * * @return the value of field 'SchemeName'. @@ -217,13 +307,20 @@ public class JalviewUserColours implements java.io.Serializable } /** - */ + */ public void removeAllColour() { this._colourList.clear(); } /** + */ + public void removeAllFilter() + { + this._filterList.clear(); + } + + /** * Method removeColour. * * @param vColour @@ -248,6 +345,30 @@ public class JalviewUserColours implements java.io.Serializable } /** + * Method removeFilter. + * + * @param vFilter + * @return true if the object was removed from the collection. + */ + public boolean removeFilter(final Filter vFilter) + { + boolean removed = _filterList.remove(vFilter); + return removed; + } + + /** + * Method removeFilterAt. + * + * @param index + * @return the element removed from the collection + */ + public Filter removeFilterAt(final int index) + { + java.lang.Object obj = this._filterList.remove(index); + return (Filter) obj; + } + + /** * * * @param index @@ -286,6 +407,44 @@ public class JalviewUserColours implements java.io.Serializable } /** + * + * + * @param index + * @param vFilter + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void setFilter(final int index, final Filter vFilter) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._filterList.size()) + { + throw new IndexOutOfBoundsException( + "setFilter: Index value '" + index + "' not in range [0.." + + (this._filterList.size() - 1) + "]"); + } + + this._filterList.set(index, vFilter); + } + + /** + * + * + * @param vFilterArray + */ + public void setFilter(final Filter[] vFilterArray) + { + // -- copy array + _filterList.clear(); + + for (int i = 0; i < vFilterArray.length; i++) + { + this._filterList.add(vFilterArray[i]); + } + } + + /** * Sets the value of field 'schemeName'. * * @param schemeName diff --git a/src/jalview/binding/MatchCondition.java b/src/jalview/binding/MatchCondition.java new file mode 100644 index 0000000..44a3d3e --- /dev/null +++ b/src/jalview/binding/MatchCondition.java @@ -0,0 +1,125 @@ +/* + * This class was automatically generated with + * Castor 1.1, 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 MatchCondition. + * + * @version $Revision$ $Date$ + */ +public class MatchCondition extends FeatureMatcher + implements java.io.Serializable +{ + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public MatchCondition() + { + super(); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * 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); + } + + /** + * 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.FeatureMatcher + */ + public static jalview.binding.FeatureMatcher unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException + { + return (jalview.binding.FeatureMatcher) Unmarshaller + .unmarshal(jalview.binding.MatchCondition.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); + } + +} diff --git a/src/jalview/binding/MatcherSet.java b/src/jalview/binding/MatcherSet.java new file mode 100644 index 0000000..756d93a --- /dev/null +++ b/src/jalview/binding/MatcherSet.java @@ -0,0 +1,125 @@ +/* + * This class was automatically generated with + * Castor 1.1, 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 MatcherSet. + * + * @version $Revision$ $Date$ + */ +public class MatcherSet extends FeatureMatcherSet + implements java.io.Serializable +{ + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public MatcherSet() + { + super(); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * 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); + } + + /** + * 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.FeatureMatcherSet + */ + public static jalview.binding.FeatureMatcherSet unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException + { + return (jalview.binding.FeatureMatcherSet) Unmarshaller + .unmarshal(jalview.binding.MatcherSet.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); + } + +} diff --git a/src/jalview/binding/types/ColourNoValueColourType.java b/src/jalview/binding/types/ColourNoValueColourType.java new file mode 100644 index 0000000..6b5dafa --- /dev/null +++ b/src/jalview/binding/types/ColourNoValueColourType.java @@ -0,0 +1,171 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding.types; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.util.Hashtable; + +/** + * Class ColourNoValueColourType. + * + * @version $Revision$ $Date$ + */ +public class ColourNoValueColourType implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * The None type + */ + public static final int NONE_TYPE = 0; + + /** + * The instance of the None type + */ + public static final ColourNoValueColourType NONE = new ColourNoValueColourType(NONE_TYPE, "None"); + + /** + * The Min type + */ + public static final int MIN_TYPE = 1; + + /** + * The instance of the Min type + */ + public static final ColourNoValueColourType MIN = new ColourNoValueColourType(MIN_TYPE, "Min"); + + /** + * The Max type + */ + public static final int MAX_TYPE = 2; + + /** + * The instance of the Max type + */ + public static final ColourNoValueColourType MAX = new ColourNoValueColourType(MAX_TYPE, "Max"); + + /** + * Field _memberTable. + */ + private static java.util.Hashtable _memberTable = init(); + + /** + * Field type. + */ + private int type = -1; + + /** + * Field stringValue. + */ + private java.lang.String stringValue = null; + + + //----------------/ + //- Constructors -/ + //----------------/ + + private ColourNoValueColourType(final int type, final java.lang.String value) { + super(); + this.type = type; + this.stringValue = value; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method enumerate.Returns an enumeration of all possible + * instances of ColourNoValueColourType + * + * @return an Enumeration over all possible instances of + * ColourNoValueColourType + */ + public static java.util.Enumeration enumerate( + ) { + return _memberTable.elements(); + } + + /** + * Method getType.Returns the type of this + * ColourNoValueColourType + * + * @return the type of this ColourNoValueColourType + */ + public int getType( + ) { + return this.type; + } + + /** + * Method init. + * + * @return the initialized Hashtable for the member table + */ + private static java.util.Hashtable init( + ) { + Hashtable members = new Hashtable(); + members.put("None", NONE); + members.put("Min", MIN); + members.put("Max", MAX); + return members; + } + + /** + * Method readResolve. will be called during deserialization to + * replace the deserialized object with the correct constant + * instance. + * + * @return this deserialized object + */ + private java.lang.Object readResolve( + ) { + return valueOf(this.stringValue); + } + + /** + * Method toString.Returns the String representation of this + * ColourNoValueColourType + * + * @return the String representation of this + * ColourNoValueColourType + */ + public java.lang.String toString( + ) { + return this.stringValue; + } + + /** + * Method valueOf.Returns a new ColourNoValueColourType based + * on the given String value. + * + * @param string + * @return the ColourNoValueColourType value of parameter + * 'string' + */ + public static jalview.binding.types.ColourNoValueColourType valueOf( + final java.lang.String string) { + java.lang.Object obj = null; + if (string != null) { + obj = _memberTable.get(string); + } + if (obj == null) { + String err = "" + string + " is not a valid ColourNoValueColourType"; + throw new IllegalArgumentException(err); + } + return (ColourNoValueColourType) obj; + } + +} diff --git a/src/jalview/binding/types/ColourThreshTypeType.java b/src/jalview/binding/types/ColourThreshTypeType.java new file mode 100644 index 0000000..024f2c0 --- /dev/null +++ b/src/jalview/binding/types/ColourThreshTypeType.java @@ -0,0 +1,168 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding.types; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.util.Hashtable; + +/** + * Class ColourThreshTypeType. + * + * @version $Revision$ $Date$ + */ +public class ColourThreshTypeType implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * The NONE type + */ + public static final int NONE_TYPE = 0; + + /** + * The instance of the NONE type + */ + public static final ColourThreshTypeType NONE = new ColourThreshTypeType(NONE_TYPE, "NONE"); + + /** + * The ABOVE type + */ + public static final int ABOVE_TYPE = 1; + + /** + * The instance of the ABOVE type + */ + public static final ColourThreshTypeType ABOVE = new ColourThreshTypeType(ABOVE_TYPE, "ABOVE"); + + /** + * The BELOW type + */ + public static final int BELOW_TYPE = 2; + + /** + * The instance of the BELOW type + */ + public static final ColourThreshTypeType BELOW = new ColourThreshTypeType(BELOW_TYPE, "BELOW"); + + /** + * Field _memberTable. + */ + private static java.util.Hashtable _memberTable = init(); + + /** + * Field type. + */ + private int type = -1; + + /** + * Field stringValue. + */ + private java.lang.String stringValue = null; + + + //----------------/ + //- Constructors -/ + //----------------/ + + private ColourThreshTypeType(final int type, final java.lang.String value) { + super(); + this.type = type; + this.stringValue = value; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method enumerate.Returns an enumeration of all possible + * instances of ColourThreshTypeType + * + * @return an Enumeration over all possible instances of + * ColourThreshTypeType + */ + public static java.util.Enumeration enumerate( + ) { + return _memberTable.elements(); + } + + /** + * Method getType.Returns the type of this ColourThreshTypeType + * + * @return the type of this ColourThreshTypeType + */ + public int getType( + ) { + return this.type; + } + + /** + * Method init. + * + * @return the initialized Hashtable for the member table + */ + private static java.util.Hashtable init( + ) { + Hashtable members = new Hashtable(); + members.put("NONE", NONE); + members.put("ABOVE", ABOVE); + members.put("BELOW", BELOW); + return members; + } + + /** + * Method readResolve. will be called during deserialization to + * replace the deserialized object with the correct constant + * instance. + * + * @return this deserialized object + */ + private java.lang.Object readResolve( + ) { + return valueOf(this.stringValue); + } + + /** + * Method toString.Returns the String representation of this + * ColourThreshTypeType + * + * @return the String representation of this ColourThreshTypeTyp + */ + public java.lang.String toString( + ) { + return this.stringValue; + } + + /** + * Method valueOf.Returns a new ColourThreshTypeType based on + * the given String value. + * + * @param string + * @return the ColourThreshTypeType value of parameter 'string' + */ + public static jalview.binding.types.ColourThreshTypeType valueOf( + final java.lang.String string) { + java.lang.Object obj = null; + if (string != null) { + obj = _memberTable.get(string); + } + if (obj == null) { + String err = "" + string + " is not a valid ColourThreshTypeType"; + throw new IllegalArgumentException(err); + } + return (ColourThreshTypeType) obj; + } + +} diff --git a/src/jalview/binding/types/FeatureMatcherByType.java b/src/jalview/binding/types/FeatureMatcherByType.java new file mode 100644 index 0000000..2185bba --- /dev/null +++ b/src/jalview/binding/types/FeatureMatcherByType.java @@ -0,0 +1,168 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding.types; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.util.Hashtable; + +/** + * Class FeatureMatcherByType. + * + * @version $Revision$ $Date$ + */ +public class FeatureMatcherByType implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * The byLabel type + */ + public static final int BYLABEL_TYPE = 0; + + /** + * The instance of the byLabel type + */ + public static final FeatureMatcherByType BYLABEL = new FeatureMatcherByType(BYLABEL_TYPE, "byLabel"); + + /** + * The byScore type + */ + public static final int BYSCORE_TYPE = 1; + + /** + * The instance of the byScore type + */ + public static final FeatureMatcherByType BYSCORE = new FeatureMatcherByType(BYSCORE_TYPE, "byScore"); + + /** + * The byAttribute type + */ + public static final int BYATTRIBUTE_TYPE = 2; + + /** + * The instance of the byAttribute type + */ + public static final FeatureMatcherByType BYATTRIBUTE = new FeatureMatcherByType(BYATTRIBUTE_TYPE, "byAttribute"); + + /** + * Field _memberTable. + */ + private static java.util.Hashtable _memberTable = init(); + + /** + * Field type. + */ + private int type = -1; + + /** + * Field stringValue. + */ + private java.lang.String stringValue = null; + + + //----------------/ + //- Constructors -/ + //----------------/ + + private FeatureMatcherByType(final int type, final java.lang.String value) { + super(); + this.type = type; + this.stringValue = value; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method enumerate.Returns an enumeration of all possible + * instances of FeatureMatcherByType + * + * @return an Enumeration over all possible instances of + * FeatureMatcherByType + */ + public static java.util.Enumeration enumerate( + ) { + return _memberTable.elements(); + } + + /** + * Method getType.Returns the type of this FeatureMatcherByType + * + * @return the type of this FeatureMatcherByType + */ + public int getType( + ) { + return this.type; + } + + /** + * Method init. + * + * @return the initialized Hashtable for the member table + */ + private static java.util.Hashtable init( + ) { + Hashtable members = new Hashtable(); + members.put("byLabel", BYLABEL); + members.put("byScore", BYSCORE); + members.put("byAttribute", BYATTRIBUTE); + return members; + } + + /** + * Method readResolve. will be called during deserialization to + * replace the deserialized object with the correct constant + * instance. + * + * @return this deserialized object + */ + private java.lang.Object readResolve( + ) { + return valueOf(this.stringValue); + } + + /** + * Method toString.Returns the String representation of this + * FeatureMatcherByType + * + * @return the String representation of this FeatureMatcherByTyp + */ + public java.lang.String toString( + ) { + return this.stringValue; + } + + /** + * Method valueOf.Returns a new FeatureMatcherByType based on + * the given String value. + * + * @param string + * @return the FeatureMatcherByType value of parameter 'string' + */ + public static jalview.binding.types.FeatureMatcherByType valueOf( + final java.lang.String string) { + java.lang.Object obj = null; + if (string != null) { + obj = _memberTable.get(string); + } + if (obj == null) { + String err = "" + string + " is not a valid FeatureMatcherByType"; + throw new IllegalArgumentException(err); + } + return (FeatureMatcherByType) obj; + } + +} diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 5fc00a3..811b377 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -25,17 +25,26 @@ import jalview.api.FeatureSettingsControllerI; import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; +import jalview.datamodel.features.FeatureMatcher; +import jalview.datamodel.features.FeatureMatcherI; import jalview.datamodel.features.FeatureMatcherSet; import jalview.datamodel.features.FeatureMatcherSetI; import jalview.gui.Help.HelpId; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; +import jalview.schemabinding.version2.CompoundMatcher; +import jalview.schemabinding.version2.Filter; import jalview.schemabinding.version2.JalviewUserColours; +import jalview.schemabinding.version2.MatchCondition; +import jalview.schemabinding.version2.MatcherSet; +import jalview.schemabinding.version2.types.ColourNoValueColourType; +import jalview.schemabinding.version2.types.ColourThreshTypeType; +import jalview.schemabinding.version2.types.FeatureMatcherByType; import jalview.schemes.FeatureColour; import jalview.util.Format; import jalview.util.MessageManager; import jalview.util.Platform; -import jalview.util.QuickSort; +import jalview.util.matcher.Condition; import jalview.viewmodel.AlignmentViewport; import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean; import jalview.ws.DasSequenceFeatureFetcher; @@ -66,6 +75,8 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; @@ -178,6 +189,290 @@ public class FeatureSettings extends JPanel Map typeWidth = null; /** + * Populates an XML model of the feature colour scheme for one feature type + * + * @param featureType + * @param fcol + * @return + */ + protected static jalview.schemabinding.version2.Colour marshalColour( + String featureType, FeatureColourI fcol) + { + jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour(); + if (fcol.isSimpleColour()) + { + col.setRGB(Format.getHexString(fcol.getColour())); + } + else + { + col.setRGB(Format.getHexString(fcol.getMaxColour())); + col.setMin(fcol.getMin()); + col.setMax(fcol.getMax()); + col.setMinRGB(jalview.util.Format.getHexString(fcol.getMinColour())); + col.setAutoScale(fcol.isAutoScaled()); + col.setThreshold(fcol.getThreshold()); + col.setColourByLabel(fcol.isColourByLabel()); + col.setThreshType(fcol.isAboveThreshold() ? ColourThreshTypeType.ABOVE + : (fcol.isBelowThreshold() ? ColourThreshTypeType.BELOW + : ColourThreshTypeType.NONE)); + if (fcol.isColourByAttribute()) + { + col.setAttributeName(fcol.getAttributeName()); + } + Color noColour = fcol.getNoColour(); + if (noColour == null) + { + col.setNoValueColour(ColourNoValueColourType.NONE); + } + else if (noColour == fcol.getMaxColour()) + { + col.setNoValueColour(ColourNoValueColourType.MAX); + } + else + { + col.setNoValueColour(ColourNoValueColourType.MIN); + } + } + col.setName(featureType); + return col; + } + + /** + * Populates an XML model of the feature filter(s) for one feature type + * + * @param firstMatcher + * the first (or only) match condition) + * @param filter + * remaining match conditions (if any) + * @param and + * if true, conditions are and-ed, else or-ed + */ + protected static MatcherSet marshalFilter(FeatureMatcherI firstMatcher, + Iterator filters, boolean and) + { + MatcherSet result = new MatcherSet(); + + if (filters.hasNext()) + { + /* + * compound matcher + */ + CompoundMatcher compound = new CompoundMatcher(); + compound.setAnd(and); + MatcherSet matcher1 = marshalFilter(firstMatcher, + Collections.emptyIterator(), and); + compound.addMatcherSet(matcher1); + FeatureMatcherI nextMatcher = filters.next(); + MatcherSet matcher2 = marshalFilter(nextMatcher, filters, and); + compound.addMatcherSet(matcher2); + result.setCompoundMatcher(compound); + } + else + { + /* + * single condition matcher + */ + MatchCondition matcherModel = new MatchCondition(); + matcherModel.setCondition( + firstMatcher.getMatcher().getCondition().getStableName()); + matcherModel.setValue(firstMatcher.getMatcher().getPattern()); + if (firstMatcher.isByAttribute()) + { + matcherModel.setBy(FeatureMatcherByType.BYATTRIBUTE); + matcherModel.setAttributeName(firstMatcher.getAttribute()); + } + else if (firstMatcher.isByLabel()) + { + matcherModel.setBy(FeatureMatcherByType.BYLABEL); + } + else if (firstMatcher.isByScore()) + { + matcherModel.setBy(FeatureMatcherByType.BYSCORE); + } + result.setMatchCondition(matcherModel); + } + + return result; + } + + /** + * Loads one XML model of a feature filter to a Jalview object + * + * @param colourModel + * @return + */ + protected static FeatureMatcherSetI unmarshalFilter(Filter filterModel) + { + FeatureMatcherSetI result = new FeatureMatcherSet(); + MatcherSet matcherSetModel = filterModel.getMatcherSet(); + try + { + unmarshalFilterConditions(result, matcherSetModel, true); + } catch (IllegalStateException e) + { + // mixing AND and OR conditions perhaps + System.err.println( + String.format("Error reading filter conditions for '%s': %s", + filterModel.getFeatureType(), e.getMessage())); + // return as much as was parsed up to the error + } + + return result; + } + + /** + * Adds feature match conditions to matcherSet as unmarshalled from XML + * (possibly recursively for compound conditions) + * + * @param matcherSet + * @param matcherSetModel + * @param and + * if true, multiple conditions are AND-ed, else they are OR-ed + * @throws IllegalStateException + * if AND and OR conditions are mixed + */ + protected static void unmarshalFilterConditions( + FeatureMatcherSetI matcherSet, MatcherSet matcherSetModel, + boolean and) + { + MatchCondition mc = matcherSetModel.getMatchCondition(); + if (mc != null) + { + /* + * single condition + */ + FeatureMatcherByType filterBy = mc.getBy(); + Condition cond = Condition.fromString(mc.getCondition()); + String pattern = mc.getValue(); + FeatureMatcherI matchCondition = null; + if (filterBy == FeatureMatcherByType.BYLABEL) + { + matchCondition = FeatureMatcher.byLabel(cond, pattern); + } + else if (filterBy == FeatureMatcherByType.BYSCORE) + { + matchCondition = FeatureMatcher.byScore(cond, pattern); + + } + else if (filterBy == FeatureMatcherByType.BYATTRIBUTE) + { + String[] attNames = mc.getAttributeName(); + matchCondition = FeatureMatcher.byAttribute(cond, pattern, + attNames); + } + + /* + * note this throws IllegalStateException if AND-ing to a + * previously OR-ed compound condition, or vice versa + */ + if (and) + { + matcherSet.and(matchCondition); + } + else + { + matcherSet.or(matchCondition); + } + } + else + { + /* + * compound condition + */ + MatcherSet[] matchers = matcherSetModel.getCompoundMatcher() + .getMatcherSet(); + boolean anded = matcherSetModel.getCompoundMatcher().getAnd(); + if (matchers.length == 2) + { + unmarshalFilterConditions(matcherSet, matchers[0], anded); + unmarshalFilterConditions(matcherSet, matchers[1], anded); + } + else + { + System.err.println("Malformed compound filter condition"); + } + } + } + + /** + * Loads one XML model of a feature colour to a Jalview object + * + * @param colourModel + * @return + */ + protected static FeatureColourI unmarshalColour( + jalview.schemabinding.version2.Colour colourModel) + { + FeatureColourI colour = null; + + if (colourModel.hasMax()) + { + Color mincol = null; + Color maxcol = null; + Color noValueColour = null; + + try + { + mincol = new Color(Integer.parseInt(colourModel.getMinRGB(), 16)); + maxcol = new Color(Integer.parseInt(colourModel.getRGB(), 16)); + } catch (Exception e) + { + Cache.log.warn("Couldn't parse out graduated feature color.", e); + } + + ColourNoValueColourType noCol = colourModel.getNoValueColour(); + if (noCol == ColourNoValueColourType.MIN) + { + noValueColour = mincol; + } + else if (noCol == ColourNoValueColourType.MAX) + { + noValueColour = maxcol; + } + + colour = new FeatureColour(mincol, maxcol, noValueColour, + colourModel.getMin(), + colourModel.getMax()); + String[] attributes = colourModel.getAttributeName(); + if (attributes != null && attributes.length > 0) + { + colour.setAttributeName(attributes); + } + if (colourModel.hasAutoScale()) + { + colour.setAutoScaled(colourModel.getAutoScale()); + } + if (colourModel.hasColourByLabel()) + { + colour.setColourByLabel(colourModel.getColourByLabel()); + } + if (colourModel.hasThreshold()) + { + colour.setThreshold(colourModel.getThreshold()); + } + ColourThreshTypeType ttyp = colourModel.getThreshType(); + if (ttyp != null) + { + if (ttyp == ColourThreshTypeType.ABOVE) + { + colour.setAboveThreshold(true); + } + else if (ttyp == ColourThreshTypeType.BELOW) + { + colour.setBelowThreshold(true); + } + } + } + else + { + Color color = new Color(Integer.parseInt(colourModel.getRGB(), 16)); + colour = new FeatureColour(color); + } + + return colour; + } + + /** * Constructor * * @param af @@ -851,6 +1146,10 @@ public class FeatureSettings extends JPanel } } + /** + * Offers a file chooser dialog, and then loads the feature colours and + * filters from file in XML format and unmarshals to Jalview feature settings + */ void load() { JalviewFileChooser chooser = new JalviewFileChooser("fc", @@ -873,60 +1172,35 @@ public class FeatureSettings extends JPanel JalviewUserColours jucs = JalviewUserColours.unmarshal(in); + /* + * load feature colours + */ for (int i = jucs.getColourCount() - 1; i >= 0; i--) { - String name; jalview.schemabinding.version2.Colour newcol = jucs.getColour(i); - if (newcol.hasMax()) - { - Color mincol = null, maxcol = null; - try - { - mincol = new Color(Integer.parseInt(newcol.getMinRGB(), 16)); - maxcol = new Color(Integer.parseInt(newcol.getRGB(), 16)); + FeatureColourI colour = unmarshalColour(newcol); + fr.setColour(newcol.getName(), colour); + fr.setOrder(newcol.getName(), i / (float) jucs.getColourCount()); + } - } catch (Exception e) - { - Cache.log.warn("Couldn't parse out graduated feature color.", - e); - } - FeatureColourI gcol = new FeatureColour(mincol, maxcol, - newcol.getMin(), newcol.getMax()); - if (newcol.hasAutoScale()) - { - gcol.setAutoScaled(newcol.getAutoScale()); - } - if (newcol.hasColourByLabel()) - { - gcol.setColourByLabel(newcol.getColourByLabel()); - } - if (newcol.hasThreshold()) - { - gcol.setThreshold(newcol.getThreshold()); - } - if (newcol.getThreshType().length() > 0) - { - String ttyp = newcol.getThreshType(); - if (ttyp.equalsIgnoreCase("ABOVE")) - { - gcol.setAboveThreshold(true); - } - if (ttyp.equalsIgnoreCase("BELOW")) - { - gcol.setBelowThreshold(true); - } - } - fr.setColour(name = newcol.getName(), gcol); - } - else + /* + * load feature filters; loaded filters will replace any that are + * currently defined, other defined filters are left unchanged + */ + for (int i = 0; i < jucs.getFilterCount(); i++) + { + jalview.schemabinding.version2.Filter filterModel = jucs + .getFilter(i); + FeatureMatcherSetI filter = unmarshalFilter(filterModel); + if (!filter.isEmpty()) { - Color color = new Color( - Integer.parseInt(jucs.getColour(i).getRGB(), 16)); - fr.setColour(name = jucs.getColour(i).getName(), - new FeatureColour(color)); + fr.setFeatureFilter(filterModel.getFeatureType(), filter); } - fr.setOrder(name, (i == 0) ? 0 : i / jucs.getColourCount()); } + + /* + * update feature settings table + */ if (table != null) { resetTable(null); @@ -943,6 +1217,10 @@ public class FeatureSettings extends JPanel } } + /** + * Offers a file chooser dialog, and then saves the current feature colours + * and any filters to the selected file in XML format + */ void save() { JalviewFileChooser chooser = new JalviewFileChooser("fc", @@ -957,50 +1235,59 @@ public class FeatureSettings extends JPanel if (value == JalviewFileChooser.APPROVE_OPTION) { String choice = chooser.getSelectedFile().getPath(); - jalview.schemabinding.version2.JalviewUserColours ucs = new jalview.schemabinding.version2.JalviewUserColours(); + JalviewUserColours ucs = new JalviewUserColours(); ucs.setSchemeName("Sequence Features"); try { PrintWriter out = new PrintWriter(new OutputStreamWriter( new FileOutputStream(choice), "UTF-8")); + /* + * sort feature types by colour order, from 0 (highest) + * to 1 (lowest) + */ Set fr_colours = fr.getAllFeatureColours(); - Iterator e = fr_colours.iterator(); - float[] sortOrder = new float[fr_colours.size()]; - String[] sortTypes = new String[fr_colours.size()]; - int i = 0; - while (e.hasNext()) + String[] sortedTypes = fr_colours + .toArray(new String[fr_colours.size()]); + Arrays.sort(sortedTypes, new Comparator() { - sortTypes[i] = e.next(); - sortOrder[i] = fr.getOrder(sortTypes[i]); - i++; - } - QuickSort.sort(sortOrder, sortTypes); - sortOrder = null; - for (i = 0; i < sortTypes.length; i++) - { - jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour(); - col.setName(sortTypes[i]); - FeatureColourI fcol = fr.getFeatureStyle(sortTypes[i]); - if (fcol.isSimpleColour()) + @Override + public int compare(String type1, String type2) { - col.setRGB(Format.getHexString(fcol.getColour())); + return Float.compare(fr.getOrder(type1), fr.getOrder(type2)); } - else + }); + + /* + * save feature colours + */ + for (String featureType : sortedTypes) + { + FeatureColourI fcol = fr.getFeatureStyle(featureType); + jalview.schemabinding.version2.Colour col = marshalColour( + featureType, fcol); + ucs.addColour(col); + } + + /* + * save any feature filters + */ + for (String featureType : sortedTypes) + { + FeatureMatcherSetI filter = fr.getFeatureFilter(featureType); + if (filter != null && !filter.isEmpty()) { - col.setRGB(Format.getHexString(fcol.getMaxColour())); - col.setMin(fcol.getMin()); - col.setMax(fcol.getMax()); - col.setMinRGB( - jalview.util.Format.getHexString(fcol.getMinColour())); - col.setAutoScale(fcol.isAutoScaled()); - col.setThreshold(fcol.getThreshold()); - col.setColourByLabel(fcol.isColourByLabel()); - col.setThreshType(fcol.isAboveThreshold() ? "ABOVE" - : (fcol.isBelowThreshold() ? "BELOW" : "NONE")); + Iterator iterator = filter.getMatchers().iterator(); + FeatureMatcherI firstMatcher = iterator.next(); + MatcherSet ms = marshalFilter(firstMatcher, iterator, + filter.isAnded()); + Filter filterModel = new Filter(); + filterModel.setFeatureType(featureType); + filterModel.setMatcherSet(ms); + ucs.addFilter(filterModel); } - ucs.addColour(col); } + ucs.marshal(out); out.close(); } catch (Exception ex) diff --git a/src/jalview/schemabinding/version2/CompoundMatcher.java b/src/jalview/schemabinding/version2/CompoundMatcher.java new file mode 100644 index 0000000..27714e2 --- /dev/null +++ b/src/jalview/schemabinding/version2/CompoundMatcher.java @@ -0,0 +1,374 @@ +/* + * 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 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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.MatcherSet at the + * given index + */ + public jalview.schemabinding.version2.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.schemabinding.version2.MatcherSet) _matcherSetList + .get(index); + } + + /** + * Method getMatcherSet.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 jalview.schemabinding.version2.MatcherSet[] getMatcherSet() + { + jalview.schemabinding.version2.MatcherSet[] array = new jalview.schemabinding.version2.MatcherSet[0]; + return (jalview.schemabinding.version2.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.schemabinding.version2.MatcherSet vMatcherSet) + { + boolean removed = _matcherSetList.remove(vMatcherSet); + return removed; + } + + /** + * Method removeMatcherSetAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.schemabinding.version2.MatcherSet removeMatcherSetAt( + final int index) + { + java.lang.Object obj = this._matcherSetList.remove(index); + return (jalview.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.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.schemabinding.version2.CompoundMatcher + */ + public static jalview.schemabinding.version2.CompoundMatcher unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException + { + return (jalview.schemabinding.version2.CompoundMatcher) Unmarshaller + .unmarshal(jalview.schemabinding.version2.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); + } + +} diff --git a/src/jalview/schemabinding/version2/FeatureMatcher.java b/src/jalview/schemabinding/version2/FeatureMatcher.java new file mode 100644 index 0000000..4d29cab --- /dev/null +++ b/src/jalview/schemabinding/version2/FeatureMatcher.java @@ -0,0 +1,383 @@ +/* + * 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); + } + +} diff --git a/src/jalview/schemabinding/version2/FeatureMatcherSet.java b/src/jalview/schemabinding/version2/FeatureMatcherSet.java new file mode 100644 index 0000000..893a30d --- /dev/null +++ b/src/jalview/schemabinding/version2/FeatureMatcherSet.java @@ -0,0 +1,202 @@ +/* + * 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; + +/** + * A feature match condition, which may be simple or compound + * + * @version $Revision$ $Date$ + */ +public class FeatureMatcherSet implements java.io.Serializable +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Internal choice value storage + */ + private java.lang.Object _choiceValue; + + /** + * Field _matchCondition. + */ + private jalview.schemabinding.version2.MatchCondition _matchCondition; + + /** + * Field _compoundMatcher. + */ + private jalview.schemabinding.version2.CompoundMatcher _compoundMatcher; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public FeatureMatcherSet() + { + super(); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Returns the value of field 'choiceValue'. The field 'choiceValue' has the + * following description: Internal choice value storage + * + * @return the value of field 'ChoiceValue'. + */ + public java.lang.Object getChoiceValue() + { + return this._choiceValue; + } + + /** + * Returns the value of field 'compoundMatcher'. + * + * @return the value of field 'CompoundMatcher'. + */ + public jalview.schemabinding.version2.CompoundMatcher getCompoundMatcher() + { + return this._compoundMatcher; + } + + /** + * Returns the value of field 'matchCondition'. + * + * @return the value of field 'MatchCondition'. + */ + public jalview.schemabinding.version2.MatchCondition getMatchCondition() + { + return this._matchCondition; + } + + /** + * 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); + } + + /** + * Sets the value of field 'compoundMatcher'. + * + * @param compoundMatcher + * the value of field 'compoundMatcher'. + */ + public void setCompoundMatcher( + final jalview.schemabinding.version2.CompoundMatcher compoundMatcher) + { + this._compoundMatcher = compoundMatcher; + this._choiceValue = compoundMatcher; + } + + /** + * Sets the value of field 'matchCondition'. + * + * @param matchCondition + * the value of field 'matchCondition'. + */ + public void setMatchCondition( + final jalview.schemabinding.version2.MatchCondition matchCondition) + { + this._matchCondition = matchCondition; + this._choiceValue = matchCondition; + } + + /** + * 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.FeatureMatcherSet + */ + public static jalview.schemabinding.version2.FeatureMatcherSet unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException + { + return (jalview.schemabinding.version2.FeatureMatcherSet) Unmarshaller + .unmarshal( + jalview.schemabinding.version2.FeatureMatcherSet.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); + } + +} diff --git a/src/jalview/schemabinding/version2/Filter.java b/src/jalview/schemabinding/version2/Filter.java new file mode 100644 index 0000000..45323a7 --- /dev/null +++ b/src/jalview/schemabinding/version2/Filter.java @@ -0,0 +1,181 @@ +/* + * 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 Filter. + * + * @version $Revision$ $Date$ + */ +public class Filter implements java.io.Serializable +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _featureType. + */ + private java.lang.String _featureType; + + /** + * Field _matcherSet. + */ + private jalview.schemabinding.version2.MatcherSet _matcherSet; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public Filter() + { + super(); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Returns the value of field 'featureType'. + * + * @return the value of field 'FeatureType'. + */ + public java.lang.String getFeatureType() + { + return this._featureType; + } + + /** + * Returns the value of field 'matcherSet'. + * + * @return the value of field 'MatcherSet'. + */ + public jalview.schemabinding.version2.MatcherSet getMatcherSet() + { + return this._matcherSet; + } + + /** + * 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); + } + + /** + * Sets the value of field 'featureType'. + * + * @param featureType + * the value of field 'featureType'. + */ + public void setFeatureType(final java.lang.String featureType) + { + this._featureType = featureType; + } + + /** + * Sets the value of field 'matcherSet'. + * + * @param matcherSet + * the value of field 'matcherSet'. + */ + public void setMatcherSet( + final jalview.schemabinding.version2.MatcherSet matcherSet) + { + this._matcherSet = matcherSet; + } + + /** + * 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.Filter + */ + public static jalview.schemabinding.version2.Filter unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException + { + return (jalview.schemabinding.version2.Filter) Unmarshaller + .unmarshal(jalview.schemabinding.version2.Filter.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); + } + +} diff --git a/src/jalview/schemabinding/version2/JalviewUserColours.java b/src/jalview/schemabinding/version2/JalviewUserColours.java index 042f092..c8d52ac 100644 --- a/src/jalview/schemabinding/version2/JalviewUserColours.java +++ b/src/jalview/schemabinding/version2/JalviewUserColours.java @@ -42,6 +42,11 @@ public class JalviewUserColours implements java.io.Serializable */ private java.util.Vector _colourList; + /** + * Field _filterList. + */ + private java.util.Vector _filterList; + // ----------------/ // - Constructors -/ // ----------------/ @@ -50,6 +55,7 @@ public class JalviewUserColours implements java.io.Serializable { super(); this._colourList = new java.util.Vector(); + this._filterList = new java.util.Vector(); } // -----------/ @@ -84,6 +90,33 @@ public class JalviewUserColours implements java.io.Serializable } /** + * + * + * @param vFilter + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addFilter(final Filter vFilter) + throws java.lang.IndexOutOfBoundsException + { + this._filterList.addElement(vFilter); + } + + /** + * + * + * @param index + * @param vFilter + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addFilter(final int index, final Filter vFilter) + throws java.lang.IndexOutOfBoundsException + { + this._filterList.add(index, vFilter); + } + + /** * Method enumerateColour. * * @return an Enumeration over all Colour elements @@ -94,6 +127,16 @@ public class JalviewUserColours implements java.io.Serializable } /** + * Method enumerateFilter. + * + * @return an Enumeration over all Filter elements + */ + public java.util.Enumeration enumerateFilter() + { + return this._filterList.elements(); + } + + /** * Method getColour. * * @param index @@ -107,9 +150,9 @@ public class JalviewUserColours implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._colourList.size()) { - throw new IndexOutOfBoundsException("getColour: Index value '" - + index + "' not in range [0.." - + (this._colourList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getColour: Index value '" + index + "' not in range [0.." + + (this._colourList.size() - 1) + "]"); } return (Colour) _colourList.get(index); @@ -141,6 +184,53 @@ public class JalviewUserColours implements java.io.Serializable } /** + * Method getFilter. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + * @return the value of the Filter at the given index + */ + public Filter getFilter(final int index) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._filterList.size()) + { + throw new IndexOutOfBoundsException( + "getFilter: Index value '" + index + "' not in range [0.." + + (this._filterList.size() - 1) + "]"); + } + + return (Filter) _filterList.get(index); + } + + /** + * Method getFilter.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 Filter[] getFilter() + { + Filter[] array = new Filter[0]; + return (Filter[]) this._filterList.toArray(array); + } + + /** + * Method getFilterCount. + * + * @return the size of this collection + */ + public int getFilterCount() + { + return this._filterList.size(); + } + + /** * Returns the value of field 'schemeName'. * * @return the value of field 'SchemeName'. @@ -217,13 +307,20 @@ public class JalviewUserColours implements java.io.Serializable } /** - */ + */ public void removeAllColour() { this._colourList.clear(); } /** + */ + public void removeAllFilter() + { + this._filterList.clear(); + } + + /** * Method removeColour. * * @param vColour @@ -248,6 +345,30 @@ public class JalviewUserColours implements java.io.Serializable } /** + * Method removeFilter. + * + * @param vFilter + * @return true if the object was removed from the collection. + */ + public boolean removeFilter(final Filter vFilter) + { + boolean removed = _filterList.remove(vFilter); + return removed; + } + + /** + * Method removeFilterAt. + * + * @param index + * @return the element removed from the collection + */ + public Filter removeFilterAt(final int index) + { + java.lang.Object obj = this._filterList.remove(index); + return (Filter) obj; + } + + /** * * * @param index @@ -261,9 +382,9 @@ public class JalviewUserColours implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._colourList.size()) { - throw new IndexOutOfBoundsException("setColour: Index value '" - + index + "' not in range [0.." - + (this._colourList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setColour: Index value '" + index + "' not in range [0.." + + (this._colourList.size() - 1) + "]"); } this._colourList.set(index, vColour); @@ -286,6 +407,44 @@ public class JalviewUserColours implements java.io.Serializable } /** + * + * + * @param index + * @param vFilter + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void setFilter(final int index, final Filter vFilter) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._filterList.size()) + { + throw new IndexOutOfBoundsException( + "setFilter: Index value '" + index + "' not in range [0.." + + (this._filterList.size() - 1) + "]"); + } + + this._filterList.set(index, vFilter); + } + + /** + * + * + * @param vFilterArray + */ + public void setFilter(final Filter[] vFilterArray) + { + // -- copy array + _filterList.clear(); + + for (int i = 0; i < vFilterArray.length; i++) + { + this._filterList.add(vFilterArray[i]); + } + } + + /** * Sets the value of field 'schemeName'. * * @param schemeName diff --git a/src/jalview/schemabinding/version2/MatchCondition.java b/src/jalview/schemabinding/version2/MatchCondition.java new file mode 100644 index 0000000..af2f3f5 --- /dev/null +++ b/src/jalview/schemabinding/version2/MatchCondition.java @@ -0,0 +1,126 @@ +/* + * 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 MatchCondition. + * + * @version $Revision$ $Date$ + */ +public class MatchCondition extends FeatureMatcher + implements java.io.Serializable +{ + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public MatchCondition() + { + super(); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * 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); + } + + /** + * 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.MatchCondition.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); + } + +} diff --git a/src/jalview/schemabinding/version2/MatcherSet.java b/src/jalview/schemabinding/version2/MatcherSet.java new file mode 100644 index 0000000..fa7fd71 --- /dev/null +++ b/src/jalview/schemabinding/version2/MatcherSet.java @@ -0,0 +1,126 @@ +/* + * 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 MatcherSet. + * + * @version $Revision$ $Date$ + */ +public class MatcherSet extends FeatureMatcherSet + implements java.io.Serializable +{ + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public MatcherSet() + { + super(); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * 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); + } + + /** + * 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.FeatureMatcherSet + */ + public static jalview.schemabinding.version2.FeatureMatcherSet unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, + org.exolab.castor.xml.ValidationException + { + return (jalview.schemabinding.version2.FeatureMatcherSet) Unmarshaller + .unmarshal(jalview.schemabinding.version2.MatcherSet.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); + } + +} diff --git a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java index 8b1ae9e..eb94047 100644 --- a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java @@ -18,8 +18,8 @@ import jalview.schemabinding.version2.Colour; * * @version $Revision$ $Date$ */ -public class ColourDescriptor extends - org.exolab.castor.xml.util.XMLClassDescriptorImpl +public class ColourDescriptor + extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { // --------------------------/ @@ -55,6 +55,9 @@ public class ColourDescriptor extends super(); _xmlName = "colour"; _elementDefinition = true; + + // -- set grouping compositor + setCompositorAsSequence(); org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; org.exolab.castor.mapping.FieldHandler handler = null; org.exolab.castor.xml.FieldValidator fieldValidator = null; @@ -197,11 +200,57 @@ public class ColourDescriptor extends typeValidator.setWhiteSpace("preserve"); } desc.setValidator(fieldValidator); - // -- _threshType + // -- _noValueColour desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.String.class, "_threshType", "threshType", + jalview.schemabinding.version2.types.ColourNoValueColourType.class, + "_noValueColour", "noValueColour", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + Colour target = (Colour) object; + return target.getNoValueColour(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + Colour target = (Colour) object; + target.setNoValueColour( + (jalview.schemabinding.version2.types.ColourNoValueColourType) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return null; + } + }; + handler = new org.exolab.castor.xml.handlers.EnumFieldHandler( + jalview.schemabinding.version2.types.ColourNoValueColourType.class, + handler); desc.setImmutable(true); + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _noValueColour + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { // -- local scope + } + desc.setValidator(fieldValidator); + // -- _threshType + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + jalview.schemabinding.version2.types.ColourThreshTypeType.class, + "_threshType", "threshType", + org.exolab.castor.xml.NodeType.Attribute); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue(java.lang.Object object) @@ -217,7 +266,8 @@ public class ColourDescriptor extends try { Colour target = (Colour) object; - target.setThreshType((java.lang.String) value); + target.setThreshType( + (jalview.schemabinding.version2.types.ColourThreshTypeType) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -229,6 +279,10 @@ public class ColourDescriptor extends return null; } }; + handler = new org.exolab.castor.xml.handlers.EnumFieldHandler( + jalview.schemabinding.version2.types.ColourThreshTypeType.class, + handler); + desc.setImmutable(true); desc.setHandler(handler); desc.setMultivalued(false); addFieldDescriptor(desc); @@ -236,10 +290,6 @@ public class ColourDescriptor extends // -- validation code for: _threshType fieldValidator = new org.exolab.castor.xml.FieldValidator(); { // -- local scope - org.exolab.castor.xml.validators.StringValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.StringValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setWhiteSpace("preserve"); } desc.setValidator(fieldValidator); // -- _threshold @@ -437,8 +487,8 @@ public class ColourDescriptor extends target.deleteColourByLabel(); return; } - target.setColourByLabel(((java.lang.Boolean) value) - .booleanValue()); + target.setColourByLabel( + ((java.lang.Boolean) value).booleanValue()); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -518,6 +568,66 @@ public class ColourDescriptor extends desc.setValidator(fieldValidator); // -- initialize element descriptors + // -- _attributeNameList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + java.lang.String.class, "_attributeNameList", "attributeName", + org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + Colour target = (Colour) object; + return target.getAttributeName(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + Colour target = (Colour) object; + target.addAttributeName((java.lang.String) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public void resetValue(Object object) + throws IllegalStateException, IllegalArgumentException + { + try + { + Colour target = (Colour) object; + target.removeAllAttributeName(); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + // -- validation code for: _attributeNameList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + fieldValidator.setMaxOccurs(2); + { // -- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); } // -----------/ diff --git a/src/jalview/schemabinding/version2/descriptors/CompoundMatcherDescriptor.java b/src/jalview/schemabinding/version2/descriptors/CompoundMatcherDescriptor.java new file mode 100644 index 0000000..2402d68 --- /dev/null +++ b/src/jalview/schemabinding/version2/descriptors/CompoundMatcherDescriptor.java @@ -0,0 +1,270 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.descriptors; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.CompoundMatcher; + +/** + * Class CompoundMatcherDescriptor. + * + * @version $Revision$ $Date$ + */ +public class CompoundMatcherDescriptor + extends org.exolab.castor.xml.util.XMLClassDescriptorImpl +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public CompoundMatcherDescriptor() + { + super(); + _xmlName = "compoundMatcher"; + _elementDefinition = true; + + // -- set grouping compositor + setCompositorAsSequence(); + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + // -- initialize attribute descriptors + + // -- _and + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + java.lang.Boolean.TYPE, "_and", "and", + org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + CompoundMatcher target = (CompoundMatcher) object; + if (!target.hasAnd()) + { + return null; + } + return (target.getAnd() ? java.lang.Boolean.TRUE + : java.lang.Boolean.FALSE); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + CompoundMatcher target = (CompoundMatcher) object; + // ignore null values for non optional primitives + if (value == null) + { + return; + } + + target.setAnd(((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _and + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { // -- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + // -- initialize element descriptors + + // -- _matcherSetList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + jalview.schemabinding.version2.MatcherSet.class, + "_matcherSetList", "matcherSet", + org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + CompoundMatcher target = (CompoundMatcher) object; + return target.getMatcherSet(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + CompoundMatcher target = (CompoundMatcher) object; + target.addMatcherSet( + (jalview.schemabinding.version2.MatcherSet) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public void resetValue(Object object) + throws IllegalStateException, IllegalArgumentException + { + try + { + CompoundMatcher target = (CompoundMatcher) object; + target.removeAllMatcherSet(); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return new jalview.schemabinding.version2.MatcherSet(); + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + // -- validation code for: _matcherSetList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(2); + fieldValidator.setMaxOccurs(2); + { // -- local scope + } + desc.setValidator(fieldValidator); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass() + { + return jalview.schemabinding.version2.CompoundMatcher.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix() + { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI() + { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName() + { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition() + { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemabinding/version2/descriptors/FeatureMatcherDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeatureMatcherDescriptor.java new file mode 100644 index 0000000..2df2f5b --- /dev/null +++ b/src/jalview/schemabinding/version2/descriptors/FeatureMatcherDescriptor.java @@ -0,0 +1,356 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.descriptors; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.FeatureMatcher; + +/** + * Class FeatureMatcherDescriptor. + * + * @version $Revision$ $Date$ + */ +public class FeatureMatcherDescriptor + extends org.exolab.castor.xml.util.XMLClassDescriptorImpl +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public FeatureMatcherDescriptor() + { + super(); + _nsURI = "www.jalview.org/colours"; + _xmlName = "FeatureMatcher"; + _elementDefinition = false; + + // -- set grouping compositor + setCompositorAsSequence(); + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + // -- initialize attribute descriptors + + // -- _by + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + jalview.schemabinding.version2.types.FeatureMatcherByType.class, + "_by", "by", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + FeatureMatcher target = (FeatureMatcher) object; + return target.getBy(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + FeatureMatcher target = (FeatureMatcher) object; + target.setBy( + (jalview.schemabinding.version2.types.FeatureMatcherByType) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return null; + } + }; + handler = new org.exolab.castor.xml.handlers.EnumFieldHandler( + jalview.schemabinding.version2.types.FeatureMatcherByType.class, + handler); + desc.setImmutable(true); + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _by + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { // -- local scope + } + desc.setValidator(fieldValidator); + // -- initialize element descriptors + + // -- _attributeNameList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + java.lang.String.class, "_attributeNameList", "attributeName", + org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + FeatureMatcher target = (FeatureMatcher) object; + return target.getAttributeName(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + FeatureMatcher target = (FeatureMatcher) object; + target.addAttributeName((java.lang.String) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public void resetValue(Object object) + throws IllegalStateException, IllegalArgumentException + { + try + { + FeatureMatcher target = (FeatureMatcher) object; + target.removeAllAttributeName(); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + // -- validation code for: _attributeNameList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + fieldValidator.setMaxOccurs(2); + { // -- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + // -- _condition + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + java.lang.String.class, "_condition", "condition", + org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + FeatureMatcher target = (FeatureMatcher) object; + return target.getCondition(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + FeatureMatcher target = (FeatureMatcher) object; + target.setCondition((java.lang.String) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _condition + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { // -- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + // -- _value + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + java.lang.String.class, "_value", "value", + org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + FeatureMatcher target = (FeatureMatcher) object; + return target.getValue(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + FeatureMatcher target = (FeatureMatcher) object; + target.setValue((java.lang.String) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _value + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { // -- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass() + { + return jalview.schemabinding.version2.FeatureMatcher.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix() + { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI() + { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName() + { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition() + { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemabinding/version2/descriptors/FeatureMatcherSetDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeatureMatcherSetDescriptor.java new file mode 100644 index 0000000..0584eec --- /dev/null +++ b/src/jalview/schemabinding/version2/descriptors/FeatureMatcherSetDescriptor.java @@ -0,0 +1,245 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.descriptors; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.FeatureMatcherSet; + +/** + * Class FeatureMatcherSetDescriptor. + * + * @version $Revision$ $Date$ + */ +public class FeatureMatcherSetDescriptor + extends org.exolab.castor.xml.util.XMLClassDescriptorImpl +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public FeatureMatcherSetDescriptor() + { + super(); + _nsURI = "www.jalview.org/colours"; + _xmlName = "FeatureMatcherSet"; + _elementDefinition = false; + + // -- set grouping compositor + setCompositorAsChoice(); + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + // -- initialize attribute descriptors + + // -- initialize element descriptors + + // -- _matchCondition + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + jalview.schemabinding.version2.MatchCondition.class, + "_matchCondition", "matchCondition", + org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + FeatureMatcherSet target = (FeatureMatcherSet) object; + return target.getMatchCondition(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + FeatureMatcherSet target = (FeatureMatcherSet) object; + target.setMatchCondition( + (jalview.schemabinding.version2.MatchCondition) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return new jalview.schemabinding.version2.MatchCondition(); + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _matchCondition + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { // -- local scope + } + desc.setValidator(fieldValidator); + // -- _compoundMatcher + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + jalview.schemabinding.version2.CompoundMatcher.class, + "_compoundMatcher", "compoundMatcher", + org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + FeatureMatcherSet target = (FeatureMatcherSet) object; + return target.getCompoundMatcher(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + FeatureMatcherSet target = (FeatureMatcherSet) object; + target.setCompoundMatcher( + (jalview.schemabinding.version2.CompoundMatcher) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return new jalview.schemabinding.version2.CompoundMatcher(); + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _compoundMatcher + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { // -- local scope + } + desc.setValidator(fieldValidator); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass() + { + return jalview.schemabinding.version2.FeatureMatcherSet.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix() + { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI() + { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName() + { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition() + { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemabinding/version2/descriptors/FilterDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FilterDescriptor.java new file mode 100644 index 0000000..f58f9ae --- /dev/null +++ b/src/jalview/schemabinding/version2/descriptors/FilterDescriptor.java @@ -0,0 +1,246 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.descriptors; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.Filter; + +/** + * Class FilterDescriptor. + * + * @version $Revision$ $Date$ + */ +public class FilterDescriptor + extends org.exolab.castor.xml.util.XMLClassDescriptorImpl +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public FilterDescriptor() + { + super(); + _xmlName = "filter"; + _elementDefinition = true; + + // -- set grouping compositor + setCompositorAsSequence(); + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + // -- initialize attribute descriptors + + // -- _featureType + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + java.lang.String.class, "_featureType", "featureType", + org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + Filter target = (Filter) object; + return target.getFeatureType(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + Filter target = (Filter) object; + target.setFeatureType((java.lang.String) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _featureType + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { // -- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); + // -- initialize element descriptors + + // -- _matcherSet + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + jalview.schemabinding.version2.MatcherSet.class, "_matcherSet", + "matcherSet", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + Filter target = (Filter) object; + return target.getMatcherSet(); + } + + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + Filter target = (Filter) object; + target.setMatcherSet( + (jalview.schemabinding.version2.MatcherSet) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + public java.lang.Object newInstance(java.lang.Object parent) + { + return new jalview.schemabinding.version2.MatcherSet(); + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + // -- validation code for: _matcherSet + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { // -- local scope + } + desc.setValidator(fieldValidator); + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass() + { + return jalview.schemabinding.version2.Filter.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix() + { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI() + { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName() + { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition() + { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java index d65de13..459d645 100644 --- a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java @@ -7,11 +7,13 @@ package jalview.schemabinding.version2.descriptors; +import jalview.schemabinding.version2.Colour; +import jalview.schemabinding.version2.Filter; + //---------------------------------/ //- Imported classes and packages -/ //---------------------------------/ -import jalview.schemabinding.version2.Colour; import jalview.schemabinding.version2.JalviewUserColours; /** @@ -19,8 +21,8 @@ import jalview.schemabinding.version2.JalviewUserColours; * * @version $Revision$ $Date$ */ -public class JalviewUserColoursDescriptor extends - org.exolab.castor.xml.util.XMLClassDescriptorImpl +public class JalviewUserColoursDescriptor + extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { // --------------------------/ @@ -192,8 +194,8 @@ public class JalviewUserColoursDescriptor extends } @Override - public void resetValue(Object object) throws IllegalStateException, - IllegalArgumentException + public void resetValue(Object object) + throws IllegalStateException, IllegalArgumentException { try { @@ -221,6 +223,64 @@ public class JalviewUserColoursDescriptor extends { // -- local scope } desc.setValidator(fieldValidator); + // -- _filterList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( + Filter.class, "_filterList", "filter", + org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() + { + @Override + public java.lang.Object getValue(java.lang.Object object) + throws IllegalStateException + { + JalviewUserColours target = (JalviewUserColours) object; + return target.getFilter(); + } + + @Override + public void setValue(java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try + { + JalviewUserColours target = (JalviewUserColours) object; + target.addFilter((Filter) value); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + @Override + public void resetValue(Object object) + throws IllegalStateException, IllegalArgumentException + { + try + { + JalviewUserColours target = (JalviewUserColours) object; + target.removeAllFilter(); + } catch (java.lang.Exception ex) + { + throw new IllegalStateException(ex.toString()); + } + } + + @Override + public java.lang.Object newInstance(java.lang.Object parent) + { + return new Filter(); + } + }; + desc.setHandler(handler); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + // -- validation code for: _filterList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { // -- local scope + } + desc.setValidator(fieldValidator); } // -----------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MatchConditionDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MatchConditionDescriptor.java new file mode 100644 index 0000000..8373421 --- /dev/null +++ b/src/jalview/schemabinding/version2/descriptors/MatchConditionDescriptor.java @@ -0,0 +1,148 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.descriptors; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.MatchCondition; + +/** + * Class MatchConditionDescriptor. + * + * @version $Revision$ $Date$ + */ +public class MatchConditionDescriptor extends + jalview.schemabinding.version2.descriptors.FeatureMatcherDescriptor +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public MatchConditionDescriptor() + { + super(); + setExtendsWithoutFlatten( + new jalview.schemabinding.version2.descriptors.FeatureMatcherDescriptor()); + _xmlName = "matchCondition"; + _elementDefinition = true; + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass() + { + return jalview.schemabinding.version2.MatchCondition.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix() + { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI() + { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName() + { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition() + { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemabinding/version2/descriptors/MatcherSetDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MatcherSetDescriptor.java new file mode 100644 index 0000000..2807f92 --- /dev/null +++ b/src/jalview/schemabinding/version2/descriptors/MatcherSetDescriptor.java @@ -0,0 +1,148 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.descriptors; + +//---------------------------------/ +//- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.MatcherSet; + +/** + * Class MatcherSetDescriptor. + * + * @version $Revision$ $Date$ + */ +public class MatcherSetDescriptor extends + jalview.schemabinding.version2.descriptors.FeatureMatcherSetDescriptor +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public MatcherSetDescriptor() + { + super(); + setExtendsWithoutFlatten( + new jalview.schemabinding.version2.descriptors.FeatureMatcherSetDescriptor()); + _xmlName = "matcherSet"; + _elementDefinition = true; + } + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass() + { + return jalview.schemabinding.version2.MatcherSet.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix() + { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI() + { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName() + { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition() + { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemabinding/version2/types/.castor.cdr b/src/jalview/schemabinding/version2/types/.castor.cdr new file mode 100644 index 0000000..5735fcc --- /dev/null +++ b/src/jalview/schemabinding/version2/types/.castor.cdr @@ -0,0 +1,4 @@ +#Thu Dec 14 09:10:14 GMT 2017 +jalview.schemabinding.version2.types.ColourNoValueColourType=jalview.schemabinding.version2.types.descriptors.ColourNoValueColourTypeDescriptor +jalview.schemabinding.version2.types.FeatureMatcherByType=jalview.schemabinding.version2.types.descriptors.FeatureMatcherByTypeDescriptor +jalview.schemabinding.version2.types.ColourThreshTypeType=jalview.schemabinding.version2.types.descriptors.ColourThreshTypeTypeDescriptor diff --git a/src/jalview/schemabinding/version2/types/ColourNoValueColourType.java b/src/jalview/schemabinding/version2/types/ColourNoValueColourType.java new file mode 100644 index 0000000..2674156 --- /dev/null +++ b/src/jalview/schemabinding/version2/types/ColourNoValueColourType.java @@ -0,0 +1,171 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.types; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.util.Hashtable; + +/** + * Class ColourNoValueColourType. + * + * @version $Revision$ $Date$ + */ +public class ColourNoValueColourType implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * The None type + */ + public static final int NONE_TYPE = 0; + + /** + * The instance of the None type + */ + public static final ColourNoValueColourType NONE = new ColourNoValueColourType(NONE_TYPE, "None"); + + /** + * The Min type + */ + public static final int MIN_TYPE = 1; + + /** + * The instance of the Min type + */ + public static final ColourNoValueColourType MIN = new ColourNoValueColourType(MIN_TYPE, "Min"); + + /** + * The Max type + */ + public static final int MAX_TYPE = 2; + + /** + * The instance of the Max type + */ + public static final ColourNoValueColourType MAX = new ColourNoValueColourType(MAX_TYPE, "Max"); + + /** + * Field _memberTable. + */ + private static java.util.Hashtable _memberTable = init(); + + /** + * Field type. + */ + private int type = -1; + + /** + * Field stringValue. + */ + private java.lang.String stringValue = null; + + + //----------------/ + //- Constructors -/ + //----------------/ + + private ColourNoValueColourType(final int type, final java.lang.String value) { + super(); + this.type = type; + this.stringValue = value; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method enumerate.Returns an enumeration of all possible + * instances of ColourNoValueColourType + * + * @return an Enumeration over all possible instances of + * ColourNoValueColourType + */ + public static java.util.Enumeration enumerate( + ) { + return _memberTable.elements(); + } + + /** + * Method getType.Returns the type of this + * ColourNoValueColourType + * + * @return the type of this ColourNoValueColourType + */ + public int getType( + ) { + return this.type; + } + + /** + * Method init. + * + * @return the initialized Hashtable for the member table + */ + private static java.util.Hashtable init( + ) { + Hashtable members = new Hashtable(); + members.put("None", NONE); + members.put("Min", MIN); + members.put("Max", MAX); + return members; + } + + /** + * Method readResolve. will be called during deserialization to + * replace the deserialized object with the correct constant + * instance. + * + * @return this deserialized object + */ + private java.lang.Object readResolve( + ) { + return valueOf(this.stringValue); + } + + /** + * Method toString.Returns the String representation of this + * ColourNoValueColourType + * + * @return the String representation of this + * ColourNoValueColourType + */ + public java.lang.String toString( + ) { + return this.stringValue; + } + + /** + * Method valueOf.Returns a new ColourNoValueColourType based + * on the given String value. + * + * @param string + * @return the ColourNoValueColourType value of parameter + * 'string' + */ + public static jalview.schemabinding.version2.types.ColourNoValueColourType valueOf( + final java.lang.String string) { + java.lang.Object obj = null; + if (string != null) { + obj = _memberTable.get(string); + } + if (obj == null) { + String err = "" + string + " is not a valid ColourNoValueColourType"; + throw new IllegalArgumentException(err); + } + return (ColourNoValueColourType) obj; + } + +} diff --git a/src/jalview/schemabinding/version2/types/ColourThreshTypeType.java b/src/jalview/schemabinding/version2/types/ColourThreshTypeType.java new file mode 100644 index 0000000..0330411 --- /dev/null +++ b/src/jalview/schemabinding/version2/types/ColourThreshTypeType.java @@ -0,0 +1,168 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.types; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.util.Hashtable; + +/** + * Class ColourThreshTypeType. + * + * @version $Revision$ $Date$ + */ +public class ColourThreshTypeType implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * The NONE type + */ + public static final int NONE_TYPE = 0; + + /** + * The instance of the NONE type + */ + public static final ColourThreshTypeType NONE = new ColourThreshTypeType(NONE_TYPE, "NONE"); + + /** + * The ABOVE type + */ + public static final int ABOVE_TYPE = 1; + + /** + * The instance of the ABOVE type + */ + public static final ColourThreshTypeType ABOVE = new ColourThreshTypeType(ABOVE_TYPE, "ABOVE"); + + /** + * The BELOW type + */ + public static final int BELOW_TYPE = 2; + + /** + * The instance of the BELOW type + */ + public static final ColourThreshTypeType BELOW = new ColourThreshTypeType(BELOW_TYPE, "BELOW"); + + /** + * Field _memberTable. + */ + private static java.util.Hashtable _memberTable = init(); + + /** + * Field type. + */ + private int type = -1; + + /** + * Field stringValue. + */ + private java.lang.String stringValue = null; + + + //----------------/ + //- Constructors -/ + //----------------/ + + private ColourThreshTypeType(final int type, final java.lang.String value) { + super(); + this.type = type; + this.stringValue = value; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method enumerate.Returns an enumeration of all possible + * instances of ColourThreshTypeType + * + * @return an Enumeration over all possible instances of + * ColourThreshTypeType + */ + public static java.util.Enumeration enumerate( + ) { + return _memberTable.elements(); + } + + /** + * Method getType.Returns the type of this ColourThreshTypeType + * + * @return the type of this ColourThreshTypeType + */ + public int getType( + ) { + return this.type; + } + + /** + * Method init. + * + * @return the initialized Hashtable for the member table + */ + private static java.util.Hashtable init( + ) { + Hashtable members = new Hashtable(); + members.put("NONE", NONE); + members.put("ABOVE", ABOVE); + members.put("BELOW", BELOW); + return members; + } + + /** + * Method readResolve. will be called during deserialization to + * replace the deserialized object with the correct constant + * instance. + * + * @return this deserialized object + */ + private java.lang.Object readResolve( + ) { + return valueOf(this.stringValue); + } + + /** + * Method toString.Returns the String representation of this + * ColourThreshTypeType + * + * @return the String representation of this ColourThreshTypeTyp + */ + public java.lang.String toString( + ) { + return this.stringValue; + } + + /** + * Method valueOf.Returns a new ColourThreshTypeType based on + * the given String value. + * + * @param string + * @return the ColourThreshTypeType value of parameter 'string' + */ + public static jalview.schemabinding.version2.types.ColourThreshTypeType valueOf( + final java.lang.String string) { + java.lang.Object obj = null; + if (string != null) { + obj = _memberTable.get(string); + } + if (obj == null) { + String err = "" + string + " is not a valid ColourThreshTypeType"; + throw new IllegalArgumentException(err); + } + return (ColourThreshTypeType) obj; + } + +} diff --git a/src/jalview/schemabinding/version2/types/FeatureMatcherByType.java b/src/jalview/schemabinding/version2/types/FeatureMatcherByType.java new file mode 100644 index 0000000..6e97332 --- /dev/null +++ b/src/jalview/schemabinding/version2/types/FeatureMatcherByType.java @@ -0,0 +1,168 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.types; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.util.Hashtable; + +/** + * Class FeatureMatcherByType. + * + * @version $Revision$ $Date$ + */ +public class FeatureMatcherByType implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * The byLabel type + */ + public static final int BYLABEL_TYPE = 0; + + /** + * The instance of the byLabel type + */ + public static final FeatureMatcherByType BYLABEL = new FeatureMatcherByType(BYLABEL_TYPE, "byLabel"); + + /** + * The byScore type + */ + public static final int BYSCORE_TYPE = 1; + + /** + * The instance of the byScore type + */ + public static final FeatureMatcherByType BYSCORE = new FeatureMatcherByType(BYSCORE_TYPE, "byScore"); + + /** + * The byAttribute type + */ + public static final int BYATTRIBUTE_TYPE = 2; + + /** + * The instance of the byAttribute type + */ + public static final FeatureMatcherByType BYATTRIBUTE = new FeatureMatcherByType(BYATTRIBUTE_TYPE, "byAttribute"); + + /** + * Field _memberTable. + */ + private static java.util.Hashtable _memberTable = init(); + + /** + * Field type. + */ + private int type = -1; + + /** + * Field stringValue. + */ + private java.lang.String stringValue = null; + + + //----------------/ + //- Constructors -/ + //----------------/ + + private FeatureMatcherByType(final int type, final java.lang.String value) { + super(); + this.type = type; + this.stringValue = value; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method enumerate.Returns an enumeration of all possible + * instances of FeatureMatcherByType + * + * @return an Enumeration over all possible instances of + * FeatureMatcherByType + */ + public static java.util.Enumeration enumerate( + ) { + return _memberTable.elements(); + } + + /** + * Method getType.Returns the type of this FeatureMatcherByType + * + * @return the type of this FeatureMatcherByType + */ + public int getType( + ) { + return this.type; + } + + /** + * Method init. + * + * @return the initialized Hashtable for the member table + */ + private static java.util.Hashtable init( + ) { + Hashtable members = new Hashtable(); + members.put("byLabel", BYLABEL); + members.put("byScore", BYSCORE); + members.put("byAttribute", BYATTRIBUTE); + return members; + } + + /** + * Method readResolve. will be called during deserialization to + * replace the deserialized object with the correct constant + * instance. + * + * @return this deserialized object + */ + private java.lang.Object readResolve( + ) { + return valueOf(this.stringValue); + } + + /** + * Method toString.Returns the String representation of this + * FeatureMatcherByType + * + * @return the String representation of this FeatureMatcherByTyp + */ + public java.lang.String toString( + ) { + return this.stringValue; + } + + /** + * Method valueOf.Returns a new FeatureMatcherByType based on + * the given String value. + * + * @param string + * @return the FeatureMatcherByType value of parameter 'string' + */ + public static jalview.schemabinding.version2.types.FeatureMatcherByType valueOf( + final java.lang.String string) { + java.lang.Object obj = null; + if (string != null) { + obj = _memberTable.get(string); + } + if (obj == null) { + String err = "" + string + " is not a valid FeatureMatcherByType"; + throw new IllegalArgumentException(err); + } + return (FeatureMatcherByType) obj; + } + +} diff --git a/src/jalview/schemabinding/version2/types/descriptors/ColourNoValueColourTypeDescriptor.java b/src/jalview/schemabinding/version2/types/descriptors/ColourNoValueColourTypeDescriptor.java new file mode 100644 index 0000000..38c3df1 --- /dev/null +++ b/src/jalview/schemabinding/version2/types/descriptors/ColourNoValueColourTypeDescriptor.java @@ -0,0 +1,150 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.types.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.types.ColourNoValueColourType; + +/** + * Class ColourNoValueColourTypeDescriptor. + * + * @version $Revision$ $Date$ + */ +public class ColourNoValueColourTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public ColourNoValueColourTypeDescriptor() { + super(); + _nsURI = "www.jalview.org/colours"; + _xmlName = "ColourNoValueColourType"; + _elementDefinition = false; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return jalview.schemabinding.version2.types.ColourNoValueColourType.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemabinding/version2/types/descriptors/ColourThreshTypeTypeDescriptor.java b/src/jalview/schemabinding/version2/types/descriptors/ColourThreshTypeTypeDescriptor.java new file mode 100644 index 0000000..f978363 --- /dev/null +++ b/src/jalview/schemabinding/version2/types/descriptors/ColourThreshTypeTypeDescriptor.java @@ -0,0 +1,150 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.types.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.types.ColourThreshTypeType; + +/** + * Class ColourThreshTypeTypeDescriptor. + * + * @version $Revision$ $Date$ + */ +public class ColourThreshTypeTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public ColourThreshTypeTypeDescriptor() { + super(); + _nsURI = "www.jalview.org/colours"; + _xmlName = "ColourThreshTypeType"; + _elementDefinition = false; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return jalview.schemabinding.version2.types.ColourThreshTypeType.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} diff --git a/src/jalview/schemabinding/version2/types/descriptors/FeatureMatcherByTypeDescriptor.java b/src/jalview/schemabinding/version2/types/descriptors/FeatureMatcherByTypeDescriptor.java new file mode 100644 index 0000000..e392e76 --- /dev/null +++ b/src/jalview/schemabinding/version2/types/descriptors/FeatureMatcherByTypeDescriptor.java @@ -0,0 +1,150 @@ +/* + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ + */ + +package jalview.schemabinding.version2.types.descriptors; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import jalview.schemabinding.version2.types.FeatureMatcherByType; + +/** + * Class FeatureMatcherByTypeDescriptor. + * + * @version $Revision$ $Date$ + */ +public class FeatureMatcherByTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public FeatureMatcherByTypeDescriptor() { + super(); + _nsURI = "www.jalview.org/colours"; + _xmlName = "FeatureMatcherByType"; + _elementDefinition = false; + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } + + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return super.getIdentity(); + } + + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return jalview.schemabinding.version2.types.FeatureMatcherByType.class; + } + + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } + + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } + + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } + + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } + + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } + +} -- 1.7.10.2