X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbinding%2FColour.java;h=f51e9aff95ddcfe3783a5d325e5f65a626fb3f56;hb=14b1b2a878190d5fffda298c4b9a901c72c74ad3;hp=3888ceab62f5e42cd8e15c94a8d9bcda20b815c8;hpb=ab43013b7e357b84b4abade0dba949668dfb2a0e;p=jalview.git diff --git a/src/jalview/binding/Colour.java b/src/jalview/binding/Colour.java index 3888cea..f51e9af 100644 --- a/src/jalview/binding/Colour.java +++ b/src/jalview/binding/Colour.java @@ -1,23 +1,10 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1) - * Copyright (C) 2014 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 . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.binding; //---------------------------------/ @@ -40,7 +27,8 @@ public class Colour implements java.io.Serializable // --------------------------/ /** - * Field _name. + * Single letter residue code for an alignment colour scheme, or feature type + * for a feature colour scheme */ private java.lang.String _name; @@ -55,9 +43,15 @@ public class Colour implements java.io.Serializable private java.lang.String _minRGB; /** - * loosely specified enumeration: NONE,ABOVE, or BELOW + * Field _noValueColour. + */ + private jalview.binding.types.NoValueColour _noValueColour = jalview.binding.types.NoValueColour + .valueOf("Min"); + + /** + * Field _threshType. */ - private java.lang.String _threshType; + private jalview.binding.types.ColourThreshTypeType _threshType; /** * Field _threshold. @@ -109,6 +103,11 @@ public class Colour implements java.io.Serializable */ private boolean _has_autoScale; + /** + * name of feature attribute to colour by, or attribute and sub-attribute + */ + private java.util.Vector _attributeNameList; + // ----------------/ // - Constructors -/ // ----------------/ @@ -116,6 +115,8 @@ public class Colour implements java.io.Serializable public Colour() { super(); + setNoValueColour(jalview.binding.types.NoValueColour.valueOf("Min")); + this._attributeNameList = new java.util.Vector(); } // -----------/ @@ -123,41 +124,140 @@ public class Colour implements java.io.Serializable // -----------/ /** - */ + * + * + * @param vAttributeName + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addAttributeName(final java.lang.String vAttributeName) + throws java.lang.IndexOutOfBoundsException + { + // check for the maximum size + if (this._attributeNameList.size() >= 2) + { + throw new IndexOutOfBoundsException( + "addAttributeName has a maximum of 2"); + } + + this._attributeNameList.addElement(vAttributeName); + } + + /** + * + * + * @param index + * @param vAttributeName + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addAttributeName(final int index, + final java.lang.String vAttributeName) + throws java.lang.IndexOutOfBoundsException + { + // check for the maximum size + if (this._attributeNameList.size() >= 2) + { + throw new IndexOutOfBoundsException( + "addAttributeName has a maximum of 2"); + } + + this._attributeNameList.add(index, vAttributeName); + } + + /** + */ public void deleteAutoScale() { this._has_autoScale = false; } /** - */ + */ public void deleteColourByLabel() { this._has_colourByLabel = false; } /** - */ + */ public void deleteMax() { this._has_max = false; } /** - */ + */ public void deleteMin() { this._has_min = false; } /** - */ + */ public void deleteThreshold() { this._has_threshold = false; } /** + * Method enumerateAttributeName. + * + * @return an Enumeration over all java.lang.String elements + */ + public java.util.Enumeration enumerateAttributeName() + { + return this._attributeNameList.elements(); + } + + /** + * Method getAttributeName. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + * @return the value of the java.lang.String at the given index + */ + public java.lang.String getAttributeName(final int index) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._attributeNameList.size()) + { + throw new IndexOutOfBoundsException("getAttributeName: Index value '" + + index + "' not in range [0.." + + (this._attributeNameList.size() - 1) + "]"); + } + + return (java.lang.String) _attributeNameList.get(index); + } + + /** + * Method getAttributeName.Returns the contents of the collection in an Array. + *

+ * Note: Just in case the collection contents are changing in another thread, + * we pass a 0-length Array of the correct type into the API call. This way we + * know that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public java.lang.String[] getAttributeName() + { + java.lang.String[] array = new java.lang.String[0]; + return (java.lang.String[]) this._attributeNameList.toArray(array); + } + + /** + * Method getAttributeNameCount. + * + * @return the size of this collection + */ + public int getAttributeNameCount() + { + return this._attributeNameList.size(); + } + + /** * Returns the value of field 'autoScale'. * * @return the value of field 'AutoScale'. @@ -208,7 +308,9 @@ public class Colour implements java.io.Serializable } /** - * Returns the value of field 'name'. + * Returns the value of field 'name'. The field 'name' has the following + * description: Single letter residue code for an alignment colour scheme, or + * feature type for a feature colour scheme * * @return the value of field 'Name'. */ @@ -218,6 +320,16 @@ public class Colour implements java.io.Serializable } /** + * 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'. @@ -228,12 +340,11 @@ public class Colour implements java.io.Serializable } /** - * Returns the value of field 'threshType'. The field 'threshType' has the - * following description: loosely specified enumeration: NONE,ABOVE, or BELOW + * Returns the value of field 'threshType'. * * @return the value of field 'ThreshType'. */ - public java.lang.String getThreshType() + public jalview.binding.types.ColourThreshTypeType getThreshType() { return this._threshType; } @@ -373,6 +484,76 @@ public class Colour implements java.io.Serializable } /** + */ + public void removeAllAttributeName() + { + this._attributeNameList.clear(); + } + + /** + * Method removeAttributeName. + * + * @param vAttributeName + * @return true if the object was removed from the collection. + */ + public boolean removeAttributeName(final java.lang.String vAttributeName) + { + boolean removed = _attributeNameList.remove(vAttributeName); + return removed; + } + + /** + * Method removeAttributeNameAt. + * + * @param index + * @return the element removed from the collection + */ + public java.lang.String removeAttributeNameAt(final int index) + { + java.lang.Object obj = this._attributeNameList.remove(index); + return (java.lang.String) obj; + } + + /** + * + * + * @param index + * @param vAttributeName + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void setAttributeName(final int index, + final java.lang.String vAttributeName) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._attributeNameList.size()) + { + throw new IndexOutOfBoundsException("setAttributeName: Index value '" + + index + "' not in range [0.." + + (this._attributeNameList.size() - 1) + "]"); + } + + this._attributeNameList.set(index, vAttributeName); + } + + /** + * + * + * @param vAttributeNameArray + */ + public void setAttributeName(final java.lang.String[] vAttributeNameArray) + { + // -- copy array + _attributeNameList.clear(); + + for (int i = 0; i < vAttributeNameArray.length; i++) + { + this._attributeNameList.add(vAttributeNameArray[i]); + } + } + + /** * Sets the value of field 'autoScale'. * * @param autoScale @@ -432,7 +613,9 @@ public class Colour implements java.io.Serializable } /** - * Sets the value of field 'name'. + * Sets the value of field 'name'. The field 'name' has the following + * description: Single letter residue code for an alignment colour scheme, or + * feature type for a feature colour scheme * * @param name * the value of field 'name'. @@ -443,6 +626,18 @@ public class Colour implements java.io.Serializable } /** + * 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 @@ -454,13 +649,13 @@ public class Colour implements java.io.Serializable } /** - * Sets the value of field 'threshType'. The field 'threshType' has the - * following description: loosely specified enumeration: NONE,ABOVE, or BELOW + * Sets the value of field 'threshType'. * * @param threshType * the value of field 'threshType'. */ - public void setThreshType(final java.lang.String threshType) + public void setThreshType( + final jalview.binding.types.ColourThreshTypeType threshType) { this._threshType = threshType; } @@ -488,12 +683,13 @@ public class Colour implements java.io.Serializable * if this object is an invalid instance according to the schema * @return the unmarshaled jalview.binding.Colour */ - public static jalview.binding.Colour unmarshal(final java.io.Reader reader) + public static jalview.binding.Colour unmarshal( + final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (jalview.binding.Colour) Unmarshaller.unmarshal( - jalview.binding.Colour.class, reader); + return (jalview.binding.Colour) Unmarshaller + .unmarshal(jalview.binding.Colour.class, reader); } /**