Implement getLastGraphGroup in for AnnotatedCollectionI
[jalview.git] / src / jalview / datamodel / AnnotatedCollectionI.java
index 878f22a..755333c 100644 (file)
@@ -62,5 +62,21 @@ public interface AnnotatedCollectionI extends SequenceCollectionI
    */
   AnnotatedCollectionI getContext();
 
-  
+  /**
+   * Returns the number of the highest annotation graph group attached to this
+   * alignment.
+   */
+  default int getLastGraphGroup()
+  {
+    var annots = getAlignmentAnnotation();
+    if (annots == null)
+      return 1;
+    int graphGroup = 1;
+    for (AlignmentAnnotation ala : annots)
+    {
+      graphGroup = Math.max(graphGroup, ala.graphGroup);
+    }
+    return graphGroup;
+  }
+
 }