ST-MOTIF ac25a1
kdHydrophobicity ccffcc|333300|-3.9|4.5|above|-2.0
+STARTFILTERS
+GAMMA-TURN-INVERSE Label Contains PDB
+kdHydrophobicity (Score LT 1.5) OR (Score GE 2.8)
+ENDFILTERS
+
STARTGROUP uniprot
<html><a href="http://pfam.xfam.org/family/PF00111">Pfam family</a></html> FER_CAPAA -1 0 0 Pfam
Iron-sulfur (2Fe-2S) FER_CAPAA -1 39 39 METAL
<em></em>
</td>
<td><div align="left">
- <ul><li><!-- JAL-2851-->Alignment doesn't appear to scroll vertically via trackpad and scrollwheel</li><ul>
+ <ul>
+ <li><!-- JAL-2851-->Alignment doesn't appear to scroll vertically via trackpad and scrollwheel</li>
+ <li><!-- JAL-2842-->Jalview hangs if up/down arrows pressed in cursor mode when cursor lies in hidden region at start of alignment</li>
+ <li><!-- JAL-2827-->Helix annotation has 'notches' when scrolled into view if columns are hidden</li>
+ <li><!-- JAL-2740-->Annotation column filter can be slow to reset (ie after hitting cancel) for large numbers of hidden columns</li>
+ <li><!-- JAL-2849-->User preference for disabling inclusion of sequence limits when exporting as flat file has no effect</li>
+ <ul>
</td>
</tr>
<tr>
label.seq_sort_by_score = Sequence sort by Score
label.load_colours = Load Colours
label.save_colours = Save Colours
+label.load_colours_tooltip = Load feature colours and filters from file
+label.save_colours_tooltip = Save feature colours and filters to file
label.fetch_das_features = Fetch DAS Features
label.selected_database_to_fetch_from = Selected {0} database {1} to fetch from {2}
label.database_param = Database: {0}
label.by_range_of = By range of
label.filters_tooltip = Click to set or amend filters
label.or = Or
-label.and = And
\ No newline at end of file
+label.and = And
+label.sequence_feature_colours = Sequence Feature Colours
You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
-->
-<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by lj (jl) -->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="www.jalview.org/colours">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jalview="www.jalview.org/colours" targetNamespace="www.jalview.org/colours">
<xs:complexType name="JalviewUserColours">
<xs:sequence>
<xs:element name="Version" maxOccurs="1" minOccurs="0" type="xs:string">
</xs:element>
<xs:element name="colour" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
- <xs:attribute name="Name" type="xs:string"/>
+ <xs:sequence>
+ <xs:element name="attributeName" type="xs:string" minOccurs="0" maxOccurs="2">
+ <xs:annotation>
+ <xs:documentation>name of feature attribute to colour by, or attribute and sub-attribute</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="Name" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Single letter residue code for an alignment colour scheme, or feature type for a feature colour scheme</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<xs:attribute name="RGB" type="xs:string" use="required"/>
<xs:attribute name="minRGB" type="xs:string" use="optional"/>
- <xs:attribute name="threshType" type="xs:string" use="optional">
- <xs:annotation>
- <xs:documentation>loosely specified enumeration: NONE,ABOVE, or BELOW</xs:documentation>
- </xs:annotation>
+ <xs:attribute name="noValueColour" use="optional" type="jalview:NoValueColour" default="Min" />
+ <xs:attribute name="threshType" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="NONE" />
+ <xs:enumeration value="ABOVE" />
+ <xs:enumeration value="BELOW" />
+ </xs:restriction>
+ </xs:simpleType>
</xs:attribute>
<xs:attribute name="threshold" type="xs:float" use="optional"/>
<xs:attribute name="max" type="xs:float" use="optional"/>
<xs:attribute name="autoScale" type="xs:boolean" use="optional"/>
</xs:complexType>
</xs:element>
+ <xs:element name="filter" maxOccurs="unbounded" minOccurs="0" >
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="matcherSet" type="jalview:FeatureMatcherSet" />
+ </xs:sequence>
+ <xs:attribute name="featureType" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
</xs:sequence>
<xs:attribute name="schemeName" type="xs:string" use="optional"/>
</xs:complexType>
+
+ <xs:complexType name="FeatureMatcherSet">
+ <xs:annotation>
+ <xs:documentation>A feature match condition, which may be simple or compound</xs:documentation>
+ </xs:annotation>
+ <xs:choice>
+ <xs:element name="matchCondition" type="jalview:FeatureMatcher" />
+ <xs:element name="compoundMatcher">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="matcherSet" minOccurs="2" maxOccurs="2" type="jalview:FeatureMatcherSet" />
+ </xs:sequence>
+ <xs:attribute name="and" type="xs:boolean" use="required">
+ <xs:annotation>
+ <xs:documentation>If true, matchers are AND-ed, if false they are OR-ed</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:complexType name="FeatureMatcher">
+ <xs:sequence>
+ <xs:element name="attributeName" type="xs:string" minOccurs="0" maxOccurs="2">
+ <xs:annotation>
+ <xs:documentation>name of feature attribute to filter on, or attribute and sub-attribute</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="condition" type="xs:string" />
+ <xs:element name="value" type="xs:string" />
+ </xs:sequence>
+ <xs:attribute name="by">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="byLabel" />
+ <xs:enumeration value="byScore" />
+ <xs:enumeration value="byAttribute" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:simpleType name="NoValueColour">
+ <xs:annotation>
+ <xs:documentation>Graduated feature colour if no score (or attribute) value</xs:documentation>
+ </xs:annotation>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="None" />
+ <xs:enumeration value="Min" />
+ <xs:enumeration value="Max" />
+ </xs:restriction>
+ </xs:simpleType>
</xs:schema>
<xs:sequence>
<xs:element name="setting" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
+ <xs:sequence>
+ <xs:element name="attributeName" type="xs:string" minOccurs="0" maxOccurs="2">
+ <xs:annotation>
+ <xs:documentation>name of feature attribute to colour by, or attribute and sub-attribute</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="matcherSet" minOccurs="0" type="jalview:FeatureMatcherSet">
+ <xs:annotation>
+ <xs:documentation>optional filter(s) applied to the feature type</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
<xs:attribute name="type" type="xs:string" use="required" />
<xs:attribute name="colour" type="xs:int" use="required" />
<xs:attribute name="display" type="xs:boolean"
</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="noValueColour" use="optional" type="jalview:NoValueColour" default="Min" />
<xs:attribute name="threshold" type="xs:float"
use="optional">
<xs:annotation>
<xs:element name="otherData" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="key" type="xs:string" use="required" />
+ <xs:attribute name="key2" type="xs:string" use="optional">
+ <xs:annotation>
+ <xs:documentation>key2 may be used for a sub-attribute of key</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<xs:attribute name="value" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
boolean isSimpleColour();
/**
- * Answers true if the feature is coloured by label (description)
+ * Answers true if the feature is coloured by label (description) or by text
+ * value of an attribute
*
* @return
*/
FeatureMatcherSetI getFeatureFilter(String featureType);
/**
- * Answers a shallow copy of the feature filters map
+ * Answers the feature filters map
*
* @return
*/
FeaturesFile formatter = new FeaturesFile();
if (format.equalsIgnoreCase("Jalview"))
{
- features = formatter.printJalviewFormat(viewport.getAlignment()
- .getSequencesArray(), getDisplayedFeatureCols(),
- getDisplayedFeatureGroups(), true);
+ features = formatter.printJalviewFormat(
+ viewport.getAlignment().getSequencesArray(),
+ getDisplayedFeatureCols(), null, getDisplayedFeatureGroups(),
+ true);
}
else
{
import java.awt.event.MouseListener;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;
-import java.util.ArrayList;
import java.util.Vector;
//import javax.swing.JPanel;
{
HiddenColumns oldHidden = av.getAnnotationColumnSelectionState()
.getOldHiddenColumns();
- if (oldHidden != null)
- {
- ArrayList<int[]> regions = oldHidden.getHiddenColumnsCopy();
- for (int[] positions : regions)
- {
- av.hideColumns(positions[0], positions[1]);
- }
- }
- // TODO not clear why we need to hide all the columns (above) if we are
- // going to copy the hidden columns over wholesale anyway
av.getAlignment().setHiddenColumns(oldHidden);
}
av.sendSelection();
// --------------------------/
/**
- * Field _name.
+ * Single letter residue code for an alignment colour scheme, or feature type
+ * for a feature colour scheme
*/
private java.lang.String _name;
private java.lang.String _minRGB;
/**
- * loosely specified enumeration: NONE,ABOVE, or BELOW
+ * Field _noValueColour.
*/
- private java.lang.String _threshType;
+ private jalview.binding.types.NoValueColour _noValueColour = jalview.binding.types.NoValueColour
+ .valueOf("Min");
+
+ /**
+ * Field _threshType.
+ */
+ private jalview.binding.types.ColourThreshTypeType _threshType;
/**
* Field _threshold.
*/
private boolean _has_autoScale;
+ /**
+ * name of feature attribute to colour by, or attribute and sub-attribute
+ */
+ private java.util.Vector _attributeNameList;
+
// ----------------/
// - Constructors -/
// ----------------/
public Colour()
{
super();
+ setNoValueColour(jalview.binding.types.NoValueColour.valueOf("Min"));
+ this._attributeNameList = new java.util.Vector();
}
// -----------/
// -----------/
/**
- */
+ *
+ *
+ * @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.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public 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'.
}
/**
- * 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'.
*/
}
/**
+ * Returns the value of field 'noValueColour'.
+ *
+ * @return the value of field 'NoValueColour'.
+ */
+ public jalview.binding.types.NoValueColour getNoValueColour()
+ {
+ return this._noValueColour;
+ }
+
+ /**
* Returns the value of field 'RGB'.
*
* @return the value of field 'RGB'.
}
/**
- * 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;
}
}
/**
+ */
+ 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
}
/**
- * 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'.
}
/**
+ * Sets the value of field 'noValueColour'.
+ *
+ * @param noValueColour
+ * the value of field 'noValueColour'.
+ */
+ public void setNoValueColour(
+ final jalview.binding.types.NoValueColour noValueColour)
+ {
+ this._noValueColour = noValueColour;
+ }
+
+ /**
* Sets the value of field 'RGB'.
*
* @param RGB
}
/**
- * 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;
}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class CompoundMatcher.
+ *
+ * @version $Revision$ $Date$
+ */
+public class CompoundMatcher implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * If true, matchers are AND-ed, if false they are OR-ed
+ */
+ private boolean _and;
+
+ /**
+ * keeps track of state for field: _and
+ */
+ private boolean _has_and;
+
+ /**
+ * Field _matcherSetList.
+ */
+ private java.util.Vector _matcherSetList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public CompoundMatcher()
+ {
+ super();
+ this._matcherSetList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vMatcherSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMatcherSet(final jalview.binding.MatcherSet vMatcherSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check for the maximum size
+ if (this._matcherSetList.size() >= 2)
+ {
+ throw new IndexOutOfBoundsException(
+ "addMatcherSet has a maximum of 2");
+ }
+
+ this._matcherSetList.addElement(vMatcherSet);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMatcherSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMatcherSet(final int index,
+ final jalview.binding.MatcherSet vMatcherSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check for the maximum size
+ if (this._matcherSetList.size() >= 2)
+ {
+ throw new IndexOutOfBoundsException(
+ "addMatcherSet has a maximum of 2");
+ }
+
+ this._matcherSetList.add(index, vMatcherSet);
+ }
+
+ /**
+ */
+ public void deleteAnd()
+ {
+ this._has_and = false;
+ }
+
+ /**
+ * Method enumerateMatcherSet.
+ *
+ * @return an Enumeration over all jalview.binding.MatcherSet elements
+ */
+ public java.util.Enumeration enumerateMatcherSet()
+ {
+ return this._matcherSetList.elements();
+ }
+
+ /**
+ * Returns the value of field 'and'. The field 'and' has the following
+ * description: If true, matchers are AND-ed, if false they are OR-ed
+ *
+ * @return the value of field 'And'.
+ */
+ public boolean getAnd()
+ {
+ return this._and;
+ }
+
+ /**
+ * Method getMatcherSet.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.binding.MatcherSet at the given index
+ */
+ public jalview.binding.MatcherSet getMatcherSet(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._matcherSetList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "getMatcherSet: Index value '" + index + "' not in range [0.."
+ + (this._matcherSetList.size() - 1) + "]");
+ }
+
+ return (jalview.binding.MatcherSet) _matcherSetList.get(index);
+ }
+
+ /**
+ * Method getMatcherSet.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.binding.MatcherSet[] getMatcherSet()
+ {
+ jalview.binding.MatcherSet[] array = new jalview.binding.MatcherSet[0];
+ return (jalview.binding.MatcherSet[]) this._matcherSetList
+ .toArray(array);
+ }
+
+ /**
+ * Method getMatcherSetCount.
+ *
+ * @return the size of this collection
+ */
+ public int getMatcherSetCount()
+ {
+ return this._matcherSetList.size();
+ }
+
+ /**
+ * Method hasAnd.
+ *
+ * @return true if at least one And has been added
+ */
+ public boolean hasAnd()
+ {
+ return this._has_and;
+ }
+
+ /**
+ * Returns the value of field 'and'. The field 'and' has the following
+ * description: If true, matchers are AND-ed, if false they are OR-ed
+ *
+ * @return the value of field 'And'.
+ */
+ public boolean isAnd()
+ {
+ return this._and;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllMatcherSet()
+ {
+ this._matcherSetList.clear();
+ }
+
+ /**
+ * Method removeMatcherSet.
+ *
+ * @param vMatcherSet
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeMatcherSet(
+ final jalview.binding.MatcherSet vMatcherSet)
+ {
+ boolean removed = _matcherSetList.remove(vMatcherSet);
+ return removed;
+ }
+
+ /**
+ * Method removeMatcherSetAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.binding.MatcherSet removeMatcherSetAt(final int index)
+ {
+ java.lang.Object obj = this._matcherSetList.remove(index);
+ return (jalview.binding.MatcherSet) obj;
+ }
+
+ /**
+ * Sets the value of field 'and'. The field 'and' has the following
+ * description: If true, matchers are AND-ed, if false they are OR-ed
+ *
+ * @param and
+ * the value of field 'and'.
+ */
+ public void setAnd(final boolean and)
+ {
+ this._and = and;
+ this._has_and = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMatcherSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setMatcherSet(final int index,
+ final jalview.binding.MatcherSet vMatcherSet)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._matcherSetList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "setMatcherSet: Index value '" + index + "' not in range [0.."
+ + (this._matcherSetList.size() - 1) + "]");
+ }
+
+ this._matcherSetList.set(index, vMatcherSet);
+ }
+
+ /**
+ *
+ *
+ * @param vMatcherSetArray
+ */
+ public void setMatcherSet(
+ final jalview.binding.MatcherSet[] vMatcherSetArray)
+ {
+ // -- copy array
+ _matcherSetList.clear();
+
+ for (int i = 0; i < vMatcherSetArray.length; i++)
+ {
+ this._matcherSetList.add(vMatcherSetArray[i]);
+ }
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.binding.CompoundMatcher
+ */
+ public static jalview.binding.CompoundMatcher unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.binding.CompoundMatcher) Unmarshaller
+ .unmarshal(jalview.binding.CompoundMatcher.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class 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.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public 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);
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * 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);
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class 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);
+ }
+
+}
*/
private java.util.Vector _colourList;
+ /**
+ * Field _filterList.
+ */
+ private java.util.Vector _filterList;
+
// ----------------/
// - Constructors -/
// ----------------/
{
super();
this._colourList = new java.util.Vector();
+ this._filterList = new java.util.Vector();
}
// -----------/
}
/**
+ *
+ *
+ * @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
}
/**
+ * Method enumerateFilter.
+ *
+ * @return an Enumeration over all Filter elements
+ */
+ public java.util.Enumeration enumerateFilter()
+ {
+ return this._filterList.elements();
+ }
+
+ /**
* Method getColour.
*
* @param index
}
/**
+ * 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.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public 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'.
}
/**
- */
+ */
public void removeAllColour()
{
this._colourList.clear();
}
/**
+ */
+ public void removeAllFilter()
+ {
+ this._filterList.clear();
+ }
+
+ /**
* Method removeColour.
*
* @param vColour
}
/**
+ * 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
}
/**
+ *
+ *
+ * @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
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class 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);
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class 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);
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding.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;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding.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;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.binding.types;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import java.util.Hashtable;
+
+/**
+ * Graduated feature colour if no score (or attribute) value
+ *
+ * @version $Revision$ $Date$
+ */
+public class NoValueColour 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 NoValueColour NONE = new NoValueColour(NONE_TYPE,
+ "None");
+
+ /**
+ * The Min type
+ */
+ public static final int MIN_TYPE = 1;
+
+ /**
+ * The instance of the Min type
+ */
+ public static final NoValueColour MIN = new NoValueColour(MIN_TYPE,
+ "Min");
+
+ /**
+ * The Max type
+ */
+ public static final int MAX_TYPE = 2;
+
+ /**
+ * The instance of the Max type
+ */
+ public static final NoValueColour MAX = new NoValueColour(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 NoValueColour(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
+ * NoValueColour
+ *
+ * @return an Enumeration over all possible instances of NoValueColour
+ */
+ public static java.util.Enumeration enumerate()
+ {
+ return _memberTable.elements();
+ }
+
+ /**
+ * Method getType.Returns the type of this NoValueColour
+ *
+ * @return the type of this NoValueColour
+ */
+ 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 NoValueColour
+ *
+ * @return the String representation of this NoValueColour
+ */
+ public java.lang.String toString()
+ {
+ return this.stringValue;
+ }
+
+ /**
+ * Method valueOf.Returns a new NoValueColour based on the given String value.
+ *
+ * @param string
+ * @return the NoValueColour value of parameter 'string'
+ */
+ public static jalview.binding.types.NoValueColour 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 NoValueColour";
+ throw new IllegalArgumentException(err);
+ }
+ return (NoValueColour) obj;
+ }
+
+}
public boolean parseFeaturesFile(String file, DataSourceType protocol,
boolean relaxedIdMatching)
{
- boolean featuresFile = false;
+ boolean featuresAdded = false;
+ FeatureRenderer fr = alignPanel.getFeatureRenderer();
try
{
- featuresFile = new FeaturesFile(false, file, protocol).parse(
- viewport.getAlignment().getDataset(),
- alignPanel.getFeatureRenderer().getFeatureColours(), false,
- relaxedIdMatching);
+ featuresAdded = new FeaturesFile(false, file, protocol).parse(
+ viewport.getAlignment().getDataset(), fr.getFeatureColours(),
+ fr.getFeatureFilters(), false, relaxedIdMatching);
} catch (Exception ex)
{
ex.printStackTrace();
}
- if (featuresFile)
+ if (featuresAdded)
{
avcg.refreshFeatureUI(true);
- if (alignPanel.getFeatureRenderer() != null)
+ if (fr != null)
{
// update the min/max ranges where necessary
- alignPanel.getFeatureRenderer().findAllFeatures(true);
+ fr.findAllFeatures(true);
}
if (avcg.getFeatureSettingsUI() != null)
{
alignPanel.paintAlignment(true, true);
}
- return featuresFile;
+ return featuresAdded;
}
*/
public class FeatureMatcher implements FeatureMatcherI
{
+ private static final String SCORE = "Score";
+
+ private static final String LABEL = "Label";
+
+ private static final String SPACE = " ";
+
+ private static final String QUOTE = "'";
+
/*
* a dummy matcher that comes in useful for the 'add a filter' gui row
*/
final private MatcherI matcher;
/**
+ * A helper method that converts a 'compound' attribute name from its display
+ * form, e.g. CSQ:PolyPhen to array form, e.g. { "CSQ", "PolyPhen" }
+ *
+ * @param attribute
+ * @return
+ */
+ public static String[] fromAttributeDisplayName(String attribute)
+ {
+ return attribute == null ? null : attribute.split(COLON);
+ }
+
+ /**
+ * A helper method that converts a 'compound' attribute name to its display
+ * form, e.g. CSQ:PolyPhen from its array form, e.g. { "CSQ", "PolyPhen" }
+ *
+ * @param attName
+ * @return
+ */
+ public static String toAttributeDisplayName(String[] attName)
+ {
+ return attName == null ? "" : String.join(COLON, attName);
+ }
+
+ /**
+ * A factory constructor that converts a stringified object (as output by
+ * toStableString) to an object instance. Returns null if parsing fails.
+ * <p>
+ * Leniency in parsing (for manually created feature files):
+ * <ul>
+ * <li>keywords Score and Label, and the condition, are not
+ * case-sensitive</li>
+ * <li>quotes around value and pattern are optional if string does not include
+ * a space</li>
+ * </ul>
+ *
+ * @param descriptor
+ * @return
+ */
+ public static FeatureMatcher fromString(final String descriptor)
+ {
+ String invalidFormat = "Invalid matcher format: " + descriptor;
+
+ /*
+ * expect
+ * value condition pattern
+ * where value is Label or Space or attributeName or attName1:attName2
+ * and pattern is a float value as string, or a text string
+ * attribute names or patterns may be quoted (must be if include space)
+ */
+ String attName = null;
+ boolean byScore = false;
+ boolean byLabel = false;
+ Condition cond = null;
+ String pattern = null;
+
+ /*
+ * parse first field (Label / Score / attribute)
+ * optionally in quotes (required if attName includes space)
+ */
+ String leftToParse = descriptor;
+ String firstField = null;
+
+ if (descriptor.startsWith(QUOTE))
+ {
+ // 'Label' / 'Score' / 'attName'
+ int nextQuotePos = descriptor.indexOf(QUOTE, 1);
+ if (nextQuotePos == -1)
+ {
+ System.err.println(invalidFormat);
+ return null;
+ }
+ firstField = descriptor.substring(1, nextQuotePos);
+ leftToParse = descriptor.substring(nextQuotePos + 1).trim();
+ }
+ else
+ {
+ // Label / Score / attName (unquoted)
+ int nextSpacePos = descriptor.indexOf(SPACE);
+ if (nextSpacePos == -1)
+ {
+ System.err.println(invalidFormat);
+ return null;
+ }
+ firstField = descriptor.substring(0, nextSpacePos);
+ leftToParse = descriptor.substring(nextSpacePos + 1).trim();
+ }
+ String lower = firstField.toLowerCase();
+ if (lower.startsWith(LABEL.toLowerCase()))
+ {
+ byLabel = true;
+ }
+ else if (lower.startsWith(SCORE.toLowerCase()))
+ {
+ byScore = true;
+ }
+ else
+ {
+ attName = firstField;
+ }
+
+ /*
+ * next field is the comparison condition
+ * most conditions require a following pattern (optionally quoted)
+ * although some conditions e.g. Present do not
+ */
+ int nextSpacePos = leftToParse.indexOf(SPACE);
+ if (nextSpacePos == -1)
+ {
+ /*
+ * no value following condition - only valid for some conditions
+ */
+ cond = Condition.fromString(leftToParse);
+ if (cond == null || cond.needsAPattern())
+ {
+ System.err.println(invalidFormat);
+ return null;
+ }
+ }
+ else
+ {
+ /*
+ * condition and pattern
+ */
+ cond = Condition.fromString(leftToParse.substring(0, nextSpacePos));
+ leftToParse = leftToParse.substring(nextSpacePos + 1).trim();
+ if (leftToParse.startsWith(QUOTE))
+ {
+ // pattern in quotes
+ if (leftToParse.endsWith(QUOTE))
+ {
+ pattern = leftToParse.substring(1, leftToParse.length() - 1);
+ }
+ else
+ {
+ // unbalanced quote
+ System.err.println(invalidFormat);
+ return null;
+ }
+ }
+ else
+ {
+ // unquoted pattern
+ pattern = leftToParse;
+ }
+ }
+
+ /*
+ * we have parsed out value, condition and pattern
+ * so can now make the FeatureMatcher
+ */
+ try
+ {
+ if (byLabel)
+ {
+ return FeatureMatcher.byLabel(cond, pattern);
+ }
+ else if (byScore)
+ {
+ return FeatureMatcher.byScore(cond, pattern);
+ }
+ else
+ {
+ String[] attNames = FeatureMatcher
+ .fromAttributeDisplayName(attName);
+ return FeatureMatcher.byAttribute(cond, pattern, attNames);
+ }
+ } catch (NumberFormatException e)
+ {
+ // numeric condition with non-numeric pattern
+ return null;
+ }
+ }
+
+ /**
* A factory constructor method for a matcher that applies its match condition
* to the feature label (description)
*
* @param cond
* @param pattern
* @return
+ * @throws NumberFormatException
+ * if an invalid numeric pattern is supplied
*/
public static FeatureMatcher byLabel(Condition cond, String pattern)
{
* @param cond
* @param pattern
* @return
+ * @throws NumberFormatException
+ * if an invalid numeric pattern is supplied
*/
public static FeatureMatcher byScore(Condition cond, String pattern)
{
* @param pattern
* @param attName
* @return
+ * @throws NumberFormatException
+ * if an invalid numeric pattern is supplied
*/
public static FeatureMatcher byAttribute(Condition cond, String pattern,
String... attName)
}
Condition condition = matcher.getCondition();
- sb.append(" ").append(condition.toString().toLowerCase());
+ sb.append(SPACE).append(condition.toString().toLowerCase());
if (condition.isNumeric())
{
- sb.append(" ").append(matcher.getPattern());
+ sb.append(SPACE).append(matcher.getPattern());
}
else if (condition.needsAPattern())
{
- sb.append(" '").append(matcher.getPattern()).append("'");
+ sb.append(" '").append(matcher.getPattern()).append(QUOTE);
}
return sb.toString();
{
return byScore;
}
+
+ @Override
+ public boolean isByAttribute()
+ {
+ return getAttribute() != null;
+ }
+
+ /**
+ * {@inheritDoc} The output of this method should be parseable by method
+ * <code>fromString<code> to restore the original object.
+ */
+ @Override
+ public String toStableString()
+ {
+ StringBuilder sb = new StringBuilder();
+ if (byLabel)
+ {
+ sb.append(LABEL); // no i18n here unlike toString() !
+ }
+ else if (byScore)
+ {
+ sb.append(SCORE);
+ }
+ else
+ {
+ /*
+ * enclose attribute name in quotes if it includes space
+ */
+ String displayName = toAttributeDisplayName(key);
+ if (displayName.contains(SPACE))
+ {
+ sb.append(QUOTE).append(displayName).append(QUOTE);
+ }
+ else
+ {
+ sb.append(displayName);
+ }
+ }
+
+ Condition condition = matcher.getCondition();
+ sb.append(SPACE).append(condition.getStableName());
+ String pattern = matcher.getPattern();
+ if (condition.needsAPattern())
+ {
+ /*
+ * enclose pattern in quotes if it includes space
+ */
+ if (pattern.contains(SPACE))
+ {
+ sb.append(SPACE).append(QUOTE).append(pattern).append(QUOTE);
+ }
+ else
+ {
+ sb.append(SPACE).append(pattern);
+ }
+ }
+
+ return sb.toString();
+ }
}
boolean isByScore();
/**
+ * Answers true if match is against a feature attribute (text or range)
+ *
+ * @return
+ */
+ boolean isByAttribute();
+
+ /**
* Answers the match condition that is applied
*
* @return
*/
MatcherI getMatcher();
+
+ /**
+ * Answers a string representation of this object suitable for use when
+ * persisting data, in a format that can be reliably read back. Any changes to
+ * the format should be backwards compatible.
+ */
+ String toStableString();
}
import java.util.ArrayList;
import java.util.List;
+/**
+ * A class that models one or more match conditions, which may be combined with
+ * AND or OR (but not a mixture)
+ *
+ * @author gmcarstairs
+ */
public class FeatureMatcherSet implements FeatureMatcherSetI
{
+ private static final String OR = "OR";
+
+ private static final String AND = "AND";
+
+ private static final String SPACE = " ";
+
+ private static final String CLOSE_BRACKET = ")";
+
+ private static final String OPEN_BRACKET = "(";
+
private static final String OR_I18N = MessageManager
.getString("label.or");
boolean andConditions;
/**
+ * A factory constructor that converts a stringified object (as output by
+ * toStableString) to an object instance.
+ *
+ * Format:
+ * <ul>
+ * <li>(condition1) AND (condition2) AND (condition3)</li>
+ * <li>or</li>
+ * <li>(condition1) OR (condition2) OR (condition3)</li>
+ * </ul>
+ * where OR and AND are not case-sensitive, and may not be mixed. Brackets are
+ * optional if there is only one condition.
+ *
+ * @param descriptor
+ * @return
+ * @see FeatureMatcher#fromString(String)
+ */
+ public static FeatureMatcherSet fromString(final String descriptor)
+ {
+ String invalid = "Invalid descriptor: " + descriptor;
+ boolean firstCondition = true;
+ FeatureMatcherSet result = new FeatureMatcherSet();
+
+ String leftToParse = descriptor.trim();
+
+ while (leftToParse.length() > 0)
+ {
+ /*
+ * inspect AND or OR condition, check not mixed
+ */
+ boolean and = true;
+ if (!firstCondition)
+ {
+ int spacePos = leftToParse.indexOf(SPACE);
+ if (spacePos == -1)
+ {
+ // trailing junk after a match condition
+ System.err.println(invalid);
+ return null;
+ }
+ String conjunction = leftToParse.substring(0, spacePos);
+ leftToParse = leftToParse.substring(spacePos + 1).trim();
+ if (conjunction.equalsIgnoreCase(AND))
+ {
+ and = true;
+ }
+ else if (conjunction.equalsIgnoreCase(OR))
+ {
+ and = false;
+ }
+ else
+ {
+ // not an AND or an OR - invalid
+ System.err.println(invalid);
+ return null;
+ }
+ }
+
+ /*
+ * now extract the next condition and AND or OR it
+ */
+ String nextCondition = leftToParse;
+ if (leftToParse.startsWith(OPEN_BRACKET))
+ {
+ int closePos = leftToParse.indexOf(CLOSE_BRACKET);
+ if (closePos == -1)
+ {
+ System.err.println(invalid);
+ return null;
+ }
+ nextCondition = leftToParse.substring(1, closePos);
+ leftToParse = leftToParse.substring(closePos + 1).trim();
+ }
+ else
+ {
+ leftToParse = "";
+ }
+
+ FeatureMatcher fm = FeatureMatcher.fromString(nextCondition);
+ if (fm == null)
+ {
+ System.err.println(invalid);
+ return null;
+ }
+ try
+ {
+ if (and)
+ {
+ result.and(fm);
+ }
+ else
+ {
+ result.or(fm);
+ }
+ firstCondition = false;
+ } catch (IllegalStateException e)
+ {
+ // thrown if OR and AND are mixed
+ System.err.println(invalid);
+ return null;
+ }
+
+ }
+ return result;
+ }
+
+ /**
* Constructor
*/
public FeatureMatcherSet()
}
@Override
- public FeatureMatcherSetI and(FeatureMatcherI m)
+ public void and(FeatureMatcherI m)
{
if (!andConditions && matchConditions.size() > 1)
{
}
matchConditions.add(m);
andConditions = true;
-
- return this;
}
@Override
- public FeatureMatcherSetI or(FeatureMatcherI m)
+ public void or(FeatureMatcherI m)
{
if (andConditions && matchConditions.size() > 1)
{
}
matchConditions.add(m);
andConditions = false;
-
- return this;
}
@Override
return matchConditions;
}
+ /**
+ * Answers a string representation of this object suitable for display, and
+ * possibly internationalized. The format is not guaranteed stable and may
+ * change in future.
+ */
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
boolean first = true;
+ boolean multiple = matchConditions.size() > 1;
for (FeatureMatcherI matcher : matchConditions)
{
if (!first)
{
String joiner = andConditions ? AND_18N : OR_I18N;
- sb.append(" ").append(joiner.toLowerCase()).append(" ");
+ sb.append(SPACE).append(joiner.toLowerCase()).append(SPACE);
}
first = false;
- sb.append("(").append(matcher.toString()).append(")");
+ if (multiple)
+ {
+ sb.append(OPEN_BRACKET).append(matcher.toString())
+ .append(CLOSE_BRACKET);
+ }
+ else
+ {
+ sb.append(matcher.toString());
+ }
}
return sb.toString();
}
return matchConditions == null || matchConditions.isEmpty();
}
+ /**
+ * {@inheritDoc} The output of this method should be parseable by method
+ * <code>fromString<code> to restore the original object.
+ */
+ @Override
+ public String toStableString()
+ {
+ StringBuilder sb = new StringBuilder();
+ boolean moreThanOne = matchConditions.size() > 1;
+ boolean first = true;
+
+ for (FeatureMatcherI matcher : matchConditions)
+ {
+ if (!first)
+ {
+ String joiner = andConditions ? AND : OR;
+ sb.append(SPACE).append(joiner).append(SPACE);
+ }
+ first = false;
+ if (moreThanOne)
+ {
+ sb.append(OPEN_BRACKET).append(matcher.toStableString())
+ .append(CLOSE_BRACKET);
+ }
+ else
+ {
+ sb.append(matcher.toStableString());
+ }
+ }
+ return sb.toString();
+ }
+
}
boolean matches(SequenceFeature feature);
/**
- * Answers a new object that matches the logical AND of this and m
+ * Adds (ANDs) match condition m to this object's matcher set
*
* @param m
- * @return
* @throws IllegalStateException
* if an attempt is made to AND to existing OR-ed conditions
*/
- FeatureMatcherSetI and(FeatureMatcherI m);
+ void and(FeatureMatcherI m);
/**
* Answers true if any second condition is AND-ed with this one, false if it
boolean isAnded();
/**
- * Answers a new object that matches the logical OR of this and m
+ * Adds (ORs) the given condition to this object's match conditions
*
* @param m
- * @return
* @throws IllegalStateException
* if an attempt is made to OR to existing AND-ed conditions
*/
- FeatureMatcherSetI or(FeatureMatcherI m);
+ void or(FeatureMatcherI m);
/**
* Answers an iterator over the combined match conditions
* @return
*/
boolean isEmpty();
+
+ /**
+ * Answers a string representation of this object suitable for use when
+ * persisting data, in a format that can be reliably read back. Any changes to
+ * the format should be backwards compatible.
+ */
+ String toStableString();
}
@Override
public void exportFeatures_actionPerformed(ActionEvent e)
{
- new AnnotationExporter().exportFeatures(alignPanel);
+ new AnnotationExporter(alignPanel).exportFeatures();
}
@Override
public void exportAnnotations_actionPerformed(ActionEvent e)
{
- new AnnotationExporter().exportAnnotations(alignPanel);
+ new AnnotationExporter(alignPanel).exportAnnotations();
}
@Override
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
-import java.util.ArrayList;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
{
HiddenColumns oldHidden = av.getAnnotationColumnSelectionState()
.getOldHiddenColumns();
- if (oldHidden != null)
- {
- ArrayList<int[]> regions = oldHidden.getHiddenColumnsCopy();
- for (int[] positions : regions)
- {
- av.hideColumns(positions[0], positions[1]);
- }
- }
- // TODO not clear why we need to hide all the columns (above) if we are
- // going to copy the hidden columns over wholesale anyway
av.getAlignment().setHiddenColumns(oldHidden);
}
av.sendSelection();
package jalview.gui;
import jalview.api.FeatureColourI;
+import jalview.bin.Cache;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceI;
+import jalview.datamodel.features.FeatureMatcherSetI;
import jalview.io.AnnotationFile;
import jalview.io.FeaturesFile;
import jalview.io.JalviewFileChooser;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.io.FileWriter;
+import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
*/
public class AnnotationExporter extends JPanel
{
- JInternalFrame frame;
+ private JInternalFrame frame;
- AlignmentPanel ap;
+ private AlignmentPanel ap;
- boolean features = true;
+ /*
+ * true if exporting features, false if exporting annotations
+ */
+ private boolean exportFeatures = true;
private AlignmentAnnotation[] annotations;
private boolean wholeView;
- public AnnotationExporter()
+ public AnnotationExporter(AlignmentPanel panel)
{
+ this.ap = panel;
try
{
jbInit();
frame.getPreferredSize().height);
}
- public void exportFeatures(AlignmentPanel ap)
+ /**
+ * Configures the diglog for options to export visible features
+ */
+ public void exportFeatures()
{
- this.ap = ap;
- features = true;
+ exportFeatures = true;
CSVFormat.setVisible(false);
frame.setTitle(MessageManager.getString("label.export_features"));
}
- public void exportAnnotations(AlignmentPanel ap)
+ /**
+ * Configures the dialog for options to export all visible annotations
+ */
+ public void exportAnnotations()
{
- this.ap = ap;
- annotations = ap.av.isShowAnnotation() ? null
- : ap.av.getAlignment().getAlignmentAnnotation();
- wholeView = true;
- startExportAnnotation();
+ boolean showAnnotation = ap.av.isShowAnnotation();
+ exportAnnotation(showAnnotation ? null
+ : ap.av.getAlignment().getAlignmentAnnotation(), true);
}
- public void exportAnnotations(AlignmentPanel alp,
- AlignmentAnnotation[] toExport)
+ /**
+ * Configures the dialog for options to export the given annotation row
+ *
+ * @param toExport
+ */
+ public void exportAnnotation(AlignmentAnnotation toExport)
{
- ap = alp;
- annotations = toExport;
- wholeView = false;
- startExportAnnotation();
+ exportAnnotation(new AlignmentAnnotation[] { toExport }, false);
}
- private void startExportAnnotation()
+ private void exportAnnotation(AlignmentAnnotation[] toExport,
+ boolean forWholeView)
{
- features = false;
+ wholeView = forWholeView;
+ annotations = toExport;
+ exportFeatures = false;
GFFFormat.setVisible(false);
CSVFormat.setVisible(true);
frame.setTitle(MessageManager.getString("label.export_annotations"));
}
- public void toFile_actionPerformed(ActionEvent e)
+ private void toFile_actionPerformed()
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+ Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle(features
+ chooser.setDialogTitle(exportFeatures
? MessageManager.getString("label.save_features_to_file")
: MessageManager.getString("label.save_annotation_to_file"));
chooser.setToolTipText(MessageManager.getString("action.save"));
if (value == JalviewFileChooser.APPROVE_OPTION)
{
- String text = getFileContents();
+ String text = getText();
try
{
- java.io.PrintWriter out = new java.io.PrintWriter(
- new java.io.FileWriter(chooser.getSelectedFile()));
-
+ PrintWriter out = new PrintWriter(
+ new FileWriter(chooser.getSelectedFile()));
out.print(text);
out.close();
} catch (Exception ex)
}
}
- close_actionPerformed(null);
+ close_actionPerformed();
+ }
+
+ /**
+ * Answers the text to output for either Features (in GFF or Jalview format) or
+ * Annotations (in CSV or Jalview format)
+ *
+ * @return
+ */
+ private String getText()
+ {
+ return exportFeatures ? getFeaturesText() : getAnnotationsText();
}
- private String getFileContents()
+ /**
+ * Returns the text contents for output of annotations in either CSV or Jalview
+ * format
+ *
+ * @return
+ */
+ private String getAnnotationsText()
{
- String text = MessageManager
- .getString("label.no_features_on_alignment");
- if (features)
+ String text;
+ if (CSVFormat.isSelected())
{
- FeaturesFile formatter = new FeaturesFile();
- SequenceI[] sequences = ap.av.getAlignment().getSequencesArray();
- Map<String, FeatureColourI> featureColours = ap.getFeatureRenderer()
- .getDisplayedFeatureCols();
- List<String> featureGroups = ap.getFeatureRenderer()
- .getDisplayedFeatureGroups();
- boolean includeNonPositional = ap.av.isShowNPFeats();
- if (GFFFormat.isSelected())
- {
- text = formatter.printGffFormat(sequences, featureColours,
- featureGroups, includeNonPositional);
- }
- else
- {
- text = formatter.printJalviewFormat(sequences, featureColours,
- featureGroups, includeNonPositional);
- }
+ text = new AnnotationFile().printCSVAnnotations(annotations);
}
else
{
- if (CSVFormat.isSelected())
+ if (wholeView)
{
- text = new AnnotationFile().printCSVAnnotations(annotations);
+ text = new AnnotationFile().printAnnotationsForView(ap.av);
}
else
{
- if (wholeView)
- {
- text = new AnnotationFile().printAnnotationsForView(ap.av);
- }
- else
- {
- text = new AnnotationFile().printAnnotations(annotations, null,
- null);
- }
+ text = new AnnotationFile().printAnnotations(annotations, null,
+ null);
}
}
return text;
}
- public void toTextbox_actionPerformed(ActionEvent e)
+ /**
+ * Returns the text contents for output of features in either GFF or Jalview
+ * format
+ *
+ * @return
+ */
+ private String getFeaturesText()
+ {
+ String text;
+ SequenceI[] sequences = ap.av.getAlignment().getSequencesArray();
+ Map<String, FeatureColourI> featureColours = ap.getFeatureRenderer()
+ .getDisplayedFeatureCols();
+ Map<String, FeatureMatcherSetI> featureFilters = ap.getFeatureRenderer()
+ .getFeatureFilters();
+ List<String> featureGroups = ap.getFeatureRenderer()
+ .getDisplayedFeatureGroups();
+ boolean includeNonPositional = ap.av.isShowNPFeats();
+
+ FeaturesFile formatter = new FeaturesFile();
+ if (GFFFormat.isSelected())
+ {
+ text = formatter.printGffFormat(sequences, featureColours,
+ featureGroups, includeNonPositional);
+ }
+ else
+ {
+ text = formatter.printJalviewFormat(sequences, featureColours,
+ featureFilters, featureGroups, includeNonPositional);
+ }
+ return text;
+ }
+
+ private void toTextbox_actionPerformed()
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
try
{
- String text = getFileContents();
+ String text = getText();
cap.setText(text);
- Desktop.addInternalFrame(cap, (features ? MessageManager
+ Desktop.addInternalFrame(cap, (exportFeatures ? MessageManager
.formatMessage("label.features_for_params", new String[]
{ ap.alignFrame.getTitle() })
: MessageManager.formatMessage("label.annotations_for_params",
600, 500);
} catch (OutOfMemoryError oom)
{
- new OOMWarning((features ? MessageManager.formatMessage(
+ new OOMWarning((exportFeatures ? MessageManager.formatMessage(
"label.generating_features_for_params", new String[]
{ ap.alignFrame.getTitle() })
: MessageManager.formatMessage(
cap.dispose();
}
- close_actionPerformed(null);
+ close_actionPerformed();
}
- public void close_actionPerformed(ActionEvent e)
+ private void close_actionPerformed()
{
try
{
@Override
public void actionPerformed(ActionEvent e)
{
- toFile_actionPerformed(e);
+ toFile_actionPerformed();
}
});
toTextbox.setText(MessageManager.getString("label.to_textbox"));
@Override
public void actionPerformed(ActionEvent e)
{
- toTextbox_actionPerformed(e);
+ toTextbox_actionPerformed();
}
});
close.setText(MessageManager.getString("action.close"));
@Override
public void actionPerformed(ActionEvent e)
{
- close_actionPerformed(e);
+ close_actionPerformed();
}
});
jalviewFormat.setOpaque(false);
}
else if (evt.getActionCommand().equals(OUTPUT_TEXT))
{
- new AnnotationExporter().exportAnnotations(ap,
- new AlignmentAnnotation[]
- { aa[selectedRow] });
+ new AnnotationExporter(ap).exportAnnotation(aa[selectedRow]);
}
else if (evt.getActionCommand().equals(COPYCONS_SEQ))
{
import jalview.api.FeatureColourI;
import jalview.api.FeatureSettingsControllerI;
-import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
+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.Filter;
import jalview.schemabinding.version2.JalviewUserColours;
+import jalview.schemabinding.version2.MatcherSet;
import jalview.schemes.FeatureColour;
-import jalview.util.Format;
import jalview.util.MessageManager;
import jalview.util.Platform;
-import jalview.util.QuickSort;
import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean;
import jalview.ws.DasSequenceFeatureFetcher;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
public class FeatureSettings extends JPanel
implements FeatureSettingsControllerI
{
+ private static final String SEQUENCE_FEATURE_COLOURS = MessageManager
+ .getString("label.sequence_feature_colours");
+
/*
* column indices of fields in Feature Settings table
*/
int originalTransparencyAsPercent = (int) (originalTransparency * 100);
transparency.setMaximum(100 - originalTransparencyAsPercent);
- originalFilters = fr.getFeatureFilters();
+ originalFilters = new HashMap<>(fr.getFeatureFilters()); // shallow copy
try
{
}
}
+ /**
+ * 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",
- "Sequence Feature Colours");
+ SEQUENCE_FEATURE_COLOURS);
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(
MessageManager.getString("label.load_feature_colours"));
if (value == JalviewFileChooser.APPROVE_OPTION)
{
File file = chooser.getSelectedFile();
+ load(file);
+ }
+ }
- try
- {
- InputStreamReader in = new InputStreamReader(
- new FileInputStream(file), "UTF-8");
+ /**
+ * Loads feature colours and filters from XML stored in the given file
+ *
+ * @param file
+ */
+ void load(File file)
+ {
+ try
+ {
+ InputStreamReader in = new InputStreamReader(
+ new FileInputStream(file), "UTF-8");
- JalviewUserColours jucs = JalviewUserColours.unmarshal(in);
+ JalviewUserColours jucs = JalviewUserColours.unmarshal(in);
- 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));
+ /*
+ * load feature colours
+ */
+ for (int i = jucs.getColourCount() - 1; i >= 0; i--)
+ {
+ jalview.schemabinding.version2.Colour newcol = jucs.getColour(i);
+ FeatureColourI colour = Jalview2XML.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
- {
- Color color = new Color(
- Integer.parseInt(jucs.getColour(i).getRGB(), 16));
- fr.setColour(name = jucs.getColour(i).getName(),
- new FeatureColour(color));
- }
- fr.setOrder(name, (i == 0) ? 0 : i / jucs.getColourCount());
- }
- if (table != null)
+ /*
+ * 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);
+ String featureType = filterModel.getFeatureType();
+ FeatureMatcherSetI filter = Jalview2XML.unmarshalFilter(featureType,
+ filterModel.getMatcherSet());
+ if (!filter.isEmpty())
{
- resetTable(null);
- Object[][] data = ((FeatureTableModel) table.getModel())
- .getData();
- ensureOrder(data);
- updateFeatureRenderer(data, false);
- table.repaint();
+ fr.setFeatureFilter(featureType, filter);
}
- } catch (Exception ex)
+ }
+
+ /*
+ * update feature settings table
+ */
+ if (table != null)
{
- System.out.println("Error loading User Colour File\n" + ex);
+ resetTable(null);
+ Object[][] data = ((FeatureTableModel) table.getModel())
+ .getData();
+ ensureOrder(data);
+ updateFeatureRenderer(data, false);
+ table.repaint();
}
+ } catch (Exception ex)
+ {
+ System.out.println("Error loading User Colour File\n" + ex);
}
}
+ /**
+ * 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",
- "Sequence Feature Colours");
+ SEQUENCE_FEATURE_COLOURS);
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(
MessageManager.getString("label.save_feature_colours"));
if (value == JalviewFileChooser.APPROVE_OPTION)
{
- String choice = chooser.getSelectedFile().getPath();
- jalview.schemabinding.version2.JalviewUserColours ucs = new jalview.schemabinding.version2.JalviewUserColours();
- ucs.setSchemeName("Sequence Features");
- try
- {
- PrintWriter out = new PrintWriter(new OutputStreamWriter(
- new FileOutputStream(choice), "UTF-8"));
+ save(chooser.getSelectedFile());
+ }
+ }
+
+ /**
+ * Saves feature colours and filters to the given file
+ *
+ * @param file
+ */
+ void save(File file)
+ {
+ JalviewUserColours ucs = new JalviewUserColours();
+ ucs.setSchemeName("Sequence Features");
+ try
+ {
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(
+ new FileOutputStream(file), "UTF-8"));
- Set<String> fr_colours = fr.getAllFeatureColours();
- Iterator<String> e = fr_colours.iterator();
- float[] sortOrder = new float[fr_colours.size()];
- String[] sortTypes = new String[fr_colours.size()];
- int i = 0;
- while (e.hasNext())
+ /*
+ * sort feature types by colour order, from 0 (highest)
+ * to 1 (lowest)
+ */
+ Set<String> fr_colours = fr.getAllFeatureColours();
+ String[] sortedTypes = fr_colours
+ .toArray(new String[fr_colours.size()]);
+ Arrays.sort(sortedTypes, new Comparator<String>()
+ {
+ @Override
+ public int compare(String type1, String type2)
{
- sortTypes[i] = e.next();
- sortOrder[i] = fr.getOrder(sortTypes[i]);
- i++;
+ return Float.compare(fr.getOrder(type1), fr.getOrder(type2));
}
- QuickSort.sort(sortOrder, sortTypes);
- sortOrder = null;
- for (i = 0; i < sortTypes.length; i++)
+ });
+
+ /*
+ * save feature colours
+ */
+ for (String featureType : sortedTypes)
+ {
+ FeatureColourI fcol = fr.getFeatureStyle(featureType);
+ jalview.schemabinding.version2.Colour col = Jalview2XML.marshalColour(
+ featureType, fcol);
+ ucs.addColour(col);
+ }
+
+ /*
+ * save any feature filters
+ */
+ for (String featureType : sortedTypes)
+ {
+ FeatureMatcherSetI filter = fr.getFeatureFilter(featureType);
+ if (filter != null && !filter.isEmpty())
{
- jalview.schemabinding.version2.Colour col = new jalview.schemabinding.version2.Colour();
- col.setName(sortTypes[i]);
- FeatureColourI fcol = fr.getFeatureStyle(sortTypes[i]);
- 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() ? "ABOVE"
- : (fcol.isBelowThreshold() ? "BELOW" : "NONE"));
- }
- ucs.addColour(col);
+ Iterator<FeatureMatcherI> iterator = filter.getMatchers().iterator();
+ FeatureMatcherI firstMatcher = iterator.next();
+ MatcherSet ms = Jalview2XML.marshalFilter(firstMatcher, iterator,
+ filter.isAnded());
+ Filter filterModel = new Filter();
+ filterModel.setFeatureType(featureType);
+ filterModel.setMatcherSet(ms);
+ ucs.addFilter(filterModel);
}
- ucs.marshal(out);
- out.close();
- } catch (Exception ex)
- {
- ex.printStackTrace();
}
+
+ ucs.marshal(out);
+ out.close();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
}
}
JButton loadColours = new JButton(
MessageManager.getString("label.load_colours"));
loadColours.setFont(JvSwingUtils.getLabelFont());
+ loadColours.setToolTipText(
+ MessageManager.getString("label.load_colours_tooltip"));
loadColours.addActionListener(new ActionListener()
{
@Override
JButton saveColours = new JButton(
MessageManager.getString("label.save_colours"));
saveColours.setFont(JvSwingUtils.getLabelFont());
+ saveColours.setToolTipText(
+ MessageManager.getString("label.save_colours_tooltip"));
saveColours.addActionListener(new ActionListener()
{
@Override
if (fc.isColourByAttribute())
{
String[] attributeName = fc.getAttributeName();
- colourByTextCombo
- .setSelectedItem(toAttributeDisplayName(attributeName));
+ colourByTextCombo.setSelectedItem(
+ FeatureMatcher.toAttributeDisplayName(attributeName));
}
else
{
* Graduated colour, by score or attribute value range
*/
graduatedColour.setSelected(true);
+ updateColourMinMax(); // ensure min, max are set
colourByRangeCombo.setEnabled(colourByRangeCombo.getItemCount() > 1);
minColour.setEnabled(true);
maxColour.setEnabled(true);
if (fc.isColourByAttribute())
{
String[] attributeName = fc.getAttributeName();
- colourByRangeCombo
- .setSelectedItem(toAttributeDisplayName(attributeName));
+ colourByRangeCombo.setSelectedItem(
+ FeatureMatcher.toAttributeDisplayName(attributeName));
}
else
{
{
// colour by attribute range
minMax = FeatureAttributes.getInstance().getMinMax(featureType,
- fromAttributeDisplayName(attName));
+ FeatureMatcher.fromAttributeDisplayName(attName));
}
return minMax;
}
String byWhat = (String) colourByTextCombo.getSelectedItem();
if (!LABEL_18N.equals(byWhat))
{
- fc.setAttributeName(fromAttributeDisplayName(byWhat));
+ fc.setAttributeName(
+ FeatureMatcher.fromAttributeDisplayName(byWhat));
}
return fc;
}
String byWhat = (String) colourByRangeCombo.getSelectedItem();
if (!SCORE_18N.equals(byWhat))
{
- fc.setAttributeName(fromAttributeDisplayName(byWhat));
+ fc.setAttributeName(FeatureMatcher.fromAttributeDisplayName(byWhat));
}
/*
return fc;
}
- /**
- * A helper method that converts a 'compound' attribute name from its display
- * form, e.g. CSQ:PolyPhen to array form, e.g. { "CSQ", "PolyPhen" }
- *
- * @param attribute
- * @return
- */
- private String[] fromAttributeDisplayName(String attribute)
- {
- return attribute == null ? null : attribute.split(COLON);
- }
-
- /**
- * A helper method that converts a 'compound' attribute name to its display
- * form, e.g. CSQ:PolyPhen from its array form, e.g. { "CSQ", "PolyPhen" }
- *
- * @param attName
- * @return
- */
- private String toAttributeDisplayName(String[] attName)
- {
- return attName == null ? "" : String.join(COLON, attName);
- }
-
@Override
protected void raiseClosed()
{
{
continue;
}
- displayAtts.add(toAttributeDisplayName(attName));
+ displayAtts.add(FeatureMatcher.toAttributeDisplayName(attName));
String desc = fa.getDescription(featureType, attName);
if (desc != null && desc.length() > MAX_TOOLTIP_LENGTH)
{
}
else
{
- attCombo.setSelectedItem(toAttributeDisplayName(attName));
+ attCombo.setSelectedItem(
+ FeatureMatcher.toAttributeDisplayName(attName));
}
attCombo.addItemListener(new ItemListener()
{
}
else
{
- item = toAttributeDisplayName(filter.getAttribute());
+ item = FeatureMatcher.toAttributeDisplayName(filter.getAttribute());
}
attCombo.setSelectedItem(item);
return item;
JComboBox<Condition> condCombo, JTextField patternField)
{
Datatype type = FeatureAttributes.getInstance().getDatatype(featureType,
- fromAttributeDisplayName(attName));
+ FeatureMatcher.fromAttributeDisplayName(attName));
if (LABEL_18N.equals(attName))
{
type = Datatype.Character;
else
{
km = FeatureMatcher.byAttribute(cond, pattern,
- fromAttributeDisplayName(attName));
+ FeatureMatcher.fromAttributeDisplayName(attName));
}
filters.set(filterIndex, km);
import jalview.datamodel.SequenceI;
import jalview.datamodel.StructureViewerModel;
import jalview.datamodel.StructureViewerModel.StructureData;
+import jalview.datamodel.features.FeatureMatcher;
+import jalview.datamodel.features.FeatureMatcherI;
+import jalview.datamodel.features.FeatureMatcherSet;
+import jalview.datamodel.features.FeatureMatcherSetI;
import jalview.ext.varna.RnaModel;
import jalview.gui.StructureViewer.ViewerType;
import jalview.io.DataSourceType;
import jalview.schemabinding.version2.AnnotationColours;
import jalview.schemabinding.version2.AnnotationElement;
import jalview.schemabinding.version2.CalcIdParam;
+import jalview.schemabinding.version2.Colour;
+import jalview.schemabinding.version2.CompoundMatcher;
import jalview.schemabinding.version2.DBRef;
import jalview.schemabinding.version2.Features;
import jalview.schemabinding.version2.Group;
import jalview.schemabinding.version2.MapListTo;
import jalview.schemabinding.version2.Mapping;
import jalview.schemabinding.version2.MappingChoice;
+import jalview.schemabinding.version2.MatchCondition;
+import jalview.schemabinding.version2.MatcherSet;
import jalview.schemabinding.version2.OtherData;
import jalview.schemabinding.version2.PdbentryItem;
import jalview.schemabinding.version2.Pdbids;
import jalview.schemabinding.version2.Tree;
import jalview.schemabinding.version2.UserColours;
import jalview.schemabinding.version2.Viewport;
+import jalview.schemabinding.version2.types.ColourThreshTypeType;
+import jalview.schemabinding.version2.types.FeatureMatcherByType;
+import jalview.schemabinding.version2.types.NoValueColour;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
import jalview.schemes.UserColourScheme;
import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
+import jalview.util.Format;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.StringUtils;
import jalview.util.jarInputStreamProvider;
+import jalview.util.matcher.Condition;
import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.ViewportRanges;
import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
}
if (sf.otherDetails != null)
{
- String key;
- Iterator<String> keys = sf.otherDetails.keySet().iterator();
- while (keys.hasNext())
+ /*
+ * save feature attributes, which may be simple strings or
+ * map valued (have sub-attributes)
+ */
+ for (Entry<String, Object> entry : sf.otherDetails.entrySet())
{
- key = keys.next();
- OtherData keyValue = new OtherData();
- keyValue.setKey(key);
- keyValue.setValue(sf.otherDetails.get(key).toString());
- features.addOtherData(keyValue);
+ String key = entry.getKey();
+ Object value = entry.getValue();
+ if (value instanceof Map<?, ?>)
+ {
+ for (Entry<String, Object> subAttribute : ((Map<String, Object>) value)
+ .entrySet())
+ {
+ OtherData otherData = new OtherData();
+ otherData.setKey(key);
+ otherData.setKey2(subAttribute.getKey());
+ otherData.setValue(subAttribute.getValue().toString());
+ features.addOtherData(otherData);
+ }
+ }
+ else
+ {
+ OtherData otherData = new OtherData();
+ otherData.setKey(key);
+ otherData.setValue(value.toString());
+ features.addOtherData(otherData);
+ }
}
}
{
jalview.schemabinding.version2.FeatureSettings fs = new jalview.schemabinding.version2.FeatureSettings();
- String[] renderOrder = ap.getSeqPanel().seqCanvas
- .getFeatureRenderer().getRenderOrder()
- .toArray(new String[0]);
+ FeatureRenderer fr = ap.getSeqPanel().seqCanvas
+ .getFeatureRenderer();
+ String[] renderOrder = fr.getRenderOrder().toArray(new String[0]);
Vector<String> settingsAdded = new Vector<>();
if (renderOrder != null)
{
for (String featureType : renderOrder)
{
- FeatureColourI fcol = ap.getSeqPanel().seqCanvas
- .getFeatureRenderer().getFeatureStyle(featureType);
Setting setting = new Setting();
setting.setType(featureType);
+
+ /*
+ * save any filter for the feature type
+ */
+ FeatureMatcherSetI filter = fr.getFeatureFilter(featureType);
+ if (filter != null) {
+ Iterator<FeatureMatcherI> filters = filter.getMatchers().iterator();
+ FeatureMatcherI firstFilter = filters.next();
+ setting.setMatcherSet(Jalview2XML.marshalFilter(
+ firstFilter, filters, filter.isAnded()));
+ }
+
+ /*
+ * save colour scheme for the feature type
+ */
+ FeatureColourI fcol = fr.getFeatureStyle(featureType);
if (!fcol.isSimpleColour())
{
setting.setColour(fcol.getMaxColour().getRGB());
setting.setMin(fcol.getMin());
setting.setMax(fcol.getMax());
setting.setColourByLabel(fcol.isColourByLabel());
+ if (fcol.isColourByAttribute())
+ {
+ setting.setAttributeName(fcol.getAttributeName());
+ }
setting.setAutoScale(fcol.isAutoScaled());
setting.setThreshold(fcol.getThreshold());
+ Color noColour = fcol.getNoColour();
+ if (noColour == null)
+ {
+ setting.setNoValueColour(NoValueColour.NONE);
+ }
+ else if (noColour.equals(fcol.getMaxColour()))
+ {
+ setting.setNoValueColour(NoValueColour.MAX);
+ }
+ else
+ {
+ setting.setNoValueColour(NoValueColour.MIN);
+ }
// -1 = No threshold, 0 = Below, 1 = Above
setting.setThreshstate(fcol.isAboveThreshold() ? 1
: (fcol.isBelowThreshold() ? 0 : -1));
setting.setDisplay(
av.getFeaturesDisplayed().isVisible(featureType));
- float rorder = ap.getSeqPanel().seqCanvas.getFeatureRenderer()
+ float rorder = fr
.getOrder(featureType);
if (rorder > -1)
{
}
// is groups actually supposed to be a map here ?
- Iterator<String> en = ap.getSeqPanel().seqCanvas
- .getFeatureRenderer().getFeatureGroups().iterator();
+ Iterator<String> en = fr.getFeatureGroups().iterator();
Vector<String> groupsAdded = new Vector<>();
while (en.hasNext())
{
}
Group g = new Group();
g.setName(grp);
- g.setDisplay(((Boolean) ap.getSeqPanel().seqCanvas
- .getFeatureRenderer().checkGroupVisibility(grp, false))
+ g.setDisplay(((Boolean) fr.checkGroupVisibility(grp, false))
.booleanValue());
fs.addGroup(g);
groupsAdded.addElement(grp);
features[f].getEnd(), features[f].getScore(),
features[f].getFeatureGroup());
sf.setStatus(features[f].getStatus());
+
+ /*
+ * load any feature attributes - include map-valued attributes
+ */
+ Map<String, Map<String, String>> mapAttributes = new HashMap<>();
for (int od = 0; od < features[f].getOtherDataCount(); od++)
{
OtherData keyValue = features[f].getOtherData(od);
- if (keyValue.getKey().startsWith("LINK"))
+ String attributeName = keyValue.getKey();
+ String attributeValue = keyValue.getValue();
+ if (attributeName.startsWith("LINK"))
{
- sf.addLink(keyValue.getValue());
+ sf.addLink(attributeValue);
}
else
{
- sf.setValue(keyValue.getKey(), keyValue.getValue());
+ String subAttribute = keyValue.getKey2();
+ if (subAttribute == null)
+ {
+ // simple string-valued attribute
+ sf.setValue(attributeName, attributeValue);
+ }
+ else
+ {
+ // attribute 'key' has sub-attribute 'key2'
+ if (!mapAttributes.containsKey(attributeName))
+ {
+ mapAttributes.put(attributeName, new HashMap<>());
+ }
+ mapAttributes.get(attributeName).put(subAttribute,
+ attributeValue);
+ }
}
-
}
+ for (Entry<String, Map<String, String>> mapAttribute : mapAttributes
+ .entrySet())
+ {
+ sf.setValue(mapAttribute.getKey(), mapAttribute.getValue());
+ }
+
// adds feature to datasequence's feature set (since Jalview 2.10)
al.getSequenceAt(i).addSequenceFeature(sf);
}
af.viewport.setShowGroupConservation(false);
}
- // recover featre settings
+ // recover feature settings
if (jms.getFeatureSettings() != null)
{
+ FeatureRenderer fr = af.alignPanel.getSeqPanel().seqCanvas
+ .getFeatureRenderer();
FeaturesDisplayed fdi;
af.viewport.setFeaturesDisplayed(fdi = new FeaturesDisplayed());
String[] renderOrder = new String[jms.getFeatureSettings()
.getSettingCount(); fs++)
{
Setting setting = jms.getFeatureSettings().getSetting(fs);
+ String featureType = setting.getType();
+
+ /*
+ * restore feature filters (if any)
+ */
+ MatcherSet filters = setting.getMatcherSet();
+ if (filters != null)
+ {
+ FeatureMatcherSetI filter = Jalview2XML
+ .unmarshalFilter(featureType, filters);
+ if (!filter.isEmpty())
+ {
+ fr.setFeatureFilter(featureType, filter);
+ }
+ }
+
+ /*
+ * restore feature colour scheme
+ */
+ Color maxColour = new Color(setting.getColour());
if (setting.hasMincolour())
{
- FeatureColourI gc = setting.hasMin()
- ? new FeatureColour(new Color(setting.getMincolour()),
- new Color(setting.getColour()), setting.getMin(),
- setting.getMax())
- : new FeatureColour(new Color(setting.getMincolour()),
- new Color(setting.getColour()), 0, 1);
+ /*
+ * minColour is always set unless a simple colour
+ * (including for colour by label though it doesn't use it)
+ */
+ Color minColour = new Color(setting.getMincolour());
+ Color noValueColour = minColour;
+ NoValueColour noColour = setting.getNoValueColour();
+ if (noColour == NoValueColour.NONE)
+ {
+ noValueColour = null;
+ }
+ else if (noColour == NoValueColour.MAX)
+ {
+ noValueColour = maxColour;
+ }
+ float min = setting.hasMin() ? setting.getMin() : 0f;
+ float max = setting.hasMin() ? setting.getMax() : 1f;
+ FeatureColourI gc = new FeatureColour(minColour, maxColour,
+ noValueColour, min, max);
+ if (setting.getAttributeNameCount() > 0)
+ {
+ gc.setAttributeName(setting.getAttributeName());
+ }
if (setting.hasThreshold())
{
gc.setThreshold(setting.getThreshold());
gc.setColourByLabel(setting.getColourByLabel());
}
// and put in the feature colour table.
- featureColours.put(setting.getType(), gc);
+ featureColours.put(featureType, gc);
}
else
{
- featureColours.put(setting.getType(),
- new FeatureColour(new Color(setting.getColour())));
+ featureColours.put(featureType,
+ new FeatureColour(maxColour));
}
- renderOrder[fs] = setting.getType();
+ renderOrder[fs] = featureType;
if (setting.hasOrder())
{
- featureOrder.put(setting.getType(), setting.getOrder());
+ featureOrder.put(featureType, setting.getOrder());
}
else
{
- featureOrder.put(setting.getType(), new Float(
+ featureOrder.put(featureType, new Float(
fs / jms.getFeatureSettings().getSettingCount()));
}
if (setting.getDisplay())
{
- fdi.setVisible(setting.getType());
+ fdi.setVisible(featureType);
}
}
Map<String, Boolean> fgtable = new Hashtable<>();
// jms.getFeatureSettings().getTransparency() : 0.0, featureOrder);
FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder,
fgtable, featureColours, 1.0f, featureOrder);
- af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()
- .transferSettings(frs);
-
+ fr.transferSettings(frs);
}
if (view.getHiddenColumnsCount() > 0)
if (this.frefedSequence == null)
{
- frefedSequence = new Vector<SeqFref>();
+ frefedSequence = new Vector<>();
}
viewportsAdded.clear();
{
return counter++;
}
+
+ /**
+ * 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(NoValueColour.NONE);
+ }
+ else if (noColour == fcol.getMaxColour())
+ {
+ col.setNoValueColour(NoValueColour.MAX);
+ }
+ else
+ {
+ col.setNoValueColour(NoValueColour.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<FeatureMatcherI> 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 featureType
+ * @param matcherSetModel
+ * @return
+ */
+ protected static FeatureMatcherSetI unmarshalFilter(
+ String featureType, MatcherSet matcherSetModel)
+ {
+ FeatureMatcherSetI result = new FeatureMatcherSet();
+ 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",
+ featureType, 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);
+ }
+
+ NoValueColour noCol = colourModel.getNoValueColour();
+ if (noCol == NoValueColour.MIN)
+ {
+ noValueColour = mincol;
+ }
+ else if (noCol == NoValueColour.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;
+ }
}
userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
Integer wi = Cache.getIntegerProperty("FIGURE_USERIDWIDTH");
userIdWidth.setText(wi == null ? "" : wi.toString());
+ // TODO: refactor to use common enum via FormatAdapter and allow extension
+ // for new flat file formats
blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true));
clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true));
fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true));
int original = seqCanvas.cursorX - dx;
int maxWidth = av.getAlignment().getWidth();
+ // TODO: once JAL-2759 is ready, change this loop to something more
+ // efficient
while (!hidden.isVisible(seqCanvas.cursorX)
- && seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0)
+ && seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0
+ && dx != 0)
{
seqCanvas.cursorX += dx;
}
PDBEntry pdb = pdbs[i];
SequenceI seq = seqs[i];
String pdbFile = pdb.getFile();
+ if (pdbFile == null || pdbFile.length() == 0)
+ {
+ pdbFile = pdb.getId();
+ }
if (!pdbsSeen.containsKey(pdbFile))
{
pdbsSeen.put(pdbFile, pdb);
import jalview.datamodel.SequenceDummy;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.datamodel.features.FeatureMatcherSet;
+import jalview.datamodel.features.FeatureMatcherSetI;
import jalview.io.gff.GffHelperBase;
import jalview.io.gff.GffHelperFactory;
import jalview.io.gff.GffHelperI;
*/
public class FeaturesFile extends AlignFile implements FeaturesSourceI
{
+ private static final String TAB_REGEX = "\\t";
+
+ private static final String STARTGROUP = "STARTGROUP";
+
+ private static final String ENDGROUP = "ENDGROUP";
+
+ private static final String STARTFILTERS = "STARTFILTERS";
+
+ private static final String ENDFILTERS = "ENDFILTERS";
+
private static final String ID_NOT_SPECIFIED = "ID_NOT_SPECIFIED";
private static final String NOTE = "Note";
* @param align
* - alignment/dataset containing sequences that are to be annotated
* @param colours
- * - hashtable to store feature colour definitions
+ * - map to store feature colour definitions
* @param removeHTML
* - process html strings into plain text
* @param relaxedIdmatching
Map<String, FeatureColourI> colours, boolean removeHTML,
boolean relaxedIdmatching)
{
- Map<String, String> gffProps = new HashMap<String, String>();
+ return parse(align, colours, null, removeHTML, relaxedIdmatching);
+ }
+
+ /**
+ * Parse GFF or Jalview format sequence features file
+ *
+ * @param align
+ * - alignment/dataset containing sequences that are to be annotated
+ * @param colours
+ * - map to store feature colour definitions
+ * @param filters
+ * - map to store feature filter definitions
+ * @param removeHTML
+ * - process html strings into plain text
+ * @param relaxedIdmatching
+ * - when true, ID matches to compound sequence IDs are allowed
+ * @return true if features were added
+ */
+ public boolean parse(AlignmentI align,
+ Map<String, FeatureColourI> colours,
+ Map<String, FeatureMatcherSetI> filters, boolean removeHTML,
+ boolean relaxedIdmatching)
+ {
+ Map<String, String> gffProps = new HashMap<>();
/*
* keep track of any sequences we try to create from the data
*/
- List<SequenceI> newseqs = new ArrayList<SequenceI>();
+ List<SequenceI> newseqs = new ArrayList<>();
String line = null;
try
continue;
}
- gffColumns = line.split("\\t"); // tab as regex
+ gffColumns = line.split(TAB_REGEX);
if (gffColumns.length == 1)
{
if (line.trim().equalsIgnoreCase("GFF"))
}
}
- if (gffColumns.length > 1 && gffColumns.length < 4)
+ if (gffColumns.length > 0 && gffColumns.length < 4)
{
/*
* if 2 or 3 tokens, we anticipate either 'startgroup', 'endgroup' or
* a feature type colour specification
*/
String ft = gffColumns[0];
- if (ft.equalsIgnoreCase("startgroup"))
+ if (ft.equalsIgnoreCase(STARTFILTERS))
+ {
+ parseFilters(filters);
+ continue;
+ }
+ if (ft.equalsIgnoreCase(STARTGROUP))
{
featureGroup = gffColumns[1];
}
- else if (ft.equalsIgnoreCase("endgroup"))
+ else if (ft.equalsIgnoreCase(ENDGROUP))
{
// We should check whether this is the current group,
// but at present there's no way of showing more than 1 group
}
/**
+ * Reads input lines from STARTFILTERS to ENDFILTERS and adds a feature type
+ * filter to the map for each line parsed. After exit from this method,
+ * nextLine() should return the line after ENDFILTERS (or we are already at
+ * end of file if ENDFILTERS was missing).
+ *
+ * @param filters
+ * @throws IOException
+ */
+ protected void parseFilters(Map<String, FeatureMatcherSetI> filters)
+ throws IOException
+ {
+ String line;
+ while ((line = nextLine()) != null)
+ {
+ if (line.toUpperCase().startsWith(ENDFILTERS))
+ {
+ return;
+ }
+ String[] tokens = line.split(TAB_REGEX);
+ if (tokens.length != 2)
+ {
+ System.err.println(String.format("Invalid token count %d for %d",
+ tokens.length, line));
+ }
+ else
+ {
+ String featureType = tokens[0];
+ FeatureMatcherSetI fm = FeatureMatcherSet.fromString(tokens[1]);
+ if (fm != null && filters != null)
+ {
+ filters.put(featureType, fm);
+ }
+ }
+ }
+ }
+
+ /**
* Try to parse a Jalview format feature specification and add it as a
* sequence feature to any matching sequences in the alignment. Returns true
* if successful (a feature was added), or false if not.
}
/**
- * Returns contents of a Jalview format features file, for visible features,
- * as filtered by type and group. Features with a null group are displayed if
- * their feature type is visible. Non-positional features may optionally be
- * included (with no check on type or group).
+ * Returns contents of a Jalview format features file, for visible features, as
+ * filtered by type and group. Features with a null group are displayed if their
+ * feature type is visible. Non-positional features may optionally be included
+ * (with no check on type or group).
*
* @param sequences
* source of features
* @param visible
* map of colour for each visible feature type
+ * @param featureFilters
* @param visibleFeatureGroups
* @param includeNonPositional
* if true, include non-positional features (regardless of group or
*/
public String printJalviewFormat(SequenceI[] sequences,
Map<String, FeatureColourI> visible,
+ Map<String, FeatureMatcherSetI> featureFilters,
List<String> visibleFeatureGroups, boolean includeNonPositional)
{
if (!includeNonPositional && (visible == null || visible.isEmpty()))
.toArray(new String[visible.keySet().size()]);
/*
+ * feature filters if any
+ */
+ outputFeatureFilters(out, visible, featureFilters);
+
+ /*
* sort groups alphabetically, and ensure that features with a
* null or empty group are output after those in named groups
*/
- List<String> sortedGroups = new ArrayList<String>(visibleFeatureGroups);
+ List<String> sortedGroups = new ArrayList<>(visibleFeatureGroups);
sortedGroups.remove(null);
sortedGroups.remove("");
Collections.sort(sortedGroups);
}
}
- for (String group : sortedGroups)
+ /*
+ * positional features within groups
+ */
+ foundSome |= outputFeaturesByGroup(out, sortedGroups, types, sequences);
+
+ return foundSome ? out.toString() : "No Features Visible";
+ }
+
+ /**
+ * Outputs any feature filters defined for visible feature types, sandwiched by
+ * STARTFILTERS and ENDFILTERS lines
+ *
+ * @param out
+ * @param visible
+ * @param featureFilters
+ */
+ void outputFeatureFilters(StringBuilder out,
+ Map<String, FeatureColourI> visible,
+ Map<String, FeatureMatcherSetI> featureFilters)
+ {
+ if (visible == null || featureFilters == null
+ || featureFilters.isEmpty())
+ {
+ return;
+ }
+
+ boolean first = true;
+ for (String featureType : visible.keySet())
+ {
+ FeatureMatcherSetI filter = featureFilters.get(featureType);
+ if (filter != null)
+ {
+ if (first)
+ {
+ first = false;
+ out.append(newline).append(STARTFILTERS).append(newline);
+ }
+ out.append(featureType).append(TAB).append(filter.toStableString())
+ .append(newline);
+ }
+ }
+ if (!first)
+ {
+ out.append(ENDFILTERS).append(newline).append(newline);
+ }
+
+ }
+
+ /**
+ * Appends output of sequence features within feature groups to the output
+ * buffer. Groups other than the null or empty group are sandwiched by
+ * STARTGROUP and ENDGROUP lines.
+ *
+ * @param out
+ * @param groups
+ * @param featureTypes
+ * @param sequences
+ * @return
+ */
+ private boolean outputFeaturesByGroup(StringBuilder out,
+ List<String> groups, String[] featureTypes, SequenceI[] sequences)
+ {
+ boolean foundSome = false;
+ for (String group : groups)
{
boolean isNamedGroup = (group != null && !"".equals(group));
if (isNamedGroup)
{
out.append(newline);
- out.append("STARTGROUP").append(TAB);
+ out.append(STARTGROUP).append(TAB);
out.append(group);
out.append(newline);
}
for (int i = 0; i < sequences.length; i++)
{
String sequenceName = sequences[i].getName();
- List<SequenceFeature> features = new ArrayList<SequenceFeature>();
- if (types.length > 0)
+ List<SequenceFeature> features = new ArrayList<>();
+ if (featureTypes.length > 0)
{
features.addAll(sequences[i].getFeatures().getFeaturesForGroup(
- true, group, types));
+ true, group, featureTypes));
}
for (SequenceFeature sequenceFeature : features)
if (isNamedGroup)
{
- out.append("ENDGROUP").append(TAB);
+ out.append(ENDGROUP).append(TAB);
out.append(group);
out.append(newline);
}
}
-
- return foundSome ? out.toString() : "No Features Visible";
+ return foundSome;
}
/**
dataset = new Alignment(new SequenceI[] {});
}
- Map<String, FeatureColourI> featureColours = new HashMap<String, FeatureColourI>();
+ Map<String, FeatureColourI> featureColours = new HashMap<>();
boolean parseResult = parse(dataset, featureColours, false, true);
if (!parseResult)
{
for (SequenceI seq : sequences)
{
- List<SequenceFeature> features = new ArrayList<SequenceFeature>();
+ List<SequenceFeature> features = new ArrayList<>();
if (includeNonPositionalFeatures)
{
features.addAll(seq.getFeatures().getNonPositionalFeatures());
public boolean getCacheSuffixDefault(FileFormatI format)
{
- return Cache.getDefault(format.getName() + "_JVSUFFIX", true);
+ return Cache.getDefault(format.getName().toUpperCase() + "_JVSUFFIX",
+ true);
}
public String formatSequences(FileFormatI format, AlignmentI alignment,
boolean validRes, boolean validEnd)
{
g.setColor(STEM_COLOUR);
- int sCol = (lastSSX / charWidth) + startRes;
+ int sCol = (lastSSX / charWidth)
+ + hiddenColumns.adjustForHiddenColumns(startRes);
int x1 = lastSSX;
int x2 = (x * charWidth);
// System.out.println(nonCanColor);
g.setColor(nonCanColor);
- int sCol = (lastSSX / charWidth) + startRes;
+ int sCol = (lastSSX / charWidth)
+ + hiddenColumns.adjustForHiddenColumns(startRes);
int x1 = lastSSX;
int x2 = (x * charWidth);
{
g.setColor(HELIX_COLOUR);
- int sCol = (lastSSX / charWidth) + startRes;
+ int sCol = (lastSSX / charWidth)
+ + hiddenColumns.adjustForHiddenColumns(startRes);
int x1 = lastSSX;
int x2 = (x * charWidth);
-#Mon Jun 20 15:44:52 BST 2016
+#Thu Dec 14 09:10:14 GMT 2017
jalview.schemabinding.version2.ThresholdLine=jalview.schemabinding.version2.descriptors.ThresholdLineDescriptor
jalview.schemabinding.version2.SequenceSetProperties=jalview.schemabinding.version2.descriptors.SequenceSetPropertiesDescriptor
jalview.schemabinding.version2.StructureState=jalview.schemabinding.version2.descriptors.StructureStateDescriptor
jalview.schemabinding.version2.Setting=jalview.schemabinding.version2.descriptors.SettingDescriptor
jalview.schemabinding.version2.AlcodonFrame=jalview.schemabinding.version2.descriptors.AlcodonFrameDescriptor
jalview.schemabinding.version2.AnnotationElement=jalview.schemabinding.version2.descriptors.AnnotationElementDescriptor
+jalview.schemabinding.version2.FeatureMatcherSet=jalview.schemabinding.version2.descriptors.FeatureMatcherSetDescriptor
jalview.schemabinding.version2.SecondaryStructure=jalview.schemabinding.version2.descriptors.SecondaryStructureDescriptor
+jalview.schemabinding.version2.MatchCondition=jalview.schemabinding.version2.descriptors.MatchConditionDescriptor
jalview.schemabinding.version2.SequenceSet=jalview.schemabinding.version2.descriptors.SequenceSetDescriptor
jalview.schemabinding.version2.Viewport=jalview.schemabinding.version2.descriptors.ViewportDescriptor
jalview.schemabinding.version2.RnaViewer=jalview.schemabinding.version2.descriptors.RnaViewerDescriptor
jalview.schemabinding.version2.DBRef=jalview.schemabinding.version2.descriptors.DBRefDescriptor
jalview.schemabinding.version2.AlcodMap=jalview.schemabinding.version2.descriptors.AlcodMapDescriptor
jalview.schemabinding.version2.Annotation=jalview.schemabinding.version2.descriptors.AnnotationDescriptor
-jalview.schemabinding.version2.Wsparameters=jalview.schemabinding.version2.descriptors.WsparametersDescriptor
jalview.schemabinding.version2.JSeq=jalview.schemabinding.version2.descriptors.JSeqDescriptor
+jalview.schemabinding.version2.MatcherSet=jalview.schemabinding.version2.descriptors.MatcherSetDescriptor
jalview.schemabinding.version2.Sequence=jalview.schemabinding.version2.descriptors.SequenceDescriptor
jalview.schemabinding.version2.WebServiceParameterSet=jalview.schemabinding.version2.descriptors.WebServiceParameterSetDescriptor
jalview.schemabinding.version2.Alcodon=jalview.schemabinding.version2.descriptors.AlcodonDescriptor
+jalview.schemabinding.version2.Filter=jalview.schemabinding.version2.descriptors.FilterDescriptor
jalview.schemabinding.version2.AnnotationColours=jalview.schemabinding.version2.descriptors.AnnotationColoursDescriptor
jalview.schemabinding.version2.Pdbids=jalview.schemabinding.version2.descriptors.PdbidsDescriptor
jalview.schemabinding.version2.AnnotationColourScheme=jalview.schemabinding.version2.descriptors.AnnotationColourSchemeDescriptor
jalview.schemabinding.version2.Mapping=jalview.schemabinding.version2.descriptors.MappingDescriptor
-jalview.schemabinding.version2.MappingChoice=jalview.schemabinding.version2.descriptors.MappingChoiceDescriptor
+jalview.schemabinding.version2.CompoundMatcher=jalview.schemabinding.version2.descriptors.CompoundMatcherDescriptor
+jalview.schemabinding.version2.JalviewModelSequence=jalview.schemabinding.version2.descriptors.JalviewModelSequenceDescriptor
jalview.schemabinding.version2.Group=jalview.schemabinding.version2.descriptors.GroupDescriptor
+jalview.schemabinding.version2.MappingChoice=jalview.schemabinding.version2.descriptors.MappingChoiceDescriptor
jalview.schemabinding.version2.Feature=jalview.schemabinding.version2.descriptors.FeatureDescriptor
-jalview.schemabinding.version2.JalviewModelSequence=jalview.schemabinding.version2.descriptors.JalviewModelSequenceDescriptor
jalview.schemabinding.version2.UserColours=jalview.schemabinding.version2.descriptors.UserColoursDescriptor
jalview.schemabinding.version2.Colour=jalview.schemabinding.version2.descriptors.ColourDescriptor
-jalview.schemabinding.version2.MapListFrom=jalview.schemabinding.version2.descriptors.MapListFromDescriptor
jalview.schemabinding.version2.PdbentryItem=jalview.schemabinding.version2.descriptors.PdbentryItemDescriptor
-jalview.schemabinding.version2.JGroup=jalview.schemabinding.version2.descriptors.JGroupDescriptor
+jalview.schemabinding.version2.MapListFrom=jalview.schemabinding.version2.descriptors.MapListFromDescriptor
jalview.schemabinding.version2.FeatureSettings=jalview.schemabinding.version2.descriptors.FeatureSettingsDescriptor
-jalview.schemabinding.version2.VamsasModel=jalview.schemabinding.version2.descriptors.VamsasModelDescriptor
-jalview.schemabinding.version2.JalviewUserColours=jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor
+jalview.schemabinding.version2.JGroup=jalview.schemabinding.version2.descriptors.JGroupDescriptor
jalview.schemabinding.version2.MapListTo=jalview.schemabinding.version2.descriptors.MapListToDescriptor
+jalview.schemabinding.version2.JalviewUserColours=jalview.schemabinding.version2.descriptors.JalviewUserColoursDescriptor
+jalview.schemabinding.version2.VamsasModel=jalview.schemabinding.version2.descriptors.VamsasModelDescriptor
jalview.schemabinding.version2.Pdbentry=jalview.schemabinding.version2.descriptors.PdbentryDescriptor
jalview.schemabinding.version2.HiddenColumns=jalview.schemabinding.version2.descriptors.HiddenColumnsDescriptor
jalview.schemabinding.version2.Features=jalview.schemabinding.version2.descriptors.FeaturesDescriptor
-jalview.schemabinding.version2.DseqFor=jalview.schemabinding.version2.descriptors.DseqForDescriptor
jalview.schemabinding.version2.VAMSAS=jalview.schemabinding.version2.descriptors.VAMSASDescriptor
-jalview.schemabinding.version2.MappingChoiceItem=jalview.schemabinding.version2.descriptors.MappingChoiceItemDescriptor
+jalview.schemabinding.version2.FeatureMatcher=jalview.schemabinding.version2.descriptors.FeatureMatcherDescriptor
// --------------------------/
/**
- * Field _name.
+ * Single letter residue code for an alignment colour scheme, or feature type
+ * for a feature colour scheme
*/
private java.lang.String _name;
private java.lang.String _minRGB;
/**
- * loosely specified enumeration: NONE,ABOVE, or BELOW
+ * Field _noValueColour.
*/
- private java.lang.String _threshType;
+ private jalview.schemabinding.version2.types.NoValueColour _noValueColour = jalview.schemabinding.version2.types.NoValueColour
+ .valueOf("Min");
+
+ /**
+ * Field _threshType.
+ */
+ private jalview.schemabinding.version2.types.ColourThreshTypeType _threshType;
/**
* Field _threshold.
*/
private boolean _has_autoScale;
+ /**
+ * name of feature attribute to colour by, or attribute and sub-attribute
+ */
+ private java.util.Vector _attributeNameList;
+
// ----------------/
// - Constructors -/
// ----------------/
public Colour()
{
super();
+ setNoValueColour(jalview.schemabinding.version2.types.NoValueColour
+ .valueOf("Min"));
+ this._attributeNameList = new java.util.Vector();
}
// -----------/
// -----------/
/**
- */
+ *
+ *
+ * @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.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public 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'.
}
/**
- * 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'.
*/
}
/**
+ * Returns the value of field 'noValueColour'.
+ *
+ * @return the value of field 'NoValueColour'.
+ */
+ public jalview.schemabinding.version2.types.NoValueColour getNoValueColour()
+ {
+ return this._noValueColour;
+ }
+
+ /**
* Returns the value of field 'RGB'.
*
* @return the value of field 'RGB'.
}
/**
- * 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.schemabinding.version2.types.ColourThreshTypeType getThreshType()
{
return this._threshType;
}
}
/**
+ */
+ 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
}
/**
- * 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'.
}
/**
+ * Sets the value of field 'noValueColour'.
+ *
+ * @param noValueColour
+ * the value of field 'noValueColour'.
+ */
+ public void setNoValueColour(
+ final jalview.schemabinding.version2.types.NoValueColour noValueColour)
+ {
+ this._noValueColour = noValueColour;
+ }
+
+ /**
* Sets the value of field 'RGB'.
*
* @param RGB
}
/**
- * 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.schemabinding.version2.types.ColourThreshTypeType threshType)
{
this._threshType = threshType;
}
throws org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
{
- return (jalview.schemabinding.version2.Colour) Unmarshaller.unmarshal(
- jalview.schemabinding.version2.Colour.class, reader);
+ return (jalview.schemabinding.version2.Colour) Unmarshaller
+ .unmarshal(jalview.schemabinding.version2.Colour.class, reader);
}
/**
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.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);
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public 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);
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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 MatchCondition _matchCondition;
+
+ /**
+ * Field _compoundMatcher.
+ */
+ private 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 CompoundMatcher getCompoundMatcher()
+ {
+ return this._compoundMatcher;
+ }
+
+ /**
+ * Returns the value of field 'matchCondition'.
+ *
+ * @return the value of field 'MatchCondition'.
+ */
+ public 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 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 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);
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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);
+ }
+
+}
*/
private java.util.Vector _colourList;
+ /**
+ * Field _filterList.
+ */
+ private java.util.Vector _filterList;
+
// ----------------/
// - Constructors -/
// ----------------/
{
super();
this._colourList = new java.util.Vector();
+ this._filterList = new java.util.Vector();
}
// -----------/
}
/**
+ *
+ *
+ * @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
}
/**
+ * Method enumerateFilter.
+ *
+ * @return an Enumeration over all Filter elements
+ */
+ public java.util.Enumeration enumerateFilter()
+ {
+ return this._filterList.elements();
+ }
+
+ /**
* Method getColour.
*
* @param index
// 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);
}
/**
+ * 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.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public 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'.
}
/**
- */
+ */
public void removeAllColour()
{
this._colourList.clear();
}
/**
+ */
+ public void removeAllFilter()
+ {
+ this._filterList.clear();
+ }
+
+ /**
* Method removeColour.
*
* @param vColour
}
/**
+ * 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
// 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);
}
/**
+ *
+ *
+ * @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
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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);
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * optional filter(s) applied to the feature type
+ *
+ * @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);
+ }
+
+}
package jalview.schemabinding.version2;
-//---------------------------------/
-//- Imported classes and packages -/
+ //---------------------------------/
+ //- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
*
* @version $Revision$ $Date$
*/
-public class OtherData implements java.io.Serializable
-{
-
- // --------------------------/
- // - Class/Member Variables -/
- // --------------------------/
-
- /**
- * Field _key.
- */
- private java.lang.String _key;
-
- /**
- * Field _value.
- */
- private java.lang.String _value;
-
- // ----------------/
- // - Constructors -/
- // ----------------/
-
- public OtherData()
- {
- super();
- }
-
- // -----------/
- // - Methods -/
- // -----------/
-
- /**
- * Returns the value of field 'key'.
- *
- * @return the value of field 'Key'.
- */
- public java.lang.String getKey()
- {
- return this._key;
- }
-
- /**
- * 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;
+public class OtherData implements java.io.Serializable {
+
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * Field _key.
+ */
+ private java.lang.String _key;
+
+ /**
+ * key2 may be used for a sub-attribute of key
+ */
+ private java.lang.String _key2;
+
+ /**
+ * Field _value.
+ */
+ private java.lang.String _value;
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public OtherData() {
+ super();
+ }
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Returns the value of field 'key'.
+ *
+ * @return the value of field 'Key'.
+ */
+ public java.lang.String getKey(
+ ) {
+ return this._key;
+ }
+
+ /**
+ * Returns the value of field 'key2'. The field 'key2' has the
+ * following description: key2 may be used for a sub-attribute
+ * of key
+ *
+ * @return the value of field 'Key2'.
+ */
+ public java.lang.String getKey2(
+ ) {
+ return this._key2;
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Sets the value of field 'key'.
+ *
+ * @param key the value of field 'key'.
+ */
+ public void setKey(
+ final java.lang.String key) {
+ this._key = key;
+ }
+
+ /**
+ * Sets the value of field 'key2'. The field 'key2' has the
+ * following description: key2 may be used for a sub-attribute
+ * of key
+ *
+ * @param key2 the value of field 'key2'.
+ */
+ public void setKey2(
+ final java.lang.String key2) {
+ this._key2 = key2;
+ }
+
+ /**
+ * 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.OtherData
+ */
+ public static jalview.schemabinding.version2.OtherData unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+ return (jalview.schemabinding.version2.OtherData) Unmarshaller.unmarshal(jalview.schemabinding.version2.OtherData.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);
}
- 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 'key'.
- *
- * @param key
- * the value of field 'key'.
- */
- public void setKey(final java.lang.String key)
- {
- this._key = key;
- }
-
- /**
- * 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.OtherData
- */
- public static jalview.schemabinding.version2.OtherData unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException,
- org.exolab.castor.xml.ValidationException
- {
- return (jalview.schemabinding.version2.OtherData) Unmarshaller
- .unmarshal(jalview.schemabinding.version2.OtherData.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);
- }
}
private boolean _has_mincolour;
/**
+ * Field _noValueColour.
+ */
+ private jalview.schemabinding.version2.types.NoValueColour _noValueColour = jalview.schemabinding.version2.types.NoValueColour
+ .valueOf("Min");
+
+ /**
* threshold value for graduated feature colour
*
*/
*/
private boolean _has_autoScale;
+ /**
+ * name of feature attribute to colour by, or attribute and sub-attribute
+ */
+ private java.util.Vector _attributeNameList;
+
+ /**
+ * optional filter(s) applied to the feature type
+ */
+ private jalview.schemabinding.version2.MatcherSet _matcherSet;
+
// ----------------/
// - Constructors -/
// ----------------/
public Setting()
{
super();
+ setNoValueColour(jalview.schemabinding.version2.types.NoValueColour
+ .valueOf("Min"));
+ this._attributeNameList = new java.util.Vector();
}
// -----------/
// -----------/
/**
- */
+ *
+ *
+ * @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 deleteColour()
{
this._has_colour = false;
}
/**
- */
+ */
public void deleteColourByLabel()
{
this._has_colourByLabel = false;
}
/**
- */
+ */
public void deleteDisplay()
{
this._has_display = false;
}
/**
- */
+ */
public void deleteMax()
{
this._has_max = false;
}
/**
- */
+ */
public void deleteMin()
{
this._has_min = false;
}
/**
- */
+ */
public void deleteMincolour()
{
this._has_mincolour = false;
}
/**
- */
+ */
public void deleteOrder()
{
this._has_order = false;
}
/**
- */
+ */
public void deleteThreshold()
{
this._has_threshold = false;
}
/**
- */
+ */
public void deleteThreshstate()
{
this._has_threshstate = 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.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public 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'.
}
/**
+ * Returns the value of field 'matcherSet'. The field 'matcherSet' has the
+ * following description: optional filter(s) applied to the feature type
+ *
+ * @return the value of field 'MatcherSet'.
+ */
+ public jalview.schemabinding.version2.MatcherSet getMatcherSet()
+ {
+ return this._matcherSet;
+ }
+
+ /**
* Returns the value of field 'max'.
*
* @return the value of field 'Max'.
}
/**
+ * Returns the value of field 'noValueColour'.
+ *
+ * @return the value of field 'NoValueColour'.
+ */
+ public jalview.schemabinding.version2.types.NoValueColour getNoValueColour()
+ {
+ return this._noValueColour;
+ }
+
+ /**
* Returns the value of field 'order'.
*
* @return the value of field 'Order'.
}
/**
+ */
+ 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
}
/**
+ * Sets the value of field 'matcherSet'. The field 'matcherSet' has the
+ * following description: optional filter(s) applied to the feature type
+ *
+ * @param matcherSet
+ * the value of field 'matcherSet'.
+ */
+ public void setMatcherSet(
+ final jalview.schemabinding.version2.MatcherSet matcherSet)
+ {
+ this._matcherSet = matcherSet;
+ }
+
+ /**
* Sets the value of field 'max'.
*
* @param max
}
/**
+ * Sets the value of field 'noValueColour'.
+ *
+ * @param noValueColour
+ * the value of field 'noValueColour'.
+ */
+ public void setNoValueColour(
+ final jalview.schemabinding.version2.types.NoValueColour noValueColour)
+ {
+ this._noValueColour = noValueColour;
+ }
+
+ /**
* Sets the value of field 'order'.
*
* @param order
*
* @version $Revision$ $Date$
*/
-public class ColourDescriptor extends
- org.exolab.castor.xml.util.XMLClassDescriptorImpl
+public class ColourDescriptor
+ extends org.exolab.castor.xml.util.XMLClassDescriptorImpl
{
// --------------------------/
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;
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.NoValueColour.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.NoValueColour) 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.NoValueColour.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)
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());
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);
// -- 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
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());
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);
}
// -----------/
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2.descriptors;
+
+import jalview.schemabinding.version2.CompoundMatcher;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import jalview.schemabinding.version2.FeatureMatcherSet;
+import jalview.schemabinding.version2.MatchCondition;
+
+/**
+ * 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(
+ MatchCondition.class, "_matchCondition", "matchCondition",
+ 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
+ {
+ FeatureMatcherSet target = (FeatureMatcherSet) object;
+ return target.getMatchCondition();
+ }
+
+ @Override
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ FeatureMatcherSet target = (FeatureMatcherSet) object;
+ target.setMatchCondition((MatchCondition) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ @Override
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new 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(
+ CompoundMatcher.class, "_compoundMatcher", "compoundMatcher",
+ 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
+ {
+ FeatureMatcherSet target = (FeatureMatcherSet) object;
+ return target.getCompoundMatcher();
+ }
+
+ @Override
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ FeatureMatcherSet target = (FeatureMatcherSet) object;
+ target.setCompoundMatcher((CompoundMatcher) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ @Override
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new 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.
+ */
+ @Override
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ @Override
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ @Override
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.FeatureMatcherSet.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ @Override
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ @Override
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ @Override
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ @Override
+ 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.
+ */
+ @Override
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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;
+ }
+
+}
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;
/**
*
* @version $Revision$ $Date$
*/
-public class JalviewUserColoursDescriptor extends
- org.exolab.castor.xml.util.XMLClassDescriptorImpl
+public class JalviewUserColoursDescriptor
+ extends org.exolab.castor.xml.util.XMLClassDescriptorImpl
{
// --------------------------/
}
@Override
- public void resetValue(Object object) throws IllegalStateException,
- IllegalArgumentException
+ public void resetValue(Object object)
+ throws IllegalStateException, IllegalArgumentException
{
try
{
{ // -- 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);
}
// -----------/
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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;
+ }
+
+}
package jalview.schemabinding.version2.descriptors;
-//---------------------------------/
-//- Imported classes and packages -/
+ //---------------------------------/
+ //- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.OtherData;
*
* @version $Revision$ $Date$
*/
-public class OtherDataDescriptor 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 OtherDataDescriptor()
- {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "otherData";
- _elementDefinition = true;
- 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
-
- // -- _key
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
- java.lang.String.class, "_key", "key",
- 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
- {
- OtherData target = (OtherData) object;
- return target.getKey();
- }
-
- public void setValue(java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try
- {
- OtherData target = (OtherData) object;
- target.setKey((java.lang.String) value);
- } catch (java.lang.Exception ex)
- {
- throw new IllegalStateException(ex.toString());
+public class OtherDataDescriptor 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 OtherDataDescriptor() {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "otherData";
+ _elementDefinition = true;
+ 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
+
+ //-- _key
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_key", "key", 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
+ {
+ OtherData target = (OtherData) object;
+ return target.getKey();
+ }
+ public void setValue( java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try {
+ OtherData target = (OtherData) object;
+ target.setKey( (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: _key
+ 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);
+ //-- _key2
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_key2", "key2", 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
+ {
+ OtherData target = (OtherData) object;
+ return target.getKey2();
+ }
+ public void setValue( java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try {
+ OtherData target = (OtherData) object;
+ target.setKey2( (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.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ //-- validation code for: _key2
+ 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);
+ //-- _value
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", 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
+ {
+ OtherData target = (OtherData) object;
+ return target.getValue();
+ }
+ public void setValue( java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try {
+ OtherData target = (OtherData) 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);
+ //-- initialize element descriptors
+
+ }
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
- public java.lang.Object newInstance(java.lang.Object parent)
- {
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode(
+ ) {
return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- // -- validation code for: _key
- 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.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler()
- {
- public java.lang.Object getValue(java.lang.Object object)
- throws IllegalStateException
- {
- OtherData target = (OtherData) object;
- return target.getValue();
- }
-
- public void setValue(java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try
- {
- OtherData target = (OtherData) 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");
+ /**
+ * 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.OtherData.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;
}
- desc.setValidator(fieldValidator);
- // -- initialize element descriptors
-
- }
-
- // -----------/
- // - 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.OtherData.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;
- }
}
*
* @version $Revision$ $Date$
*/
-public class SettingDescriptor extends
- org.exolab.castor.xml.util.XMLClassDescriptorImpl
+public class SettingDescriptor
+ extends org.exolab.castor.xml.util.XMLClassDescriptorImpl
{
// --------------------------/
_nsURI = "www.jalview.org";
_xmlName = "setting";
_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;
typeValidator.setMaxInclusive(2147483647);
}
desc.setValidator(fieldValidator);
+ // -- _noValueColour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.types.NoValueColour.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
+ {
+ Setting target = (Setting) object;
+ return target.getNoValueColour();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) object;
+ target.setNoValueColour(
+ (jalview.schemabinding.version2.types.NoValueColour) 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.NoValueColour.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);
// -- _threshold
desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
java.lang.Float.TYPE, "_threshold", "threshold",
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());
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
+ {
+ Setting target = (Setting) object;
+ return target.getAttributeName();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) 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
+ {
+ Setting target = (Setting) 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.setNameSpaceURI("www.jalview.org");
+ 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);
+ // -- _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
+ {
+ Setting target = (Setting) object;
+ return target.getMatcherSet();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ Setting target = (Setting) 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.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _matcherSet
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ }
+ desc.setValidator(fieldValidator);
}
// -----------/
--- /dev/null
+#Thu Dec 14 15:28:22 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.NoValueColour=jalview.schemabinding.version2.types.descriptors.NoValueColourDescriptor
+jalview.schemabinding.version2.types.ColourThreshTypeType=jalview.schemabinding.version2.types.descriptors.ColourThreshTypeTypeDescriptor
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2.types;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import java.util.Hashtable;
+
+/**
+ * Graduated feature colour if no score (or attribute) value
+ *
+ * @version $Revision$ $Date$
+ */
+public class NoValueColour 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 NoValueColour NONE = new NoValueColour(NONE_TYPE,
+ "None");
+
+ /**
+ * The Min type
+ */
+ public static final int MIN_TYPE = 1;
+
+ /**
+ * The instance of the Min type
+ */
+ public static final NoValueColour MIN = new NoValueColour(MIN_TYPE,
+ "Min");
+
+ /**
+ * The Max type
+ */
+ public static final int MAX_TYPE = 2;
+
+ /**
+ * The instance of the Max type
+ */
+ public static final NoValueColour MAX = new NoValueColour(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 NoValueColour(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
+ * NoValueColour
+ *
+ * @return an Enumeration over all possible instances of NoValueColour
+ */
+ public static java.util.Enumeration enumerate()
+ {
+ return _memberTable.elements();
+ }
+
+ /**
+ * Method getType.Returns the type of this NoValueColour
+ *
+ * @return the type of this NoValueColour
+ */
+ 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 NoValueColour
+ *
+ * @return the String representation of this NoValueColour
+ */
+ public java.lang.String toString()
+ {
+ return this.stringValue;
+ }
+
+ /**
+ * Method valueOf.Returns a new NoValueColour based on the given String value.
+ *
+ * @param string
+ * @return the NoValueColour value of parameter 'string'
+ */
+ public static jalview.schemabinding.version2.types.NoValueColour 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 NoValueColour";
+ throw new IllegalArgumentException(err);
+ }
+ return (NoValueColour) obj;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.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;
+ }
+
+}
--- /dev/null
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2.types.descriptors;
+
+//---------------------------------/
+//- Imported classes and packages -/
+//---------------------------------/
+
+import jalview.schemabinding.version2.types.NoValueColour;
+
+/**
+ * Class NoValueColourDescriptor.
+ *
+ * @version $Revision$ $Date$
+ */
+public class NoValueColourDescriptor
+ 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 NoValueColourDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org/colours";
+ _xmlName = "NoValueColour";
+ _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.NoValueColour.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;
+ }
+
+}
import jalview.api.FeatureColourI;
import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.features.FeatureMatcher;
import jalview.util.ColorUtils;
import jalview.util.Format;
*/
public class FeatureColour implements FeatureColourI
{
+ private static final String ABSOLUTE = "abso";
+
+ private static final String ABOVE = "above";
+
+ private static final String BELOW = "below";
+
+ /*
+ * constants used to read or write a Jalview Features file
+ */
+ private static final String LABEL = "label";
+
+ private static final String SCORE = "score";
+
+ private static final String ATTRIBUTE = "attribute";
+
+ private static final String NO_VALUE_MIN = "noValueMin";
+
+ private static final String NO_VALUE_MAX = "noValueMax";
+
+ private static final String NO_VALUE_NONE = "noValueNone";
+
static final Color DEFAULT_NO_COLOUR = null;
private static final String BAR = "|";
/**
* Parses a Jalview features file format colour descriptor
- * [label|][mincolour|maxcolour
- * |[absolute|]minvalue|maxvalue|thresholdtype|thresholdvalue] Examples:
+ * <p>
+ * <code>
+ * [label|score|[attribute|attributeName]|][mincolour|maxcolour|
+ * [absolute|]minvalue|maxvalue|[noValueOption|]thresholdtype|thresholdvalue]</code>
+ * <p>
+ * 'Score' is optional (default) for a graduated colour. An attribute with
+ * sub-attribute should be written as (for example) CSQ:Consequence.
+ * noValueOption is one of <code>noValueMin, noValueMax, noValueNone</code>
+ * with default noValueMin.
+ * <p>
+ * Examples:
* <ul>
* <li>red</li>
* <li>a28bbb</li>
* <li>25,125,213</li>
* <li>label</li>
+ * <li>attribute|CSQ:PolyPhen</li>
* <li>label|||0.0|0.0|above|12.5</li>
* <li>label|||0.0|0.0|below|12.5</li>
* <li>red|green|12.0|26.0|none</li>
+ * <li>score|red|green|12.0|26.0|none</li>
+ * <li>attribute|AF|red|green|12.0|26.0|none</li>
+ * <li>attribute|AF|red|green|noValueNone|12.0|26.0|none</li>
* <li>a28bbb|3eb555|12.0|26.0|above|12.5</li>
* <li>a28bbb|3eb555|abso|12.0|26.0|below|12.5</li>
* </ul>
* @throws IllegalArgumentException
* if not parseable
*/
- public static FeatureColour parseJalviewFeatureColour(String descriptor)
+ public static FeatureColourI parseJalviewFeatureColour(String descriptor)
{
- StringTokenizer gcol = new StringTokenizer(descriptor, "|", true);
+ StringTokenizer gcol = new StringTokenizer(descriptor, BAR, true);
float min = Float.MIN_VALUE;
float max = Float.MAX_VALUE;
- boolean labelColour = false;
+ boolean byLabel = false;
+ boolean byAttribute = false;
+ String attName = null;
+ String mincol = null;
+ String maxcol = null;
- String mincol = gcol.nextToken();
- if (mincol == "|")
+ /*
+ * first token should be 'label', or 'score', or an
+ * attribute name, or simple colour, or minimum colour
+ */
+ String nextToken = gcol.nextToken();
+ if (nextToken == BAR)
{
throw new IllegalArgumentException(
"Expected either 'label' or a colour specification in the line: "
+ descriptor);
}
- String maxcol = null;
- if (mincol.toLowerCase().indexOf("label") == 0)
+ if (nextToken.toLowerCase().startsWith(LABEL))
{
- labelColour = true;
+ byLabel = true;
+ // get the token after the next delimiter:
mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
- // skip '|'
mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
}
+ else if (nextToken.toLowerCase().startsWith(SCORE))
+ {
+ mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
+ mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
+ }
+ else if (nextToken.toLowerCase().startsWith(ATTRIBUTE))
+ {
+ byAttribute = true;
+ attName = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
+ attName = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
+ mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
+ mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null);
+ }
+ else
+ {
+ mincol = nextToken;
+ }
- if (!labelColour && !gcol.hasMoreTokens())
+ /*
+ * if only one token, it can validly be label, attributeName,
+ * or a plain colour value
+ */
+ if (!gcol.hasMoreTokens())
{
- /*
- * only a simple colour specification - parse it
- */
+ if (byLabel || byAttribute)
+ {
+ FeatureColourI fc = new FeatureColour();
+ fc.setColourByLabel(true);
+ if (byAttribute)
+ {
+ fc.setAttributeName(
+ FeatureMatcher.fromAttributeDisplayName(attName));
+ }
+ return fc;
+ }
+
Color colour = ColorUtils.parseColourString(descriptor);
if (colour == null)
{
}
/*
+ * continue parsing for min/max/no colour (if graduated)
+ * and for threshold (colour by text or graduated)
+ */
+
+ /*
* autoScaled == true: colours range over actual score range
* autoScaled == false ('abso'): colours range over min/max range
*/
boolean autoScaled = true;
String tok = null, minval, maxval;
+ String noValueColour = NO_VALUE_MIN;
+
if (mincol != null)
{
// at least four more tokens
- if (mincol.equals("|"))
+ if (mincol.equals(BAR))
{
- mincol = "";
+ mincol = null;
}
else
{
gcol.nextToken(); // skip next '|'
}
maxcol = gcol.nextToken();
- if (maxcol.equals("|"))
+ if (maxcol.equals(BAR))
{
- maxcol = "";
+ maxcol = null;
}
else
{
gcol.nextToken(); // skip next '|'
}
tok = gcol.nextToken();
+
+ /*
+ * check for specifier for colour for no attribute value
+ * (new in 2.11, defaults to minColour if not specified)
+ */
+ if (tok.equalsIgnoreCase(NO_VALUE_MIN))
+ {
+ tok = gcol.nextToken();
+ tok = gcol.nextToken();
+ }
+ else if (tok.equalsIgnoreCase(NO_VALUE_MAX))
+ {
+ noValueColour = NO_VALUE_MAX;
+ tok = gcol.nextToken();
+ tok = gcol.nextToken();
+ }
+ else if (tok.equalsIgnoreCase(NO_VALUE_NONE))
+ {
+ noValueColour = NO_VALUE_NONE;
+ tok = gcol.nextToken();
+ tok = gcol.nextToken();
+ }
+
gcol.nextToken(); // skip next '|'
- if (tok.toLowerCase().startsWith("abso"))
+ if (tok.toLowerCase().startsWith(ABSOLUTE))
{
minval = gcol.nextToken();
gcol.nextToken(); // skip next '|'
}
else
{
- // add in some dummy min/max colours for the label-only
- // colourscheme.
- mincol = "FFFFFF";
- maxcol = "000000";
+ /*
+ * dummy min/max colours for colour by text
+ * (label or attribute value)
+ */
+ mincol = "white";
+ maxcol = "black";
+ byLabel = true;
}
/*
- * construct the FeatureColour
+ * construct the FeatureColour!
*/
FeatureColour featureColour;
try
{
Color minColour = ColorUtils.parseColourString(mincol);
Color maxColour = ColorUtils.parseColourString(maxcol);
- featureColour = new FeatureColour(minColour, maxColour, min, max);
- featureColour.setColourByLabel(labelColour);
+ Color noColour = noValueColour.equals(NO_VALUE_MAX) ? maxColour
+ : (noValueColour.equals(NO_VALUE_NONE) ? null : minColour);
+ featureColour = new FeatureColour(minColour, maxColour, noColour, min,
+ max);
+ featureColour.setColourByLabel(minColour == null);
featureColour.setAutoScaled(autoScaled);
+ if (byAttribute)
+ {
+ featureColour.setAttributeName(
+ FeatureMatcher.fromAttributeDisplayName(attName));
+ }
// add in any additional parameters
String ttype = null, tval = null;
if (gcol.hasMoreTokens())
{
// threshold type and possibly a threshold value
ttype = gcol.nextToken();
- if (ttype.toLowerCase().startsWith("below"))
+ if (ttype.toLowerCase().startsWith(BELOW))
{
featureColour.setBelowThreshold(true);
}
- else if (ttype.toLowerCase().startsWith("above"))
+ else if (ttype.toLowerCase().startsWith(ABOVE))
{
featureColour.setAboveThreshold(true);
}
"Ignoring additional tokens in parameters in graduated colour specification\n");
while (gcol.hasMoreTokens())
{
- System.err.println("|" + gcol.nextToken());
+ System.err.println(BAR + gcol.nextToken());
}
System.err.println("\n");
}
else
{
StringBuilder sb = new StringBuilder(32);
- if (isColourByLabel())
+ if (isColourByAttribute())
{
- sb.append("label");
- if (hasThreshold())
- {
- sb.append(BAR).append(BAR).append(BAR);
- }
+ sb.append(ATTRIBUTE).append(BAR);
+ sb.append(
+ FeatureMatcher.toAttributeDisplayName(getAttributeName()));
+ }
+ else if (isColourByLabel())
+ {
+ sb.append(LABEL);
+ }
+ else
+ {
+ sb.append(SCORE);
}
if (isGraduatedColour())
{
- sb.append(Format.getHexString(getMinColour())).append(BAR);
+ sb.append(BAR).append(Format.getHexString(getMinColour()))
+ .append(BAR);
sb.append(Format.getHexString(getMaxColour())).append(BAR);
+ String noValue = minColour.equals(noColour) ? NO_VALUE_MIN
+ : (maxColour.equals(noColour) ? NO_VALUE_MAX
+ : NO_VALUE_NONE);
+ sb.append(noValue).append(BAR);
if (!isAutoScaled())
{
- sb.append("abso").append(BAR);
+ sb.append(ABSOLUTE).append(BAR);
+ }
+ }
+ else
+ {
+ /*
+ * colour by text with score threshold: empty fields for
+ * minColour and maxColour (not used)
+ */
+ if (hasThreshold())
+ {
+ sb.append(BAR).append(BAR).append(BAR);
}
}
if (hasThreshold() || isGraduatedColour())
sb.append(getMax()).append(BAR);
if (isBelowThreshold())
{
- sb.append("below").append(BAR).append(getThreshold());
+ sb.append(BELOW).append(BAR).append(getThreshold());
}
else if (isAboveThreshold())
{
- sb.append("above").append(BAR).append(getThreshold());
+ sb.append(ABOVE).append(BAR).append(getThreshold());
}
else
{
*/
public enum Condition
{
- Contains(false, true), NotContains(false, true), Matches(false, true),
- NotMatches(false, true), Present(false, false), NotPresent(false, false),
- EQ(true, true), NE(true, true), LT(true, true), LE(true, true),
- GT(true, true), GE(true, true);
-
+ Contains(false, true, "Contains"),
+ NotContains(false, true, "NotContains"), Matches(false, true, "Matches"),
+ NotMatches(false, true, "NotMatches"), Present(false, false, "Present"),
+ NotPresent(false, false, "NotPresent"), EQ(true, true, "EQ"),
+ NE(true, true, "NE"), LT(true, true, "LT"), LE(true, true, "LE"),
+ GT(true, true, "GT"), GE(true, true, "GE");
+
private boolean numeric;
private boolean needsAPattern;
- Condition(boolean isNumeric, boolean needsPattern)
+ /*
+ * value used to save a Condition to the
+ * Jalview project file or restore it from project;
+ * it should not be changed even if enum names change in future
+ */
+ private String stableName;
+
+ /**
+ * Answers the enum value whose 'stable name' matches the argument (not case
+ * sensitive), or null if no match
+ *
+ * @param stableName
+ * @return
+ */
+ public static Condition fromString(String stableName)
+ {
+ for (Condition c : values())
+ {
+ if (c.stableName.equalsIgnoreCase(stableName))
+ {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param isNumeric
+ * @param needsPattern
+ * @param stablename
+ */
+ Condition(boolean isNumeric, boolean needsPattern, String stablename)
{
numeric = isNumeric;
needsAPattern = needsPattern;
+ stableName = stablename;
}
/**
return needsAPattern;
}
+ public String getStableName()
+ {
+ return stableName;
+ }
+
/**
* Answers a display name for the match condition, suitable for showing in
* drop-down menus. The value may be internationalized using the resource key
* @param compareTo
* @return
* @throws NumberFormatException
- * if a numerical condition is specified with a non-numeric comparison
- * value
+ * if a numerical condition is specified with a non-numeric
+ * comparison value
* @throws NullPointerException
* if a null condition or comparison string is specified
*/
@Override
public Map<String, FeatureMatcherSetI> getFeatureFilters()
{
- return new HashMap<>(featureFilters);
+ return featureFilters;
}
@Override
/**
* Answers the colour for the feature, or null if the feature is excluded by
- * feature type or group visibility, by filters, or by colour threshold
- * settings
+ * feature group visibility, by filters, or by colour threshold settings. This
+ * method does not take feature visibility into account.
*
* @param sf
* @param fc
public Color getColor(SequenceFeature sf, FeatureColourI fc)
{
/*
- * is the feature type displayed?
- */
- if (!showFeatureOfType(sf.getType()))
- {
- return null;
- }
-
- /*
* is the feature group displayed?
*/
if (featureGroupNotShown(sf))
import java.util.Map;
import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import junit.extensions.PA;
{
/**
+ * clear down attributes map before tests
+ */
+ @BeforeClass
+ public void setUp()
+ {
+ FeatureAttributes fa = FeatureAttributes.getInstance();
+ ((Map<?, ?>) PA.getValue(fa, "attributes")).clear();
+ }
+
+ /**
* clear down attributes map after tests
*/
@AfterMethod
"csq", "AF" }) < 0);
}
- @Test
+ @Test(groups = "Functional")
public void testGetMinMax()
{
SequenceFeature sf = new SequenceFeature("Pfam", "desc", 10, 20,
* Test the method that returns an attribute description, provided it is
* recorded and unique
*/
- @Test
+ @Test(groups = "Functional")
public void testGetDescription()
{
FeatureAttributes fa = FeatureAttributes.getInstance();
assertNull(fa.getDescription("Pfam", "kd"));
}
- @Test
+ @Test(groups = "Functional")
public void testDatatype()
{
FeatureAttributes fa = FeatureAttributes.getInstance();
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
* OR failed attribute and score conditions with matched label condition
*/
fms = new FeatureMatcherSet();
- fms.or(fm2).or(byScoreFail);
+ fms.or(fm2);
+ fms.or(byScoreFail);
assertFalse(fms.matches(sf));
fms.or(byLabelPass);
assertTrue(fms.matches(sf));
FeatureMatcherSetI fms = new FeatureMatcherSet();
assertEquals(fms.toString(), "");
fms.and(fm1);
- assertEquals(fms.toString(), "(AF < 1.2)");
+ assertEquals(fms.toString(), "AF < 1.2");
fms.and(fm2);
assertEquals(fms.toString(),
"(AF < 1.2) and (CLIN_SIG does not contain 'path')");
fms = new FeatureMatcherSet();
assertEquals(fms.toString(), "");
fms.or(fm1);
- assertEquals(fms.toString(), "(AF < 1.2)");
+ assertEquals(fms.toString(), "AF < 1.2");
fms.or(fm2);
assertEquals(fms.toString(),
"(AF < 1.2) or (CLIN_SIG does not contain 'path')");
csq.put("Consequence", "Catastrophic");
assertTrue(fms.matches(sf));
}
+
+ /**
+ * Tests for toStableString which (unlike toString) does not i18n the
+ * conditions
+ *
+ * @see FeatureMatcherTest#testToStableString()
+ */
+ @Test(groups = "Functional")
+ public void testToStableString()
+ {
+ FeatureMatcherI fm1 = FeatureMatcher.byAttribute(Condition.LT, "1.2",
+ "AF");
+ assertEquals(fm1.toStableString(), "AF LT 1.2");
+
+ FeatureMatcher fm2 = FeatureMatcher.byAttribute(Condition.NotContains,
+ "path", "CLIN_SIG");
+ assertEquals(fm2.toStableString(), "CLIN_SIG NotContains path");
+
+ /*
+ * AND them
+ */
+ FeatureMatcherSetI fms = new FeatureMatcherSet();
+ assertEquals(fms.toStableString(), "");
+ fms.and(fm1);
+ // no brackets needed if a single condition
+ assertEquals(fms.toStableString(), "AF LT 1.2");
+ // brackets if more than one condition
+ fms.and(fm2);
+ assertEquals(fms.toStableString(),
+ "(AF LT 1.2) AND (CLIN_SIG NotContains path)");
+
+ /*
+ * OR them
+ */
+ fms = new FeatureMatcherSet();
+ assertEquals(fms.toStableString(), "");
+ fms.or(fm1);
+ assertEquals(fms.toStableString(), "AF LT 1.2");
+ fms.or(fm2);
+ assertEquals(fms.toStableString(),
+ "(AF LT 1.2) OR (CLIN_SIG NotContains path)");
+
+ /*
+ * attribute or value including space is quoted
+ */
+ FeatureMatcher fm3 = FeatureMatcher.byAttribute(Condition.NotMatches,
+ "foo bar", "CSQ", "Poly Phen");
+ assertEquals(fm3.toStableString(),
+ "'CSQ:Poly Phen' NotMatches 'foo bar'");
+ fms.or(fm3);
+ assertEquals(fms.toStableString(),
+ "(AF LT 1.2) OR (CLIN_SIG NotContains path) OR ('CSQ:Poly Phen' NotMatches 'foo bar')");
+
+ try
+ {
+ fms.and(fm1);
+ fail("Expected exception");
+ } catch (IllegalStateException e)
+ {
+ // expected
+ }
+ }
+
+ /**
+ * Tests for parsing a string representation of a FeatureMatcherSet
+ *
+ * @see FeatureMatcherSetTest#testToStableString()
+ */
+ @Test(groups = "Functional")
+ public void testFromString()
+ {
+ String descriptor = "AF LT 1.2";
+ FeatureMatcherSetI fms = FeatureMatcherSet.fromString(descriptor);
+
+ /*
+ * shortcut asserts by verifying a 'roundtrip',
+ * which we trust if other tests pass :-)
+ */
+ assertEquals(fms.toStableString(), descriptor);
+
+ // brackets optional, quotes optional, condition case insensitive
+ fms = FeatureMatcherSet.fromString("('AF' lt '1.2')");
+ assertEquals(fms.toStableString(), descriptor);
+
+ descriptor = "(AF LT 1.2) AND (CLIN_SIG NotContains path)";
+ fms = FeatureMatcherSet.fromString(descriptor);
+ assertEquals(fms.toStableString(), descriptor);
+
+ // AND is not case-sensitive
+ fms = FeatureMatcherSet
+ .fromString("(AF LT 1.2) and (CLIN_SIG NotContains path)");
+ assertEquals(fms.toStableString(), descriptor);
+
+ descriptor = "(AF LT 1.2) OR (CLIN_SIG NotContains path)";
+ fms = FeatureMatcherSet.fromString(descriptor);
+ assertEquals(fms.toStableString(), descriptor);
+
+ // OR is not case-sensitive
+ fms = FeatureMatcherSet
+ .fromString("(AF LT 1.2) or (CLIN_SIG NotContains path)");
+ assertEquals(fms.toStableString(), descriptor);
+
+ // can get away without brackets on last match condition
+ fms = FeatureMatcherSet
+ .fromString("(AF LT 1.2) or CLIN_SIG NotContains path");
+ assertEquals(fms.toStableString(), descriptor);
+
+ descriptor = "(AF LT 1.2) OR (CLIN_SIG NotContains path) OR ('CSQ:Poly Phen' NotMatches 'foo bar')";
+ fms = FeatureMatcherSet.fromString(descriptor);
+ assertEquals(fms.toStableString(), descriptor);
+
+ // can't mix OR and AND
+ descriptor = "(AF LT 1.2) OR (CLIN_SIG NotContains path) AND ('CSQ:Poly Phen' NotMatches 'foo bar')";
+ assertNull(FeatureMatcherSet.fromString(descriptor));
+
+ // can't mix AND and OR
+ descriptor = "(AF LT 1.2) and (CLIN_SIG NotContains path) or ('CSQ:Poly Phen' NotMatches 'foo bar')";
+ assertNull(FeatureMatcherSet.fromString(descriptor));
+
+ // brackets missing
+ assertNull(FeatureMatcherSet
+ .fromString("AF LT 1.2 or CLIN_SIG NotContains path"));
+
+ // invalid conjunction
+ assertNull(FeatureMatcherSet.fromString("(AF LT 1.2) but (AF GT -2)"));
+
+ // unbalanced quote (1)
+ assertNull(FeatureMatcherSet.fromString("('AF lt '1.2')"));
+
+ // unbalanced quote (2)
+ assertNull(FeatureMatcherSet.fromString("('AF' lt '1.2)"));
+ }
}
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
import jalview.datamodel.SequenceFeature;
public class FeatureMatcherTest
{
- @Test
+ @Test(groups = "Functional")
public void testMatches_byLabel()
{
SequenceFeature sf = new SequenceFeature("Cath", "this is my label", 11,
FeatureMatcher.byLabel(Condition.NotPresent, "").matches(sf));
}
- @Test
+ @Test(groups = "Functional")
public void testMatches_byScore()
{
SequenceFeature sf = new SequenceFeature("Cath", "this is my label", 11,
assertFalse(FeatureMatcher.byScore(Condition.GT, "3.2").matches(sf));
assertTrue(FeatureMatcher.byScore(Condition.GT, "2.2").matches(sf));
}
- @Test
+
+ @Test(groups = "Functional")
public void testMatches_byAttribute()
{
/*
assertFalse(fm.matches(sf));
}
- @Test
+ @Test(groups = "Functional")
public void testToString()
{
Locale.setDefault(Locale.ENGLISH);
MessageManager.getString("label.score") + " >= 12.2");
}
- @Test
+ @Test(groups = "Functional")
public void testGetAttribute()
{
FeatureMatcherI fm = FeatureMatcher.byAttribute(Condition.GE, "-2",
assertNull(FeatureMatcher.byScore(Condition.LE, "-1").getAttribute());
}
- @Test
+ @Test(groups = "Functional")
+ public void testIsByAttribute()
+ {
+ assertFalse(FeatureMatcher.byLabel(Condition.NotContains, "foo")
+ .isByAttribute());
+ assertFalse(FeatureMatcher.byScore(Condition.LE, "-1").isByAttribute());
+ assertTrue(FeatureMatcher.byAttribute(Condition.LE, "-1", "AC")
+ .isByAttribute());
+ }
+
+ @Test(groups = "Functional")
public void testIsByLabel()
{
assertTrue(FeatureMatcher.byLabel(Condition.NotContains, "foo")
.isByLabel());
}
- @Test
+ @Test(groups = "Functional")
public void testIsByScore()
{
assertFalse(FeatureMatcher.byLabel(Condition.NotContains, "foo")
.isByScore());
}
- @Test
+ @Test(groups = "Functional")
public void testGetMatcher()
{
FeatureMatcherI fm = FeatureMatcher.byAttribute(Condition.GE, "-2f",
assertEquals(fm.getMatcher().getFloatValue(), -2F);
assertEquals(fm.getMatcher().getPattern(), "-2.0");
}
+
+ @Test(groups = "Functional")
+ public void testFromString()
+ {
+ FeatureMatcherI fm = FeatureMatcher.fromString("'AF' LT 1.2");
+ assertFalse(fm.isByLabel());
+ assertFalse(fm.isByScore());
+ assertEquals(fm.getAttribute(), new String[] { "AF" });
+ assertSame(Condition.LT, fm.getMatcher().getCondition());
+ assertEquals(fm.getMatcher().getFloatValue(), 1.2f);
+ assertEquals(fm.getMatcher().getPattern(), "1.2");
+
+ // quotes are optional, condition is not case sensitive
+ fm = FeatureMatcher.fromString("AF lt '1.2'");
+ assertFalse(fm.isByLabel());
+ assertFalse(fm.isByScore());
+ assertEquals(fm.getAttribute(), new String[] { "AF" });
+ assertSame(Condition.LT, fm.getMatcher().getCondition());
+ assertEquals(fm.getMatcher().getFloatValue(), 1.2f);
+ assertEquals(fm.getMatcher().getPattern(), "1.2");
+
+ fm = FeatureMatcher.fromString("'AF' Present");
+ assertFalse(fm.isByLabel());
+ assertFalse(fm.isByScore());
+ assertEquals(fm.getAttribute(), new String[] { "AF" });
+ assertSame(Condition.Present, fm.getMatcher().getCondition());
+
+ fm = FeatureMatcher.fromString("CSQ:Consequence contains damaging");
+ assertFalse(fm.isByLabel());
+ assertFalse(fm.isByScore());
+ assertEquals(fm.getAttribute(), new String[] { "CSQ", "Consequence" });
+ assertSame(Condition.Contains, fm.getMatcher().getCondition());
+ assertEquals(fm.getMatcher().getPattern(), "damaging");
+
+ // keyword Label is not case sensitive
+ fm = FeatureMatcher.fromString("LABEL Matches 'foobar'");
+ assertTrue(fm.isByLabel());
+ assertFalse(fm.isByScore());
+ assertNull(fm.getAttribute());
+ assertSame(Condition.Matches, fm.getMatcher().getCondition());
+ assertEquals(fm.getMatcher().getPattern(), "foobar");
+
+ fm = FeatureMatcher.fromString("'Label' matches 'foo bar'");
+ assertTrue(fm.isByLabel());
+ assertFalse(fm.isByScore());
+ assertNull(fm.getAttribute());
+ assertSame(Condition.Matches, fm.getMatcher().getCondition());
+ assertEquals(fm.getMatcher().getPattern(), "foo bar");
+
+ // quotes optional on pattern
+ fm = FeatureMatcher.fromString("'Label' matches foo bar");
+ assertTrue(fm.isByLabel());
+ assertFalse(fm.isByScore());
+ assertNull(fm.getAttribute());
+ assertSame(Condition.Matches, fm.getMatcher().getCondition());
+ assertEquals(fm.getMatcher().getPattern(), "foo bar");
+
+ fm = FeatureMatcher.fromString("Score GE 12.2");
+ assertFalse(fm.isByLabel());
+ assertTrue(fm.isByScore());
+ assertNull(fm.getAttribute());
+ assertSame(Condition.GE, fm.getMatcher().getCondition());
+ assertEquals(fm.getMatcher().getPattern(), "12.2");
+ assertEquals(fm.getMatcher().getFloatValue(), 12.2f);
+
+ // keyword Score is not case sensitive
+ fm = FeatureMatcher.fromString("'SCORE' ge '12.2'");
+ assertFalse(fm.isByLabel());
+ assertTrue(fm.isByScore());
+ assertNull(fm.getAttribute());
+ assertSame(Condition.GE, fm.getMatcher().getCondition());
+ assertEquals(fm.getMatcher().getPattern(), "12.2");
+ assertEquals(fm.getMatcher().getFloatValue(), 12.2f);
+
+ // invalid numeric pattern
+ assertNull(FeatureMatcher.fromString("Score eq twelve"));
+ // unbalanced opening quote
+ assertNull(FeatureMatcher.fromString("'Score ge 12.2"));
+ // unbalanced pattern quote
+ assertNull(FeatureMatcher.fromString("'Score' ge '12.2"));
+ // pattern missing
+ assertNull(FeatureMatcher.fromString("Score ge"));
+ // condition and pattern missing
+ assertNull(FeatureMatcher.fromString("Score"));
+ // everything missing
+ assertNull(FeatureMatcher.fromString(""));
+ }
+
+ /**
+ * Tests for toStableString which (unlike toString) does not i18n the
+ * conditions
+ */
+ @Test(groups = "Functional")
+ public void testToStableString()
+ {
+ // attribute name not quoted unless it contains space
+ FeatureMatcherI fm = FeatureMatcher.byAttribute(Condition.LT, "1.2",
+ "AF");
+ assertEquals(fm.toStableString(), "AF LT 1.2");
+
+ /*
+ * Present / NotPresent omit the value pattern
+ */
+ fm = FeatureMatcher.byAttribute(Condition.Present, "", "AF");
+ assertEquals(fm.toStableString(), "AF Present");
+ fm = FeatureMatcher.byAttribute(Condition.NotPresent, "", "AF");
+ assertEquals(fm.toStableString(), "AF NotPresent");
+
+ /*
+ * by Label
+ * pattern not quoted unless it contains space
+ */
+ fm = FeatureMatcher.byLabel(Condition.Matches, "foobar");
+ assertEquals(fm.toStableString(), "Label Matches foobar");
+
+ fm = FeatureMatcher.byLabel(Condition.Matches, "foo bar");
+ assertEquals(fm.toStableString(), "Label Matches 'foo bar'");
+
+ /*
+ * by Score
+ */
+ fm = FeatureMatcher.byScore(Condition.GE, "12.2");
+ assertEquals(fm.toStableString(), "Score GE 12.2");
+ }
}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.gui;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.bin.Cache;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.SequenceI;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
+import jalview.io.FormatAdapter;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Unit tests for AnnotationChooser
+ *
+ * @author kmourao
+ *
+ */
+public class AnnotationColumnChooserTest
+{
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
+ // 4 sequences x 13 positions
+ final static String TEST_DATA = ">FER_CAPAA Ferredoxin\n"
+ + "TIETHKEAELVG-\n"
+ + ">FER_CAPAN Ferredoxin, chloroplast precursor\n"
+ + "TIETHKEAELVG-\n"
+ + ">FER1_SOLLC Ferredoxin-1, chloroplast precursor\n"
+ + "TIETHKEEELTA-\n" + ">Q93XJ9_SOLTU Ferredoxin I precursor\n"
+ + "TIETHKEEELTA-\n";
+
+ AnnotationChooser testee;
+
+ AlignmentPanel parentPanel;
+
+ AlignFrame af;
+
+ @BeforeMethod(alwaysRun = true)
+ public void setUp() throws IOException
+ {
+ Cache.loadProperties("test/jalview/io/testProps.jvprops");
+ // pin down annotation sort order for test
+ Cache.applicationProperties.setProperty(Preferences.SORT_ANNOTATIONS,
+ SequenceAnnotationOrder.NONE.name());
+ final String TRUE = Boolean.TRUE.toString();
+ Cache.applicationProperties.setProperty(Preferences.SHOW_AUTOCALC_ABOVE,
+ TRUE);
+ Cache.applicationProperties.setProperty("SHOW_QUALITY", TRUE);
+ Cache.applicationProperties.setProperty("SHOW_CONSERVATION", TRUE);
+ Cache.applicationProperties.setProperty("SHOW_IDENTITY", TRUE);
+
+ AlignmentI al = new FormatAdapter().readFile(TEST_DATA,
+ DataSourceType.PASTE, FileFormat.Fasta);
+ af = new AlignFrame(al, 700, 500);
+ parentPanel = new AlignmentPanel(af, af.getViewport());
+ addAnnotations();
+ }
+
+ /**
+ * Add 4 annotations, 3 of them sequence-specific.
+ *
+ * <PRE>
+ * ann1 - for sequence 0 - label 'IUPRED' ann2 - not sequence related - label
+ * 'Beauty' ann3 - for sequence 3 - label 'JMol' ann4 - for sequence 2 - label
+ * 'IUPRED' ann5 - for sequence 1 - label 'JMol'
+ */
+ private void addAnnotations()
+ {
+ Annotation an = new Annotation(2f);
+ Annotation[] anns = new Annotation[] { an, an, an };
+ AlignmentAnnotation ann0 = new AlignmentAnnotation("IUPRED", "", anns);
+ AlignmentAnnotation ann1 = new AlignmentAnnotation("Beauty", "", anns);
+ AlignmentAnnotation ann2 = new AlignmentAnnotation("JMol", "", anns);
+ AlignmentAnnotation ann3 = new AlignmentAnnotation("IUPRED", "", anns);
+ AlignmentAnnotation ann4 = new AlignmentAnnotation("JMol", "", anns);
+ SequenceI[] seqs = parentPanel.getAlignment().getSequencesArray();
+ ann0.setSequenceRef(seqs[0]);
+ ann2.setSequenceRef(seqs[3]);
+ ann3.setSequenceRef(seqs[2]);
+ ann4.setSequenceRef(seqs[1]);
+ parentPanel.getAlignment().addAnnotation(ann0);
+ parentPanel.getAlignment().addAnnotation(ann1);
+ parentPanel.getAlignment().addAnnotation(ann2);
+ parentPanel.getAlignment().addAnnotation(ann3);
+ parentPanel.getAlignment().addAnnotation(ann4);
+ }
+
+ /**
+ * Test reset
+ */
+ @Test(groups = { "Functional" })
+ public void testReset()
+ {
+ AnnotationColumnChooser acc = new AnnotationColumnChooser(
+ af.getViewport(), af.alignPanel);
+
+ HiddenColumns oldhidden = new HiddenColumns();
+ oldhidden.hideColumns(10, 20);
+ acc.setOldHiddenColumns(oldhidden);
+
+ HiddenColumns newHidden = new HiddenColumns();
+ newHidden.hideColumns(0, 3);
+ newHidden.hideColumns(22, 25);
+ af.getViewport().setHiddenColumns(newHidden);
+
+ HiddenColumns currentHidden = af.getViewport().getAlignment()
+ .getHiddenColumns();
+ List<int[]> regions = currentHidden.getHiddenColumnsCopy();
+ assertEquals(regions.get(0)[0], 0);
+ assertEquals(regions.get(0)[1], 3);
+ assertEquals(regions.get(1)[0], 22);
+ assertEquals(regions.get(1)[1], 25);
+
+ // now reset hidden columns
+ acc.reset();
+ currentHidden = af.getViewport().getAlignment().getHiddenColumns();
+ regions = currentHidden.getHiddenColumnsCopy();
+ assertEquals(regions.get(0)[0], 10);
+ assertEquals(regions.get(0)[1], 20);
+
+ // check works with empty hidden columns as old columns
+ oldhidden = new HiddenColumns();
+ acc.setOldHiddenColumns(oldhidden);
+ acc.reset();
+ currentHidden = af.getViewport().getAlignment().getHiddenColumns();
+ assertFalse(currentHidden.hasHiddenColumns());
+
+ // check works with empty hidden columns as new columns
+ oldhidden.hideColumns(10, 20);
+ acc.setOldHiddenColumns(oldhidden);
+ currentHidden = af.getViewport().getAlignment().getHiddenColumns();
+ assertFalse(currentHidden.hasHiddenColumns());
+
+ acc.reset();
+ currentHidden = af.getViewport().getAlignment().getHiddenColumns();
+ regions = currentHidden.getHiddenColumnsCopy();
+ assertEquals(regions.get(0)[0], 10);
+ assertEquals(regions.get(0)[1], 20);
+ }
+}
--- /dev/null
+package jalview.gui;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import jalview.api.FeatureColourI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.features.FeatureMatcher;
+import jalview.datamodel.features.FeatureMatcherSet;
+import jalview.datamodel.features.FeatureMatcherSetI;
+import jalview.io.DataSourceType;
+import jalview.io.FileLoader;
+import jalview.schemes.FeatureColour;
+import jalview.util.matcher.Condition;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.testng.annotations.Test;
+
+public class FeatureSettingsTest
+{
+ /**
+ * Test a roundtrip of save and reload of feature colours and filters as XML
+ *
+ * @throws IOException
+ */
+ @Test(groups = "Functional")
+ public void testSaveLoad() throws IOException
+ {
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+ ">Seq1\nACDEFGHIKLM", DataSourceType.PASTE);
+ SequenceI seq1 = af.getViewport().getAlignment().getSequenceAt(0);
+
+ /*
+ * add some features to the sequence
+ */
+ int score = 1;
+ addFeatures(seq1, "type1", score++);
+ addFeatures(seq1, "type2", score++);
+ addFeatures(seq1, "type3", score++);
+ addFeatures(seq1, "type4", score++);
+ addFeatures(seq1, "type5", score++);
+
+ /*
+ * set colour schemes for features
+ */
+ FeatureRenderer fr = af.getFeatureRenderer();
+
+ // type1: red
+ fr.setColour("type1", new FeatureColour(Color.red));
+
+ // type2: by label
+ FeatureColourI byLabel = new FeatureColour();
+ byLabel.setColourByLabel(true);
+ fr.setColour("type2", byLabel);
+
+ // type3: by score above threshold
+ FeatureColourI byScore = new FeatureColour(Color.BLACK, Color.BLUE, 1,
+ 10);
+ byScore.setAboveThreshold(true);
+ byScore.setThreshold(2f);
+ fr.setColour("type3", byScore);
+
+ // type4: by attribute AF
+ FeatureColourI byAF = new FeatureColour();
+ byAF.setColourByLabel(true);
+ byAF.setAttributeName("AF");
+ fr.setColour("type4", byAF);
+
+ // type5: by attribute CSQ:PolyPhen below threshold
+ FeatureColourI byPolyPhen = new FeatureColour(Color.BLACK, Color.BLUE,
+ 1, 10);
+ byPolyPhen.setBelowThreshold(true);
+ byPolyPhen.setThreshold(3f);
+ byPolyPhen.setAttributeName("CSQ", "PolyPhen");
+ fr.setColour("type5", byPolyPhen);
+
+ /*
+ * set filters for feature types
+ */
+
+ // filter type1 features by (label contains "x")
+ FeatureMatcherSetI filterByX = new FeatureMatcherSet();
+ filterByX.and(FeatureMatcher.byLabel(Condition.Contains, "x"));
+ fr.setFeatureFilter("type1", filterByX);
+
+ // filter type2 features by (score <= 2.4 and score > 1.1)
+ FeatureMatcherSetI filterByScore = new FeatureMatcherSet();
+ filterByScore.and(FeatureMatcher.byScore(Condition.LE, "2.4"));
+ filterByScore.and(FeatureMatcher.byScore(Condition.GT, "1.1"));
+ fr.setFeatureFilter("type2", filterByScore);
+
+ // filter type3 features by (AF contains X OR CSQ:PolyPhen != 0)
+ FeatureMatcherSetI filterByXY = new FeatureMatcherSet();
+ filterByXY
+ .and(FeatureMatcher.byAttribute(Condition.Contains, "X", "AF"));
+ filterByXY.or(FeatureMatcher.byAttribute(Condition.NE, "0", "CSQ",
+ "PolyPhen"));
+ fr.setFeatureFilter("type3", filterByXY);
+
+ /*
+ * save colours and filters to an XML file
+ */
+ File coloursFile = File.createTempFile("testSaveLoad", ".fc");
+ coloursFile.deleteOnExit();
+ FeatureSettings fs = new FeatureSettings(af);
+ fs.save(coloursFile);
+
+ /*
+ * change feature colours and filters
+ */
+ FeatureColourI pink = new FeatureColour(Color.pink);
+ fr.setColour("type1", pink);
+ fr.setColour("type2", pink);
+ fr.setColour("type3", pink);
+ fr.setColour("type4", pink);
+ fr.setColour("type5", pink);
+
+ FeatureMatcherSetI filter2 = new FeatureMatcherSet();
+ filter2.and(FeatureMatcher.byLabel(Condition.NotContains, "y"));
+ fr.setFeatureFilter("type1", filter2);
+ fr.setFeatureFilter("type2", filter2);
+ fr.setFeatureFilter("type3", filter2);
+ fr.setFeatureFilter("type4", filter2);
+ fr.setFeatureFilter("type5", filter2);
+
+ /*
+ * reload colours and filters from file and verify they are restored
+ */
+ fs.load(coloursFile);
+ FeatureColourI fc = fr.getFeatureStyle("type1");
+ assertTrue(fc.isSimpleColour());
+ assertEquals(fc.getColour(), Color.red);
+ fc = fr.getFeatureStyle("type2");
+ assertTrue(fc.isColourByLabel());
+ fc = fr.getFeatureStyle("type3");
+ assertTrue(fc.isGraduatedColour());
+ assertNull(fc.getAttributeName());
+ assertTrue(fc.isAboveThreshold());
+ assertEquals(fc.getThreshold(), 2f);
+ fc = fr.getFeatureStyle("type4");
+ assertTrue(fc.isColourByLabel());
+ assertTrue(fc.isColourByAttribute());
+ assertEquals(fc.getAttributeName(), new String[] { "AF" });
+ fc = fr.getFeatureStyle("type5");
+ assertTrue(fc.isGraduatedColour());
+ assertTrue(fc.isColourByAttribute());
+ assertEquals(fc.getAttributeName(), new String[] { "CSQ", "PolyPhen" });
+ assertTrue(fc.isBelowThreshold());
+ assertEquals(fc.getThreshold(), 3f);
+
+ assertEquals(fr.getFeatureFilter("type1").toStableString(), "Label Contains x");
+ assertEquals(fr.getFeatureFilter("type2").toStableString(),
+ "(Score LE 2.4) AND (Score GT 1.1)");
+ assertEquals(fr.getFeatureFilter("type3").toStableString(),
+ "(AF Contains X) OR (CSQ:PolyPhen NE 0.0)");
+ }
+
+ /**
+ * Adds two features of the given type to the given sequence, also setting the
+ * score as the value of attribute "AF" and sub-attribute "CSQ:PolyPhen"
+ *
+ * @param seq
+ * @param featureType
+ * @param score
+ */
+ private void addFeatures(SequenceI seq, String featureType, int score)
+ {
+ addFeature(seq, featureType, score++);
+ addFeature(seq, featureType, score);
+ }
+
+ private void addFeature(SequenceI seq, String featureType, int score)
+ {
+ SequenceFeature sf = new SequenceFeature(featureType, "desc", 1, 2,
+ score, "grp");
+ sf.setValue("AF", score);
+ sf.setValue("CSQ", new HashMap<String, String>()
+ {
+ {
+ put("PolyPhen", Integer.toString(score));
+ }
+ });
+ seq.addSequenceFeature(sf);
+ }
+}
PDBEntry pdbe4 = new PDBEntry("1GAQ", "A", Type.PDB, null);
PDBEntry pdbe5 = new PDBEntry("3A6S", "B", Type.PDB, "path2");
PDBEntry pdbe6 = new PDBEntry("1GAQ", "B", Type.PDB, null);
+ PDBEntry pdbe7 = new PDBEntry("1FOO", "Q", Type.PDB, null);
+
PDBEntry[] pdbs = new PDBEntry[] { pdbe1, pdbe2, pdbe3, pdbe4, pdbe5,
- pdbe6 };
+ pdbe6, pdbe7 };
/*
* seq1 ... seq6 associated with pdbe1 ... pdbe6
assertTrue(uniques.containsKey(pdbe4));
assertFalse(uniques.containsKey(pdbe5));
assertFalse(uniques.containsKey(pdbe6));
+ assertTrue(uniques.containsKey(pdbe7));
// 1A70 associates with seq1 and seq3
SequenceI[] ss = uniques.get(pdbe1);
assertEquals(ss.length, 2);
assertSame(seqs[3], ss[0]);
assertSame(seqs[5], ss[1]);
+
+ // 1FOO has seq7
+ ss = uniques.get(pdbe7);
+ assertEquals(ss.length, 1);
+ assertSame(seqs[6], ss[0]);
}
}
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
import jalview.api.FeatureColourI;
import jalview.api.FeatureRenderer;
import jalview.datamodel.SequenceDummy;
import jalview.datamodel.SequenceFeature;
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.datamodel.features.SequenceFeatures;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
+import jalview.schemes.FeatureColour;
import jalview.structure.StructureSelectionManager;
+import jalview.util.matcher.Condition;
import java.awt.Color;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
*/
FeatureRenderer fr = af.alignPanel.getFeatureRenderer();
Map<String, FeatureColourI> visible = fr.getDisplayedFeatureCols();
- List<String> visibleGroups = new ArrayList<String>(
+ List<String> visibleGroups = new ArrayList<>(
Arrays.asList(new String[] {}));
String exported = featuresFile.printJalviewFormat(
- al.getSequencesArray(), visible, visibleGroups, false);
+ al.getSequencesArray(), visible, null, visibleGroups, false);
String expected = "No Features Visible";
assertEquals(expected, exported);
*/
visibleGroups.add("uniprot");
exported = featuresFile.printJalviewFormat(al.getSequencesArray(),
- visible, visibleGroups, true);
+ visible, null, visibleGroups, true);
expected = "Cath\tFER_CAPAA\t-1\t0\t0\tDomain\t0.0\n"
+ "desc1\tFER_CAPAN\t-1\t0\t0\tPfam\t1.3\n"
+ "desc3\tFER1_SOLLC\t-1\t0\t0\tPfam\n" // NaN is not output
fr.setVisible("GAMMA-TURN");
visible = fr.getDisplayedFeatureCols();
exported = featuresFile.printJalviewFormat(al.getSequencesArray(),
- visible, visibleGroups, false);
+ visible, null, visibleGroups, false);
expected = "METAL\tcc9900\n"
- + "GAMMA-TURN\tff0000|00ffff|20.0|95.0|below|66.0\n"
+ + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n"
+ "\nSTARTGROUP\tuniprot\n"
+ "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
+ "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n"
fr.setVisible("Pfam");
visible = fr.getDisplayedFeatureCols();
exported = featuresFile.printJalviewFormat(al.getSequencesArray(),
- visible, visibleGroups, false);
+ visible, null, visibleGroups, false);
/*
* features are output within group, ordered by sequence and by type
*/
expected = "METAL\tcc9900\n"
+ "Pfam\tff0000\n"
- + "GAMMA-TURN\tff0000|00ffff|20.0|95.0|below|66.0\n"
+ + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n"
+ "\nSTARTGROUP\tuniprot\n"
+ "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
+ "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n"
*/
FeaturesFile featuresFile = new FeaturesFile();
FeatureRenderer fr = af.alignPanel.getFeatureRenderer();
- Map<String, FeatureColourI> visible = new HashMap<String, FeatureColourI>();
- List<String> visibleGroups = new ArrayList<String>(
+ Map<String, FeatureColourI> visible = new HashMap<>();
+ List<String> visibleGroups = new ArrayList<>(
Arrays.asList(new String[] {}));
String exported = featuresFile.printGffFormat(al.getSequencesArray(),
visible, visibleGroups, false);
+ "FER_CAPAN\tUniprot\tPfam\t20\t20\t0.0\t+\t2\tx=y;black=white\n";
assertEquals(expected, exported);
}
+
+ /**
+ * Test for parsing of feature filters as represented in a Jalview features
+ * file
+ *
+ * @throws Exception
+ */
+ @Test(groups = { "Functional" })
+ public void testParseFilters() throws Exception
+ {
+ Map<String, FeatureMatcherSetI> filters = new HashMap<>();
+ String text = "sequence_variant\tCSQ:PolyPhen NotContains 'damaging'\n"
+ + "missense_variant\t(label contains foobar) and (Score lt 1.3)";
+ FeaturesFile featuresFile = new FeaturesFile(text,
+ DataSourceType.PASTE);
+ featuresFile.parseFilters(filters);
+ assertEquals(filters.size(), 2);
+
+ FeatureMatcherSetI fm = filters.get("sequence_variant");
+ assertNotNull(fm);
+ Iterator<FeatureMatcherI> matchers = fm.getMatchers().iterator();
+ FeatureMatcherI matcher = matchers.next();
+ assertFalse(matchers.hasNext());
+ String[] attributes = matcher.getAttribute();
+ assertArrayEquals(attributes, new String[] { "CSQ", "PolyPhen" });
+ assertSame(matcher.getMatcher().getCondition(), Condition.NotContains);
+ assertEquals(matcher.getMatcher().getPattern(), "damaging");
+
+ fm = filters.get("missense_variant");
+ assertNotNull(fm);
+ matchers = fm.getMatchers().iterator();
+ matcher = matchers.next();
+ assertTrue(matcher.isByLabel());
+ assertSame(matcher.getMatcher().getCondition(), Condition.Contains);
+ assertEquals(matcher.getMatcher().getPattern(), "foobar");
+ matcher = matchers.next();
+ assertTrue(matcher.isByScore());
+ assertSame(matcher.getMatcher().getCondition(), Condition.LT);
+ assertEquals(matcher.getMatcher().getPattern(), "1.3");
+ assertEquals(matcher.getMatcher().getFloatValue(), 1.3f);
+
+ assertFalse(matchers.hasNext());
+ }
+
+ @Test(groups = { "Functional" })
+ public void testOutputFeatureFilters()
+ {
+ FeaturesFile ff = new FeaturesFile();
+ StringBuilder sb = new StringBuilder();
+ Map<String, FeatureColourI> visible = new HashMap<>();
+ visible.put("pfam", new FeatureColour(Color.red));
+ Map<String, FeatureMatcherSetI> featureFilters = new HashMap<>();
+
+ // with no filters, nothing is output
+ ff.outputFeatureFilters(sb, visible, featureFilters);
+ assertEquals("", sb.toString());
+
+ // with filter for not visible features only, nothing is output
+ FeatureMatcherSet filter = new FeatureMatcherSet();
+ filter.and(FeatureMatcher.byLabel(Condition.Present, null));
+ featureFilters.put("foobar", filter);
+ ff.outputFeatureFilters(sb, visible, featureFilters);
+ assertEquals("", sb.toString());
+
+ // with filters for visible feature types
+ FeatureMatcherSet filter2 = new FeatureMatcherSet();
+ filter2.and(FeatureMatcher.byAttribute(Condition.Present, null, "CSQ",
+ "PolyPhen"));
+ filter2.and(FeatureMatcher.byScore(Condition.LE, "-2.4"));
+ featureFilters.put("pfam", filter2);
+ visible.put("foobar", new FeatureColour(Color.blue));
+ ff.outputFeatureFilters(sb, visible, featureFilters);
+ String expected = "\nSTARTFILTERS\nfoobar\tLabel Present\npfam\t(CSQ:PolyPhen Present) AND (Score LE -2.4)\nENDFILTERS\n\n";
+ assertEquals(expected, sb.toString());
+ }
}
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureColourI;
import jalview.api.ViewStyleI;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.PDBEntry.Type;
import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.datamodel.features.FeatureMatcher;
+import jalview.datamodel.features.FeatureMatcherSet;
+import jalview.datamodel.features.FeatureMatcherSetI;
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
import jalview.gui.Desktop;
+import jalview.gui.FeatureRenderer;
import jalview.gui.Jalview2XML;
import jalview.gui.JvOptionPane;
import jalview.gui.PopupMenu;
import jalview.schemes.BuriedColourScheme;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.FeatureColour;
import jalview.schemes.JalviewColourScheme;
import jalview.schemes.RNAHelicesColour;
import jalview.schemes.StrandColourScheme;
import jalview.schemes.TCoffeeColourScheme;
import jalview.structure.StructureImportSettings;
+import jalview.util.matcher.Condition;
import jalview.viewmodel.AlignmentViewport;
+import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
String afid = af.getViewport().getSequenceSetId();
// remember reference sequence for each panel
- Map<String, SequenceI> refseqs = new HashMap<String, SequenceI>();
+ Map<String, SequenceI> refseqs = new HashMap<>();
/*
* mark sequence 2, 3, 4.. in panels 1, 2, 3...
* remember representative and hidden sequences marked
* on each panel
*/
- Map<String, SequenceI> repSeqs = new HashMap<String, SequenceI>();
- Map<String, List<String>> hiddenSeqNames = new HashMap<String, List<String>>();
+ Map<String, SequenceI> repSeqs = new HashMap<>();
+ Map<String, List<String>> hiddenSeqNames = new HashMap<>();
/*
* mark sequence 2, 3, 4.. in panels 1, 2, 3...
repIndex = Math.max(repIndex, 1);
SequenceI repSeq = alignment.getSequenceAt(repIndex);
repSeqs.put(ap.getViewName(), repSeq);
- List<String> hiddenNames = new ArrayList<String>();
+ List<String> hiddenNames = new ArrayList<>();
hiddenSeqNames.put(ap.getViewName(), hiddenNames);
/*
assertTrue(rs.conservationApplied());
assertEquals(rs.getConservationInc(), 30);
}
+
+ /**
+ * Test save and reload of feature colour schemes and filter settings
+ *
+ * @throws IOException
+ */
+ @Test(groups = { "Functional" })
+ public void testSaveLoadFeatureColoursAndFilters() throws IOException
+ {
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+ ">Seq1\nACDEFGHIKLM", DataSourceType.PASTE);
+ SequenceI seq1 = af.getViewport().getAlignment().getSequenceAt(0);
+
+ /*
+ * add some features to the sequence
+ */
+ int score = 1;
+ addFeatures(seq1, "type1", score++);
+ addFeatures(seq1, "type2", score++);
+ addFeatures(seq1, "type3", score++);
+ addFeatures(seq1, "type4", score++);
+ addFeatures(seq1, "type5", score++);
+
+ /*
+ * set colour schemes for features
+ */
+ FeatureRenderer fr = af.getFeatureRenderer();
+ fr.findAllFeatures(true);
+
+ // type1: red
+ fr.setColour("type1", new FeatureColour(Color.red));
+
+ // type2: by label
+ FeatureColourI byLabel = new FeatureColour();
+ byLabel.setColourByLabel(true);
+ fr.setColour("type2", byLabel);
+
+ // type3: by score above threshold
+ FeatureColourI byScore = new FeatureColour(Color.BLACK, Color.BLUE, 1,
+ 10);
+ byScore.setAboveThreshold(true);
+ byScore.setThreshold(2f);
+ fr.setColour("type3", byScore);
+
+ // type4: by attribute AF
+ FeatureColourI byAF = new FeatureColour();
+ byAF.setColourByLabel(true);
+ byAF.setAttributeName("AF");
+ fr.setColour("type4", byAF);
+
+ // type5: by attribute CSQ:PolyPhen below threshold
+ FeatureColourI byPolyPhen = new FeatureColour(Color.BLACK, Color.BLUE,
+ 1, 10);
+ byPolyPhen.setBelowThreshold(true);
+ byPolyPhen.setThreshold(3f);
+ byPolyPhen.setAttributeName("CSQ", "PolyPhen");
+ fr.setColour("type5", byPolyPhen);
+
+ /*
+ * set filters for feature types
+ */
+
+ // filter type1 features by (label contains "x")
+ FeatureMatcherSetI filterByX = new FeatureMatcherSet();
+ filterByX.and(FeatureMatcher.byLabel(Condition.Contains, "x"));
+ fr.setFeatureFilter("type1", filterByX);
+
+ // filter type2 features by (score <= 2.4 and score > 1.1)
+ FeatureMatcherSetI filterByScore = new FeatureMatcherSet();
+ filterByScore.and(FeatureMatcher.byScore(Condition.LE, "2.4"));
+ filterByScore.and(FeatureMatcher.byScore(Condition.GT, "1.1"));
+ fr.setFeatureFilter("type2", filterByScore);
+
+ // filter type3 features by (AF contains X OR CSQ:PolyPhen != 0)
+ FeatureMatcherSetI filterByXY = new FeatureMatcherSet();
+ filterByXY
+ .and(FeatureMatcher.byAttribute(Condition.Contains, "X", "AF"));
+ filterByXY.or(FeatureMatcher.byAttribute(Condition.NE, "0", "CSQ",
+ "PolyPhen"));
+ fr.setFeatureFilter("type3", filterByXY);
+
+ /*
+ * save as Jalview project
+ */
+ File tfile = File.createTempFile("JalviewTest", ".jvp");
+ tfile.deleteOnExit();
+ String filePath = tfile.getAbsolutePath();
+ assertTrue(af.saveAlignment(filePath, FileFormat.Jalview),
+ "Failed to store as a project.");
+
+ /*
+ * close current alignment and load the saved project
+ */
+ af.closeMenuItem_actionPerformed(true);
+ af = null;
+ af = new FileLoader()
+ .LoadFileWaitTillLoaded(filePath, DataSourceType.FILE);
+ assertNotNull(af, "Failed to import new project");
+
+ /*
+ * verify restored feature colour schemes and filters
+ */
+ fr = af.getFeatureRenderer();
+ FeatureColourI fc = fr.getFeatureStyle("type1");
+ assertTrue(fc.isSimpleColour());
+ assertEquals(fc.getColour(), Color.red);
+ fc = fr.getFeatureStyle("type2");
+ assertTrue(fc.isColourByLabel());
+ fc = fr.getFeatureStyle("type3");
+ assertTrue(fc.isGraduatedColour());
+ assertNull(fc.getAttributeName());
+ assertTrue(fc.isAboveThreshold());
+ assertEquals(fc.getThreshold(), 2f);
+ fc = fr.getFeatureStyle("type4");
+ assertTrue(fc.isColourByLabel());
+ assertTrue(fc.isColourByAttribute());
+ assertEquals(fc.getAttributeName(), new String[] { "AF" });
+ fc = fr.getFeatureStyle("type5");
+ assertTrue(fc.isGraduatedColour());
+ assertTrue(fc.isColourByAttribute());
+ assertEquals(fc.getAttributeName(), new String[] { "CSQ", "PolyPhen" });
+ assertTrue(fc.isBelowThreshold());
+ assertEquals(fc.getThreshold(), 3f);
+
+ assertEquals(fr.getFeatureFilter("type1").toStableString(),
+ "Label Contains x");
+ assertEquals(fr.getFeatureFilter("type2").toStableString(),
+ "(Score LE 2.4) AND (Score GT 1.1)");
+ assertEquals(fr.getFeatureFilter("type3").toStableString(),
+ "(AF Contains X) OR (CSQ:PolyPhen NE 0.0)");
+ }
+
+ private void addFeature(SequenceI seq, String featureType, int score)
+ {
+ SequenceFeature sf = new SequenceFeature(featureType, "desc", 1, 2,
+ score, "grp");
+ sf.setValue("AF", score);
+ sf.setValue("CSQ", new HashMap<String, String>()
+ {
+ {
+ put("PolyPhen", Integer.toString(score));
+ }
+ });
+ seq.addSequenceFeature(sf);
+ }
+
+ /**
+ * Adds two features of the given type to the given sequence, also setting the
+ * score as the value of attribute "AF" and sub-attribute "CSQ:PolyPhen"
+ *
+ * @param seq
+ * @param featureType
+ * @param score
+ */
+ private void addFeatures(SequenceI seq, String featureType, int score)
+ {
+ addFeature(seq, featureType, score++);
+ addFeature(seq, featureType, score);
+ }
}
/*
* hide feature type, then unhide
+ * - feature type visibility should not affect the result
*/
FeatureSettingsBean[] data = new FeatureSettingsBean[1];
data[0] = new FeatureSettingsBean("Cath", fc, null, false);
fr.setFeaturePriority(data);
- assertNull(fr.getColour(sf1));
+ assertEquals(fr.getColour(sf1), Color.red);
data[0] = new FeatureSettingsBean("Cath", fc, null, true);
fr.setFeaturePriority(data);
assertEquals(fr.getColour(sf1), Color.red);
import static org.testng.AssertJUnit.fail;
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+import jalview.api.FeatureColourI;
import jalview.datamodel.SequenceFeature;
import jalview.gui.JvOptionPane;
import jalview.util.ColorUtils;
assertEquals("domain\tlabel", fc.toJalviewFormat("domain"));
/*
+ * colour by attribute text (no threshold)
+ */
+ fc = new FeatureColour();
+ fc.setColourByLabel(true);
+ fc.setAttributeName("CLIN_SIG");
+ assertEquals("domain\tattribute|CLIN_SIG", fc.toJalviewFormat("domain"));
+
+ /*
* colour by label (autoscaled) (an odd state you can reach by selecting
* 'above threshold', then deselecting 'threshold is min/max' then 'colour
* by label')
*/
+ fc.setAttributeName((String[]) null);
fc.setAutoScaled(true);
assertEquals("domain\tlabel", fc.toJalviewFormat("domain"));
/*
- * colour by label (above threshold) (min/max values are output though not
- * used by this scheme)
+ * colour by label (above threshold)
*/
fc.setAutoScaled(false);
fc.setThreshold(12.5f);
fc.setAboveThreshold(true);
+ // min/max values are output though not used by this scheme
assertEquals("domain\tlabel|||0.0|0.0|above|12.5",
fc.toJalviewFormat("domain"));
fc.toJalviewFormat("domain"));
/*
- * graduated colour, no threshold
+ * colour by attributes text (below threshold)
+ */
+ fc.setBelowThreshold(true);
+ fc.setAttributeName("CSQ", "Consequence");
+ assertEquals("domain\tattribute|CSQ:Consequence|||0.0|0.0|below|12.5",
+ fc.toJalviewFormat("domain"));
+
+ /*
+ * graduated colour by score, no threshold
+ * - default constructor sets noValueColor = minColor
*/
fc = new FeatureColour(Color.GREEN, Color.RED, 12f, 25f);
String greenHex = Format.getHexString(Color.GREEN);
- String expected = String.format("domain\t%s|%s|abso|12.0|25.0|none",
- greenHex, redHex);
+ String expected = String.format(
+ "domain\tscore|%s|%s|noValueMin|abso|12.0|25.0|none", greenHex,
+ redHex);
assertEquals(expected, fc.toJalviewFormat("domain"));
/*
+ * graduated colour by score, no threshold, no value gets min colour
+ */
+ fc = new FeatureColour(Color.GREEN, Color.RED, Color.GREEN, 12f, 25f);
+ expected = String.format(
+ "domain\tscore|%s|%s|noValueMin|abso|12.0|25.0|none", greenHex,
+ redHex);
+ assertEquals(expected, fc.toJalviewFormat("domain"));
+
+ /*
+ * graduated colour by score, no threshold, no value gets max colour
+ */
+ fc = new FeatureColour(Color.GREEN, Color.RED, Color.RED, 12f, 25f);
+ expected = String.format(
+ "domain\tscore|%s|%s|noValueMax|abso|12.0|25.0|none", greenHex,
+ redHex);
+ assertEquals(expected, fc.toJalviewFormat("domain"));
+
+ /*
* colour ranges over the actual score ranges (not min/max)
*/
fc.setAutoScaled(true);
- expected = String.format("domain\t%s|%s|12.0|25.0|none", greenHex,
+ expected = String.format(
+ "domain\tscore|%s|%s|noValueMax|12.0|25.0|none", greenHex,
redHex);
assertEquals(expected, fc.toJalviewFormat("domain"));
/*
- * graduated colour below threshold
+ * graduated colour by score, below threshold
*/
fc.setThreshold(12.5f);
fc.setBelowThreshold(true);
- expected = String.format("domain\t%s|%s|12.0|25.0|below|12.5",
+ expected = String.format(
+ "domain\tscore|%s|%s|noValueMax|12.0|25.0|below|12.5",
greenHex, redHex);
assertEquals(expected, fc.toJalviewFormat("domain"));
/*
- * graduated colour above threshold
+ * graduated colour by score, above threshold
*/
fc.setThreshold(12.5f);
fc.setAboveThreshold(true);
fc.setAutoScaled(false);
- expected = String.format("domain\t%s|%s|abso|12.0|25.0|above|12.5",
+ expected = String.format(
+ "domain\tscore|%s|%s|noValueMax|abso|12.0|25.0|above|12.5",
+ greenHex, redHex);
+ assertEquals(expected, fc.toJalviewFormat("domain"));
+
+ /*
+ * graduated colour by attribute, above threshold
+ */
+ fc.setAttributeName("CSQ", "AF");
+ fc.setAboveThreshold(true);
+ fc.setAutoScaled(false);
+ expected = String.format(
+ "domain\tattribute|CSQ:AF|%s|%s|noValueMax|abso|12.0|25.0|above|12.5",
greenHex, redHex);
assertEquals(expected, fc.toJalviewFormat("domain"));
}
/*
* simple colour by name
*/
- FeatureColour fc = FeatureColour.parseJalviewFeatureColour("red");
+ FeatureColourI fc = FeatureColour.parseJalviewFeatureColour("red");
assertTrue(fc.isSimpleColour());
assertEquals(Color.RED, fc.getColour());
assertEquals(12.0f, fc.getThreshold());
/*
- * graduated colour (by name) (no threshold)
+ * colour by attribute text (no threshold)
+ */
+ fc = FeatureColour.parseJalviewFeatureColour("attribute|CLIN_SIG");
+ assertTrue(fc.isColourByAttribute());
+ assertTrue(fc.isColourByLabel());
+ assertFalse(fc.hasThreshold());
+ assertArrayEquals(new String[] { "CLIN_SIG" }, fc.getAttributeName());
+
+ /*
+ * colour by attributes text (with score threshold)
+ */
+ fc = FeatureColour.parseJalviewFeatureColour(
+ "attribute|CSQ:Consequence|||0.0|0.0|above|12.0");
+ assertTrue(fc.isColourByLabel());
+ assertTrue(fc.isColourByAttribute());
+ assertArrayEquals(new String[] { "CSQ", "Consequence" },
+ fc.getAttributeName());
+ assertTrue(fc.isAboveThreshold());
+ assertEquals(12.0f, fc.getThreshold());
+
+ /*
+ * graduated colour by score (with colour names) (no threshold)
*/
fc = FeatureColour.parseJalviewFeatureColour("red|green|10.0|20.0");
assertTrue(fc.isGraduatedColour());
assertTrue(fc.isAutoScaled());
/*
- * graduated colour (by hex code) (above threshold)
+ * graduated colour (explicitly by 'score') (no threshold)
+ */
+ fc = FeatureColour
+ .parseJalviewFeatureColour("Score|red|green|10.0|20.0");
+ assertTrue(fc.isGraduatedColour());
+ assertFalse(fc.hasThreshold());
+ assertEquals(Color.RED, fc.getMinColour());
+ assertEquals(Color.GREEN, fc.getMaxColour());
+ assertEquals(10f, fc.getMin());
+ assertEquals(20f, fc.getMax());
+ assertTrue(fc.isAutoScaled());
+
+ /*
+ * graduated colour by attribute (no threshold)
+ */
+ fc = FeatureColour
+ .parseJalviewFeatureColour("attribute|AF|red|green|10.0|20.0");
+ assertTrue(fc.isGraduatedColour());
+ assertTrue(fc.isColourByAttribute());
+ assertArrayEquals(new String[] { "AF" }, fc.getAttributeName());
+ assertFalse(fc.hasThreshold());
+ assertEquals(Color.RED, fc.getMinColour());
+ assertEquals(Color.GREEN, fc.getMaxColour());
+ assertEquals(10f, fc.getMin());
+ assertEquals(20f, fc.getMax());
+ assertTrue(fc.isAutoScaled());
+
+ /*
+ * graduated colour by score (colours by hex code) (above threshold)
*/
String descriptor = String.format("%s|%s|10.0|20.0|above|15",
Format.getHexString(Color.RED),
assertTrue(fc.isAutoScaled());
/*
+ * graduated colour by attributes (below threshold)
+ */
+ fc = FeatureColour.parseJalviewFeatureColour(
+ "attribute|CSQ:AF|red|green|10.0|20.0|below|13");
+ assertTrue(fc.isGraduatedColour());
+ assertTrue(fc.isColourByAttribute());
+ assertArrayEquals(new String[] { "CSQ", "AF" }, fc.getAttributeName());
+ assertTrue(fc.hasThreshold());
+ assertTrue(fc.isBelowThreshold());
+ assertEquals(13f, fc.getThreshold());
+ assertEquals(Color.RED, fc.getMinColour());
+ assertEquals(Color.GREEN, fc.getMaxColour());
+ assertEquals(10f, fc.getMin());
+ assertEquals(20f, fc.getMax());
+ assertTrue(fc.isAutoScaled());
+
+ /*
* graduated colour (by RGB triplet) (below threshold), absolute scale
*/
- descriptor = String.format("255,0,0|0,255,0|abso|10.0|20.0|below|15");
+ descriptor = "255,0,0|0,255,0|abso|10.0|20.0|below|15";
fc = FeatureColour.parseJalviewFeatureColour(descriptor);
assertTrue(fc.isGraduatedColour());
assertFalse(fc.isAutoScaled());
assertEquals(10f, fc.getMin());
assertEquals(20f, fc.getMax());
- descriptor = String
- .format("blue|255,0,255|absolute|20.0|95.0|below|66.0");
+ descriptor = "blue|255,0,255|absolute|20.0|95.0|below|66.0";
fc = FeatureColour.parseJalviewFeatureColour(descriptor);
assertTrue(fc.isGraduatedColour());
}
package jalview.util.matcher;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
import java.util.Locale;
*/
assertEquals(Condition.NE.toString(), "not =");
}
+
+ @Test(groups = "Functional")
+ public void testGetStableName()
+ {
+ assertEquals(Condition.Contains.getStableName(), "Contains");
+ assertEquals(Condition.NotContains.getStableName(), "NotContains");
+ assertEquals(Condition.Matches.getStableName(), "Matches");
+ assertEquals(Condition.NotMatches.getStableName(), "NotMatches");
+ assertEquals(Condition.Present.getStableName(), "Present");
+ assertEquals(Condition.NotPresent.getStableName(), "NotPresent");
+ assertEquals(Condition.LT.getStableName(), "LT");
+ assertEquals(Condition.LE.getStableName(), "LE");
+ assertEquals(Condition.GT.getStableName(), "GT");
+ assertEquals(Condition.GE.getStableName(), "GE");
+ assertEquals(Condition.EQ.getStableName(), "EQ");
+ assertEquals(Condition.NE.getStableName(), "NE");
+ }
+
+ @Test(groups = "Functional")
+ public void testFromString()
+ {
+ assertEquals(Condition.fromString("Contains"), Condition.Contains);
+ // not case sensitive
+ assertEquals(Condition.fromString("contains"), Condition.Contains);
+ assertEquals(Condition.fromString("CONTAINS"), Condition.Contains);
+ assertEquals(Condition.fromString("NotContains"),
+ Condition.NotContains);
+ assertEquals(Condition.fromString("Matches"), Condition.Matches);
+ assertEquals(Condition.fromString("NotMatches"), Condition.NotMatches);
+ assertEquals(Condition.fromString("Present"), Condition.Present);
+ assertEquals(Condition.fromString("NotPresent"), Condition.NotPresent);
+ assertEquals(Condition.fromString("LT"), Condition.LT);
+ assertEquals(Condition.fromString("LE"), Condition.LE);
+ assertEquals(Condition.fromString("GT"), Condition.GT);
+ assertEquals(Condition.fromString("GE"), Condition.GE);
+ assertEquals(Condition.fromString("EQ"), Condition.EQ);
+ assertEquals(Condition.fromString("NE"), Condition.NE);
+
+ assertNull(Condition.fromString("Equals"));
+ assertNull(Condition.fromString(""));
+ assertNull(Condition.fromString(null));
+ }
}