Implement getLastGraphGroup in for AnnotatedCollectionI
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Thu, 6 Jul 2023 13:23:55 +0000 (15:23 +0200)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Wed, 12 Jul 2023 14:25:05 +0000 (16:25 +0200)
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;
+  }
+
 }