From: Mateusz Warowny Date: Thu, 6 Jul 2023 13:23:55 +0000 (+0200) Subject: Implement getLastGraphGroup in for AnnotatedCollectionI X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cfbb94908f5b2d247b763e2663f180058efda7aa;p=jalview.git Implement getLastGraphGroup in for AnnotatedCollectionI --- diff --git a/src/jalview/datamodel/AnnotatedCollectionI.java b/src/jalview/datamodel/AnnotatedCollectionI.java index 878f22a..755333c 100644 --- a/src/jalview/datamodel/AnnotatedCollectionI.java +++ b/src/jalview/datamodel/AnnotatedCollectionI.java @@ -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; + } + }