X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemabinding%2Fversion2%2FJalviewModelSequence.java;h=932ba14a32f8ed8cfac36208f4fa0038c8b9b3a2;hb=d6815a9bc0fc9b9c1fe8e1871a4b0e9d7bd7a11f;hp=c7c02c5494fdff3148341a593831db2135dd6716;hpb=b6b044f8887234eb5ee0146064b906f5ca2a74a5;p=jalview.git diff --git a/src/jalview/schemabinding/version2/JalviewModelSequence.java b/src/jalview/schemabinding/version2/JalviewModelSequence.java index c7c02c5..932ba14 100644 --- a/src/jalview/schemabinding/version2/JalviewModelSequence.java +++ b/src/jalview/schemabinding/version2/JalviewModelSequence.java @@ -52,6 +52,11 @@ public class JalviewModelSequence implements java.io.Serializable private java.util.Vector _treeList; /** + * Field _pcaViewerList. + */ + private java.util.Vector _pcaViewerList; + + /** * Field _featureSettings. */ private jalview.schemabinding.version2.FeatureSettings _featureSettings; @@ -68,6 +73,7 @@ public class JalviewModelSequence implements java.io.Serializable this._viewportList = new java.util.Vector(); this._userColoursList = new java.util.Vector(); this._treeList = new java.util.Vector(); + this._pcaViewerList = new java.util.Vector(); } // -----------/ @@ -133,6 +139,35 @@ public class JalviewModelSequence implements java.io.Serializable /** * * + * @param vPcaViewer + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addPcaViewer( + final jalview.schemabinding.version2.PcaViewer vPcaViewer) + throws java.lang.IndexOutOfBoundsException + { + this._pcaViewerList.addElement(vPcaViewer); + } + + /** + * + * + * @param index + * @param vPcaViewer + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addPcaViewer(final int index, + final jalview.schemabinding.version2.PcaViewer vPcaViewer) + throws java.lang.IndexOutOfBoundsException + { + this._pcaViewerList.add(index, vPcaViewer); + } + + /** + * + * * @param vTree * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection @@ -239,6 +274,17 @@ public class JalviewModelSequence implements java.io.Serializable } /** + * Method enumeratePcaViewer. + * + * @return an Enumeration over all jalview.schemabinding.version2.PcaViewer + * elements + */ + public java.util.Enumeration enumeratePcaViewer() + { + return this._pcaViewerList.elements(); + } + + /** * Method enumerateTree. * * @return an Enumeration over all jalview.schemabinding.version2.Tree @@ -296,9 +342,9 @@ public class JalviewModelSequence implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._JGroupList.size()) { - throw new IndexOutOfBoundsException("getJGroup: Index value '" - + index + "' not in range [0.." - + (this._JGroupList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getJGroup: Index value '" + index + "' not in range [0.." + + (this._JGroupList.size() - 1) + "]"); } return (jalview.schemabinding.version2.JGroup) _JGroupList.get(index); @@ -379,6 +425,56 @@ public class JalviewModelSequence implements java.io.Serializable } /** + * Method getPcaViewer. + * + * @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.PcaViewer at the + * given index + */ + public jalview.schemabinding.version2.PcaViewer getPcaViewer( + final int index) throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._pcaViewerList.size()) + { + throw new IndexOutOfBoundsException( + "getPcaViewer: Index value '" + index + "' not in range [0.." + + (this._pcaViewerList.size() - 1) + "]"); + } + + return (jalview.schemabinding.version2.PcaViewer) _pcaViewerList + .get(index); + } + + /** + * Method getPcaViewer.Returns the contents of the collection in an Array. + *

+ * Note: Just in case the collection contents are changing in another thread, + * we pass a 0-length Array of the correct type into the API call. This way we + * know that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.schemabinding.version2.PcaViewer[] getPcaViewer() + { + jalview.schemabinding.version2.PcaViewer[] array = new jalview.schemabinding.version2.PcaViewer[0]; + return (jalview.schemabinding.version2.PcaViewer[]) this._pcaViewerList + .toArray(array); + } + + /** + * Method getPcaViewerCount. + * + * @return the size of this collection + */ + public int getPcaViewerCount() + { + return this._pcaViewerList.size(); + } + + /** * Method getTree. * * @param index @@ -485,15 +581,15 @@ public class JalviewModelSequence implements java.io.Serializable * @return the value of the jalview.schemabinding.version2.Viewport at the * given index */ - public jalview.schemabinding.version2.Viewport getViewport(final int index) - throws java.lang.IndexOutOfBoundsException + public jalview.schemabinding.version2.Viewport getViewport( + final int index) throws java.lang.IndexOutOfBoundsException { // check bounds for index if (index < 0 || index >= this._viewportList.size()) { - throw new IndexOutOfBoundsException("getViewport: Index value '" - + index + "' not in range [0.." - + (this._viewportList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "getViewport: Index value '" + index + "' not in range [0.." + + (this._viewportList.size() - 1) + "]"); } return (jalview.schemabinding.version2.Viewport) _viewportList @@ -581,35 +677,42 @@ public class JalviewModelSequence implements java.io.Serializable } /** - */ + */ public void removeAllJGroup() { this._JGroupList.clear(); } /** - */ + */ public void removeAllJSeq() { this._JSeqList.clear(); } /** - */ + */ + public void removeAllPcaViewer() + { + this._pcaViewerList.clear(); + } + + /** + */ public void removeAllTree() { this._treeList.clear(); } /** - */ + */ public void removeAllUserColours() { this._userColoursList.clear(); } /** - */ + */ public void removeAllViewport() { this._viewportList.clear(); @@ -666,6 +769,32 @@ public class JalviewModelSequence implements java.io.Serializable } /** + * Method removePcaViewer. + * + * @param vPcaViewer + * @return true if the object was removed from the collection. + */ + public boolean removePcaViewer( + final jalview.schemabinding.version2.PcaViewer vPcaViewer) + { + boolean removed = _pcaViewerList.remove(vPcaViewer); + return removed; + } + + /** + * Method removePcaViewerAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.schemabinding.version2.PcaViewer removePcaViewerAt( + final int index) + { + java.lang.Object obj = this._pcaViewerList.remove(index); + return (jalview.schemabinding.version2.PcaViewer) obj; + } + + /** * Method removeTree. * * @param vTree @@ -768,9 +897,9 @@ public class JalviewModelSequence implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._JGroupList.size()) { - throw new IndexOutOfBoundsException("setJGroup: Index value '" - + index + "' not in range [0.." - + (this._JGroupList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setJGroup: Index value '" + index + "' not in range [0.." + + (this._JGroupList.size() - 1) + "]"); } this._JGroupList.set(index, vJGroup); @@ -820,7 +949,8 @@ public class JalviewModelSequence implements java.io.Serializable * * @param vJSeqArray */ - public void setJSeq(final jalview.schemabinding.version2.JSeq[] vJSeqArray) + public void setJSeq( + final jalview.schemabinding.version2.JSeq[] vJSeqArray) { // -- copy array _JSeqList.clear(); @@ -835,6 +965,46 @@ public class JalviewModelSequence implements java.io.Serializable * * * @param index + * @param vPcaViewer + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void setPcaViewer(final int index, + final jalview.schemabinding.version2.PcaViewer vPcaViewer) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._pcaViewerList.size()) + { + throw new IndexOutOfBoundsException( + "setPcaViewer: Index value '" + index + "' not in range [0.." + + (this._pcaViewerList.size() - 1) + "]"); + } + + this._pcaViewerList.set(index, vPcaViewer); + } + + /** + * + * + * @param vPcaViewerArray + */ + public void setPcaViewer( + final jalview.schemabinding.version2.PcaViewer[] vPcaViewerArray) + { + // -- copy array + _pcaViewerList.clear(); + + for (int i = 0; i < vPcaViewerArray.length; i++) + { + this._pcaViewerList.add(vPcaViewerArray[i]); + } + } + + /** + * + * + * @param index * @param vTree * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection @@ -858,7 +1028,8 @@ public class JalviewModelSequence implements java.io.Serializable * * @param vTreeArray */ - public void setTree(final jalview.schemabinding.version2.Tree[] vTreeArray) + public void setTree( + final jalview.schemabinding.version2.Tree[] vTreeArray) { // -- copy array _treeList.clear(); @@ -924,9 +1095,9 @@ public class JalviewModelSequence implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._viewportList.size()) { - throw new IndexOutOfBoundsException("setViewport: Index value '" - + index + "' not in range [0.." - + (this._viewportList.size() - 1) + "]"); + throw new IndexOutOfBoundsException( + "setViewport: Index value '" + index + "' not in range [0.." + + (this._viewportList.size() - 1) + "]"); } this._viewportList.set(index, vViewport);