X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbinding%2FSequenceSet.java;h=7ed3b52db875f6661879979da2d5b2864cc3912c;hb=03c446f178b6a0b61ad33cb219398132d640fbef;hp=4300c3951138022ebea8373e76a81051127bcae9;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/jalview/binding/SequenceSet.java b/src/jalview/binding/SequenceSet.java index 4300c39..7ed3b52 100755 --- a/src/jalview/binding/SequenceSet.java +++ b/src/jalview/binding/SequenceSet.java @@ -1,56 +1,38 @@ /* - * This class was automatically generated with + * This class was automatically generated with * Castor 0.9.6, using an XML * Schema. * $Id$ */ -/* -* Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle -* -* This program 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 2 -* of the License, or (at your option) any later version. -* -* This program 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 this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -*/ -package jalview.binding; - -import org.exolab.castor.xml.MarshalException; -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; +package jalview.binding; + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -//- Imported classes and packages -/ -//---------------------------------/ + import java.io.IOException; import java.io.Reader; import java.io.Serializable; import java.io.Writer; - import java.util.Enumeration; import java.util.Vector; - +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.xml.sax.ContentHandler; /** * Class SequenceSet. - * + * * @version $Revision$ $Date$ */ public class SequenceSet implements java.io.Serializable { - //--------------------------/ - //- Class/Member Variables -/ + + + //--------------------------/ + //- Class/Member Variables -/ //--------------------------/ /** @@ -78,443 +60,445 @@ public class SequenceSet implements java.io.Serializable { */ private java.util.Vector _annotationList; + + //----------------/ + //- Constructors -/ //----------------/ - //- Constructors -/ - //----------------/ + public SequenceSet() { super(); _sequenceList = new Vector(); _annotationList = new Vector(); - } - //-- jalview.binding.SequenceSet() - //-----------/ + } //-- jalview.binding.SequenceSet() + + + //-----------/ + //- Methods -/ + //-----------/ + /** + * Method addAnnotation + * + * + * + * @param vAnnotation + */ public void addAnnotation(jalview.binding.Annotation vAnnotation) - throws java.lang.IndexOutOfBoundsException { + throws java.lang.IndexOutOfBoundsException + { _annotationList.addElement(vAnnotation); - } - //-- void addAnnotation(jalview.binding.Annotation) + } //-- void addAnnotation(jalview.binding.Annotation) /** * Method addAnnotation - * - * - * + * + * + * * @param index * @param vAnnotation */ public void addAnnotation(int index, jalview.binding.Annotation vAnnotation) - throws java.lang.IndexOutOfBoundsException { + throws java.lang.IndexOutOfBoundsException + { _annotationList.insertElementAt(vAnnotation, index); - } - //-- void addAnnotation(int, jalview.binding.Annotation) + } //-- void addAnnotation(int, jalview.binding.Annotation) /** * Method addSequence - * - * - * + * + * + * * @param vSequence */ public void addSequence(jalview.binding.Sequence vSequence) - throws java.lang.IndexOutOfBoundsException { + throws java.lang.IndexOutOfBoundsException + { _sequenceList.addElement(vSequence); - } - //-- void addSequence(jalview.binding.Sequence) + } //-- void addSequence(jalview.binding.Sequence) /** * Method addSequence - * - * - * + * + * + * * @param index * @param vSequence */ public void addSequence(int index, jalview.binding.Sequence vSequence) - throws java.lang.IndexOutOfBoundsException { + throws java.lang.IndexOutOfBoundsException + { _sequenceList.insertElementAt(vSequence, index); - } - //-- void addSequence(int, jalview.binding.Sequence) + } //-- void addSequence(int, jalview.binding.Sequence) /** * Method deleteAligned - * + * */ - public void deleteAligned() { - this._has_aligned = false; - } - //-- void deleteAligned() + public void deleteAligned() + { + this._has_aligned= false; + } //-- void deleteAligned() /** * Method enumerateAnnotation - * - * - * + * + * + * * @return Enumeration */ - public java.util.Enumeration enumerateAnnotation() { + public java.util.Enumeration enumerateAnnotation() + { return _annotationList.elements(); - } - //-- java.util.Enumeration enumerateAnnotation() + } //-- java.util.Enumeration enumerateAnnotation() /** * Method enumerateSequence - * - * - * + * + * + * * @return Enumeration */ - public java.util.Enumeration enumerateSequence() { + public java.util.Enumeration enumerateSequence() + { return _sequenceList.elements(); - } - //-- java.util.Enumeration enumerateSequence() + } //-- java.util.Enumeration enumerateSequence() /** * Returns the value of field 'aligned'. - * + * * @return boolean * @return the value of field 'aligned'. */ - public boolean getAligned() { + public boolean getAligned() + { return this._aligned; - } - //-- boolean getAligned() + } //-- boolean getAligned() /** * Method getAnnotation - * - * - * + * + * + * * @param index * @return Annotation */ public jalview.binding.Annotation getAnnotation(int index) - throws java.lang.IndexOutOfBoundsException { + throws java.lang.IndexOutOfBoundsException + { //-- check bounds for index if ((index < 0) || (index > _annotationList.size())) { throw new IndexOutOfBoundsException(); } - + return (jalview.binding.Annotation) _annotationList.elementAt(index); - } - //-- jalview.binding.Annotation getAnnotation(int) + } //-- jalview.binding.Annotation getAnnotation(int) /** * Method getAnnotation - * - * - * + * + * + * * @return Annotation */ - public jalview.binding.Annotation[] getAnnotation() { + public jalview.binding.Annotation[] getAnnotation() + { int size = _annotationList.size(); jalview.binding.Annotation[] mArray = new jalview.binding.Annotation[size]; - for (int index = 0; index < size; index++) { mArray[index] = (jalview.binding.Annotation) _annotationList.elementAt(index); } - return mArray; - } - //-- jalview.binding.Annotation[] getAnnotation() + } //-- jalview.binding.Annotation[] getAnnotation() /** * Method getAnnotationCount - * - * - * + * + * + * * @return int */ - public int getAnnotationCount() { + public int getAnnotationCount() + { return _annotationList.size(); - } - //-- int getAnnotationCount() + } //-- int getAnnotationCount() /** * Returns the value of field 'gapChar'. - * + * * @return String * @return the value of field 'gapChar'. */ - public java.lang.String getGapChar() { + public java.lang.String getGapChar() + { return this._gapChar; - } - //-- java.lang.String getGapChar() + } //-- java.lang.String getGapChar() /** * Method getSequence - * - * - * + * + * + * * @param index * @return Sequence */ public jalview.binding.Sequence getSequence(int index) - throws java.lang.IndexOutOfBoundsException { + throws java.lang.IndexOutOfBoundsException + { //-- check bounds for index if ((index < 0) || (index > _sequenceList.size())) { throw new IndexOutOfBoundsException(); } - + return (jalview.binding.Sequence) _sequenceList.elementAt(index); - } - //-- jalview.binding.Sequence getSequence(int) + } //-- jalview.binding.Sequence getSequence(int) /** * Method getSequence - * - * - * + * + * + * * @return Sequence */ - public jalview.binding.Sequence[] getSequence() { + public jalview.binding.Sequence[] getSequence() + { int size = _sequenceList.size(); jalview.binding.Sequence[] mArray = new jalview.binding.Sequence[size]; - for (int index = 0; index < size; index++) { mArray[index] = (jalview.binding.Sequence) _sequenceList.elementAt(index); } - return mArray; - } - //-- jalview.binding.Sequence[] getSequence() + } //-- jalview.binding.Sequence[] getSequence() /** * Method getSequenceCount - * - * - * + * + * + * * @return int */ - public int getSequenceCount() { + public int getSequenceCount() + { return _sequenceList.size(); - } - //-- int getSequenceCount() + } //-- int getSequenceCount() /** * Method hasAligned - * - * - * + * + * + * * @return boolean */ - public boolean hasAligned() { + public boolean hasAligned() + { return this._has_aligned; - } - //-- boolean hasAligned() + } //-- boolean hasAligned() /** * Method isValid - * - * - * + * + * + * * @return boolean */ - public boolean isValid() { + public boolean isValid() + { try { validate(); - } catch (org.exolab.castor.xml.ValidationException vex) { + } + catch (org.exolab.castor.xml.ValidationException vex) { return false; } - return true; - } - //-- boolean isValid() + } //-- boolean isValid() /** * Method marshal - * - * - * + * + * + * * @param out */ public void marshal(java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException { + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + Marshaller.marshal(this, out); - } - //-- void marshal(java.io.Writer) + } //-- void marshal(java.io.Writer) /** * Method marshal - * - * - * + * + * + * * @param handler */ public void marshal(org.xml.sax.ContentHandler handler) - throws java.io.IOException, org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException { + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + Marshaller.marshal(this, handler); - } - //-- void marshal(org.xml.sax.ContentHandler) + } //-- void marshal(org.xml.sax.ContentHandler) /** * Method removeAllAnnotation - * + * */ - public void removeAllAnnotation() { + public void removeAllAnnotation() + { _annotationList.removeAllElements(); - } - //-- void removeAllAnnotation() + } //-- void removeAllAnnotation() /** * Method removeAllSequence - * + * */ - public void removeAllSequence() { + public void removeAllSequence() + { _sequenceList.removeAllElements(); - } - //-- void removeAllSequence() + } //-- void removeAllSequence() /** * Method removeAnnotation - * - * - * + * + * + * * @param index * @return Annotation */ - public jalview.binding.Annotation removeAnnotation(int index) { + public jalview.binding.Annotation removeAnnotation(int index) + { java.lang.Object obj = _annotationList.elementAt(index); _annotationList.removeElementAt(index); - return (jalview.binding.Annotation) obj; - } - //-- jalview.binding.Annotation removeAnnotation(int) + } //-- jalview.binding.Annotation removeAnnotation(int) /** * Method removeSequence - * - * - * + * + * + * * @param index * @return Sequence */ - public jalview.binding.Sequence removeSequence(int index) { + public jalview.binding.Sequence removeSequence(int index) + { java.lang.Object obj = _sequenceList.elementAt(index); _sequenceList.removeElementAt(index); - return (jalview.binding.Sequence) obj; - } - //-- jalview.binding.Sequence removeSequence(int) + } //-- jalview.binding.Sequence removeSequence(int) /** * Sets the value of field 'aligned'. - * + * * @param aligned the value of field 'aligned'. */ - public void setAligned(boolean aligned) { + public void setAligned(boolean aligned) + { this._aligned = aligned; this._has_aligned = true; - } - //-- void setAligned(boolean) + } //-- void setAligned(boolean) /** * Method setAnnotation - * - * - * + * + * + * * @param index * @param vAnnotation */ public void setAnnotation(int index, jalview.binding.Annotation vAnnotation) - throws java.lang.IndexOutOfBoundsException { + throws java.lang.IndexOutOfBoundsException + { //-- check bounds for index if ((index < 0) || (index > _annotationList.size())) { throw new IndexOutOfBoundsException(); } - _annotationList.setElementAt(vAnnotation, index); - } - //-- void setAnnotation(int, jalview.binding.Annotation) + } //-- void setAnnotation(int, jalview.binding.Annotation) /** * Method setAnnotation - * - * - * + * + * + * * @param annotationArray */ - public void setAnnotation(jalview.binding.Annotation[] annotationArray) { + public void setAnnotation(jalview.binding.Annotation[] annotationArray) + { //-- copy array _annotationList.removeAllElements(); - for (int i = 0; i < annotationArray.length; i++) { _annotationList.addElement(annotationArray[i]); } - } - //-- void setAnnotation(jalview.binding.Annotation) + } //-- void setAnnotation(jalview.binding.Annotation) /** * Sets the value of field 'gapChar'. - * + * * @param gapChar the value of field 'gapChar'. */ - public void setGapChar(java.lang.String gapChar) { + public void setGapChar(java.lang.String gapChar) + { this._gapChar = gapChar; - } - //-- void setGapChar(java.lang.String) + } //-- void setGapChar(java.lang.String) /** * Method setSequence - * - * - * + * + * + * * @param index * @param vSequence */ public void setSequence(int index, jalview.binding.Sequence vSequence) - throws java.lang.IndexOutOfBoundsException { + throws java.lang.IndexOutOfBoundsException + { //-- check bounds for index if ((index < 0) || (index > _sequenceList.size())) { throw new IndexOutOfBoundsException(); } - _sequenceList.setElementAt(vSequence, index); - } - //-- void setSequence(int, jalview.binding.Sequence) + } //-- void setSequence(int, jalview.binding.Sequence) /** * Method setSequence - * - * - * + * + * + * * @param sequenceArray */ - public void setSequence(jalview.binding.Sequence[] sequenceArray) { + public void setSequence(jalview.binding.Sequence[] sequenceArray) + { //-- copy array _sequenceList.removeAllElements(); - for (int i = 0; i < sequenceArray.length; i++) { _sequenceList.addElement(sequenceArray[i]); } - } - //-- void setSequence(jalview.binding.Sequence) + } //-- void setSequence(jalview.binding.Sequence) /** * Method unmarshal - * - * - * + * + * + * * @param reader * @return Object */ public static java.lang.Object unmarshal(java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException { - return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, - reader); - } - //-- java.lang.Object unmarshal(java.io.Reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, reader); + } //-- java.lang.Object unmarshal(java.io.Reader) /** * Method validate - * + * */ - public void validate() throws org.exolab.castor.xml.ValidationException { + public void validate() + throws org.exolab.castor.xml.ValidationException + { org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); validator.validate(this); - } - //-- void validate() + } //-- void validate() + }