X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbinding%2FJSeq.java;h=ee559455cd465b7c4dbb275e78380841a7f9c497;hb=0fc704a18faa7d11b6d02876bb6c1e8bc19f343c;hp=751409f0b161223878e176c9ab5f6389894670bc;hpb=c68ce4c63bd79f23b87aac3eb0afa7f6b42a3098;p=jalview.git diff --git a/src/jalview/binding/JSeq.java b/src/jalview/binding/JSeq.java index 751409f..ee55945 100755 --- a/src/jalview/binding/JSeq.java +++ b/src/jalview/binding/JSeq.java @@ -15,6 +15,8 @@ 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; @@ -73,6 +75,16 @@ public class JSeq implements java.io.Serializable { */ private boolean _has_id; + /** + * Field _featuresList + */ + private java.util.Vector _featuresList; + + /** + * Field _pdbidsList + */ + private java.util.Vector _pdbidsList; + //----------------/ //- Constructors -/ @@ -80,6 +92,8 @@ public class JSeq implements java.io.Serializable { public JSeq() { super(); + _featuresList = new Vector(); + _pdbidsList = new Vector(); } //-- jalview.binding.JSeq() @@ -88,6 +102,60 @@ public class JSeq implements java.io.Serializable { //-----------/ /** + * Method addFeatures + * + * + * + * @param vFeatures + */ + public void addFeatures(jalview.binding.Features vFeatures) + throws java.lang.IndexOutOfBoundsException + { + _featuresList.addElement(vFeatures); + } //-- void addFeatures(jalview.binding.Features) + + /** + * Method addFeatures + * + * + * + * @param index + * @param vFeatures + */ + public void addFeatures(int index, jalview.binding.Features vFeatures) + throws java.lang.IndexOutOfBoundsException + { + _featuresList.insertElementAt(vFeatures, index); + } //-- void addFeatures(int, jalview.binding.Features) + + /** + * Method addPdbids + * + * + * + * @param vPdbids + */ + public void addPdbids(jalview.binding.Pdbids vPdbids) + throws java.lang.IndexOutOfBoundsException + { + _pdbidsList.addElement(vPdbids); + } //-- void addPdbids(jalview.binding.Pdbids) + + /** + * Method addPdbids + * + * + * + * @param index + * @param vPdbids + */ + public void addPdbids(int index, jalview.binding.Pdbids vPdbids) + throws java.lang.IndexOutOfBoundsException + { + _pdbidsList.insertElementAt(vPdbids, index); + } //-- void addPdbids(int, jalview.binding.Pdbids) + + /** * Method deleteColour * */ @@ -124,6 +192,30 @@ public class JSeq implements java.io.Serializable { } //-- void deleteStart() /** + * Method enumerateFeatures + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateFeatures() + { + return _featuresList.elements(); + } //-- java.util.Enumeration enumerateFeatures() + + /** + * Method enumeratePdbids + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumeratePdbids() + { + return _pdbidsList.elements(); + } //-- java.util.Enumeration enumeratePdbids() + + /** * Returns the value of field 'colour'. * * @return int @@ -146,6 +238,54 @@ public class JSeq implements java.io.Serializable { } //-- int getEnd() /** + * Method getFeatures + * + * + * + * @param index + * @return Features + */ + public jalview.binding.Features getFeatures(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _featuresList.size())) { + throw new IndexOutOfBoundsException(); + } + + return (jalview.binding.Features) _featuresList.elementAt(index); + } //-- jalview.binding.Features getFeatures(int) + + /** + * Method getFeatures + * + * + * + * @return Features + */ + public jalview.binding.Features[] getFeatures() + { + int size = _featuresList.size(); + jalview.binding.Features[] mArray = new jalview.binding.Features[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (jalview.binding.Features) _featuresList.elementAt(index); + } + return mArray; + } //-- jalview.binding.Features[] getFeatures() + + /** + * Method getFeaturesCount + * + * + * + * @return int + */ + public int getFeaturesCount() + { + return _featuresList.size(); + } //-- int getFeaturesCount() + + /** * Returns the value of field 'id'. * * @return int @@ -157,6 +297,54 @@ public class JSeq implements java.io.Serializable { } //-- int getId() /** + * Method getPdbids + * + * + * + * @param index + * @return Pdbids + */ + public jalview.binding.Pdbids getPdbids(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _pdbidsList.size())) { + throw new IndexOutOfBoundsException(); + } + + return (jalview.binding.Pdbids) _pdbidsList.elementAt(index); + } //-- jalview.binding.Pdbids getPdbids(int) + + /** + * Method getPdbids + * + * + * + * @return Pdbids + */ + public jalview.binding.Pdbids[] getPdbids() + { + int size = _pdbidsList.size(); + jalview.binding.Pdbids[] mArray = new jalview.binding.Pdbids[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (jalview.binding.Pdbids) _pdbidsList.elementAt(index); + } + return mArray; + } //-- jalview.binding.Pdbids[] getPdbids() + + /** + * Method getPdbidsCount + * + * + * + * @return int + */ + public int getPdbidsCount() + { + return _pdbidsList.size(); + } //-- int getPdbidsCount() + + /** * Returns the value of field 'start'. * * @return int @@ -262,6 +450,54 @@ public class JSeq implements java.io.Serializable { } //-- void marshal(org.xml.sax.ContentHandler) /** + * Method removeAllFeatures + * + */ + public void removeAllFeatures() + { + _featuresList.removeAllElements(); + } //-- void removeAllFeatures() + + /** + * Method removeAllPdbids + * + */ + public void removeAllPdbids() + { + _pdbidsList.removeAllElements(); + } //-- void removeAllPdbids() + + /** + * Method removeFeatures + * + * + * + * @param index + * @return Features + */ + public jalview.binding.Features removeFeatures(int index) + { + java.lang.Object obj = _featuresList.elementAt(index); + _featuresList.removeElementAt(index); + return (jalview.binding.Features) obj; + } //-- jalview.binding.Features removeFeatures(int) + + /** + * Method removePdbids + * + * + * + * @param index + * @return Pdbids + */ + public jalview.binding.Pdbids removePdbids(int index) + { + java.lang.Object obj = _pdbidsList.elementAt(index); + _pdbidsList.removeElementAt(index); + return (jalview.binding.Pdbids) obj; + } //-- jalview.binding.Pdbids removePdbids(int) + + /** * Sets the value of field 'colour'. * * @param colour the value of field 'colour'. @@ -284,6 +520,40 @@ public class JSeq implements java.io.Serializable { } //-- void setEnd(int) /** + * Method setFeatures + * + * + * + * @param index + * @param vFeatures + */ + public void setFeatures(int index, jalview.binding.Features vFeatures) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _featuresList.size())) { + throw new IndexOutOfBoundsException(); + } + _featuresList.setElementAt(vFeatures, index); + } //-- void setFeatures(int, jalview.binding.Features) + + /** + * Method setFeatures + * + * + * + * @param featuresArray + */ + public void setFeatures(jalview.binding.Features[] featuresArray) + { + //-- copy array + _featuresList.removeAllElements(); + for (int i = 0; i < featuresArray.length; i++) { + _featuresList.addElement(featuresArray[i]); + } + } //-- void setFeatures(jalview.binding.Features) + + /** * Sets the value of field 'id'. * * @param id the value of field 'id'. @@ -295,6 +565,40 @@ public class JSeq implements java.io.Serializable { } //-- void setId(int) /** + * Method setPdbids + * + * + * + * @param index + * @param vPdbids + */ + public void setPdbids(int index, jalview.binding.Pdbids vPdbids) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _pdbidsList.size())) { + throw new IndexOutOfBoundsException(); + } + _pdbidsList.setElementAt(vPdbids, index); + } //-- void setPdbids(int, jalview.binding.Pdbids) + + /** + * Method setPdbids + * + * + * + * @param pdbidsArray + */ + public void setPdbids(jalview.binding.Pdbids[] pdbidsArray) + { + //-- copy array + _pdbidsList.removeAllElements(); + for (int i = 0; i < pdbidsArray.length; i++) { + _pdbidsList.addElement(pdbidsArray[i]); + } + } //-- void setPdbids(jalview.binding.Pdbids) + + /** * Sets the value of field 'start'. * * @param start the value of field 'start'.