JAL-2374 new contains methods for seq and seq,apos
[jalview.git] / src / jalview / datamodel / SequenceGroup.java
index 4f9d530..e37c55e 100755 (executable)
@@ -1411,4 +1411,24 @@ public class SequenceGroup implements AnnotatedCollectionI
     }
     return false;
   }
+
+  /**
+   * @param seq
+   * @return true if seq is a member of the group
+   */
+
+  public boolean contains(SequenceI seq1)
+  {
+    return sequences.contains(seq1);
+  }
+
+  /**
+   * @param seq
+   * @param apos
+   * @return true if startRes<=apos and endRes>=apos and seq is in the group
+   */
+  public boolean contains(SequenceI seq, int apos)
+  {
+    return (startRes <= apos && endRes >= apos) && sequences.contains(seq);
+  }
 }